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.

enter image description here

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.

  • 6
    $\begingroup$ Convert to polar co-ordinates (en.wikipedia.org/wiki/Polar_coordinate_system) $\endgroup$ Sep 13 at 12:10
  • 1
    $\begingroup$ 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. $\endgroup$
    – jcken
    Sep 13 at 12:10
  • 1
    $\begingroup$ @DikranMarsupial That looks a lot like an answer! $\endgroup$
    – Dave
    Sep 13 at 12:30
  • 3
    $\begingroup$ @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. $\endgroup$ Sep 13 at 14:50
  • $\begingroup$ @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. $\endgroup$ Sep 13 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.