/** * <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 the multilayer 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 multilayer perceptron with * gradient descent.</summary> * * <param name="trainSet"> Training data given to the algorithm</param> * <param name="parameters">Parameters of the multilayer perceptron.</param> */ public override void Train(InstanceList.InstanceList trainSet, Parameter.Parameter parameters) { var partition = trainSet.StratifiedPartition( ((MultiLayerPerceptronParameter) parameters).GetCrossValidationRatio(), new Random(parameters.GetSeed())); model = new MultiLayerPerceptronModel(partition.Get(1), partition.Get(0), (MultiLayerPerceptronParameter) parameters); }
/** * <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; }
/** * <summary> Training algorithm for random classifier.</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) { model = new RandomModel(new List <String>(trainSet.ClassDistribution().Keys), parameters.GetSeed()); }
/** * <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); }