DetectSpikeBySsa获取模型参数并对其进行重新训练(ML.NET v1.2.0)

时间:2019-07-19 18:32:32

标签: c# .net ml.net

我正在研究一个TimeSeries模型,需要分析数据收集的异常情况。为此,我正在使用 DetectSpikeBySsa 。但问题是,我现在需要的是为将来的数据重新训练模型。

我已经在搜索文档,而我只了解其他类型的模型,例如LinearRegression。

https://docs.microsoft.com/en-us/dotnet/machine-learning/how-to-guides/train-machine-learning-model-ml-net

// Pipeline that I used
var pipeline = context.Transforms.DetectSpikeBySsa(
                            outputColumnName: nameof(DataPredicted.Prediction),
                            inputColumnName: nameof(DataPoints.value),
                            confidence: 99,
                            pvalueHistoryLength: data.Count() / numberOfDays,
                            trainingWindowSize: data.Count(),
                            seasonalityWindowSize: data.Count() / numberOfDays);
// Train and Save the model locally
ITransformer trainedModel = pipeline.Fit(dataComplete);
context.Model.Save(trainedModel, dataComplete.Schema, file);


// Loading the trained model in other instance
ITransformer trainedModel = context.Model.Load(file, out var modelInputSquema);

// After this I would like to retrain the model and analyze the differences between before and after.

经过训练的模型可以很好地处理旧数据,但是我们当然需要使用新数据重新训练模型。

所以,问题是:

  1. 如何获取训练后的模型(DetectSpikeBySsa)的参数
  2. 如何重新训练模型并比较旧模型?

非常感谢!任何信息将不胜感激。

1 个答案:

答案 0 :(得分:0)

目前,人们无法重新训练该模型。根据docs.microsoft,可以重新训练以下算法。

Re-Train a Model in ML.Net

  • PerceptronTrainer平均水平
  • FieldAwareFactorizationMachineTrainer
  • LbfgsLogisticRegressionBinaryTrainer
  • LbfgsMaximumEntropyMulticlassTrainer
  • LbfgsPoissonRegressionTrainer
  • LinearSvmTrainer
  • OnlineGradientDescentTrainer
  • SgdCalibratedTrainer
  • SgdNonCalibratedTrainer
  • SymbolicSgdLogisticRegressionBinaryTrainer

可能有可能添加到您的数据中并训练新模型并用其他名称保存。然后,您可以评估两个模型,并选择得分更高的模型。如果模型的效果不佳或改变了模型的功能,您可能还想尝试其他算法。

相关问题