- Timestamp:
- 11/13/15 20:54:47 (9 years ago)
- Location:
- stable
- Files:
-
- 6 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 13025-13026,13064
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Algorithms.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Algorithms.DataAnalysis merged: 13026
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj
r13146 r13148 200 200 <Compile Include="GradientBoostedTrees\GradientBoostedTreesModel.cs" /> 201 201 <Compile Include="GradientBoostedTrees\LossFunctions\AbsoluteErrorLoss.cs" /> 202 <Compile Include="GradientBoostedTrees\LossFunctions\QuantileRegressionLoss.cs" /> 202 203 <Compile Include="GradientBoostedTrees\LossFunctions\ILossFunction.cs" /> 203 204 <Compile Include="GradientBoostedTrees\LossFunctions\LogisticRegressionLoss.cs" /> -
stable/HeuristicLab.Common/3.3/EnumerableStatisticExtensions.cs
r12009 r13148 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Diagnostics.Contracts; 24 25 using System.Linq; 25 26 … … 44 45 } else { 45 46 return (valuesArr[(n / 2) - 1] + valuesArr[n / 2]) / 2.0; 47 } 48 } 49 50 /// <summary> 51 /// Calculates the alpha-quantile element of the enumeration. 52 /// </summary> 53 /// <param name="values"></param> 54 /// <returns></returns> 55 public static double Quantile(this IEnumerable<double> values, double alpha) { 56 Contract.Assert(alpha > 0 && alpha < 1); 57 // iterate only once 58 double[] valuesArr = values.ToArray(); 59 int n = valuesArr.Length; 60 if (n == 0) throw new InvalidOperationException("Enumeration contains no elements."); 61 62 Array.Sort(valuesArr); 63 // starts at 0 64 65 // return the element at Math.Ceiling (if n*alpha is fractional) or the average of two elements if n*alpha is integer. 66 var pos = n * alpha; 67 Contract.Assert(pos >= 0); 68 Contract.Assert(pos < n); 69 bool isInteger = Math.Round(pos).IsAlmost(pos); 70 if (isInteger) { 71 return 0.5 * (valuesArr[(int)pos - 1] + valuesArr[(int)pos]); 72 } else { 73 return valuesArr[(int)Math.Ceiling(pos) - 1]; 46 74 } 47 75 } -
stable/HeuristicLab.Tests
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Tests merged: 13025,13064
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Tests/HeuristicLab.Tests.csproj
r12747 r13148 468 468 <Compile Include="HeuristicLab.Collections-3.3\BidirectionalLookupTest.cs" /> 469 469 <Compile Include="HeuristicLab.Collections-3.3\ObservableKeyedListTest.cs" /> 470 <Compile Include="HeuristicLab.Common-3.3\EnumerableStatisticExtensions.cs" /> 470 471 <Compile Include="HeuristicLab.Encodings.BinaryVectorEncoding-3.3\Auxiliary.cs" /> 471 472 <Compile Include="HeuristicLab.Encodings.BinaryVectorEncoding-3.3\NPointCrossoverTest.cs" /> … … 616 617 </None> 617 618 <None Include="HeuristicLab.snk" /> 619 <None Include="Test References\HeuristicLab.PluginInfrastructure-3.3.accessor" /> 618 620 <None Include="Test Resources\GA_SymbReg.hl"> 619 621 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> … … 629 631 </None> 630 632 <Shadow Include="Test References\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.accessor" /> 631 <Shadow Include="Test References\HeuristicLab.PluginInfrastructure-3.3.accessor" />632 633 <Shadow Include="Test References\HeuristicLab.MainForm.WindowsForms-3.3.accessor" /> 633 634 <Shadow Include="Test References\HeuristicLab.Encodings.IntegerVectorEncoding-3.3.accessor" />
Note: See TracChangeset
for help on using the changeset viewer.