Esempio n. 1
0
        public override void Train(IForecastingDataSets datasets)
        {
            OnStartRunning(new ComponentRunEventArgs(datasets));
            AnnModelParameter para = mParameter as AnnModelParameter;

            LinearLayer inputLayer = new LinearLayer(datasets.InputData[0].Length);

            SigmoidLayer hiddenLayer = new SigmoidLayer(para.HiddenNeuronsCount[0]);
            SigmoidLayer outputLayer = new SigmoidLayer(1);

            new BackpropagationConnector(inputLayer, hiddenLayer).Initializer  = new RandomFunction(0d, 0.3d);
            new BackpropagationConnector(hiddenLayer, outputLayer).Initializer = new RandomFunction(0d, 0.3d);
            network = new BackpropagationNetwork(inputLayer, outputLayer);
            network.SetLearningRate(para.LearningRate);
            network.JitterEpoch      = para.JitterEpoch;
            network.JitterNoiseLimit = para.JitterNoiseLimit;
            network.EndEpochEvent   += new TrainingEpochEventHandler(
                delegate(object senderNetwork, TrainingEpochEventArgs args)
            {
                // TODO: trainning error needs to be calculated
                OnRunningEpoch(new AnnModelRunEpochEventArgs(args.TrainingIteration + 1, 0));
            });

            network.Learn(ForecastingDataSets.ConvertToTrainingSet(datasets), para.Iterations);

            datasets.ForecastedData = new double[datasets.InputData.Length][];
            for (int i = 0; i < datasets.InputData.Length; i++)
            {
                datasets.ForecastedData[i]    = new double[1];
                datasets.ForecastedData[i][0] = Forecast(datasets.InputData[i]);
            }
            OnFinishRunning(new ComponentRunEventArgs(datasets));
        }
Esempio n. 2
0
 public NeuralNetworkModel(AnnModelParameter parameter)
     : base(parameter)
 {
     Orgnization  = "HUST WREIS";
     ID           = "80056193-8885-4BCA-B402-457DB4A9CCB4";
     Name         = "Neural  Network";
     Descriptions = "";
 }
Esempio n. 3
0
 public BpANNModel(AnnModelParameter parameter)
 {
     Orgnization                  = "HUST WREIS";
     ID                           = "2F710E58-91E8-4CF4-A721-A7FA243D0D69";
     Name                         = "Artificial Neuron Network";
     Descriptions                 = "";
     mAnnModelParameter           = parameter;
     mAnnModelParameter.Component = this;
 }
Esempio n. 4
0
        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);
        }