My features for a problem are just a single feature, so X_train has just a single dimension. Now, I have used SVM , naive Bayes, and Logistic Regression. So now How do I draw the decision boundaries of these classifiers? Is there is a way to draw a one dimension feature vector with the decision boundary using python? I have done many searches but I couldn't find any results. The X_train shape is (489, 1) (489 instances each with a single value)

  • $\begingroup$ How many output classes do you have, and how many decision boundaries do you have in your 489 points (if you order them linearly)? $\endgroup$ – Philip Kendall Jan 30 at 17:56
  • $\begingroup$ @PhilipKendall Two Classes . For the boundaries I have one generated from Naive Bayes , one from linear SVM , one from Logistic regression and finally one from non-linear SVM with polynomial Kernel. $\endgroup$ – John adams Jan 31 at 1:28

To visualize a decision boundary of a classifier, specifically a binary classifier as in your case, you can instantiate a grid of points that spans the domain of interest that you want to classify. Then use your trained classifier to predict the class of each and every point in the grid. If the grid resolution is fine enough, when you plot the contours of the grid points with color corresponding to its class, you can then visualize the decision boundary. It is helpful to overlay the original training data points so that you can see how your decision boundaries are generated based on various training sets. See the following exampleenter image description here


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.