def compute_cross_fold(data):
data_table = pd.read_csv("total_set.csv",index_col=0)
#data_norm = (data - data.mean()) / (data.sum())
scaler = preprocessing.StandardScaler().fit(data)
data_scaled = scaler.transform(data)
#print data_scaled
profitability_target = data_table['Profitable']
#print profitability_target
#gross_target = data_table['Domestic Gross']
#tomato = data_table['Rotten']
#normalized_target_gross = (gross_target - gross_target.mean()) / (gross_target.max() - gross_target.min())
#tomato = (tomato - tomato.mean()) / (tomato.max() - tomato.min())
#clf_profit = svm.SVC(kernel='rbf',C=0.8, gamma=5,verbose=True)
clf_profit = svm.LinearSVC(C=0.001,verbose=True,tol=.1)
clf_profit.fit(data_scaled,profitability_target)
scores = cross_val_score(clf_profit, data_scaled, profitability_target, cv=10)
#print("Accuracy: %0.2f (+/- %0.2f)" % (scores.mean(), scores.std() * 2))
return (scores.mean(), scores.std() * 2)
k_fold_predictor.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录