- Timestamp:
- 07/08/16 14:37:15 (8 years ago)
- Location:
- stable
- Files:
-
- 5 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/BaselineClassifiers/OneR.cs
r13092 r14027 139 139 } 140 140 141 var model = new OneRClassificationModel( bestVariable, bestSplits.Select(s => s.thresholdValue).ToArray(), bestSplits.Select(s => s.classValue).ToArray(), bestMissingValuesClass);141 var model = new OneRClassificationModel(problemData.TargetVariable, bestVariable, bestSplits.Select(s => s.thresholdValue).ToArray(), bestSplits.Select(s => s.classValue).ToArray(), bestMissingValuesClass); 142 142 var solution = new OneRClassificationSolution(model, (IClassificationProblemData)problemData.Clone()); 143 143 -
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/BaselineClassifiers/OneRClassificationModel.cs
r13098 r14027 31 31 [StorableClass] 32 32 [Item("OneR Classification Model", "A model that uses intervals for one variable to determine the class.")] 33 public class OneRClassificationModel : NamedItem, IClassificationModel { 33 public class OneRClassificationModel : ClassificationModel { 34 public override IEnumerable<string> VariablesUsedForPrediction { 35 get { return new[] { Variable }; } 36 } 37 34 38 [Storable] 35 39 protected string variable; … … 66 70 public override IDeepCloneable Clone(Cloner cloner) { return new OneRClassificationModel(this, cloner); } 67 71 68 public OneRClassificationModel(string variable, double[] splits, double[] classes, double missingValuesClass = double.NaN)69 : base( ) {72 public OneRClassificationModel(string targetVariable, string variable, double[] splits, double[] classes, double missingValuesClass = double.NaN) 73 : base(targetVariable) { 70 74 if (splits.Length != classes.Length) { 71 75 throw new ArgumentException("Number of splits and classes has to be equal."); … … 84 88 // uses sorting to return the values in the order of rows, instead of using nested for loops 85 89 // to avoid O(n²) runtime 86 public IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows) {90 public override IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows) { 87 91 var values = dataset.GetDoubleValues(Variable, rows).ToArray(); 88 92 var rowsArray = rows.ToArray(); … … 108 112 } 109 113 110 public IClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData) {114 public override IClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData) { 111 115 return new OneRClassificationSolution(this, new ClassificationProblemData(problemData)); 112 116 } -
stable/HeuristicLab.Algorithms.DataAnalysis/3.4/BaselineClassifiers/ZeroR.cs
r13098 r14027 64 64 .MaxItems(kvp => kvp.Value).Select(x => x.Key).First(); 65 65 66 var model = new ConstantModel(dominantClass );66 var model = new ConstantModel(dominantClass, target); 67 67 var solution = model.CreateClassificationSolution(problemData); 68 68 return solution;
Note: See TracChangeset
for help on using the changeset viewer.