コード例 #1
0
ファイル: flare-solar.py プロジェクト: makeho8/python
print('Accuracy of S_TWSVM %.3f' % (100 * np.mean(y_S_TWSVM == y_test)))
###Cross validation score of S_TWSVM
#from sklearn.model_selection import cross_val_score
scores = cross_val_score(estimator=clf3,
                         X=AB_train_mms,
                         y=y_train,
                         cv=10,
                         n_jobs=1)
#print('CV accuracy scores of S_TWSVM: %s' %scores)
print('CV accuracy of S_TWSVM: %.3f +/- %.3f' %
      (np.mean(scores), np.std(scores)))

# TWSVM: best params of TWSVM {'c': 1.0, 'c_': 1.0}
from TWSVM_class import TWSVM
start_time = time.time()
clf4 = TWSVM(c=1, c_=1)
clf4.fit(AB_train_mms, y_train)
end_time = time.time()
print('total run time of TWSVM: %f ' % ((end_time - start_time)))
y_TWSVM = clf4.predict(AB_test_mms)
print('Accuracy of TWSVM %.3f ' % (100 * np.mean(y_TWSVM == y_test)))
###Cross validation score of TWSVM
#from sklearn.model_selection import cross_val_score
scores = cross_val_score(estimator=clf4,
                         X=AB_train_mms,
                         y=y_train,
                         cv=10,
                         n_jobs=1)
#print('CV accuracy scores of TWSVM: %s' %scores)
print('CV accuracy of TWSVM: %.3f +/- %.3f' %
      (np.mean(scores), np.std(scores)))
コード例 #2
0
ファイル: Image.py プロジェクト: makeho8/python
clf3 = S_TWSVM(c1 = 1, c2 = 0.0001, c3 = 100)
clf3.fit(AB_train_mms, y_train)
end_time = time.time()
print('Total runtime of S_TWSVM: %s' %((end_time - start_time)))
y_S_TWSVM = clf3.predict(AB_test_mms)
print('Accuracy of S_TWSVM %.3f' %(100*np.mean(y_S_TWSVM == y_test)))
###Cross validation score of S_TWSVM
#from sklearn.model_selection import cross_val_score
scores = cross_val_score(estimator = clf3, X = AB_train_mms, y = y_train, cv = 10, n_jobs =1)
#print('CV accuracy scores of S_TWSVM: %s' %scores)
print('CV accuracy of S_TWSVM: %.3f +/- %.3f' % (np.mean(scores), np.std(scores)))

# TWSVM best params of TWSVM {'c': 100.0, 'c_': 10.0}
from TWSVM_class import TWSVM
start_time = time.time()
clf4 = TWSVM(c = 100, c_ = 10)
clf4.fit(AB_train_mms, y_train)
end_time = time.time()
print('total run time of TWSVM: %f ' %((end_time - start_time)))
y_TWSVM = clf4.predict(AB_test_mms)
print('Accuracy of TWSVM %.3f ' %(100*np.mean(y_TWSVM == y_test)))
###Cross validation score of TWSVM
#from sklearn.model_selection import cross_val_score
scores = cross_val_score(estimator = clf4, X = AB_train_mms, y = y_train, cv = 10, n_jobs =1)
#print('CV accuracy scores of TWSVM: %s' %scores)
print('CV accuracy of TWSVM: %.3f +/- %.3f' % (np.mean(scores), np.std(scores)))

# SVM best params of SVM 
#from SVM_class import SVM
#start_time = time.time()
#clf5 = SVM(c = 1)
コード例 #3
0
ファイル: australian.py プロジェクト: makeho8/python
print('Accuracy of S_TWSVM %.3f' % (100 * np.mean(y_S_TWSVM == y_test)))
###Cross validation score of S_TWSVM
#from sklearn.model_selection import cross_val_score
scores = cross_val_score(estimator=clf3,
                         X=AB_train_mms,
                         y=y_train,
                         cv=10,
                         n_jobs=1)
#print('CV accuracy scores of S_TWSVM: %s' %scores)
print('CV accuracy of S_TWSVM: %.3f +/- %.3f' %
      (np.mean(scores), np.std(scores)))

# TWSVM best params of TWSVM {'c': 0.1, 'c_': 0.1}
from TWSVM_class import TWSVM
start_time = time.time()
clf4 = TWSVM(c=0.1, c_=0.1)
clf4.fit(AB_train_mms, y_train)
end_time = time.time()
print('total run time of TWSVM: %f ' % ((end_time - start_time)))
y_TWSVM = clf4.predict(AB_test_mms)
print('Accuracy of TWSVM %.3f ' % (100 * np.mean(y_TWSVM == y_test)))
###Cross validation score of TWSVM
#from sklearn.model_selection import cross_val_score
scores = cross_val_score(estimator=clf4,
                         X=AB_train_mms,
                         y=y_train,
                         cv=10,
                         n_jobs=1)
#print('CV accuracy scores of TWSVM: %s' %scores)
print('CV accuracy of TWSVM: %.3f +/- %.3f' %
      (np.mean(scores), np.std(scores)))
コード例 #4
0
ファイル: CMC.py プロジェクト: makeho8/python
clf3 = S_TWSVM(c1 = 10, c2 = 100, c3 = 1000)
clf3.fit(AB_train_mms, y_train)
end_time = time.time()
print('Total runtime of S_TWSVM: %s' %((end_time - start_time)))
y_S_TWSVM = clf3.predict(AB_test_mms)
print('Accuracy of S_TWSVM %.3f' %(100*np.mean(y_S_TWSVM == y_test)))
###Cross validation score of S_TWSVM
#from sklearn.model_selection import cross_val_score
scores = cross_val_score(estimator = clf3, X = AB_train_mms, y = y_train, cv = 10, n_jobs =1)
#print('CV accuracy scores of S_TWSVM: %s' %scores)
print('CV accuracy of S_TWSVM: %.3f +/- %.3f' % (np.mean(scores), np.std(scores)))

# TWSVM best params of TWSVM {'c': 0.0001, 'c_': 0.0001}
from TWSVM_class import TWSVM
start_time = time.time()
clf4 = TWSVM(c = 0.0001, c_ = 0.0001)
clf4.fit(AB_train_mms, y_train)
end_time = time.time()
print('total run time of TWSVM: %f ' %((end_time - start_time)))
y_TWSVM = clf4.predict(AB_test_mms)
print('Accuracy of TWSVM %.3f ' %(100*np.mean(y_TWSVM == y_test)))
###Cross validation score of TWSVM
#from sklearn.model_selection import cross_val_score
scores = cross_val_score(estimator = clf4, X = AB_train_mms, y = y_train, cv = 10, n_jobs =1)
#print('CV accuracy scores of TWSVM: %s' %scores)
print('CV accuracy of TWSVM: %.3f +/- %.3f' % (np.mean(scores), np.std(scores)))

# SVM best params of SVM 
#from SVM_class import SVM
#start_time = time.time()
#clf5 = SVM(c = 1)
コード例 #5
0
###Cross validation score of S_TWSVM
#from sklearn.model_selection import cross_val_score
scores = cross_val_score(estimator=clf3,
                         X=AB_train_mms,
                         y=y_train,
                         cv=10,
                         n_jobs=1)
#print('CV accuracy scores of S_TWSVM: %s' %scores)
print('CV accuracy of S_TWSVM: %.3f +/- %.3f' %
      (np.mean(scores), np.std(scores)))

# TWSVM best params of TWSVM {'c': 10, 'c_': 0.1}
from TWSVM_class import TWSVM

start_time = time.time()
clf4 = TWSVM(c=10, c_=0.1)
clf4.fit(AB_train_mms, y_train)
end_time = time.time()
print('total run time of TWSVM: %f ' % ((end_time - start_time)))
y_TWSVM = clf4.predict(AB_test_mms)
print('Accuracy of TWSVM %.3f ' % (100 * np.mean(y_TWSVM == y_test)))
###Cross validation score of TWSVM
#from sklearn.model_selection import cross_val_score
scores = cross_val_score(estimator=clf4,
                         X=AB_train_mms,
                         y=y_train,
                         cv=10,
                         n_jobs=1)
#print('CV accuracy scores of TWSVM: %s' %scores)
print('CV accuracy of TWSVM: %.3f +/- %.3f' %
      (np.mean(scores), np.std(scores)))