The rough version of the Local Outlier Factor divides a point's reach by its neighbours' average reach. The full formula keeps that idea, but averages over all neighbours and smooths the distances. Your job is to implement it exactly.
Points are lists of coordinates (any number of dimensions, no two identical), and is the Euclidean distance between them.
This is the smoothing: any point inside 's own k-distance counts as exactly that far from , so tiny distances inside a crowd don't swing the result.
Task: write lof_scores(points, k) returning one LOF per point, in the order given, each rounded to 4 decimal places. You may assume the number of points.
A score near 1 means the point is as crowded as its own neighbours, so it fits its region, however sparse that region is. A score well above 1 means it has far more empty space around it than they do.
One circle and one cut-off of 4 other points, used everywhere. Every spread-out point reads 0, and even the grid's corners count as sparse.
Once your code passes every test, a reference solution shows up here so you can compare it with yours.