Changeset 16388 for branches/2892_LR-prediction-intervals/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourModel.cs
- Timestamp:
- 12/15/18 12:36:08 (5 years ago)
- Location:
- branches/2892_LR-prediction-intervals
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2892_LR-prediction-intervals
- Property svn:ignore
-
old new 1 *.docstates 2 *.psess 3 *.resharper 4 *.suo 5 *.user 6 *.vsp 7 Doxygen 8 FxCopResults.txt 9 Google.ProtocolBuffers-0.9.1.dll 10 Google.ProtocolBuffers-2.4.1.473.dll 11 HeuristicLab 3.3.5.1.ReSharper.user 12 HeuristicLab 3.3.6.0.ReSharper.user 13 HeuristicLab.4.5.resharper.user 14 HeuristicLab.ExtLibs.6.0.ReSharper.user 15 HeuristicLab.Scripting.Development 16 HeuristicLab.resharper.user 17 ProtoGen.exe 1 18 TestResults 19 _ReSharper.HeuristicLab 20 _ReSharper.HeuristicLab 3.3 21 _ReSharper.HeuristicLab 3.3 Tests 22 _ReSharper.HeuristicLab.ExtLibs 23 bin 24 protoc.exe 25 obj 26 .vs
-
- Property svn:mergeinfo changed
-
Property
svn:global-ignores
set to
*.nuget
packages
- Property svn:ignore
-
branches/2892_LR-prediction-intervals/HeuristicLab.Algorithms.DataAnalysis
- Property svn:mergeinfo changed
-
branches/2892_LR-prediction-intervals/HeuristicLab.Algorithms.DataAnalysis/3.4
- Property svn:mergeinfo changed
-
branches/2892_LR-prediction-intervals/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourModel.cs
r15583 r16388 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(); … … 142 145 } 143 146 144 if (inputMatrix.C ast<double>().Any(x => double.IsNaN(x) || double.IsInfinity(x)))147 if (inputMatrix.ContainsNanOrInfinity()) 145 148 throw new NotSupportedException( 146 149 "Nearest neighbour model does not support NaN or infinity values in the input dataset."); … … 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.