# How to fit logistic regression to circular data?

I've made a script that can do normal logistic regression with sigmoid(linear model). However, I have data that has a circular decision boundary and looks like this.

My question is how I can modify my script handle these data? I am thinking of including the circular equation, but I am not sure how.

• Convert to polar co-ordinates (en.wikipedia.org/wiki/Polar_coordinate_system) Sep 13 at 12:10
• It looks to me if $x_0^2 + x_1^2 \leq 1$ then $y=1$ and otherwise $y=0$. Could you use this as a feature/decision criteria? I.e. distance of $(x_0, x_1)$ from the origin. Sep 13 at 12:10
• @DikranMarsupial That looks a lot like an answer!
– Dave
Sep 13 at 12:30
• @DikranMarsupial I think a better option (making fewer assumptions) is to include both linear and quadratic effects of $x_1$ and $x_2$ as well as their interaction (unless it is known a priori that the region is perfectly circular rather than elliptic and centered at the origin). But it all depends on what fits the data and what is known a priori about the data generating process. Sep 13 at 14:50
• @JarleTufto when I am teaching ML, I often use a similar example to motivate radial basis function neural networks and kernel learning methods, so I would probably go that route (with regularisation) to make a general non-linear version. However the nice thing about 2D data is we can just look at the data and use intuition to find a sensible transformation. Sep 13 at 16:24