Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2270


Ignore:
Timestamp:
08/10/09 14:11:37 (15 years ago)
Author:
gkronber
Message:

Added properties for the separation in training/validation/test set to HL.Modeling.IModel. #712

Location:
trunk/sources
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/SimpleDispatcher.cs

    r2258 r2270  
    4343    }
    4444
    45     private Random random;   
     45    private Random random;
    4646    private Dictionary<int, List<AlgorithmConfiguration>> finishedAndDispatchedRuns;
    4747
    4848    public SimpleDispatcher(IModelingDatabase database, Problem problem)
    49       : base(database, problem) {     
     49      : base(database, problem) {
    5050      random = new Random();
    5151      finishedAndDispatchedRuns = new Dictionary<int, List<AlgorithmConfiguration>>();
     
    100100    private void PopulateFinishedRuns() {
    101101      var dispatchedAlgos = from model in Database.GetAllModels()
    102                             select new {
    103                               TargetVariable = model.TargetVariable.Name,
    104                               Algorithm = model.Algorithm.Name,
    105                               Inputvariables = Database.GetInputVariableResults(model).Select(x => x.Variable.Name).Distinct() };
     102                            select new {
     103                              TargetVariable = model.TargetVariable.Name,
     104                              Algorithm = model.Algorithm.Name,
     105                              Inputvariables = Database.GetInputVariableResults(model).Select(x => x.Variable.Name).Distinct()
     106                            };
    106107      foreach (var algo in dispatchedAlgos) {
    107108        AddDispatchedRun(algo.TargetVariable, algo.Inputvariables, algo.Algorithm);
     
    144145    private void AddDispatchedRun(string targetVariable, IEnumerable<string> inputVariables, string algorithm) {
    145146      AddDispatchedRun(
    146         Problem.Dataset.GetVariableIndex(targetVariable), 
    147         inputVariables.Select(x => Problem.Dataset.GetVariableIndex(x)).ToArray(), 
     147        Problem.Dataset.GetVariableIndex(targetVariable),
     148        inputVariables.Select(x => Problem.Dataset.GetVariableIndex(x)).ToArray(),
    148149        algorithm);
    149150    }
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/BaseClasses/AlgorithmBase.cs

    r2242 r2270  
    423423      model.Dataset = ds;
    424424      model.TargetVariable = ds.GetVariableName(bestModelScope.GetVariableValue<IntData>("TargetVariable", true).Data);
     425      model.TrainingSamplesStart = bestModelScope.GetVariableValue<IntData>("TrainingSamplesStart", true).Data;
     426      model.TrainingSamplesEnd = bestModelScope.GetVariableValue<IntData>("TrainingSamplesEnd", true).Data;
     427      model.ValidationSamplesStart = bestModelScope.GetVariableValue<IntData>("ValidationSamplesStart", true).Data;
     428      model.ValidationSamplesEnd = bestModelScope.GetVariableValue<IntData>("ValidationSamplesEnd", true).Data;
     429      model.TestSamplesStart = bestModelScope.GetVariableValue<IntData>("TestSamplesStart", true).Data;
     430      model.TestSamplesEnd = bestModelScope.GetVariableValue<IntData>("TestSamplesEnd", true).Data;
     431
    425432      model.TrainingMeanSquaredError = bestModelScope.GetVariableValue<DoubleData>("Quality", false).Data;
    426433      model.ValidationMeanSquaredError = bestModelScope.GetVariableValue<DoubleData>("ValidationQuality", false).Data;
  • trunk/sources/HeuristicLab.LinearRegression/3.2/LinearRegression.cs

    r2242 r2270  
    152152      testMSE.GetVariableInfo("SamplesEnd").ActualName = "TestSamplesEnd";
    153153      #endregion
    154      
     154
    155155      #region R2
    156156      CoefficientOfDeterminationEvaluator trainingR2 = new CoefficientOfDeterminationEvaluator();
     
    290290      model.Dataset = ds;
    291291      model.TargetVariable = ds.GetVariableName(bestModelScope.GetVariableValue<IntData>("TargetVariable", true).Data);
     292      model.TrainingSamplesStart = bestModelScope.GetVariableValue<IntData>("TrainingSamplesStart", true).Data;
     293      model.TrainingSamplesEnd = bestModelScope.GetVariableValue<IntData>("TrainingSamplesEnd", true).Data;
     294      model.ValidationSamplesStart = bestModelScope.GetVariableValue<IntData>("ValidationSamplesStart", true).Data;
     295      model.ValidationSamplesEnd = bestModelScope.GetVariableValue<IntData>("ValidationSamplesEnd", true).Data;
     296      model.TestSamplesStart = bestModelScope.GetVariableValue<IntData>("TestSamplesStart", true).Data;
     297      model.TestSamplesEnd = bestModelScope.GetVariableValue<IntData>("TestSamplesEnd", true).Data;
    292298
    293299      ItemList evaluationImpacts = bestModelScope.GetVariableValue<ItemList>("VariableEvaluationImpacts", false);
  • trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DatabaseService.cs

    r2229 r2270  
    6868
    6969    public void Persist(HeuristicLab.Modeling.IAlgorithm algorithm) {
    70       int trainingSamplesStart = ((IntData)algorithm.Engine.GlobalScope.GetVariableValue("TrainingSamplesStart", false)).Data;
    71       int trainingSamplesEnd = ((IntData)algorithm.Engine.GlobalScope.GetVariableValue("TrainingSamplesEnd", false)).Data;
    72       int validationSamplesStart = ((IntData)algorithm.Engine.GlobalScope.GetVariableValue("ValidationSamplesStart", false)).Data;
    73       int validationSamplesEnd = ((IntData)algorithm.Engine.GlobalScope.GetVariableValue("ValidationSamplesEnd", false)).Data;
    74       int testSamplesStart = ((IntData)algorithm.Engine.GlobalScope.GetVariableValue("TestSamplesStart", false)).Data;
    75       int testSamplesEnd = ((IntData)algorithm.Engine.GlobalScope.GetVariableValue("TestSamplesEnd", false)).Data;
    76 
    7770      GetOrCreateProblem(algorithm.Dataset);
    7871      Dictionary<string, Variable> variables = GetAllVariables();
     
    8376      using (ModelingDataContext ctx = new ModelingDataContext(connection)) {
    8477        model = new Model(target, algo);
    85         model.TrainingSamplesStart = trainingSamplesStart;
    86         model.TrainingSamplesEnd = trainingSamplesEnd;
    87         model.ValidationSamplesStart = validationSamplesStart;
    88         model.ValidationSamplesEnd = validationSamplesEnd;
    89         model.TestSamplesStart = testSamplesStart;
    90         model.TestSamplesEnd = testSamplesEnd;
     78        model.TrainingSamplesStart = algorithm.Model.TrainingSamplesStart;
     79        model.TrainingSamplesEnd = algorithm.Model.TrainingSamplesEnd;
     80        model.ValidationSamplesStart = algorithm.Model.ValidationSamplesStart;
     81        model.ValidationSamplesEnd = algorithm.Model.ValidationSamplesEnd;
     82        model.TestSamplesStart = algorithm.Model.TestSamplesStart;
     83        model.TestSamplesEnd = algorithm.Model.TestSamplesEnd;
    9184
    9285        ctx.Models.InsertOnSubmit(model);
  • trunk/sources/HeuristicLab.Modeling/3.2/IModel.cs

    r2223 r2270  
    3131    string TargetVariable { get; }
    3232    IEnumerable<string> InputVariables { get; }
     33    int TrainingSamplesStart { get; set; }
     34    int TrainingSamplesEnd { get; set; }
     35    int ValidationSamplesStart { get; set; }
     36    int ValidationSamplesEnd { get; set; }
     37    int TestSamplesStart { get; set; }
     38    int TestSamplesEnd { get; set; }
    3339    double TrainingMeanSquaredError { get; }
    3440    double ValidationMeanSquaredError { get; }
  • trunk/sources/HeuristicLab.Modeling/3.2/Model.cs

    r2223 r2270  
    4646      get { return inputVariables; }
    4747    }
     48
     49    public int TrainingSamplesStart { get; set; }
     50    public int TrainingSamplesEnd { get; set; }
     51    public int ValidationSamplesStart { get; set; }
     52    public int ValidationSamplesEnd { get; set; }
     53    public int TestSamplesStart { get; set; }
     54    public int TestSamplesEnd { get; set; }
    4855
    4956    public void AddInputVariables(string variableName) {
  • trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorRegression.cs

    r2251 r2270  
    162162      modelScopeCreator.AddVariable(new HeuristicLab.Core.Variable("SubScopes", new IntData(1)));
    163163      main.AddSubOperator(modelScopeCreator);
    164      
     164
    165165      SequentialSubScopesProcessor seqSubScopesProc = new SequentialSubScopesProcessor();
    166166      IOperator modelProcessor = CreateModelProcessor();
     
    238238      nuBranch.Name = "NuLoop";
    239239      nuBranch.GetVariableInfo("Condition").ActualName = "RepeatNuLoop";
    240      
     240
    241241      nuBranch.AddSubOperator(nuLoop);
    242242      nuLoop.AddSubOperator(nuBranch);
     
    362362      progOp.RemoveVariableInfo("Result");
    363363      progOp.AddVariableInfo(new VariableInfo("Value", "Value", typeof(IntData), VariableKind.In | VariableKind.Out));
    364       progOp.Code = "Value.Data = "+value+";";
     364      progOp.Code = "Value.Data = " + value + ";";
    365365      progOp.GetVariableInfo("Value").ActualName = paramName;
    366366      return progOp;
     
    443443      model.Dataset = ds;
    444444      model.TargetVariable = ds.GetVariableName(bestModelScope.GetVariableValue<IntData>("TargetVariable", true).Data);
     445      model.TrainingSamplesStart = bestModelScope.GetVariableValue<IntData>("TrainingSamplesStart", true).Data;
     446      model.TrainingSamplesEnd = bestModelScope.GetVariableValue<IntData>("TrainingSamplesEnd", true).Data;
     447      model.ValidationSamplesStart = bestModelScope.GetVariableValue<IntData>("ValidationSamplesStart", true).Data;
     448      model.ValidationSamplesEnd = bestModelScope.GetVariableValue<IntData>("ValidationSamplesEnd", true).Data;
     449      model.TestSamplesStart = bestModelScope.GetVariableValue<IntData>("TestSamplesStart", true).Data;
     450      model.TestSamplesEnd = bestModelScope.GetVariableValue<IntData>("TestSamplesEnd", true).Data;
    445451
    446452      ItemList evaluationImpacts = bestModelScope.GetVariableValue<ItemList>("VariableEvaluationImpacts", false);
Note: See TracChangeset for help on using the changeset viewer.