id review name label 1 it is a great product for turning lights on. Ashley 2 plays music and have a good sound. Alex 3 I love it, lots of fun. Peter
I want to use probabilistic classifier (linear_svc) to predict labels (probability of 1) based on review. My code:
from sklearn.svm import LinearSVC from sklearn.calibration import CalibratedClassifierCV from sklearn import datasets #Load dataset X = training['review'] y = training['label'] linear_svc = LinearSVC() #The base estimator # This is the calibrated classifier which can give probabilistic classifier calibrated_svc = CalibratedClassifierCV(linear_svc, method='sigmoid', #sigmoid will use Platt's scaling. Refer to documentation for other methods. cv=3) calibrated_svc.fit(X, y) # predict prediction_data = predict_data['review'] predicted_probs = calibrated_svc.predict_proba(prediction_data)
It gives following error on calibrated_svc.fit(X, y):
ValueError: could not convert string to float: 'it is a great product for turning...'
I would appreciate your help.