Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/08/09 16:22:35 (15 years ago)
Author:
gkronber
Message:

Fixed bugs related to time series prognosis with SVMs. And fixed an exception when trying to save time-series models to the database. #776 (Error when trying to save time-series prognosis predictors to the database)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.SupportVectorMachines/3.2/PredictorBuilder.cs

    r2373 r2421  
    3636      AddVariableInfo(new VariableInfo("SVMModel", "The SVM model", typeof(SVMModel), VariableKind.In));
    3737      AddVariableInfo(new VariableInfo("TargetVariable", "The target variable", typeof(StringData), VariableKind.In));
    38       AddVariableInfo(new VariableInfo("InputVariables", "The input variable names", typeof(StringData), VariableKind.In));
     38      AddVariableInfo(new VariableInfo("InputVariables", "The input variable names", typeof(ItemList), VariableKind.In));
    3939      AddVariableInfo(new VariableInfo("TrainingSamplesStart", "Start index of the training set", typeof(IntData), VariableKind.In));
    4040      AddVariableInfo(new VariableInfo("TrainingSamplesEnd", "End index of the training set", typeof(IntData), VariableKind.In));
     
    6363      string targetVariableName = ds.GetVariableName(targetVariable);
    6464      ItemList inputVariables = GetVariableValue<ItemList>("InputVariables", scope, true);
    65       Dictionary<string, int> variableNames = new Dictionary<string, int>();
    66       for (int i = 0; i < ds.Columns; i++) variableNames[ds.GetVariableName(i)] = i;
     65      var inputVariableNames = from x in inputVariables
     66                               select ((StringData)x).Data;
    6767
    6868      double mean = ds.GetMean(targetVariable, start, end);
    6969      double range = ds.GetRange(targetVariable, start, end);
    7070
    71       Predictor predictor = new Predictor(model, targetVariableName, variableNames, minTimeOffset, maxTimeOffset);
     71      Predictor predictor = new Predictor(model, targetVariableName, inputVariableNames, minTimeOffset, maxTimeOffset);
    7272      predictor.LowerPredictionLimit = mean - punishmentFactor * range;
    7373      predictor.UpperPredictionLimit = mean + punishmentFactor * range;
Note: See TracChangeset for help on using the changeset viewer.