简体   繁体   English

模型进度 Scikit Learn

[英]Model Progress Scikit Learn

Is there an easy way to obtain predictions for any of the models in Scikit learn before they converge?是否有一种简单的方法可以在 Scikit 中的任何模型收敛之前获得预测? I'm aiming to make animations of models as they train to observe their behavior.我的目标是制作模型的动画,因为他们训练观察他们的行为。

Ideally, this would be similar to how one can extract results after an epoch of training for an ANN in Keras.理想情况下,这类似于在 Keras 中训练 ANN 的一个时期之后如何提取结果。

You may want to use the learning curve class for evaluating intermediate results.您可能希望使用学习曲线类来评估中间结果。

Among the parameters, there's one called train_sizes that lets you specify the number of training examples that will be used to generate the curve.在参数中,有一个名为train_sizes的参数可让您指定将用于生成曲线的训练示例的数量。 It can be both absolute, or relative to the available samples.它可以是绝对的,也可以是相对于可用样本的。

For instance, using linear regression:例如,使用线性回归:

from sklearn.linear_model import LinearRegression
from sklearn.model_selection import learning_curve
TRAIN_SIZES = [1, 100, 500, 2000, 5000]
train_sizes, train_scores, validation_scores = learning_curve(
                                                  estimator=LinearRegression(),
                                                  X=myX,
                                                  y=myY,
                                                  train_sizes=TRAIN_SIZES
                                               )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM