数据挖掘-3.建模调参
程序员文章站
2022-05-15 14:35:26
...
绘制学习率曲线与验证曲线
learning_curve :param ::train_size
fill_between
def plot_learning_curve(estimator,title, X, y, ylim=None, cv=None, n_jobs=1,
train_size = np.linspace(.1,1.0,5)):
plt.figure()
plt.title(title)
if ylim is not None:
plt.ylim(*ylim)
plt.xlabel('Training example')
plt.ylabel('score')
train_sizes, train_scores, test_scores = learning_curve(estimator, X, y, cv=cv,
n_jobs = n_jobs,
train_sizes = train_size,
scoring = make_scorer(mean_absolute_error))
train_scores_mean = np.mean(train_scores,axis=1)
train_scores_std = np.std(train_scores,axis=1)
test_scores_mean = np.mean(test_scores,axis=1)
test_scores_std = np.std(test_scores,axis=1)
plt.grid()
plt.fill_between(train_sizes, train_scores_mean - train_scores_std,
train_scores_mean + test_scores_std, alpha=.1, color='r')
plt.fill_between(train_sizes,test_scores_mean - test_scores_std,
test_scores_mean + test_scores_std, alpha=.1, color='g')
plt.plot(train_sizes,train_scores_mean, 'o-', color='r', label='train_mean')
plt.plot(train_sizes,test_scores_mean, 'o-', color='g', label='val_mean')
plt.legend(loc='best')
return plt
上一篇: Oracle 11g使用exp导出空表
下一篇: shiro身份认证加密
推荐阅读
-
Python数据挖掘(烟火图像分类:传统机器学习建模方法与卷积神经网络性能比较)
-
Python数据挖掘(烟火图像分类:传统机器学习建模方法与卷积神经网络性能比较)
-
DATAWHALE-数据挖掘竞赛入门-task4-建模调参
-
[Python数据分析] 6-挖掘建模(无监督学习)
-
数据挖掘Task4 建模调参
-
Datawhale 零基础入门数据挖掘-Task4 建模调参
-
Datawhale 零基础入门数据挖掘-Task4 建模调参
-
Datawhale 零基础入门数据挖掘-Task4 建模调参
-
Datawhale 零基础入门数据挖掘-Task4 建模调参
-
Datawhale零基础入门数据挖掘-Task4 建模调参笔记