Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5649


Ignore:
Timestamp:
03/10/11 10:00:09 (14 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.

Location:
branches/DataAnalysis Refactoring
Files:
20 added
28 edited

Legend:

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

    r5617 r5649  
    7676      base.Start();
    7777      OnStarted();
    78       Run();
    79       OnStopped();
     78      try {
     79        Run();
     80      }
     81      catch (Exception e) {
     82        OnExceptionOccurred(e);
     83      }
     84      finally {
     85        OnStopped();
     86      }
    8087    }
    8188
  • branches/DataAnalysis Refactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/Linear/LinearRegression.cs

    r5624 r5649  
    4242  [StorableClass]
    4343  public sealed class LinearRegression : FixedDataAnalysisAlgorithm<IRegressionProblem> {
    44     private const string LinearRegressionModelResultName = "LinearRegressionModel";
     44    private const string LinearRegressionModelResultName = "Linear regression solution";
    4545
    4646    [StorableConstructor]
     
    5151    public LinearRegression()
    5252      : base() {
     53      Problem = new RegressionProblem();
    5354    }
    5455    [StorableHook(HookType.AfterDeserialization)]
     
    6364      double rmsError, cvRmsError;
    6465      var solution = CreateLinearRegressionSolution(Problem.ProblemData, out rmsError, out cvRmsError);
    65       Results.Add(new Result(LinearRegressionModelResultName, "The linear regression model.", solution));
    66       Results.Add(new Result("Root mean square error", "The root of the mean of squared errors of the linear regression model on the training set.", new DoubleValue(rmsError)));
    67       Results.Add(new Result("Estimated root mean square error (cross-validation)", "The estimated root of the mean of squared errors of the linear regression model via cross validation.", new DoubleValue(cvRmsError)));
     66      Results.Add(new Result(LinearRegressionModelResultName, "The linear regression solution.", solution));
     67      Results.Add(new Result("Root mean square error", "The root of the mean of squared errors of the linear regression solution on the training set.", new DoubleValue(rmsError)));
     68      Results.Add(new Result("Estimated root mean square error (cross-validation)", "The estimated root of the mean of squared errors of the linear regression solution via cross validation.", new DoubleValue(cvRmsError)));
    6869    }
    6970
     
    7172      Dataset dataset = problemData.Dataset;
    7273      string targetVariable = problemData.TargetVariable;
    73       IEnumerable<string> allowedInputVariables = problemData.InputVariables.CheckedItems.Select(x => x.Value);
     74      IEnumerable<string> allowedInputVariables = problemData.AllowedInputVariables;
    7475      int samplesStart = problemData.TrainingPartitionStart.Value;
    7576      int samplesEnd = problemData.TrainingPartitionEnd.Value;
    76 
    77       IEnumerable<string> selectedInputVariables = problemData.InputVariables.CheckedItems.Select(x => x.Value);
    7877
    7978      double[,] inputMatrix = LinearRegressionUtil.PrepareInputMatrix(dataset, targetVariable, allowedInputVariables, samplesStart, samplesEnd);
     
    8786      int retVal = 1;
    8887      alglib.lrbuild(inputMatrix, nRows, nFeatures, out retVal, out lm, out ar);
    89       if (retVal != 1) throw new ArgumentException("Error in calculation of linear regression model");
     88      if (retVal != 1) throw new ArgumentException("Error in calculation of linear regression solution");
    9089      rmsError = ar.rmserror;
    9190      cvRmsError = ar.cvrmserror;
  • 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
  • branches/DataAnalysis Refactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorClassificationSolution.cs

    r5626 r5649  
    4141    }
    4242
    43     [Storable]
    44     private double lowerEstimationLimit;
    45     public double LowerEstimationLimit {
    46       get { return lowerEstimationLimit; }
    47     }
    48 
    49     [Storable]
    50     private double upperEstimationLimit;
    51     public double UpperEstimationLimit {
    52       get { return upperEstimationLimit; }
    53     }
    54 
    55     private List<string> inputVariables;
    56     [Storable]
    57     private IEnumerable<string> InputVariablesStorable {
    58       get { return inputVariables; }
    59       set { inputVariables = new List<string>(value); }
    60     }
    61 
    6243    public Dataset SupportVectors {
    6344      get { return CalculateSupportVectors(); }
     
    6849    private SupportVectorClassificationSolution(SupportVectorClassificationSolution original, Cloner cloner)
    6950      : base(original, cloner) {
    70       inputVariables = new List<string>(original.inputVariables);
    71       lowerEstimationLimit = original.lowerEstimationLimit;
    72       upperEstimationLimit = original.upperEstimationLimit;
    7351    }
    74     public SupportVectorClassificationSolution(SupportVectorMachineModel model, IClassificationProblemData problemData, IEnumerable<string> inputVariables, double lowerEstimationLimit, double upperEstimationLimit)
     52    public SupportVectorClassificationSolution(SupportVectorMachineModel model, IClassificationProblemData problemData)
    7553      : base(model, problemData) {
    76       this.inputVariables = new List<string>(inputVariables);
    77       this.lowerEstimationLimit = lowerEstimationLimit;
    78       this.upperEstimationLimit = upperEstimationLimit;
    7954    }
    8055
     
    8762      base.OnProblemDataChanged(e);
    8863    }
    89    
     64
    9065    private Dataset CalculateSupportVectors() {
    9166      if (Model.Model.SupportVectorIndizes.Length == 0)
  • branches/DataAnalysis Refactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorMachineModel.cs

    r5626 r5649  
    3030using SVM;
    3131using HeuristicLab.Problems.DataAnalysis;
     32using System.Drawing;
    3233
    3334namespace HeuristicLab.Algorithms.DataAnalysis {
     
    3839  [Item("SupportVectorMachineModel", "Represents a support vector machine model.")]
    3940  public sealed class SupportVectorMachineModel : NamedItem, IRegressionModel, IClassificationModel {
    40     [StorableConstructor]
    41     private SupportVectorMachineModel(bool deserializing) : base(deserializing) { }
    42     private SupportVectorMachineModel(SupportVectorMachineModel original, Cloner cloner)
    43       : base(original, cloner) {
    44       // only using a shallow copy here! (gkronber)
    45       this.model = original.model;
    46       this.rangeTransform = original.rangeTransform;
    47     }
    48     public SupportVectorMachineModel() : base() { }
    4941
    5042    private SVM.Model model;
     
    7769      }
    7870    }
     71
     72    [Storable]
     73    private string targetVariable;
     74    [Storable]
     75    private string[] allowedInputVariables;
     76
     77    [StorableConstructor]
     78    private SupportVectorMachineModel(bool deserializing) : base(deserializing) { }
     79    private SupportVectorMachineModel(SupportVectorMachineModel original, Cloner cloner)
     80      : base(original, cloner) {
     81      // only using a shallow copy here! (gkronber)
     82      this.model = original.model;
     83      this.rangeTransform = original.rangeTransform;
     84
     85    }
     86    public SupportVectorMachineModel(SVM.Model model, SVM.RangeTransform rangeTransform, string targetVariable, IEnumerable<string> allowedInputVariables)
     87      : base() {
     88      this.name = ItemName;
     89      this.description = ItemDescription;
     90      this.model = model;
     91      this.rangeTransform = rangeTransform;
     92      this.targetVariable = targetVariable;
     93      this.allowedInputVariables = allowedInputVariables.ToArray();
     94    }
     95
     96    public override IDeepCloneable Clone(Cloner cloner) {
     97      return new SupportVectorMachineModel(this, cloner);
     98    }
     99
     100
    79101    #region IRegressionModel Members
    80     public IEnumerable<double> GetEstimatedValues(IRegressionProblemData problemData, IEnumerable<int> rows) {
    81       return GetEstimatedValues(problemData, problemData.TargetVariable, rows);
     102    public IEnumerable<double> GetEstimatedValues(Dataset dataset, IEnumerable<int> rows) {
     103      return GetEstimatedValuesHelper(dataset, rows);
    82104    }
    83105    #endregion
    84106    #region IClassificationModel Members
    85     public IEnumerable<double> GetEstimatedValues(IClassificationProblemData problemData, IEnumerable<int> rows) {
    86       return GetEstimatedValues(problemData, problemData.TargetVariable, rows);
    87     }
    88 
    89     public IEnumerable<double> GetEstimatedClassValues(IClassificationProblemData problemData, IEnumerable<int> rows) {
    90       return GetEstimatedValues(problemData, problemData.TargetVariable, rows);
     107    public IEnumerable<double> GetEstimatedClassValues(Dataset dataset, IEnumerable<int> rows) {
     108      return GetEstimatedValuesHelper(dataset, rows);
    91109    }
    92110    #endregion
    93     private IEnumerable<double> GetEstimatedValues(IDataAnalysisProblemData problemData, string targetVariable, IEnumerable<int> rows) {
    94       var allowedInputVariables = problemData.InputVariables.CheckedItems.Select(x => x.Value);
    95       SVM.Problem problem = SupportVectorMachineUtil.CreateSvmProblem(problemData.Dataset, targetVariable, allowedInputVariables, rows);
     111    private IEnumerable<double> GetEstimatedValuesHelper(Dataset dataset, IEnumerable<int> rows) {
     112      SVM.Problem problem = SupportVectorMachineUtil.CreateSvmProblem(dataset, targetVariable, allowedInputVariables, rows);
    96113      SVM.Problem scaledProblem = Scaling.Scale(RangeTransform, problem);
    97114
     
    149166    }
    150167    #endregion
    151 
    152     public override IDeepCloneable Clone(Cloner cloner) {
    153       return new SupportVectorMachineModel(this, cloner);
    154     }
    155 
    156     /// <summary>
    157     ///  Exports the <paramref name="model"/> in string representation to stream <paramref name="s"/>
    158     /// </summary>
    159     /// <param name="model">The support vector machine model to export</param>
    160     /// <param name="s">The stream to export the model to</param>
    161     public static void Export(SupportVectorMachineModel model, Stream s) {
    162       StreamWriter writer = new StreamWriter(s);
    163       writer.WriteLine("RangeTransform:");
    164       writer.Flush();
    165       using (MemoryStream memStream = new MemoryStream()) {
    166         SVM.RangeTransform.Write(memStream, model.RangeTransform);
    167         memStream.Seek(0, SeekOrigin.Begin);
    168         memStream.WriteTo(s);
    169       }
    170       writer.WriteLine("Model:");
    171       writer.Flush();
    172       using (MemoryStream memStream = new MemoryStream()) {
    173         SVM.Model.Write(memStream, model.Model);
    174         memStream.Seek(0, SeekOrigin.Begin);
    175         memStream.WriteTo(s);
    176       }
    177       s.Flush();
    178     }
    179 
    180     /// <summary>
    181     /// Imports a support vector machine model given as string representation.
    182     /// </summary>
    183     /// <param name="reader">The reader to retrieve the string representation from</param>
    184     /// <returns>The imported support vector machine model.</returns>
    185     public static SupportVectorMachineModel Import(TextReader reader) {
    186       SupportVectorMachineModel model = new SupportVectorMachineModel();
    187       while (reader.ReadLine().Trim() != "RangeTransform:") ; // read until line "RangeTransform";
    188       model.RangeTransform = SVM.RangeTransform.Read(reader);
    189       // read until "Model:"
    190       while (reader.ReadLine().Trim() != "Model:") ;
    191       model.Model = SVM.Model.Read(reader);
    192       return model;
    193     }
    194168  }
    195169}
  • branches/DataAnalysis Refactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorRegression.cs

    r5626 r5649  
    9595    public SupportVectorRegression()
    9696      : base() {
     97      Problem = new RegressionProblem();
     98
    9799      List<StringValue> svrTypes = (from type in new List<string> { "NU_SVR", "EPSILON_SVR" }
    98100                                    select new StringValue(type).AsReadOnly())
     
    102104                                       select new StringValue(type).AsReadOnly())
    103105                                   .ToList();
    104       ItemSet<StringValue> kernelTypeSet = new ItemSet<StringValue>(svrTypes);
     106      ItemSet<StringValue> kernelTypeSet = new ItemSet<StringValue>(kernelTypes);
    105107      Parameters.Add(new ConstrainedValueParameter<StringValue>(SvmTypeParameterName, "The type of SVM to use.", svrTypeSet, svrTypes[0]));
    106108      Parameters.Add(new ConstrainedValueParameter<StringValue>(KernelTypeParameterName, "The kernel type to use for the SVM.", kernelTypeSet, kernelTypes[3]));
     
    120122    protected override void Run() {
    121123      IRegressionProblemData problemData = Problem.ProblemData;
    122       IEnumerable<string> selectedInputVariables = problemData.InputVariables.CheckedItems.Select(x => x.Value);
     124      IEnumerable<string> selectedInputVariables = problemData.AllowedInputVariables;
    123125      var solution = CreateSupportVectorRegressionSolution(problemData, selectedInputVariables, SvmType.Value, KernelType.Value, Cost.Value, Nu.Value, Gamma.Value, Epsilon.Value);
    124126
     
    149151      SVM.RangeTransform rangeTransform = SVM.RangeTransform.Compute(problem);
    150152      SVM.Problem scaledProblem = SVM.Scaling.Scale(rangeTransform, problem);
    151       var model = new SupportVectorMachineModel();
    152       model.Model = SVM.Training.Train(scaledProblem, parameter);
    153       model.RangeTransform = rangeTransform;
    154 
    155       return new SupportVectorRegressionSolution(model, problemData, allowedInputVariables, double.NegativeInfinity, double.PositiveInfinity);
     153      var model = new SupportVectorMachineModel(SVM.Training.Train(scaledProblem, parameter), rangeTransform, targetVariable, allowedInputVariables);
     154      return new SupportVectorRegressionSolution(model, problemData);
    156155    }
    157156    #endregion
  • branches/DataAnalysis Refactoring/HeuristicLab.Algorithms.DataAnalysis/3.4/SupportVectorMachine/SupportVectorRegressionSolution.cs

    r5626 r5649  
    4141    }
    4242
    43     [Storable]
    44     private double lowerEstimationLimit;
    45     public double LowerEstimationLimit {
    46       get { return lowerEstimationLimit; }
    47     }
    48 
    49     [Storable]
    50     private double upperEstimationLimit;
    51     public double UpperEstimationLimit {
    52       get { return upperEstimationLimit; }
    53     }
    54 
    55     private List<string> inputVariables;
    56     [Storable]
    57     private IEnumerable<string> InputVariablesStorable {
    58       get { return inputVariables; }
    59       set { inputVariables = new List<string>(value); }
    60     }
    61 
    6243    public Dataset SupportVectors {
    6344      get { return CalculateSupportVectors(); }
     
    6849    private SupportVectorRegressionSolution(SupportVectorRegressionSolution original, Cloner cloner)
    6950      : base(original, cloner) {
    70       inputVariables = new List<string>(original.inputVariables);
    71       lowerEstimationLimit = original.lowerEstimationLimit;
    72       upperEstimationLimit = original.upperEstimationLimit;
    7351    }
    74     public SupportVectorRegressionSolution(SupportVectorMachineModel model, IRegressionProblemData problemData, IEnumerable<string> inputVariables, double lowerEstimationLimit, double upperEstimationLimit)
     52    public SupportVectorRegressionSolution(SupportVectorMachineModel model, IRegressionProblemData problemData)
    7553      : base(model, problemData) {
    76       this.inputVariables = new List<string>(inputVariables);
    77       this.lowerEstimationLimit = lowerEstimationLimit;
    78       this.upperEstimationLimit = upperEstimationLimit;
    7954    }
    8055
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.csproj

    r5630 r5649  
    108108  </ItemGroup>
    109109  <ItemGroup>
     110    <Compile Include="Interfaces\ISymbolicDiscriminantFunctionClassificationModel.cs" />
     111    <Compile Include="SymbolicDiscriminantFunctionClassificationModel.cs" />
     112    <Compile Include="SymbolicDiscriminantFunctionClassificationSolution.cs" />
    110113    <Compile Include="Interfaces\ISymbolicClassificationModel.cs" />
    111114    <Compile Include="Interfaces\ISymbolicClassificationSolution.cs" />
     
    121124    <Compile Include="SingleObjective\SymbolicClassificationSingleObjectiveProblem.cs" />
    122125    <Compile Include="SingleObjective\SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer.cs" />
    123     <Compile Include="SymbolicClassificationModel.cs" />
     126    <Compile Include="SymbolicClassificationModel.cs">
     127      <SubType>Code</SubType>
     128    </Compile>
    124129    <Compile Include="SymbolicClassificationSolution.cs" />
    125130    <None Include="HeuristicLab.snk" />
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationSolution.cs

    r5624 r5649  
    2222
    2323using HeuristicLab.Problems.DataAnalysis.Symbolic;
     24using System.Collections.Generic;
     25using System;
    2426namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    2527  public interface ISymbolicClassificationSolution : IClassificationSolution, ISymbolicDataAnalysisSolution {
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer.cs

    r5557 r5649  
    3737  [Item("SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer", "An operator that analyzes the training best symbolic classification solution for multi objective symbolic classification problems.")]
    3838  [StorableClass]
    39   public sealed class SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer : SymbolicDataAnalysisMultiObjectiveTrainingBestSolutionAnalyzer<ISymbolicClassificationSolution> {
     39  public sealed class SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer : SymbolicDataAnalysisMultiObjectiveTrainingBestSolutionAnalyzer<ISymbolicClassificationSolution>,
     40    ISymbolicDataAnalysisInterpreterOperator {
     41    private const string ProblemDataParameterName = "ProblemData";
     42    private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicDataAnalysisTreeInterpreter";
     43    #region parameter properties
     44    public ILookupParameter<IClassificationProblemData> ProblemDataParameter {
     45      get { return (ILookupParameter<IClassificationProblemData>)Parameters[ProblemDataParameterName]; }
     46    }
     47    public ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicDataAnalysisTreeInterpreterParameter {
     48      get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; }
     49    }
     50    #endregion
     51    #region properties
     52    public IClassificationProblemData ProblemData {
     53      get { return ProblemDataParameter.ActualValue; }
     54    }
     55    public ISymbolicDataAnalysisExpressionTreeInterpreter SymbolicDataAnalysisTreeInterpreter {
     56      get { return SymbolicDataAnalysisTreeInterpreterParameter.ActualValue; }
     57    }
     58    #endregion
    4059    [StorableConstructor]
    4160    private SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     
    4362    public SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer()
    4463      : base() {
     64      Parameters.Add(new LookupParameter<IClassificationProblemData>(ProblemDataParameterName, "The problem data for the symbolic classification solution."));
    4565    }
    4666    public override IDeepCloneable Clone(Cloner cloner) {
     
    5070
    5171    protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQuality) {
    52       throw new System.NotImplementedException();
     72      var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreter, ProblemData.ClassValues);
     73      return new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemData);
    5374    }
    5475  }
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer.cs

    r5557 r5649  
    3737  [Item("SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer", "An operator that analyzes the training best symbolic classification solution for single objective symbolic classification problems.")]
    3838  [StorableClass]
    39   public sealed class SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer<ISymbolicClassificationSolution> {
    40 
     39  public sealed class SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer<ISymbolicClassificationSolution>,
     40    ISymbolicDataAnalysisInterpreterOperator {
     41    private const string ProblemDataParameterName = "ProblemData";
     42    private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicDataAnalysisTreeInterpreter";
     43    #region parameter properties
     44    public ILookupParameter<IClassificationProblemData> ProblemDataParameter {
     45      get { return (ILookupParameter<IClassificationProblemData>)Parameters[ProblemDataParameterName]; }
     46    }
     47    public ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicDataAnalysisTreeInterpreterParameter {
     48      get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; }
     49    }
     50    #endregion
     51    #region properties
     52    public IClassificationProblemData ProblemData {
     53      get { return ProblemDataParameter.ActualValue; }
     54    }
     55    public ISymbolicDataAnalysisExpressionTreeInterpreter SymbolicDataAnalysisTreeInterpreter {
     56      get { return SymbolicDataAnalysisTreeInterpreterParameter.ActualValue; }
     57    }
     58    #endregion
    4159    [StorableConstructor]
    4260    private SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     
    5068
    5169    protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) {
    52       throw new System.NotImplementedException();
     70      var model = new SymbolicDiscriminantFunctionClassificationModel(bestTree, SymbolicDataAnalysisTreeInterpreter, ProblemData.ClassValues);
     71      return new SymbolicDiscriminantFunctionClassificationSolution(model, ProblemData);
    5372    }
    5473  }
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationModel.cs

    r5624 r5649  
    5555    #region IClassificationModel Members
    5656
    57     public IEnumerable<double> GetEstimatedValues(IClassificationProblemData problemData, IEnumerable<int> rows) {
    58       return Interpreter.GetSymbolicExpressionTreeValues(SymbolicExpressionTree, problemData.Dataset, rows);
    59     }
    60 
    61     public IEnumerable<double> GetEstimatedClassValues(IClassificationProblemData problemData, IEnumerable<int> rows) {
    62       throw new NotImplementedException();
     57    public IEnumerable<double> GetEstimatedClassValues(Dataset dataset, IEnumerable<int> rows) {
     58      return Interpreter.GetSymbolicExpressionTreeValues(SymbolicExpressionTree, dataset, rows);
    6359    }
    6460
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionModel.cs

    r5624 r5649  
    5353    }
    5454
    55     public IEnumerable<double> GetEstimatedValues(IRegressionProblemData problemData, IEnumerable<int> rows) {
    56       return Interpreter.GetSymbolicExpressionTreeValues(SymbolicExpressionTree, problemData.Dataset, rows);
     55    public IEnumerable<double> GetEstimatedValues(Dataset dataset, IEnumerable<int> rows) {
     56      return Interpreter.GetSymbolicExpressionTreeValues(SymbolicExpressionTree, dataset, rows);
    5757    }
    5858  }
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisEvaluator.cs

    r5624 r5649  
    5555      get { return (ILookupParameter<ISymbolicExpressionTree>)Parameters[SymbolicExpressionTreeParameterName]; }
    5656    }
    57     public IValueLookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicDataAnalysisTreeInterpreterParameter {
    58       get { return (IValueLookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; }
     57    public ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicDataAnalysisTreeInterpreterParameter {
     58      get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; }
    5959    }
    6060    public IValueLookupParameter<T> ProblemDataParameter {
     
    119119      : base() {
    120120      Parameters.Add(new ValueLookupParameter<IRandom>(RandomParameterName, "The random generator to use."));
    121       Parameters.Add(new ValueLookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The interpreter that should be used to calculate the output values of the symbolic data analysis tree."));
     121      Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The interpreter that should be used to calculate the output values of the symbolic data analysis tree."));
    122122      Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(SymbolicExpressionTreeParameterName, "The symbolic data analysis solution encoded as a symbolic expression tree."));
    123123      Parameters.Add(new ValueLookupParameter<T>(ProblemDataParameterName, "The problem data on which the symbolic data analysis solution should be evaluated."));
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interfaces/ISymbolicDataAnalysisInterpreterOperator.cs

    r5624 r5649  
    2424namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
    2525  public interface ISymbolicDataAnalysisInterpreterOperator : IOperator {
    26     IValueLookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicDataAnalysisTreeInterpreterParameter { get; }
     26    ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicDataAnalysisTreeInterpreterParameter { get; }
    2727  }
    2828}
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisModel.cs

    r5624 r5649  
    3131using HeuristicLab.Optimization;
    3232using System;
     33using System.Drawing;
    3334
    3435namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
     
    3839  [StorableClass]
    3940  public abstract class SymbolicDataAnalysisModel : NamedItem, ISymbolicDataAnalysisModel {
     41    public override Image ItemImage {
     42      get { return HeuristicLab.Common.Resources.VSImageLibrary.Function; }
     43    }
     44
    4045    #region properties
    4146
     
    6368    public SymbolicDataAnalysisModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter)
    6469      : base() {
     70      this.name = ItemName;
     71      this.description = ItemDescription;
    6572      this.symbolicExpressionTree = tree;
    6673      this.interpreter = interpreter;
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/ClassificationProblem.cs

    r5625 r5649  
    2626namespace HeuristicLab.Problems.DataAnalysis {
    2727  [StorableClass]
    28   [Item("ClassificationProblem", "")]
     28  [Item("ClassificationProblem", "A general classification problem.")]
    2929  [Creatable("Problems")]
    3030  public class ClassificationProblem : DataAnalysisProblem<IClassificationProblemData>, IClassificationProblem {
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/ClassificationProblemData.cs

    r5601 r5649  
    194194    #endregion
    195195
    196     #region propeties
     196    #region properties
    197197    public string TargetVariable {
    198198      get { return TargetVariableParameter.Value.Value; }
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/ClassificationSolution.cs

    r5624 r5649  
    3737  [StorableClass]
    3838  public abstract class ClassificationSolution : DataAnalysisSolution, IClassificationSolution {
    39     private const string ThresholdsResultsName = "Thresholds";
     39    private const string TrainingAccuracyResultName = "Accuracy (training)";
     40    private const string TestAccuracyResultName = "Accuracy (test)";
    4041    [StorableConstructor]
    4142    protected ClassificationSolution(bool deserializing) : base(deserializing) { }
     
    4546    public ClassificationSolution(IClassificationModel model, IClassificationProblemData problemData)
    4647      : base(model, problemData) {
    47       DoubleArray thresholds = new DoubleArray();
    48       Add(new Result(ThresholdsResultsName, "The threshold values for class boundaries.", thresholds));
    49       thresholds.Reset += new EventHandler(thresholds_Reset);
    50       thresholds.ItemChanged += new EventHandler<EventArgs<int>>(thresholds_ItemChanged);
     48      double[] estimatedTrainingClassValues = EstimatedTrainingClassValues.ToArray(); // cache values
     49      IEnumerable<double> originalTrainingClassValues = ProblemData.Dataset.GetEnumeratedVariableValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes);
     50      double[] estimatedTestClassValues = EstimatedTestClassValues.ToArray(); // cache values
     51      IEnumerable<double> originalTestClassValues = ProblemData.Dataset.GetEnumeratedVariableValues(ProblemData.TargetVariable, ProblemData.TestIndizes);
     52
     53      double trainingAccuracy = OnlineAccuracyEvaluator.Calculate(estimatedTrainingClassValues, originalTrainingClassValues);
     54      double testAccuracy = OnlineAccuracyEvaluator.Calculate(estimatedTestClassValues, originalTestClassValues);
     55
     56      Add(new Result(TrainingAccuracyResultName, "Accuracy of the model on the training partition (percentage of correctly classified instances).", new PercentValue(trainingAccuracy)));
     57      Add(new Result(TestAccuracyResultName, "Accuracy of the model on the test partition (percentage of correctly classified instances).", new PercentValue(testAccuracy)));
    5158    }
    5259
     
    6168    }
    6269
    63     public virtual IEnumerable<double> EstimatedValues {
    64       get {
    65         return GetEstimatedValues(Enumerable.Range(0, ProblemData.Dataset.Rows));
    66       }
    67     }
    68 
    69     public virtual IEnumerable<double> EstimatedTrainingValues {
    70       get {
    71         return GetEstimatedValues(ProblemData.TrainingIndizes);
    72       }
    73     }
    74 
    75     public virtual IEnumerable<double> EstimatedTestValues {
    76       get {
    77         return GetEstimatedValues(ProblemData.TestIndizes);
    78       }
    79     }
    80 
    81     public virtual IEnumerable<double> GetEstimatedValues(IEnumerable<int> rows) {
    82       return Model.GetEstimatedValues(ProblemData, rows);
    83     }
    84 
    85     public IEnumerable<double> Thresholds {
    86       get {
    87         return (DoubleArray)this[ThresholdsResultsName].Value;
    88       }
    89     }
    90 
    91     public IEnumerable<double> EstimatedClassValues {
     70    public virtual IEnumerable<double> EstimatedClassValues {
    9271      get {
    9372        return GetEstimatedClassValues(Enumerable.Range(0, ProblemData.Dataset.Rows));
     
    9574    }
    9675
    97     public IEnumerable<double> EstimatedTrainingClassValues {
     76    public virtual IEnumerable<double> EstimatedTrainingClassValues {
    9877      get {
    9978        return GetEstimatedClassValues(ProblemData.TrainingIndizes);
     
    10180    }
    10281
    103     public IEnumerable<double> EstimatedTestClassValues {
     82    public virtual IEnumerable<double> EstimatedTestClassValues {
    10483      get {
    10584        return GetEstimatedClassValues(ProblemData.TestIndizes);
     
    10786    }
    10887
    109     public IEnumerable<double> GetEstimatedClassValues(IEnumerable<int> rows) {
    110       return Model.GetEstimatedClassValues(ProblemData, rows);
    111     }
    112 
    113     #endregion
    114     #region events
    115     private void thresholds_ItemChanged(object sender, EventArgs<int> e) {
    116       OnThresholdsChanged(EventArgs.Empty);
    117     }
    118 
    119     private void thresholds_Reset(object sender, EventArgs e) {
    120       OnThresholdsChanged(EventArgs.Empty);
    121     }
    122 
    123     public event EventHandler ThresholdsChanged;
    124     private void OnThresholdsChanged(EventArgs e) {
    125       var listeners = ThresholdsChanged;
    126       if (listeners != null) listeners(this, e);
     88    public virtual IEnumerable<double> GetEstimatedClassValues(IEnumerable<int> rows) {
     89      return Model.GetEstimatedClassValues(ProblemData.Dataset, rows);
    12790    }
    12891    #endregion
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/DataAnalysisProblemData.cs

    r5601 r5649  
    4444      get { return (IFixedValueParameter<Dataset>)Parameters[DatasetParameterName]; }
    4545    }
    46     public IFixedValueParameter<ICheckedItemCollection<StringValue>> InputVariablesParameter {
    47       get { return (IFixedValueParameter<ICheckedItemCollection<StringValue>>)Parameters[InputVariablesParameterName]; }
     46    public IFixedValueParameter<ICheckedItemList<StringValue>> InputVariablesParameter {
     47      get { return (IFixedValueParameter<ICheckedItemList<StringValue>>)Parameters[InputVariablesParameterName]; }
    4848    }
    4949    public IFixedValueParameter<IntValue> TrainingPartitionStartParameter {
     
    6565      get { return DatasetParameter.Value; }
    6666    }
    67     public ICheckedItemCollection<StringValue> InputVariables {
     67    public ICheckedItemList<StringValue> InputVariables {
    6868      get { return InputVariablesParameter.Value; }
    6969    }
    7070    public IEnumerable<string> AllowedInputVariables {
    71       get { return InputVariables.CheckedItems.Select(x => x.Value); }
     71      get { return InputVariables.CheckedItems.Select(x => x.Value.Value); }
    7272    }
    7373
     
    110110        throw new ArgumentException("All allowed input variables must be present in the dataset.");
    111111
    112       var inputVariables = new CheckedItemCollection<StringValue>(dataset.VariableNames.Select(x => new StringValue(x)));
     112      var inputVariables = new CheckedItemList<StringValue>(dataset.VariableNames.Select(x => new StringValue(x)));
    113113      foreach (StringValue x in inputVariables)
    114114        inputVariables.SetItemCheckedState(x, allowedInputVariables.Contains(x.Value));
     
    120120
    121121      Parameters.Add(new FixedValueParameter<Dataset>(DatasetParameterName, "", dataset));
    122       Parameters.Add(new FixedValueParameter<ICheckedItemCollection<StringValue>>(InputVariablesParameterName, "", inputVariables.AsReadOnly()));
     122      Parameters.Add(new FixedValueParameter<ICheckedItemList<StringValue>>(InputVariablesParameterName, "", inputVariables.AsReadOnly()));
    123123      Parameters.Add(new FixedValueParameter<IntValue>(TrainingPartitionStartParameterName, "", new IntValue(trainingPartitionStart)));
    124124      Parameters.Add(new FixedValueParameter<IntValue>(TrainingPartitionEndParameterName, "", new IntValue(trainingPartitionEnd)));
     
    132132    private void RegisterEventHandlers() {
    133133      DatasetParameter.ValueChanged += new EventHandler(Parameter_ValueChanged);
    134       InputVariables.CheckedItemsChanged += new CollectionItemsChangedEventHandler<StringValue>(InputVariables_CheckedItemsChanged);
     134      InputVariables.CheckedItemsChanged += new CollectionItemsChangedEventHandler<IndexedItem<StringValue>>(InputVariables_CheckedItemsChanged);
    135135      TrainingPartitionStart.ValueChanged += new EventHandler(Parameter_ValueChanged);
    136136      TrainingPartitionEnd.ValueChanged += new EventHandler(Parameter_ValueChanged);
     
    139139    }
    140140
    141     private void InputVariables_CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs<StringValue> e) {
     141    private void InputVariables_CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<StringValue>> e) {
    142142      OnChanged();
    143143    }
     144
    144145    private void Parameter_ValueChanged(object sender, EventArgs e) {
    145146      OnChanged();
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/DataAnalysisSolution.cs

    r5624 r5649  
    8282    public DataAnalysisSolution(IDataAnalysisModel model, IDataAnalysisProblemData problemData)
    8383      : base() {
    84       name = string.Empty;
    85       description = string.Empty;
     84      name = ItemName;
     85      description = ItemDescription;
    8686      Add(new Result(ModelResultName, "The symbolic data analysis model.", model));
    8787      Add(new Result(ProblemDataResultName, "The symbolic data analysis problem data.", problemData));
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj

    r5620 r5649  
    111111    <Compile Include="ClassificationProblem.cs" />
    112112    <Compile Include="ClassificationSolution.cs" />
     113    <Compile Include="ClusteringProblem.cs" />
     114    <Compile Include="ClusteringProblemData.cs" />
     115    <Compile Include="ClusteringSolution.cs" />
     116    <Compile Include="DiscriminantFunctionClassificationModel.cs" />
     117    <Compile Include="DiscriminantFunctionClassificationSolution.cs" />
    113118    <Compile Include="DataAnalysisSolution.cs" />
     119    <Compile Include="Interfaces\Classification\IDiscriminantFunctionClassificationModel.cs" />
     120    <Compile Include="Interfaces\Classification\IDiscriminantFunctionClassificationSolution.cs" />
     121    <Compile Include="Interfaces\Clustering\IClusteringModel.cs" />
     122    <Compile Include="Interfaces\Clustering\IClusteringProblem.cs" />
     123    <Compile Include="Interfaces\Clustering\IClusteringProblemData.cs" />
     124    <Compile Include="Interfaces\Clustering\IClusteringSolution.cs" />
     125    <Compile Include="OnlineEvaluators\OnlineAccuracyEvaluator.cs" />
    114126    <Compile Include="RegressionProblemData.cs" />
    115127    <Compile Include="DataAnalysisProblemData.cs" />
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Classification/IClassificationModel.cs

    r5620 r5649  
    2323namespace HeuristicLab.Problems.DataAnalysis {
    2424  public interface IClassificationModel : IDataAnalysisModel {
    25     IEnumerable<double> GetEstimatedValues(IClassificationProblemData problemData, IEnumerable<int> rows);
    26     IEnumerable<double> GetEstimatedClassValues(IClassificationProblemData problemData, IEnumerable<int> rows);
     25    IEnumerable<double> GetEstimatedClassValues(Dataset dataset, IEnumerable<int> rows);
    2726  }
    2827}
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Classification/IClassificationSolution.cs

    r5509 r5649  
    2727    new IClassificationProblemData ProblemData { get; }
    2828
    29     IEnumerable<double> EstimatedValues { get; }
    30     IEnumerable<double> EstimatedTrainingValues { get; }
    31     IEnumerable<double> EstimatedTestValues { get; }
    32     IEnumerable<double> GetEstimatedValues(IEnumerable<int> rows);
    33 
    34     IEnumerable<double> Thresholds { get; }
    3529    IEnumerable<double> EstimatedClassValues { get; }
    3630    IEnumerable<double> EstimatedTrainingClassValues { get; }
    3731    IEnumerable<double> EstimatedTestClassValues { get; }
    3832    IEnumerable<double> GetEstimatedClassValues(IEnumerable<int> rows);
    39 
    40     event EventHandler ThresholdsChanged;
    4133  }
    4234}
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataAnalysisProblemData.cs

    r5601 r5649  
    2828  public interface IDataAnalysisProblemData : IParameterizedNamedItem {
    2929    Dataset Dataset { get; }
    30     ICheckedItemCollection<StringValue> InputVariables { get; }
     30    ICheckedItemList<StringValue> InputVariables { get; }
    3131    IEnumerable<string> AllowedInputVariables { get; }
    3232
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Regression/IRegressionModel.cs

    r5496 r5649  
    2323namespace HeuristicLab.Problems.DataAnalysis {
    2424  public interface IRegressionModel : IDataAnalysisModel {
    25     IEnumerable<double> GetEstimatedValues(IRegressionProblemData problemData, IEnumerable<int> rows);
     25    IEnumerable<double> GetEstimatedValues(Dataset dataset, IEnumerable<int> rows);
    2626  }
    2727}
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/RegressionProblem.cs

    r5625 r5649  
    2626namespace HeuristicLab.Problems.DataAnalysis {
    2727  [StorableClass]
    28   [Item("RegressionProblem", "")]
     28  [Item("RegressionProblem", "A general regression problem")]
    2929  [Creatable("Problems")]
    3030  public class RegressionProblem : DataAnalysisProblem<IRegressionProblemData>, IRegressionProblem {
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/RegressionSolution.cs

    r5624 r5649  
    3737  [StorableClass]
    3838  public abstract class RegressionSolution : DataAnalysisSolution, IRegressionSolution {
     39    private const string TrainingMeanSquaredErrorResultName = "Mean squared error (training)";
     40    private const string TestMeanSquaredErrorResultName = "Mean squared error (test)";
     41    private const string TrainingSquaredCorrelationResultName = "Pearson's R² (training)";
     42    private const string TestSquaredCorrelationResultName = "Pearson's R² (test)";
     43    private const string TrainingRelativeErrorResultName = "Average relative error (training)";
     44    private const string TestRelativeErrorResultName = "Average relative error (test)";
     45
    3946    [StorableConstructor]
    4047    protected RegressionSolution(bool deserializing) : base(deserializing) { }
     
    4451    public RegressionSolution(IRegressionModel model, IRegressionProblemData problemData)
    4552      : base(model, problemData) {
     53      double[] estimatedTrainingValues = EstimatedTrainingValues.ToArray(); // cache values
     54      IEnumerable<double> originalTrainingValues = ProblemData.Dataset.GetEnumeratedVariableValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes);
     55      double[] estimatedTestValues = EstimatedTestValues.ToArray(); // cache values
     56      IEnumerable<double> originalTestValues = ProblemData.Dataset.GetEnumeratedVariableValues(ProblemData.TargetVariable, ProblemData.TestIndizes);
     57
     58      double trainingMSE = OnlineMeanSquaredErrorEvaluator.Calculate(estimatedTrainingValues, originalTrainingValues);
     59      double testMSE = OnlineMeanSquaredErrorEvaluator.Calculate(estimatedTestValues, originalTestValues);
     60      double trainingR2 = OnlinePearsonsRSquaredEvaluator.Calculate(estimatedTrainingValues, originalTrainingValues);
     61      double testR2 = OnlinePearsonsRSquaredEvaluator.Calculate(estimatedTestValues, originalTestValues);
     62      double trainingRelError = OnlineMeanAbsolutePercentageErrorEvaluator.Calculate(estimatedTrainingValues, originalTrainingValues);
     63      double testRelError = OnlineMeanAbsolutePercentageErrorEvaluator.Calculate(estimatedTestValues, originalTestValues);
     64
     65      Add(new Result(TrainingMeanSquaredErrorResultName, "Mean of squared errors of the model on the training partition", new DoubleValue(trainingMSE)));
     66      Add(new Result(TestMeanSquaredErrorResultName, "Mean of squared errors of the model on the test partition", new DoubleValue(testMSE)));
     67      Add(new Result(TrainingSquaredCorrelationResultName, "Squared Pearson's correlation coefficient of the model output and the actual values on the training partition", new DoubleValue(trainingR2)));
     68      Add(new Result(TestSquaredCorrelationResultName, "Squared Pearson's correlation coefficient of the model output and the actual values on the test partition", new DoubleValue(testR2)));
     69      Add(new Result(TrainingRelativeErrorResultName, "Average of the relative errors of the model output and the actual values on the training partition", new PercentValue(trainingRelError)));
     70      Add(new Result(TestRelativeErrorResultName, "Average of the relative errors of the model output and the actual values on the test partition", new PercentValue(testRelError)));
    4671    }
    4772
     73    protected override void OnProblemDataChanged(EventArgs e) {
     74      base.OnProblemDataChanged(e);
     75      throw new NotImplementedException(); // need to recalculate results
     76    }
     77    protected override void OnModelChanged(EventArgs e) {
     78      base.OnModelChanged(e);
     79      throw new NotImplementedException(); // need to recalculate results
     80    }
    4881    #region IRegressionSolution Members
    4982
     
    75108
    76109    public virtual IEnumerable<double> GetEstimatedValues(IEnumerable<int> rows) {
    77       return Model.GetEstimatedValues(ProblemData, rows);
     110      return Model.GetEstimatedValues(ProblemData.Dataset, rows);
    78111    }
    79 
    80112    #endregion
    81113  }
Note: See TracChangeset for help on using the changeset viewer.