Python初心者です。
PythonでSVMを実装しようとしているのですが、実行する度に正解率の値が変わってしまいます。
random_state=〇〇
で結果が変わらないようにしているのですが
何故なのでしょうか。
よろしくお願いいたします。
該当のソースコード
from sklearn.svm import LinearSVC
from sklearn.model_selection import train_test_split
from pandas import Series, DataFrame
from imblearn.over_sampling import SMOTE
a = pd.read_csv("a.csv",encoding='cp932')
X = a.drop('joined', axis=1)
y = a['joined']
y = y.astype('int')
sm = SMOTE(kind="svm")
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=66)
X_res, y_res = sm.fit_sample(X_train,y_train)
model = LinearSVC()
model.fit(X_res,y_res)
print('正解率(train):{:.3f}'.format(model.score(X_train, y_train)))
print('正解率(test):{:.3f}'.format(model.score(X_test, y_test)))
補足情報
Jupyter Notebookを使用して実行しています。

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/08/09 00:27