public HybridModel(HybridModelParameter parameter) : base(parameter) { Orgnization = "HUST WREIS"; ID = "34934C27-DD41-44D8-B359-BF56B663A6B8"; Name = "Hybrid Model"; Descriptions = ""; }
public static IForecastingModel CreateForecastingModel(string name) { IForecastingModel model = null; switch (name) { case "Artificial Neural Network": AnnModelParameter annPara = new AnnModelParameter(); model = new NeuralNetworkModel(annPara); break; case "HIGANN": AnnModelParameter annPara1 = new AnnModelParameter(); model = new NeuralNetworkModel(annPara1); break; case "Support Vector Machine": Heiflow.AI.SVM.Parameter p = new Heiflow.AI.SVM.Parameter(); model = new SVMModel(p); break; case "Multiple Linear Regression": ModelParameter mp = new ModelParameter(); model = new MLRModel(mp); break; case "Genetic Programming": GPModelParameter para = new GPModelParameter(); model = new GPModel(para); break; case "Model Tree": Rule root = new Rule(5, 0.47035, RuleType.Interior); Rule right = new Rule(RuleType.RightLeaf); root.RightChild = right; Rule left = new Rule(5, 0.30445, RuleType.Interior); root.LeftChild = left; Rule left1 = new Rule(RuleType.LeftLeaf); left.LeftChild = left1; Rule right1 = new Rule(9, 0.156, RuleType.Interior); left.RightChild = right1; Rule right1_left = new Rule(RuleType.LeftLeaf); right1.LeftChild = right1_left; Rule right1_right = new Rule(RuleType.RightLeaf); right1.RightChild = right1_right; HybridModelParameter hmp = new HybridModelParameter(root); model = new HybridModel(hmp); break; } return(model); }
public override double Forecast(double[] inputVector) { HybridModelParameter hmp = mParameter as HybridModelParameter; MLRModel mlr = hmp.CurrentLeafRule.Model as MLRModel; if (mlr != null) { double y = 0; for (int i = 0; i < inputVector.Length; i++) { y += inputVector[i] * mlr.RegressionCoefficients[i]; } return(y); } else { return(0); } }
public override void Train(IForecastingDataSets datasets) { HybridModelParameter para = mParameter as HybridModelParameter; OnStartRunning(new ComponentRunEventArgs(datasets)); if (para.Rule.Type == RuleType.Interior) { BuildRuleTree(para.Rule, datasets); datasets.ForecastedData = new double[datasets.InputData.Length][]; for (int i = 0; i < datasets.InputData.Length; i++) { datasets.ForecastedData[i] = new double[1]; HybridModelParameter hmp = mParameter as HybridModelParameter; hmp.CurrentLeafRule = LocateRule(datasets.InputData[i], hmp.Rule); datasets.ForecastedData[i][0] = Forecast(datasets.InputData[i]); OnRunningEpoch(new ComponentRunEpochEventArgs(i)); } } OnFinishRunning(new ComponentRunEventArgs(datasets)); }