Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16212 for branches


Ignore:
Timestamp:
10/06/18 08:10:08 (6 years ago)
Author:
gkronber
Message:

#2929 several fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2929_PrioritizedGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.PGE/3.3/PGE.cs

    r16200 r16212  
    285285
    286286
    287       int nTrainData = Problem.ProblemData.TrainingPartition.Size;
    288       int nTestData = Problem.ProblemData.TestPartition.Size;
    289287
    290288      //Constants
    291289      int sortType = 0;
    292290      string problemTypeString = "benchmark";
    293       int NumProcs = 12;
     291      int numProc = 12;
    294292      string problemName = Problem.ProblemData.Name;
    295293
    296 
    297       int indepLen = Problem.ProblemData.AllowedInputVariables.Count();
    298294
    299295      var problemData = Problem.ProblemData;
    300296      var variables = problemData.AllowedInputVariables.Concat(new string[] { problemData.TargetVariable });
    301297      // no idea why the following are IntPtr, this should not be necessary for marshalling, it should be ok to just send the double[,]
    302       IntPtr trainData = GetData(problemData.Dataset, variables, problemData.TrainingIndices);
    303       IntPtr testData = GetData(problemData.Dataset, variables, problemData.TestIndices);
    304 
    305       int numberOfUseableVariables = problemData.AllowedInputVariables.Count();
     298      int nTrainData;
     299      int nTestData;
     300      IntPtr trainData = GetData(problemData.Dataset, variables, problemData.TrainingIndices, out nTrainData);
     301      IntPtr testData = GetData(problemData.Dataset, variables, problemData.TestIndices, out nTestData);
     302
    306303      var inputVariableNames = string.Join(" ", problemData.AllowedInputVariables);
    307304      // TODO: does this work when input variables contain spaces?
     
    325322
    326323
     324
    327325      AddTestData(cIndepNames, cDependentNames, testData, nTestData);
    328326
    329327      AddTrainData(cIndepNames, cDependentNames, trainData, nTrainData);
    330328
    331       IntPtr cUseableVars = GetUsableVars(problemData.AllowedInputVariables.Count());
     329      int numberOfUseableVariables = problemData.AllowedInputVariables.Count();
     330      IntPtr cUseableVars = GetUsableVars(numberOfUseableVariables);
    332331
    333332      InitSearch(MaxGen, PgeRptEpoch, PgeRptCount, PgeArchiveCap, PeelCnt, EvalrCount, ZeroEpsilon, cInitMethod, cGrowMethod, sortType);
    334333
     334      // cUsableVars: list of indices into dependent variables
    335335      InitTreeParams(cRoots, cNodes, cNonTrig, cLeafs, cUseableVars, numberOfUseableVariables, MaxSize, MinSize, MaxDepth, MinDepth);
    336336
    337       InitProblem(cName, MaxIterations, HitRatio, SearchVar, cProblemTypeString, NumProcs);
     337      // SearchVar: list of indices into independent variables (0 for first index)
     338      InitProblem(cName, MaxIterations, HitRatio, SearchVar, cProblemTypeString, numProc);
    338339
    339340      var curItersItem = new IntValue();
     
    408409    }
    409410
    410     private static IntPtr GetData(IDataset ds, IEnumerable<string> variableNames, IEnumerable<int> rows) {
     411    private static IntPtr GetData(IDataset ds, IEnumerable<string> variableNames, IEnumerable<int> rows, out int n) {
    411412
    412413      var dim = variableNames.Count();
     
    421422        r++;
    422423      }
    423      
     424
     425      n = val.Length;
    424426
    425427      // TODO: seems strange to marshal this explicitly, we can just send the data over to PGE
Note: See TracChangeset for help on using the changeset viewer.