Changeset 13184 for stable/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/LossFunctions
- Timestamp:
- 11/16/15 19:49:40 (9 years ago)
- Location:
- stable
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 12868,12873,12875,13065-13066,13157-13158
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Algorithms.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Algorithms.DataAnalysis merged: 12868,12873,12875,13065-13066,13157-13158
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/LossFunctions/AbsoluteErrorLoss.cs
r12700 r13184 23 23 using System; 24 24 using System.Collections.Generic; 25 using System.Diagnostics;26 using System.Linq;27 25 using HeuristicLab.Common; 26 using HeuristicLab.Core; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 28 29 29 namespace HeuristicLab.Algorithms.DataAnalysis { 30 30 // loss function for the weighted absolute error 31 public class AbsoluteErrorLoss : ILossFunction { 31 [StorableClass] 32 [Item("Absolute error loss", "")] 33 public sealed class AbsoluteErrorLoss : Item, ILossFunction { 34 public AbsoluteErrorLoss() { } 35 32 36 public double GetLoss(IEnumerable<double> target, IEnumerable<double> pred) { 33 37 var targetEnum = target.GetEnumerator(); … … 77 81 } 78 82 79 public override string ToString() { 80 return "Absolute error loss"; 83 #region item implementation 84 [StorableConstructor] 85 private AbsoluteErrorLoss(bool deserializing) : base(deserializing) { } 86 87 private AbsoluteErrorLoss(AbsoluteErrorLoss original, Cloner cloner) : base(original, cloner) { } 88 89 public override IDeepCloneable Clone(Cloner cloner) { 90 return new AbsoluteErrorLoss(this, cloner); 81 91 } 92 #endregion 82 93 } 83 94 } -
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/LossFunctions/ILossFunction.cs
r12700 r13184 22 22 23 23 using System.Collections.Generic; 24 using HeuristicLab.Core; 24 25 25 26 namespace HeuristicLab.Algorithms.DataAnalysis { … … 27 28 // target represents the target vector (original targets from the problem data, never changed) 28 29 // pred represents the current vector of predictions (a weighted combination of models learned so far, this vector is updated after each step) 29 public interface ILossFunction {30 public interface ILossFunction : IItem { 30 31 // returns the loss of the current prediction vector 31 32 double GetLoss(IEnumerable<double> target, IEnumerable<double> pred); -
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/LossFunctions/LogisticRegressionLoss.cs
r12700 r13184 26 26 using System.Linq; 27 27 using HeuristicLab.Common; 28 using HeuristicLab.Core; 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 30 29 31 namespace HeuristicLab.Algorithms.DataAnalysis { 30 32 // Greedy Function Approximation: A Gradient Boosting Machine (page 9) 31 public class LogisticRegressionLoss : ILossFunction { 33 [StorableClass] 34 [Item("Logistic regression loss", "")] 35 public sealed class LogisticRegressionLoss : Item, ILossFunction { 36 public LogisticRegressionLoss() { } 37 32 38 public double GetLoss(IEnumerable<double> target, IEnumerable<double> pred) { 33 39 var targetEnum = target.GetEnumerator(); … … 83 89 } 84 90 85 public override string ToString() { 86 return "Logistic regression loss"; 91 #region item implementation 92 [StorableConstructor] 93 private LogisticRegressionLoss(bool deserializing) : base(deserializing) { } 94 95 private LogisticRegressionLoss(LogisticRegressionLoss original, Cloner cloner) : base(original, cloner) { } 96 97 public override IDeepCloneable Clone(Cloner cloner) { 98 return new LogisticRegressionLoss(this, cloner); 87 99 } 100 #endregion 101 88 102 } 89 103 } -
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/LossFunctions/RelativeErrorLoss.cs
r12700 r13184 26 26 using System.Linq; 27 27 using HeuristicLab.Common; 28 using HeuristicLab.Core; 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 30 29 31 namespace HeuristicLab.Algorithms.DataAnalysis { 30 32 // relative error loss is a special case of weighted absolute error loss with weights = (1/target) 31 public class RelativeErrorLoss : ILossFunction { 33 [StorableClass] 34 [Item("Relative error loss", "")] 35 public sealed class RelativeErrorLoss : Item, ILossFunction { 36 public RelativeErrorLoss() { } 37 32 38 public double GetLoss(IEnumerable<double> target, IEnumerable<double> pred) { 33 39 var targetEnum = target.GetEnumerator(); … … 105 111 } 106 112 107 public override string ToString() { 108 return "Relative error loss"; 113 #region item implementation 114 [StorableConstructor] 115 private RelativeErrorLoss(bool deserializing) : base(deserializing) { } 116 117 private RelativeErrorLoss(RelativeErrorLoss original, Cloner cloner) : base(original, cloner) { } 118 119 public override IDeepCloneable Clone(Cloner cloner) { 120 return new RelativeErrorLoss(this, cloner); 109 121 } 122 #endregion 110 123 } 111 124 } -
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/LossFunctions/SquaredErrorLoss.cs
r12700 r13184 24 24 using System.Collections.Generic; 25 25 using System.Linq; 26 using HeuristicLab.Common; 27 using HeuristicLab.Core; 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 26 29 27 30 namespace HeuristicLab.Algorithms.DataAnalysis { 28 public class SquaredErrorLoss : ILossFunction { 31 [StorableClass] 32 [Item("Squared error loss", "")] 33 public sealed class SquaredErrorLoss : Item, ILossFunction { 34 public SquaredErrorLoss() { } 35 29 36 public double GetLoss(IEnumerable<double> target, IEnumerable<double> pred) { 30 37 var targetEnum = target.GetEnumerator(); … … 70 77 } 71 78 72 public override string ToString() { 73 return "Squared error loss"; 79 #region item implementation 80 [StorableConstructor] 81 private SquaredErrorLoss(bool deserializing) : base(deserializing) { } 82 83 private SquaredErrorLoss(SquaredErrorLoss original, Cloner cloner) : base(original, cloner) { } 84 85 public override IDeepCloneable Clone(Cloner cloner) { 86 return new SquaredErrorLoss(this, cloner); 74 87 } 88 #endregion 75 89 } 76 90 }
Note: See TracChangeset
for help on using the changeset viewer.