Changeset 2440 for trunk/sources/HeuristicLab.GP.StructureIdentification
- Timestamp:
- 10/20/09 11:20:13 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.GP.StructureIdentification/3.3
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/Evaluators/GPEvaluatorBase.cs
r2341 r2440 32 32 AddVariableInfo(new VariableInfo("FunctionTree", "The function tree that should be evaluated", typeof(IGeneticProgrammingModel), VariableKind.In)); 33 33 AddVariableInfo(new VariableInfo("Dataset", "Dataset with all samples on which to apply the function", typeof(Dataset), VariableKind.In)); 34 AddVariableInfo(new VariableInfo("TargetVariable", " Index of the column of the dataset that holds the target variable", typeof(IntData), VariableKind.In));34 AddVariableInfo(new VariableInfo("TargetVariable", "Name of the target variable", typeof(StringData), VariableKind.In)); 35 35 AddVariableInfo(new VariableInfo("TotalEvaluatedNodes", "Number of evaluated nodes", typeof(DoubleData), VariableKind.In | VariableKind.Out)); 36 36 AddVariableInfo(new VariableInfo("SamplesStart", "Start index of samples in dataset to evaluate", typeof(IntData), VariableKind.In)); … … 41 41 public override IOperation Apply(IScope scope) { 42 42 // get all variable values 43 int targetVariable = GetVariableValue<IntData>("TargetVariable", scope, true).Data;44 43 Dataset dataset = GetVariableValue<Dataset>("Dataset", scope, true); 44 int targetVariable = dataset.GetVariableIndex(GetVariableValue<StringData>("TargetVariable", scope, true).Data); 45 45 IGeneticProgrammingModel gpModel = GetVariableValue<IGeneticProgrammingModel>("FunctionTree", scope, true); 46 46 double totalEvaluatedNodes = scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data; -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/HL2TreeEvaluatorInjector.cs
r2327 r2440 37 37 AddVariableInfo(new VariableInfo("TrainingSamplesStart", "Start index of training set", typeof(DoubleData), VariableKind.In)); 38 38 AddVariableInfo(new VariableInfo("TrainingSamplesEnd", "End index of training set", typeof(DoubleData), VariableKind.In)); 39 AddVariableInfo(new VariableInfo("TargetVariable", " Index of the target variable", typeof(IntData), VariableKind.In));39 AddVariableInfo(new VariableInfo("TargetVariable", "Name of the target variable", typeof(StringData), VariableKind.In)); 40 40 AddVariableInfo(new VariableInfo("PunishmentFactor", "The punishment factor limits the estimated values to a certain range", typeof(DoubleData), VariableKind.In)); 41 41 AddVariableInfo(new VariableInfo("TreeEvaluator", "The tree evaluator to evaluate models", typeof(ITreeEvaluator), VariableKind.New)); … … 51 51 int start = GetVariableValue<IntData>("TrainingSamplesStart", scope, true).Data; 52 52 int end = GetVariableValue<IntData>("TrainingSamplesEnd", scope, true).Data; 53 int targetVariable = GetVariableValue<IntData>("TargetVariable", scope, true).Data;53 string targetVariable = GetVariableValue<StringData>("TargetVariable", scope, true).Data; 54 54 double mean = dataset.GetMean(targetVariable, start, end); 55 55 double range = dataset.GetRange(targetVariable, start, end); -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/HL3TreeEvaluatorInjector.cs
r2327 r2440 37 37 AddVariableInfo(new VariableInfo("TrainingSamplesStart", "Start index of training set", typeof(DoubleData), VariableKind.In)); 38 38 AddVariableInfo(new VariableInfo("TrainingSamplesEnd", "End index of training set", typeof(DoubleData), VariableKind.In)); 39 AddVariableInfo(new VariableInfo("TargetVariable", " Index of the target variable", typeof(IntData), VariableKind.In));39 AddVariableInfo(new VariableInfo("TargetVariable", "Name of the target variable", typeof(StringData), VariableKind.In)); 40 40 AddVariableInfo(new VariableInfo("PunishmentFactor", "The punishment factor limits the estimated values to a certain range", typeof(DoubleData), VariableKind.In)); 41 41 AddVariableInfo(new VariableInfo("TreeEvaluator", "The tree evaluator to evaluate models", typeof(ITreeEvaluator), VariableKind.New)); … … 51 51 int start = GetVariableValue<IntData>("TrainingSamplesStart", scope, true).Data; 52 52 int end = GetVariableValue<IntData>("TrainingSamplesEnd", scope, true).Data; 53 int targetVariable = GetVariableValue<IntData>("TargetVariable", scope, true).Data;53 string targetVariable = GetVariableValue<StringData>("TargetVariable", scope, true).Data; 54 54 double mean = dataset.GetMean(targetVariable, start, end); 55 55 double range = dataset.GetRange(targetVariable, start, end); -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/OffspringSelectionGPRegression.cs
r2419 r2440 39 39 public override string Name { get { return "OffspringSelectionGP - StructureIdentification"; } } 40 40 41 public virtual intTargetVariable {42 get { return ProblemInjector.GetVariableValue< IntData>("TargetVariable", null, false).Data; }43 set { ProblemInjector.GetVariableValue< IntData>("TargetVariable", null, false).Data = value; }41 public virtual string TargetVariable { 42 get { return ProblemInjector.GetVariableValue<StringData>("TargetVariable", null, false).Data; } 43 set { ProblemInjector.GetVariableValue<StringData>("TargetVariable", null, false).Data = value; } 44 44 } 45 45 … … 57 57 } 58 58 } 59 public IEnumerable< int> AllowedVariables {59 public IEnumerable<string> AllowedVariables { 60 60 get { 61 ItemList< IntData> allowedVariables = ProblemInjector.GetVariableValue<ItemList<IntData>>("AllowedFeatures", null, false);61 ItemList<StringData> allowedVariables = ProblemInjector.GetVariableValue<ItemList<StringData>>("AllowedFeatures", null, false); 62 62 return allowedVariables.Select(x => x.Data); 63 63 } 64 64 set { 65 ItemList< IntData> allowedVariables = ProblemInjector.GetVariableValue<ItemList<IntData>>("AllowedFeatures", null, false);66 foreach ( int x in value) allowedVariables.Add(new IntData(x));65 ItemList<StringData> allowedVariables = ProblemInjector.GetVariableValue<ItemList<StringData>>("AllowedFeatures", null, false); 66 foreach (string x in value) allowedVariables.Add(new StringData(x)); 67 67 } 68 68 } -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/PredictorBuilder.cs
r2332 r2440 40 40 AddVariableInfo(new VariableInfo("TrainingSamplesStart", "Start index of training set", typeof(DoubleData), VariableKind.In)); 41 41 AddVariableInfo(new VariableInfo("TrainingSamplesEnd", "End index of training set", typeof(DoubleData), VariableKind.In)); 42 AddVariableInfo(new VariableInfo("TargetVariable", " Index of the target variable", typeof(IntData), VariableKind.In));42 AddVariableInfo(new VariableInfo("TargetVariable", "Name of the target variable", typeof(StringData), VariableKind.In)); 43 43 AddVariableInfo(new VariableInfo("Predictor", "The predictor combines the function tree and the evaluator and can be used to generate estimated values", typeof(IPredictor), VariableKind.New)); 44 44 } … … 55 55 int start = GetVariableValue<IntData>("TrainingSamplesStart", scope, true).Data; 56 56 int end = GetVariableValue<IntData>("TrainingSamplesEnd", scope, true).Data; 57 int targetVariable = GetVariableValue<IntData>("TargetVariable", scope, true).Data;57 string targetVariable = GetVariableValue<StringData>("TargetVariable", scope, true).Data; 58 58 IPredictor predictor = CreatePredictor(model, evaluator, punishmentFactor, dataset, targetVariable, start, end); 59 59 scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("Predictor"), predictor)); -
trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/StandardGPRegression.cs
r2419 r2440 39 39 public override string Name { get { return "StandardGP - StructureIdentification"; } } 40 40 41 public virtual intTargetVariable {42 get { return ProblemInjector.GetVariableValue< IntData>("TargetVariable", null, false).Data; }43 set { ProblemInjector.GetVariableValue< IntData>("TargetVariable", null, false).Data = value; }41 public virtual string TargetVariable { 42 get { return ProblemInjector.GetVariableValue<StringData>("TargetVariable", null, false).Data; } 43 set { ProblemInjector.GetVariableValue<StringData>("TargetVariable", null, false).Data = value; } 44 44 } 45 45 … … 58 58 } 59 59 60 public IEnumerable< int> AllowedVariables {60 public IEnumerable<string> AllowedVariables { 61 61 get { 62 ItemList< IntData> allowedVariables = ProblemInjector.GetVariableValue<ItemList<IntData>>("AllowedFeatures", null, false);62 ItemList<StringData> allowedVariables = ProblemInjector.GetVariableValue<ItemList<StringData>>("AllowedFeatures", null, false); 63 63 return allowedVariables.Select(x => x.Data); 64 64 } 65 65 set { 66 ItemList< IntData> allowedVariables = ProblemInjector.GetVariableValue<ItemList<IntData>>("AllowedFeatures", null, false);67 foreach ( int x in value) allowedVariables.Add(new IntData(x));66 ItemList<StringData> allowedVariables = ProblemInjector.GetVariableValue<ItemList<StringData>>("AllowedFeatures", null, false); 67 foreach (string x in value) allowedVariables.Add(new StringData(x)); 68 68 } 69 69 }
Note: See TracChangeset
for help on using the changeset viewer.