#region License Information
/* HeuristicLab
* Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using System.Collections.Generic;
using System.Linq;
using HeuristicLab.Common;
using HeuristicLab.Core;
using HeuristicLab.Data;
using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
using HeuristicLab.Operators;
using HeuristicLab.Parameters;
using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
using HeuristicLab.Optimization;
namespace HeuristicLab.Problems.DataAnalysis.Symbolic {
///
/// Abstract base class for symbolic data analysis analyzers that validate a solution on a separate data partition using the evaluator.
///
[StorableClass]
public abstract class SymbolicDataAnalysisValidationAnalyzer : SymbolicDataAnalysisAnalyzer,
ISymbolicDataAnalysisValidationAnalyzer
where T : class, ISymbolicDataAnalysisEvaluator
where U : class, IDataAnalysisProblemData {
private const string ProblemDataParameterName = "ProblemData";
private const string EvaluatorParameterName = "Evaluator";
private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicDataAnalysisTreeInterpreter";
private const string ValidationSamplesStartParameterName = "ValidationSamplesStart";
private const string ValidationSamplesEndParameterName = "ValidationSamplesEnd";
#region parameter properties
public ILookupParameter ProblemDataParameter {
get { return (ILookupParameter)Parameters[ProblemDataParameterName]; }
}
public ILookupParameter EvaluatorParameter {
get { return (ILookupParameter)Parameters[EvaluatorParameterName]; }
}
public ILookupParameter SymbolicDataAnalysisTreeInterpreterParameter {
get { return (ILookupParameter)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; }
}
public IValueLookupParameter ValidationSamplesStartParameter {
get { return (IValueLookupParameter)Parameters[ValidationSamplesStartParameterName]; }
}
public IValueLookupParameter ValidationSamplesEndParameter {
get { return (IValueLookupParameter)Parameters[ValidationSamplesEndParameterName]; }
}
#endregion
#region properties
public U ProblemData { get { return ProblemDataParameter.ActualValue; } }
public T Evaluator { get { return EvaluatorParameter.ActualValue; } }
public ISymbolicDataAnalysisExpressionTreeInterpreter SymbolicDataAnalysisTreeInterpreter { get { return SymbolicDataAnalysisTreeInterpreterParameter.ActualValue; } }
public IntValue ValidationSamplesStart { get { return ValidationSamplesStartParameter.ActualValue; } }
public IntValue ValidationSamplesEnd { get { return ValidationSamplesEndParameter.ActualValue; } }
#endregion
[StorableConstructor]
protected SymbolicDataAnalysisValidationAnalyzer(bool deserializing) : base(deserializing) { }
protected SymbolicDataAnalysisValidationAnalyzer(SymbolicDataAnalysisValidationAnalyzer original, Cloner cloner)
: base(original, cloner) {
}
public SymbolicDataAnalysisValidationAnalyzer()
: base() {
Parameters.Add(new LookupParameter(ProblemDataParameterName, "The problem data of the symbolic data analysis problem."));
Parameters.Add(new LookupParameter(EvaluatorParameterName, "The operator to use for fitness evaluation on the validation partition."));
Parameters.Add(new LookupParameter(SymbolicDataAnalysisTreeInterpreterParameterName, "The interpreter for symbolic data analysis expression trees."));
Parameters.Add(new ValueLookupParameter(ValidationSamplesStartParameterName, "The start index of the validation partition."));
Parameters.Add(new ValueLookupParameter(ValidationSamplesEndParameterName, "The end index of the validation partition."));
}
}
}