2

I'm working in a space which has 8 dimensions (i.e. 8 features). I have plotted the data points in 2D by applying PCA as well as TSNE. Now I would like also to draw the borderlines of the classifiers I use as shown here. By the way, I'm using different classifiers (SVM, GNB, Logistic Regression).

This means that I have the different 8-dimensional points which I plot in 2D using PCA or TSNE. On top of this plot I would like to plot the different classification regions as shown in the link above.

Of course the classification boundaries/regions are also 8-dimensional. How can I turn the classification boundaries/regions into 2D matching my 2D data points?

machinery
  • 5,972
  • 12
  • 67
  • 118

1 Answers1

1

Interesting question here, I once wondered it. It can be answered several way, including more or less details depending whether you want to fully understand or to apply the method.

As you don't a lot of detail but you included a sklearn link, I will first answer on a technical point of view: "How can you do it with sklearn?"

You have a function for this: transform(X, y=None) which will apply the PCA projection (yes, PCA is a projection for high dimensional space to a lower one).

So you basically just need to give transform(your_boundaries) to apply it.

In term of pseudo code this would give: pca = PCA(n_component=2).fit(data) 2dboundaries = pca.transform(boundaries)

Et voilà!

Do not hesitate to give more details or ask question. I could add some specific development if it is relevant.

Hope it helps
pltrdy

pltrdy
  • 2,069
  • 1
  • 11
  • 29
  • Thanks for your answer. I see how to apply the transformation but the remaining question is now how to get (and plot) the boundaries for the different classifiers. – machinery Feb 01 '17 at 09:24
  • I can suggest the excellent sklearn article on classifier boundaries: http://scikit-learn.org/stable/auto_examples/svm/plot_iris.html I couldn't do better than paraphrasing it. It is, to me, the best resource. – pltrdy Feb 01 '17 at 09:38