- Timestamp:
- 10/29/15 19:48:17 (8 years ago)
- Location:
- branches/ClassificationModelComparison/HeuristicLab.Algorithms.DataAnalysis/3.4
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ClassificationModelComparison/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj
r13085 r13089 318 318 <Compile Include="Linear\AlglibUtil.cs" /> 319 319 <Compile Include="Linear\OneRTest.cs" /> 320 <Compile Include="Linear\OneR.cs" />321 320 <Compile Include="Linear\OneR\OneRClassificationModel.cs" /> 322 321 <Compile Include="Linear\OneR\OneRClassificationSolution.cs" /> -
branches/ClassificationModelComparison/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/OneRTest.cs
r10570 r13089 34 34 /// 1R classification algorithm. 35 35 /// </summary> 36 [Item("OneR Classification", " 1R classification algorithm.")]36 [Item("OneR Classification", "A simple classification algorithm the searches the best single-variable split (does not support categorical features correctly).")] 37 37 [StorableClass] 38 38 public sealed class OneRTest : FixedDataAnalysisAlgorithm<IClassificationProblem> { … … 63 63 } 64 64 65 public static IClassificationSolution CreateOneRSolution(IClassificationProblemData problemData, int minBucketSize ) {65 public static IClassificationSolution CreateOneRSolution(IClassificationProblemData problemData, int minBucketSize = 6) { 66 66 var bestClassified = 0; 67 67 List<Split> bestSplits = null; -
branches/ClassificationModelComparison/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/ZeroR.cs
r13086 r13089 31 31 /// 0R classification algorithm. 32 32 /// </summary> 33 [Item("ZeroR", " 0R classification algorithm.")]34 [Creatable("Data Analysis")] 33 [Item("ZeroR", "The simplest possible classifier, ZeroR always predicts the majority class.")] 34 [Creatable("Data Analysis")] // TODO 35 35 [StorableClass] 36 36 public sealed class ZeroR : FixedDataAnalysisAlgorithm<IClassificationProblem> { … … 52 52 protected override void Run() { 53 53 var solution = CreateZeroRSolution(Problem.ProblemData); 54 Results.Add(new Result("ZeroR solution", "The 0R classifier.", solution));54 Results.Add(new Result("ZeroR solution", "The simplest possible classifier, ZeroR always predicts the majority class.", solution)); 55 55 } 56 56 … … 60 60 var targetValues = dataset.GetDoubleValues(target, problemData.TrainingIndices); 61 61 62 63 // if multiple classes have the same number of observations then simply take the first one 62 64 var dominantClass = targetValues.GroupBy(x => x).ToDictionary(g => g.Key, g => g.Count()) 63 65 .MaxItems(kvp => kvp.Value).Select(x => x.Key).First(); 64 66 65 var model = new Constant ClassificationModel(dominantClass);67 var model = new ConstantRegressionModel(dominantClass); 66 68 var solution = new ConstantClassificationSolution(model, (IClassificationProblemData)problemData.Clone()); 67 69 return solution;
Note: See TracChangeset
for help on using the changeset viewer.