Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/17/11 12:16:46 (14 years ago)
Author:
mkommend
Message:

#1418: Commited remaining changes regarding OnlineEvaluators and solutions.

Location:
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataAnalysisSolution.cs

    r5490 r5507  
    2020#endregion
    2121
     22using System;
    2223using HeuristicLab.Core;
    2324
     
    2627    IDataAnalysisModel Model { get; }
    2728    IDataAnalysisProblemData ProblemData { get; }
     29
     30    EventHandler ModelChanged;
     31    EventHandler ProblemDataChanged;
    2832  }
    2933}
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Regression/IRegressionSolution.cs

    r5501 r5507  
    2020#endregion
    2121
     22using System.Collections.Generic;
    2223namespace HeuristicLab.Problems.DataAnalysis {
    2324  public interface IRegressionnSolution : IDataAnalysisSolution {
    2425    new IRegressionModel Model { get; }
    2526    new IRegressionProblemData ProblemData { get; }
     27
     28    IEnumerable<double> EstimatedValues { get; }
     29    IEnumerable<double> EstimatedTrainingValues { get; }
     30    IEnumerable<double> EstimatedTestValues { get; }
     31    IEnumerable<double> GetEstimatedValues(IEnumerable<int> rows);
    2632  }
    2733}
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineCovarianceEvaluator.cs

    r5491 r5507  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324
    2425namespace HeuristicLab.Problems.DataAnalysis {
     
    6768    }
    6869    #endregion
     70
     71    public static double Calculate(IEnumerable<double> first, IEnumerable<double> second) {
     72      IEnumerator<double> firstEnumerator = first.GetEnumerator();
     73      IEnumerator<double> secondEnumerator = second.GetEnumerator();
     74      OnlineCovarianceEvaluator covarianceEvaluator = new OnlineCovarianceEvaluator();
     75
     76      while (firstEnumerator.MoveNext() & secondEnumerator.MoveNext()) {
     77        double estimated = secondEnumerator.Current;
     78        double original = firstEnumerator.Current;
     79        covarianceEvaluator.Add(original, estimated);
     80      }
     81
     82      if (secondEnumerator.MoveNext() || firstEnumerator.MoveNext()) {
     83        throw new ArgumentException("Number of elements in first and second enumeration doesn't match.");
     84      } else {
     85        return covarianceEvaluator.Covariance;
     86      }
     87    }
    6988  }
    7089}
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineMeanAbsolutePercentageErrorEvaluator.cs

    r5491 r5507  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using HeuristicLab.Common;
    2425
     
    6364
    6465    #endregion
     66
     67    public static double Calculate(IEnumerable<double> first, IEnumerable<double> second) {
     68      IEnumerator<double> firstEnumerator = first.GetEnumerator();
     69      IEnumerator<double> secondEnumerator = second.GetEnumerator();
     70      OnlineMeanAbsolutePercentageErrorEvaluator evaluator = new OnlineMeanAbsolutePercentageErrorEvaluator();
     71
     72      while (firstEnumerator.MoveNext() & secondEnumerator.MoveNext()) {
     73        double estimated = secondEnumerator.Current;
     74        double original = firstEnumerator.Current;
     75        evaluator.Add(original, estimated);
     76      }
     77
     78      if (secondEnumerator.MoveNext() || firstEnumerator.MoveNext()) {
     79        throw new ArgumentException("Number of elements in first and second enumeration doesn't match.");
     80      } else {
     81        return evaluator.MeanAbsolutePercentageError;
     82      }
     83    }
    6584  }
    6685}
  • branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineNormalizedMeanSquaredErrorEvaluator.cs

    r5491 r5507  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324
    2425namespace HeuristicLab.Problems.DataAnalysis {
     
    6061    }
    6162    #endregion
     63
     64    public static double Calculate(IEnumerable<double> first, IEnumerable<double> second) {
     65      IEnumerator<double> firstEnumerator = first.GetEnumerator();
     66      IEnumerator<double> secondEnumerator = second.GetEnumerator();
     67      OnlineNormalizedMeanSquaredErrorEvaluator normalizedMSEEvaluator = new OnlineNormalizedMeanSquaredErrorEvaluator();
     68
     69      while (firstEnumerator.MoveNext() & secondEnumerator.MoveNext()) {
     70        double estimated = secondEnumerator.Current;
     71        double original = firstEnumerator.Current;
     72        normalizedMSEEvaluator.Add(original, estimated);
     73      }
     74
     75      if (secondEnumerator.MoveNext() || firstEnumerator.MoveNext()) {
     76        throw new ArgumentException("Number of elements in first and second enumeration doesn't match.");
     77      } else {
     78        return normalizedMSEEvaluator.NormalizedMeanSquaredError;
     79      }
     80    }
    6281  }
    6382}
Note: See TracChangeset for help on using the changeset viewer.