Program an Uncircularness Score Your task is to program a mathematical function s, that takes a nonempty finite set A of points in the 2D plane, and outputs an uncircularity score s(A) that satisfies following properties:

Positive Definiteness: If there is a circle or a straight line that contains all points of A, then s(A) = 0. Otherwise s(A) &gt; 0

Surjectivity: It is surjective to the nonnegative real numbers, that means for every nonnegative real number r there is a finite subset A of the plane such that s(A) = r.

Translation Invariance: s is translation invariant if s(A) = s(A + v) for every vector v and for all A.

Scale Invariance: s is scale invariant, if s(A) = s(A * t) for every t≠0 and for all A.

Continuity. s is said to be continuous if the function f(p) := s(A ∪ {p}) (mapping the a point p to a real number) is continuous using the standard absolute value on the real numbers, and the standard euclidean norm on the points of the plane.


Intuitively speaking this uncircularness score can be thought of as something similar to the correlation coefficient in linear regression.
Details
Your function in theory has to work in the reals, but for the purpose of this challenge you can use floating point numbers as substitute. Please provide an explanation of your submission and an argument why those five properties hold. You can take two lists of coordinates or a list of tuples or similar formats as input. You can assume that no point in the input is repeated i.e. all points are unique.
Python 2 with numpy, 116 bytes

from numpy import*
def f(x,y):a=linalg.lstsq(hstack((x,y,ones_like(x))),(x*x+y*y)/2);return a[1]/sum((x-a[0][0])**4)


Takes x and y as 2d column vectors and returns an array containing the answer.  Note that this will give an empty array for a perfectly straight line or with 3 or fewer points.  I think lstsq gives no residuals if there's a perfect fit.

Explanation

Essentially, this finds the circle of best fit and gets the squared residuals.

We want to minimize (x - x_center)^2 + (y - y_center)^2 - R^2.  It looks nasty and nonlinear, but we can rewrite that as x_center(-2x) + y_center(-2y) + stuff = x^2 + y^2, where the stuff is still nasty and nonlinear in terms of x_center, y_center, and R, but we don't need to care about it.  So we can just solve [-2x -2y 1][x_center, y_center, stuff]^T = [x^2 + y^2].

We could then back out R if we really wanted, but that doesn't help us much here.  Thankfully, the lstsq function can give us the residuals, which satisfies most of the conditions.  Subtracting the center and scaling by (R^2)^2 = R^4 ~ x^4 gives us translational and scale invariance.


This is positive definite because the squared residuals are nonnegative, and we're dividing by a square.  It tends toward 0 for circles and lines because we're fitting a circle.
I'm fairly sure it's not surjective, but I can't get a good bound. If there is an upper bound, we can map [0, bound) to the nonnegative reals (for example, with 1 / (bound - answer) - 1 / bound) for a few more bytes.
We subtract out the center, so it's translationally invariant.
We divide by x**4, which removes the scale dependence.
It's composed of continuous functions, so it's continuous.