Skip to content

support_vector_machines.py increase error tolerance to suppress convergence warnings #1929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions machine_learning/support_vector_machines.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from sklearn.datasets import load_iris
from sklearn import svm
from sklearn.model_selection import train_test_split
import doctest


# different functions implementing different types of SVM's
Expand All @@ -12,15 +11,15 @@ def NuSVC(train_x, train_y):


def Linearsvc(train_x, train_y):
svc_linear = svm.LinearSVC()
svc_linear = svm.LinearSVC(tol=10e-2)
svc_linear.fit(train_x, train_y)
return svc_linear


def SVC(train_x, train_y):
# svm.SVC(C=1.0, kernel='rbf', degree=3, gamma=0.0, coef0=0.0, shrinking=True,
# probability=False,tol=0.001, cache_size=200, class_weight=None, verbose=False,
# max_iter=-1, random_state=None)
# max_iter=1000, random_state=None)
# various parameters like "kernel","gamma","C" can effectively tuned for a given
# machine learning model.
SVC = svm.SVC(gamma="auto")
Expand All @@ -39,7 +38,6 @@ def test(X_new):
'versicolor'
>>> test([6,3,4,1])
'versicolor'

"""
iris = load_iris()
# splitting the dataset to test and train
Expand All @@ -55,4 +53,6 @@ def test(X_new):


if __name__ == "__main__":
import doctest

doctest.testmod()