Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorClassification.cs @ 2375

Last change on this file since 2375 was 2356, checked in by gkronber, 15 years ago

Moved common (not algorithm specific) model analyzer code (same operator tree in all regression/classification/time-series-prognosis engines) to HL.Modeling. #625, #705, #739.

File size: 2.2 KB
Line 
1
2#region License Information
3/* HeuristicLab
4 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
5 *
6 * This file is part of HeuristicLab.
7 *
8 * HeuristicLab is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * HeuristicLab is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
20 */
21#endregion
22
23using System;
24using System.Collections.Generic;
25using System.Linq;
26using System.Text;
27using HeuristicLab.Core;
28using System.Xml;
29using System.Diagnostics;
30using HeuristicLab.DataAnalysis;
31using HeuristicLab.Data;
32using HeuristicLab.Operators;
33using HeuristicLab.Logging;
34using HeuristicLab.Operators.Programmable;
35using HeuristicLab.Modeling;
36using HeuristicLab.Random;
37using HeuristicLab.Selection;
38
39namespace HeuristicLab.SupportVectorMachines {
40  public class SupportVectorClassification : SupportVectorRegression, IClassificationAlgorithm {
41
42    public override string Name { get { return "SupportVectorClassification"; } }
43
44    public SupportVectorClassification()
45      : base() {
46      SvmType = "NU_SVC";
47      CostList = new DoubleArrayData(new double[] { 1.0 });
48      MaxCostIndex = 1;
49    }
50
51    protected override IOperator CreateModelAnalyzerOperator() {
52      return DefaultClassificationOperators.CreatePostProcessingOperator();
53    }
54
55
56    protected override IAnalyzerModel CreateSVMModel(IScope bestModelScope) {
57      IAnalyzerModel model = new AnalyzerModel();
58      model.SetMetaData("Cost", bestModelScope.GetVariableValue<DoubleData>("Cost", false).Data);
59      model.SetMetaData("Nu", bestModelScope.GetVariableValue<DoubleData>("Nu", false).Data);
60      DefaultClassificationOperators.PopulateAnalyzerModel(bestModelScope, model);
61      return model;
62    }
63  }
64}
Note: See TracBrowser for help on using the repository browser.