Ejemplo n.º 1
0
        public static double CalculateQualityForImpacts(ISymbolicRegressionModel model, IRegressionProblemData problemData, IEnumerable <int> rows)
        {
            var estimatedValues = model.GetEstimatedValues(problemData.Dataset, rows); // also bounds the values
            var targetValues    = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
            OnlineCalculatorError errorState;
            var r       = OnlinePearsonsRCalculator.Calculate(targetValues, estimatedValues, out errorState);
            var quality = r * r;

            if (errorState != OnlineCalculatorError.None)
            {
                return(double.NaN);
            }
            return(quality);
        }
        public SymbolicRegressionSolution(ISymbolicRegressionModel model, IRegressionProblemData problemData)
            : base(model, problemData)
        {
            foreach (var node in model.SymbolicExpressionTree.Root.IterateNodesPrefix().OfType <SymbolicExpressionTreeTopLevelNode>())
            {
                node.SetGrammar(null);
            }

            Add(new Result(ModelLengthResultName, "Length of the symbolic regression model.", new IntValue()));
            Add(new Result(ModelDepthResultName, "Depth of the symbolic regression model.", new IntValue()));

            ResultCollection estimationLimitResults = new ResultCollection();

            estimationLimitResults.Add(new Result(EstimationLimitsResultName, "", new DoubleLimit()));
            estimationLimitResults.Add(new Result(TrainingUpperEstimationLimitHitsResultName, "", new IntValue()));
            estimationLimitResults.Add(new Result(TestUpperEstimationLimitHitsResultName, "", new IntValue()));
            estimationLimitResults.Add(new Result(TrainingLowerEstimationLimitHitsResultName, "", new IntValue()));
            estimationLimitResults.Add(new Result(TestLowerEstimationLimitHitsResultName, "", new IntValue()));
            estimationLimitResults.Add(new Result(TrainingNaNEvaluationsResultName, "", new IntValue()));
            estimationLimitResults.Add(new Result(TestNaNEvaluationsResultName, "", new IntValue()));
            Add(new Result(EstimationLimitsResultsResultName, "Results concerning the estimation limits of symbolic regression solution", estimationLimitResults));
            RecalculateResults();
        }
 public static double CalculateQualityForImpacts(ISymbolicRegressionModel model, IRegressionProblemData problemData, IEnumerable<int> rows) {
   var estimatedValues = model.GetEstimatedValues(problemData.Dataset, rows); // also bounds the values
   var targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, rows);
   OnlineCalculatorError errorState;
   var r = OnlinePearsonsRCalculator.Calculate(targetValues, estimatedValues, out errorState);
   var quality = r * r;
   if (errorState != OnlineCalculatorError.None) return double.NaN;
   return quality;
 }
    public SymbolicRegressionSolution(ISymbolicRegressionModel model, IRegressionProblemData problemData)
      : base(model, problemData) {
      foreach (var node in model.SymbolicExpressionTree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTopLevelNode>())
        node.SetGrammar(null);

      Add(new Result(ModelLengthResultName, "Length of the symbolic regression model.", new IntValue()));
      Add(new Result(ModelDepthResultName, "Depth of the symbolic regression model.", new IntValue()));

      ResultCollection estimationLimitResults = new ResultCollection();
      estimationLimitResults.Add(new Result(EstimationLimitsResultName, "", new DoubleLimit()));
      estimationLimitResults.Add(new Result(TrainingUpperEstimationLimitHitsResultName, "", new IntValue()));
      estimationLimitResults.Add(new Result(TestUpperEstimationLimitHitsResultName, "", new IntValue()));
      estimationLimitResults.Add(new Result(TrainingLowerEstimationLimitHitsResultName, "", new IntValue()));
      estimationLimitResults.Add(new Result(TestLowerEstimationLimitHitsResultName, "", new IntValue()));
      estimationLimitResults.Add(new Result(TrainingNaNEvaluationsResultName, "", new IntValue()));
      estimationLimitResults.Add(new Result(TestNaNEvaluationsResultName, "", new IntValue()));
      Add(new Result(EstimationLimitsResultsResultName, "Results concerning the estimation limits of symbolic regression solution", estimationLimitResults));
      RecalculateResults();
    }