I come from a programming background and learning the math behind the data science and algorithms now.

I would like to understand the logic behind how a data gets plotted in a graph when using Logistic regression.

Lets consider a Testing data like this,

ID  Age  Grade  Location   Churn
1   24    1        A         1
2   25    1        A1        1
3   28    1        A2        1
4   31    2        A3        0

And this could get plotted like this in Logistic regression like this -

[A mocked image below]

enter image description here

How did these ID's usually gets plotted in the graph. What's the math behind a data like this getting plotted in a graph.

I understand the plane separating the points. But couldn't understand how the points got there in the first place.

This may be basic for experienced people. But it has been a question in my mind for a while. I tried to get any online materials but I couldn't or may be I don't know what to search for.

Also, does this plotting differs in any way for SVM and other models. I guess only the model splitting the points will differ.

Please give me leads in understanding this one.

  • $\begingroup$ This answer may help, 10814. $\endgroup$
    – Edmund
    Sep 18 '19 at 0:02

First let's understand the problem. This is a classification task. The last column represents your target value and rest of the columns are features for a given id. The target value represents which class a given row will belong to. In the plot it is represented by red (Class - 1) and green (Class - 0). We use rest of the column values to plot a given point.

Now we just simply plot one value vs another. The graph that you have shown is for only two variable but in reality we will be using all the variable and the separation will not be a line, but a hyperplane. Since it is difficult to visualize, we usually use only two dimensions for demonstration purposes.

As an example, here is a plot for Age vs Grade marking different classes with different colors:

enter image description here

I hope you get the basic idea. Also, I suggest you to look at tutorials for kNN classifier. It will give you more understanding of the cocept.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.