/**
         * <summary> Training algorithm for auto encoders. An auto encoder is a neural network which attempts to replicate its input at its output.</summary>
         *
         * <param name="trainSet">  Training data given to the algorithm.</param>
         * <param name="parameters">Parameters of the auto encoder.</param>
         */
        public override void Train(InstanceList.InstanceList trainSet, Parameter.Parameter parameters)
        {
            var partition = trainSet.StratifiedPartition(0.2, new Random(parameters.GetSeed()));

            model = new AutoEncoderModel(partition.Get(1), partition.Get(0),
                                         (MultiLayerPerceptronParameter)parameters);
        }
        /**
         * <summary> Training algorithm for deep network classifier.</summary>
         *
         * <param name="trainSet">  Training data given to the algorithm.</param>
         * <param name="parameters">Parameters of the deep network algorithm. crossValidationRatio and seed are used as parameters.</param>
         */
        public override void Train(InstanceList.InstanceList trainSet, Parameter.Parameter parameters)
        {
            var partition = trainSet.StratifiedPartition(
                ((DeepNetworkParameter)parameters).GetCrossValidationRatio(), new Random(parameters.GetSeed()));

            model = new DeepNetworkModel(partition.Get(1), partition.Get(0), (DeepNetworkParameter)parameters);
        }
        /**
         * <summary> Training algorithm for the linear perceptron algorithm. 20 percent of the data is separated as cross-validation
         * data used for selecting the best weights. 80 percent of the data is used for training the linear perceptron with
         * gradient descent.</summary>
         *
         * <param name="trainSet">  Training data given to the algorithm</param>
         * <param name="parameters">Parameters of the linear perceptron.</param>
         */
        public override void Train(InstanceList.InstanceList trainSet, Parameter.Parameter parameters)
        {
            var partition = trainSet.StratifiedPartition(
                ((LinearPerceptronParameter)parameters).GetCrossValidationRatio(), new Random(parameters.GetSeed()));

            model = new LinearPerceptronModel(partition.Get(1), partition.Get(0),
                                              (LinearPerceptronParameter)parameters);
        }
示例#4
0
        /**
         * <summary> Training algorithm for C4.5 univariate decision tree classifier. 20 percent of the data are left aside for pruning
         * 80 percent of the data is used for constructing the tree.</summary>
         *
         * <param name="trainSet">  Training data given to the algorithm.</param>
         * <param name="parameters">-</param>
         */
        public override void Train(InstanceList.InstanceList trainSet, Parameter.Parameter parameters)
        {
            DecisionTree tree;

            if (((C45Parameter)parameters).IsPrune())
            {
                var partition = trainSet.StratifiedPartition(
                    ((C45Parameter)parameters).GetCrossValidationRatio(), new Random(parameters.GetSeed()));
                tree = new DecisionTree(new DecisionNode(partition.Get(1), null, null, false));
                tree.Prune(partition.Get(0));
            }
            else
            {
                tree = new DecisionTree(new DecisionNode(trainSet, null, null, false));
            }

            model = tree;
        }