Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/10/11 10:00:09 (13 years ago)
Author:
gkronber
Message:

#1418 Implemented classes for classification based on a discriminant function and thresholds and implemented interfaces and base classes for clustering.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis Refactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorClassification.cs

    r5626 r5649  
    8888    public SupportVectorClassification()
    8989      : base() {
     90      Problem = new ClassificationProblem();
     91
    9092      List<StringValue> svrTypes = (from type in new List<string> { "NU_SVC", "EPSILON_SVC" }
    9193                                    select new StringValue(type).AsReadOnly())
     
    9597                                       select new StringValue(type).AsReadOnly())
    9698                                   .ToList();
    97       ItemSet<StringValue> kernelTypeSet = new ItemSet<StringValue>(svrTypes);
     99      ItemSet<StringValue> kernelTypeSet = new ItemSet<StringValue>(kernelTypes);
    98100      Parameters.Add(new ConstrainedValueParameter<StringValue>(SvmTypeParameterName, "The type of SVM to use.", svrTypeSet, svrTypes[0]));
    99101      Parameters.Add(new ConstrainedValueParameter<StringValue>(KernelTypeParameterName, "The kernel type to use for the SVM.", kernelTypeSet, kernelTypes[3]));
     
    112114    protected override void Run() {
    113115      IClassificationProblemData problemData = Problem.ProblemData;
    114       IEnumerable<string> selectedInputVariables = problemData.InputVariables.CheckedItems.Select(x => x.Value);
     116      IEnumerable<string> selectedInputVariables = problemData.AllowedInputVariables;
    115117      var solution = CreateSupportVectorClassificationSolution(problemData, selectedInputVariables, SvmType.Value, KernelType.Value, Cost.Value, Nu.Value, Gamma.Value);
    116118
     
    140142      SVM.RangeTransform rangeTransform = SVM.RangeTransform.Compute(problem);
    141143      SVM.Problem scaledProblem = SVM.Scaling.Scale(rangeTransform, problem);
    142       var model = new SupportVectorMachineModel();
    143       model.Model = SVM.Training.Train(scaledProblem, parameter);
    144       model.RangeTransform = rangeTransform;
     144      var model = new SupportVectorMachineModel(SVM.Training.Train(scaledProblem, parameter), rangeTransform, targetVariable, allowedInputVariables);
    145145
    146       return new SupportVectorClassificationSolution(model, problemData, allowedInputVariables, double.NegativeInfinity, double.PositiveInfinity);
     146      return new SupportVectorClassificationSolution(model, problemData);
    147147    }
    148148    #endregion
Note: See TracChangeset for help on using the changeset viewer.