The biggest difference between the models you’re building from a “features” point of view is that Naive Bayes treats them as independent, whereas SVM looks at the interactions between them to a certain degree, as long as you’re using a non-linear kernel (Gaussian, rbf, poly etc.). So if you have interactions, and, given your problem, … Read more
It seems the task you are trying to solve is regression: predicting the price. However, you are training a classification model, that assigns a class to every input. ROC-AUC score is meant for classification problems where the output is the probability of the input belonging to a class. If you do a multi-class classification, then … Read more
I am trying to predict economic cycles using Gaussian Naive Bayes “Classifier”. data (input X) : target (output Y) : Below is my code: Below is Error: What am I doing wrong? How can I resolve this issue /error ?
Accuracy is a classification metric. You can’t use it with a regression. See the documentation for info on the various metrics.
It’s because accuracy_score is for classification tasks only. For regression you should use something different, for example: Where X_test is samples, y_test is corresponding ground truth values. It will compute predictions inside.
import nltk is Python syntax, and as such won’t work in a shell script. To test the version of nltk and scikit_learn, you can write a Python script and run it. Such a script may look like Note that not all Python packages are guaranteed to have a __version__ attribute, so for some others it … Read more
I guess you have the wrong version of scikit-learn, a similar situation was described here on GitHub. Previously (before v0.18), train_test_split was located in the cross_validation module: However, now it’s in the model_selection module: so you’ll need the newest version. To upgrade to at least version 0.18, do: (Or pip3, depending on your version of Python). If you’ve installed it in a different way, make sure … Read more
No, there isn’t. Somebody’s working on this and the patch might be merged into mainline some day, but right now there’s no support for categorical variables in scikit-learn except dummy (one-hot) encoding.
Worked for me after installing scipy.
Remove scoring=’roc_auc’ and it will work as roc_auc curve does not support categorical data.