Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/21/11 13:37:43 (13 years ago)
Author:
gkronber
Message:

#1474: added implementations for regression and classification with neural network ensembles (wrappers for alglib).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkClassification.cs

    r6579 r6580  
    3838  /// Neural network classification data analysis algorithm.
    3939  /// </summary>
    40   [Item("Neural Network Classification", "Neural network classification data analysis algorithm (wrapper for ALGLIB).")]
     40  [Item("Neural Network Classification", "Neural network classification data analysis algorithm (wrapper for ALGLIB). Further documentation: http://www.alglib.net/dataanalysis/neuralnetworks.php")]
    4141  [Creatable("Data Analysis")]
    4242  [StorableClass]
     
    156156        throw new NotSupportedException("Neural network classification does not support NaN or infinity values in the input dataset.");
    157157
    158       alglib.multilayerperceptron multiLayerPerceptron = null;
    159       int numberOfClasses = problemData.ClassValues.Count();
    160       if (nLayers == 0) {
    161         alglib.mlpcreatec0(allowedInputVariables.Count(), numberOfClasses, out multiLayerPerceptron);
    162       } else if (nLayers == 1) {
    163         alglib.mlpcreatec1(allowedInputVariables.Count(), nHiddenNodes1, numberOfClasses, out multiLayerPerceptron);
    164       } else if (nLayers == 2) {
    165         alglib.mlpcreatec2(allowedInputVariables.Count(), nHiddenNodes1, nHiddenNodes2, numberOfClasses, out multiLayerPerceptron);
    166       } else throw new ArgumentException("Number of layers must be zero, one, or two.", "nLayers");
    167       alglib.mlpreport rep;
    168158      int nRows = inputMatrix.GetLength(0);
    169159      int nFeatures = inputMatrix.GetLength(1) - 1;
     
    178168        inputMatrix[row, nFeatures] = classIndizes[inputMatrix[row, nFeatures]];
    179169      }
     170
     171      alglib.multilayerperceptron multiLayerPerceptron = null;
     172      if (nLayers == 0) {
     173        alglib.mlpcreatec0(allowedInputVariables.Count(), nClasses, out multiLayerPerceptron);
     174      } else if (nLayers == 1) {
     175        alglib.mlpcreatec1(allowedInputVariables.Count(), nHiddenNodes1, nClasses, out multiLayerPerceptron);
     176      } else if (nLayers == 2) {
     177        alglib.mlpcreatec2(allowedInputVariables.Count(), nHiddenNodes1, nHiddenNodes2, nClasses, out multiLayerPerceptron);
     178      } else throw new ArgumentException("Number of layers must be zero, one, or two.", "nLayers");
     179      alglib.mlpreport rep;
    180180
    181181      int info;
Note: See TracChangeset for help on using the changeset viewer.