- Timestamp:
- 10/06/18 08:10:08 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2929_PrioritizedGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.PGE/3.3/PGE.cs
r16200 r16212 285 285 286 286 287 int nTrainData = Problem.ProblemData.TrainingPartition.Size;288 int nTestData = Problem.ProblemData.TestPartition.Size;289 287 290 288 //Constants 291 289 int sortType = 0; 292 290 string problemTypeString = "benchmark"; 293 int NumProcs= 12;291 int numProc = 12; 294 292 string problemName = Problem.ProblemData.Name; 295 293 296 297 int indepLen = Problem.ProblemData.AllowedInputVariables.Count();298 294 299 295 var problemData = Problem.ProblemData; 300 296 var variables = problemData.AllowedInputVariables.Concat(new string[] { problemData.TargetVariable }); 301 297 // 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 306 303 var inputVariableNames = string.Join(" ", problemData.AllowedInputVariables); 307 304 // TODO: does this work when input variables contain spaces? … … 325 322 326 323 324 327 325 AddTestData(cIndepNames, cDependentNames, testData, nTestData); 328 326 329 327 AddTrainData(cIndepNames, cDependentNames, trainData, nTrainData); 330 328 331 IntPtr cUseableVars = GetUsableVars(problemData.AllowedInputVariables.Count()); 329 int numberOfUseableVariables = problemData.AllowedInputVariables.Count(); 330 IntPtr cUseableVars = GetUsableVars(numberOfUseableVariables); 332 331 333 332 InitSearch(MaxGen, PgeRptEpoch, PgeRptCount, PgeArchiveCap, PeelCnt, EvalrCount, ZeroEpsilon, cInitMethod, cGrowMethod, sortType); 334 333 334 // cUsableVars: list of indices into dependent variables 335 335 InitTreeParams(cRoots, cNodes, cNonTrig, cLeafs, cUseableVars, numberOfUseableVariables, MaxSize, MinSize, MaxDepth, MinDepth); 336 336 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); 338 339 339 340 var curItersItem = new IntValue(); … … 408 409 } 409 410 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) { 411 412 412 413 var dim = variableNames.Count(); … … 421 422 r++; 422 423 } 423 424 425 n = val.Length; 424 426 425 427 // 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.