-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPriceForecastModel.training.cs
40 lines (36 loc) · 1.51 KB
/
PriceForecastModel.training.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// This file was auto-generated by ML.NET Model Builder.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.ML;
namespace NodeBlock_Plugin_MachineLearning
{
public partial class PriceForecastModel
{
/// <summary>
/// Retrains model using the pipeline generated as part of the training process. For more information on how to load data, see aka.ms/loaddata.
/// </summary>
/// <param name="mlContext"></param>
/// <param name="trainData"></param>
/// <returns></returns>
public static ITransformer RetrainPipeline(MLContext mlContext, IDataView trainData)
{
var pipeline = BuildPipeline(mlContext);
var model = pipeline.Fit(trainData);
return model;
}
/// <summary>
/// build the pipeline that is used from model builder. Use this function to retrain model.
/// </summary>
/// <param name="mlContext"></param>
/// <returns></returns>
public static IEstimator<ITransformer> BuildPipeline(MLContext mlContext)
{
// Data process configuration with pipeline data transformations
var pipeline = mlContext.Forecasting.ForecastBySsa(windowSize:8,seriesLength:11593,trainSize:522,horizon:1,outputColumnName:@"Price",inputColumnName:@"Price",confidenceLowerBoundColumn:@"Price_LB",confidenceUpperBoundColumn:@"Price_UB");
return pipeline;
}
}
}