public BuildGenericBackPropagationRprop() { _model = new ModelBackPropagationBase(); _activationFunctionOutputLayer = new Sigmoid(); _factorDecrease = .5; _factorIncrease = 1.2; _alpha = .1; _maxUpdateFactor = Double.MaxValue; _minUpdateFactor = Double.MinValue; }
protected bool VerifyUpstreamLayers(ModelBackPropagationBase model) { bool exceptionFlag = false; Parallel.For(1, model.GetNumberOfLayers(), new ParallelOptions { MaxDegreeOfParallelism = _maxParallelThreads }, idxLayer => { if (model.GetLayer(idxLayer).GetNumberOfUpstreamUnits() < 0) //Check if Upstream Layer is setup, this will set an exception otherwise { exceptionFlag = true; } }); return(exceptionFlag); }
protected bool VerifyLayers(ModelBackPropagationBase model) { bool exceptionFlag = false; Parallel.For(0, model.GetNumberOfLayers() - 1, new ParallelOptions { MaxDegreeOfParallelism = _maxParallelThreads }, idxLayer => { if (model.GetLayer(idxLayer) == null) { exceptionFlag = true; } }); return(exceptionFlag); }
BuildModel(double[][] trainingData, string[] attributeHeaders, int indexTargetAttribute) { //Verify data and set variables VerifyData(trainingData, attributeHeaders, indexTargetAttribute); //model.Mode = _mode; //Classification or Regression //Find out number of categories _noOfUnitsOutputLayer = GetNumberOfTargetValues(_mode, trainingData, indexTargetAttribute).Length; //Set Number of Hidden Layers if (_noOfUnitsHiddenLayer == int.MinValue) { _noOfUnitsHiddenLayer = GetNumberOfHiddenUnits(_noOfUnitsOutputLayer, _scalingFactor, _noOfAttributes); } if (_activationFunctions[0] == null) { SetActivationFunction(0, new Sigmoid()); } if (_activationFunctions[1] == null) { SetActivationFunction(1, new Sigmoid()); } BuildGenericBackPropagationStandard build = new BuildGenericBackPropagationStandard(); build.SetParameters((double)_mode, 1, _threshold, _noOfEpoch, _alpha); build.AddHiddenLayer(0, _noOfUnitsHiddenLayer, _activationFunctions[0]); build.SetOutputLayerActivationFunction(_activationFunctions[1]); ModelBackPropagationBase model = (ModelBackPropagationBase)build.BuildModel( _trainingData, _attributeHeaders, _indexTargetAttribute); return(model); }
public BuildGenericBackPropagationStandard() { _model = new ModelBackPropagationBase(); _activationFunctionOutputLayer = new Sigmoid(); }