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 |
|
---|
23 | using System;
|
---|
24 | using System.Collections.Generic;
|
---|
25 | using System.Linq;
|
---|
26 | using System.Text;
|
---|
27 | using HeuristicLab.Core;
|
---|
28 | using System.Xml;
|
---|
29 | using System.Diagnostics;
|
---|
30 | using HeuristicLab.DataAnalysis;
|
---|
31 | using HeuristicLab.Data;
|
---|
32 | using HeuristicLab.Operators;
|
---|
33 | using HeuristicLab.Logging;
|
---|
34 | using HeuristicLab.Operators.Programmable;
|
---|
35 | using HeuristicLab.Modeling;
|
---|
36 | using HeuristicLab.Random;
|
---|
37 | using HeuristicLab.Selection;
|
---|
38 |
|
---|
39 | namespace 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 | }
|
---|