Changeset 16386 for branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour
- Timestamp:
- 12/15/18 12:07:16 (6 years ago)
- Location:
- branches/2925_AutoDiffForDynamicalModels
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2925_AutoDiffForDynamicalModels
- Property svn:mergeinfo changed
-
branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Algorithms.DataAnalysis
- Property svn:mergeinfo changed
-
branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Algorithms.DataAnalysis/3.4
- Property svn:mergeinfo changed
-
branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourModel.cs
r15786 r16386 130 130 // automatic determination of weights (all features should have variance = 1) 131 131 this.weights = this.allowedInputVariables 132 .Select(name => 1.0 / dataset.GetDoubleValues(name, rows).StandardDeviationPop()) 132 .Select(name => { 133 var pop = dataset.GetDoubleValues(name, rows).StandardDeviationPop(); 134 return pop.IsAlmost(0) ? 1.0 : 1.0/pop; 135 }) 133 136 .Concat(new double[] { 1.0 }) // no scaling for target variable 134 137 .ToArray(); … … 259 262 260 263 264 public bool IsProblemDataCompatible(IRegressionProblemData problemData, out string errorMessage) { 265 return RegressionModel.IsProblemDataCompatible(this, problemData, out errorMessage); 266 } 267 268 public override bool IsProblemDataCompatible(IDataAnalysisProblemData problemData, out string errorMessage) { 269 if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null."); 270 271 var regressionProblemData = problemData as IRegressionProblemData; 272 if (regressionProblemData != null) 273 return IsProblemDataCompatible(regressionProblemData, out errorMessage); 274 275 var classificationProblemData = problemData as IClassificationProblemData; 276 if (classificationProblemData != null) 277 return IsProblemDataCompatible(classificationProblemData, out errorMessage); 278 279 throw new ArgumentException("The problem data is not a regression nor a classification problem data. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData"); 280 } 281 261 282 IRegressionSolution IRegressionModel.CreateRegressionSolution(IRegressionProblemData problemData) { 262 283 return new NearestNeighbourRegressionSolution(this, new RegressionProblemData(problemData));
Note: See TracChangeset
for help on using the changeset viewer.