I am using the SVM classifier built in NLTK and after training the model, when I try to classify a document, the program terminates with Error during execution, QProcess error: 1 Execution Interrupted
I am using the following code:-
classifier = nltk.classify.svm.SvmClassifier.train(train_features)
for test_record in test_data_list:
features = extract_features(test_record)
predict = classifier.classify(features)
print predict
What could be the reason for the error?
nltk.classify.svm was deprecated. For classification based
on support vector machines SVMs use nltk.classify.scikitlearn
(or scikit-learn directly).For more details NLTK 3.0 documentation
You can use nltk.classify.scikitlearn as follows
import nltk.classify
from sklearn.svm import LinearSVC
classifier = nltk.classify.SklearnClassifier(LinearSVC())
classifier.train(train_features)
for test_record in test_data_list:
features = extract_features(test_record)
predict = classifier.classify(features)
print predict
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With