- Timestamp:
- 07/08/16 14:37:15 (8 years ago)
- Location:
- stable
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 13826,13921-13922,13941,13992-13993,14000
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Algorithms.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Algorithms.DataAnalysis merged: 13921-13922,13941,13992-13993,14000
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkClassification.cs
r13297 r14027 220 220 221 221 var problemDataClone = (IClassificationProblemData)problemData.Clone(); 222 return new NeuralNetworkClassificationSolution( problemDataClone, new NeuralNetworkModel(multiLayerPerceptron, targetVariable, allowedInputVariables, problemDataClone.ClassValues.ToArray()));222 return new NeuralNetworkClassificationSolution(new NeuralNetworkModel(multiLayerPerceptron, targetVariable, allowedInputVariables, problemDataClone.ClassValues.ToArray()), problemDataClone); 223 223 } 224 224 #endregion -
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkClassificationSolution.cs
r12009 r14027 43 43 : base(original, cloner) { 44 44 } 45 public NeuralNetworkClassificationSolution(I ClassificationProblemData problemData, INeuralNetworkModel nnModel)45 public NeuralNetworkClassificationSolution(INeuralNetworkModel nnModel, IClassificationProblemData problemData) 46 46 : base(nnModel, problemData) { 47 47 } -
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleClassification.cs
r13297 r14027 204 204 relClassError = alglib.mlperelclserror(mlpEnsemble, inputMatrix, nRows); 205 205 var problemDataClone = (IClassificationProblemData)problemData.Clone(); 206 return new NeuralNetworkEnsembleClassificationSolution( problemDataClone, new NeuralNetworkEnsembleModel(mlpEnsemble, targetVariable, allowedInputVariables, problemDataClone.ClassValues.ToArray()));206 return new NeuralNetworkEnsembleClassificationSolution(new NeuralNetworkEnsembleModel(mlpEnsemble, targetVariable, allowedInputVariables, problemDataClone.ClassValues.ToArray()), problemDataClone); 207 207 } 208 208 #endregion -
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleClassificationSolution.cs
r12009 r14027 43 43 : base(original, cloner) { 44 44 } 45 public NeuralNetworkEnsembleClassificationSolution(I ClassificationProblemData problemData, INeuralNetworkEnsembleModel nnModel)45 public NeuralNetworkEnsembleClassificationSolution(INeuralNetworkEnsembleModel nnModel, IClassificationProblemData problemData) 46 46 : base(nnModel, problemData) { 47 47 } -
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleModel.cs
r12702 r14027 34 34 [StorableClass] 35 35 [Item("NeuralNetworkEnsembleModel", "Represents a neural network ensemble for regression and classification.")] 36 public sealed class NeuralNetworkEnsembleModel : NamedItem, INeuralNetworkEnsembleModel {36 public sealed class NeuralNetworkEnsembleModel : ClassificationModel, INeuralNetworkEnsembleModel { 37 37 38 38 private alglib.mlpensemble mlpEnsemble; … … 46 46 } 47 47 } 48 } 49 50 public override IEnumerable<string> VariablesUsedForPrediction { 51 get { return allowedInputVariables; } 48 52 } 49 53 … … 72 76 } 73 77 public NeuralNetworkEnsembleModel(alglib.mlpensemble mlpEnsemble, string targetVariable, IEnumerable<string> allowedInputVariables, double[] classValues = null) 74 : base( ) {78 : base(targetVariable) { 75 79 this.name = ItemName; 76 80 this.description = ItemDescription; … … 103 107 } 104 108 105 public IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows) {109 public override IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows) { 106 110 double[,] inputData = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables, rows); 107 111 … … 129 133 } 130 134 131 public INeuralNetworkEnsembleRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) { 132 return new NeuralNetworkEnsembleRegressionSolution(new RegressionEnsembleProblemData(problemData), this); 133 } 134 IRegressionSolution IRegressionModel.CreateRegressionSolution(IRegressionProblemData problemData) { 135 return CreateRegressionSolution(problemData); 136 } 137 public INeuralNetworkEnsembleClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData) { 138 return new NeuralNetworkEnsembleClassificationSolution(new ClassificationEnsembleProblemData(problemData), this); 139 } 140 IClassificationSolution IClassificationModel.CreateClassificationSolution(IClassificationProblemData problemData) { 141 return CreateClassificationSolution(problemData); 135 public IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) { 136 return new NeuralNetworkEnsembleRegressionSolution(this, new RegressionEnsembleProblemData(problemData)); 137 } 138 public override IClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData) { 139 return new NeuralNetworkEnsembleClassificationSolution(this, new ClassificationEnsembleProblemData(problemData)); 142 140 } 143 141 -
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleRegression.cs
r13297 r14027 190 190 avgRelError = alglib.mlpeavgrelerror(mlpEnsemble, inputMatrix, nRows); 191 191 192 return new NeuralNetworkEnsembleRegressionSolution( (IRegressionProblemData)problemData.Clone(), new NeuralNetworkEnsembleModel(mlpEnsemble, targetVariable, allowedInputVariables));192 return new NeuralNetworkEnsembleRegressionSolution(new NeuralNetworkEnsembleModel(mlpEnsemble, targetVariable, allowedInputVariables), (IRegressionProblemData)problemData.Clone()); 193 193 } 194 194 #endregion -
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkEnsembleRegressionSolution.cs
r12009 r14027 43 43 : base(original, cloner) { 44 44 } 45 public NeuralNetworkEnsembleRegressionSolution(I RegressionProblemData problemData, INeuralNetworkEnsembleModel nnModel)45 public NeuralNetworkEnsembleRegressionSolution(INeuralNetworkEnsembleModel nnModel, IRegressionProblemData problemData) 46 46 : base(nnModel, problemData) { 47 47 RecalculateResults(); -
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkModel.cs
r12702 r14027 34 34 [StorableClass] 35 35 [Item("NeuralNetworkModel", "Represents a neural network for regression and classification.")] 36 public sealed class NeuralNetworkModel : NamedItem, INeuralNetworkModel {36 public sealed class NeuralNetworkModel : ClassificationModel, INeuralNetworkModel { 37 37 38 38 private alglib.multilayerperceptron multiLayerPerceptron; … … 48 48 } 49 49 50 [Storable] 51 private string targetVariable; 50 public override IEnumerable<string> VariablesUsedForPrediction { 51 get { return allowedInputVariables; } 52 } 53 52 54 [Storable] 53 55 private string[] allowedInputVariables; … … 74 76 multiLayerPerceptron.innerobj.x = (double[])original.multiLayerPerceptron.innerobj.x.Clone(); 75 77 multiLayerPerceptron.innerobj.y = (double[])original.multiLayerPerceptron.innerobj.y.Clone(); 76 targetVariable = original.targetVariable;77 78 allowedInputVariables = (string[])original.allowedInputVariables.Clone(); 78 79 if (original.classValues != null) … … 80 81 } 81 82 public NeuralNetworkModel(alglib.multilayerperceptron multiLayerPerceptron, string targetVariable, IEnumerable<string> allowedInputVariables, double[] classValues = null) 82 : base( ) {83 : base(targetVariable) { 83 84 this.name = ItemName; 84 85 this.description = ItemDescription; 85 86 this.multiLayerPerceptron = multiLayerPerceptron; 86 this.targetVariable = targetVariable;87 87 this.allowedInputVariables = allowedInputVariables.ToArray(); 88 88 if (classValues != null) … … 111 111 } 112 112 113 public IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows) {113 public override IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows) { 114 114 double[,] inputData = AlglibUtil.PrepareInputMatrix(dataset, allowedInputVariables, rows); 115 115 … … 137 137 } 138 138 139 public INeuralNetworkRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) { 140 return new NeuralNetworkRegressionSolution(new RegressionProblemData(problemData), this); 141 } 142 IRegressionSolution IRegressionModel.CreateRegressionSolution(IRegressionProblemData problemData) { 143 return CreateRegressionSolution(problemData); 144 } 145 public INeuralNetworkClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData) { 146 return new NeuralNetworkClassificationSolution(new ClassificationProblemData(problemData), this); 147 } 148 IClassificationSolution IClassificationModel.CreateClassificationSolution(IClassificationProblemData problemData) { 149 return CreateClassificationSolution(problemData); 139 public IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) { 140 return new NeuralNetworkRegressionSolution(this, new RegressionProblemData(problemData)); 141 } 142 public override IClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData) { 143 return new NeuralNetworkClassificationSolution(this, new ClassificationProblemData(problemData)); 150 144 } 151 145 -
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkRegression.cs
r13297 r14027 207 207 avgRelError = alglib.mlpavgrelerror(multiLayerPerceptron, inputMatrix, nRows); 208 208 209 return new NeuralNetworkRegressionSolution( (IRegressionProblemData)problemData.Clone(), new NeuralNetworkModel(multiLayerPerceptron, targetVariable, allowedInputVariables));209 return new NeuralNetworkRegressionSolution(new NeuralNetworkModel(multiLayerPerceptron, targetVariable, allowedInputVariables), (IRegressionProblemData)problemData.Clone()); 210 210 } 211 211 #endregion -
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/NeuralNetwork/NeuralNetworkRegressionSolution.cs
r12009 r14027 43 43 : base(original, cloner) { 44 44 } 45 public NeuralNetworkRegressionSolution(I RegressionProblemData problemData, INeuralNetworkModel nnModel)45 public NeuralNetworkRegressionSolution(INeuralNetworkModel nnModel, IRegressionProblemData problemData) 46 46 : base(nnModel, problemData) { 47 47 }
Note: See TracChangeset
for help on using the changeset viewer.