如何从LinearSVC模型中检索训练历史?

时间:2019-03-27 12:01:57

标签: python-3.x scikit-learn svm

我正在尝试检索SVM模型的训练历史以绘制其学习曲线。像这样:

history = model.fit(X, Y, validation_split=0.33, epochs=150, batch_size=10)

我已经研究过GridSearchCV best model CV historyhttps://scikit-learn.org/stable/auto_examples/model_selection/plot_learning_curve.html,但是第一种方法不适用于LinearSVC模型,第二种方法并不是我想做的(到目前为止)据我了解,如果使用学习曲线方法,则必须在网格搜索后再次训练模型。

model = GridSearchCV(LinearSVC(verbose=0), 
                              {'C': [1, 10, 100, 1000]}, cv=5, 
                              iid=False, scoring='recall_macro')

model.fit(x_train, y_train)
_, loss, val_loss = learning_curve(model.best_estimator_.fit(X, Y, cv=5))

如何获取此历史记录?我正在使用sklearn 0.20.3。

0 个答案:

没有答案