Changeset 6812


Ignore:
Timestamp:
09/20/11 21:04:30 (10 years ago)
Author:
gkronber
Message:

#1650 fixed SVM_TYPE and added code to set the weights of the different classes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorClassification.cs

    r6240 r6812  
    8888      Problem = new ClassificationProblem();
    8989
    90       List<StringValue> svrTypes = (from type in new List<string> { "NU_SVC", "EPSILON_SVC" }
     90      List<StringValue> svrTypes = (from type in new List<string> { "NU_SVC", "C_SVC" }
    9191                                    select new StringValue(type).AsReadOnly())
    9292                                   .ToList();
     
    134134      parameter.Probability = false;
    135135
     136      foreach (double c in problemData.ClassValues) {
     137        double wSum = 0.0;
     138        foreach (double otherClass in problemData.ClassValues) {
     139          if (!c.IsAlmost(otherClass)) {
     140            wSum += problemData.GetClassificationPenalty(c, otherClass);
     141          }
     142        }
     143        parameter.Weights.Add((int)c, wSum);
     144      }
     145
    136146
    137147      SVM.Problem problem = SupportVectorMachineUtil.CreateSvmProblem(dataset, targetVariable, allowedInputVariables, rows);
Note: See TracChangeset for help on using the changeset viewer.