Look at the section 'Evaluation of the performance on the test set' at the following url:
Working With Text Data — scikit-learn 0.23.2 documentation[
^]
High level, example code would look like:
feature_extraction = TfidfVectorizer()
X = feature_extraction.fit_transform(data["sentiments"].values)
X_train = X[:num_training]
X_test = X[num_training:]
y_train = data["Label"].values[:num_training]
y_test = data["Label"].values[num_training:]
clf = SVC(probability=True, kernel='rbf')
clf.fit(X_train, y_train)
predictions = clf.predict_proba(X_test)
Now, in case you want to re-invent wheel and have your own implementation of SVM, would suggest you star from here:
scikit-learn/_classes.py at master · scikit-learn/scikit-learn · GitHub[
^]