- Timestamp:
- 09/25/18 11:28:51 (6 years ago)
- Location:
- branches/2929_PrioritizedGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.PGE/3.3/go-code/go-pge/problems
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2929_PrioritizedGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.PGE/3.3/go-code/go-pge/problems/data.go
r16080 r16183 8 8 "math/rand" 9 9 "os" 10 "C" 11 "unsafe" 10 12 ) 11 13 … … 126 128 } 127 129 130 func (trainData *PointSet) InitTrainData(indepNames []string, depndNames []string, matrix unsafe.Pointer, nEntries int) { 131 trainData.indepNames = indepNames //First line in .trn file 132 trainData.numDim = len(trainData.indepNames) 133 trainData.depndNames = depndNames //Second line in .trn file 134 fmt.Printf("Var Names = %v | %v\n", trainData.depndNames, trainData.indepNames) 135 var nClum int = len(indepNames) + len(depndNames) 136 137 for i := 0; i < nEntries; i++ { 138 var pnt Point 139 for j := 0; j < len(trainData.indepNames); j++ { 140 elemNr := i * nClum + j 141 item := (*float64) (unsafe.Pointer( uintptr(unsafe.Pointer(matrix)) + unsafe.Sizeof(float64(0)) * uintptr(elemNr) )) 142 pnt.indep = append(pnt.indep, *item) 143 } 144 145 for j := len(trainData.indepNames); j < (len(trainData.indepNames) + len(trainData.depndNames)); j++ { 146 elemNr := i * nClum + j 147 item := (*float64) (unsafe.Pointer( uintptr(unsafe.Pointer(matrix)) + unsafe.Sizeof(float64(0)) * uintptr(elemNr) )) 148 pnt.depnd = append(pnt.depnd, *item ) 149 } 150 151 if len(pnt.indep) > 0 { 152 trainData.dataPoints = append(trainData.dataPoints, pnt) 153 } 154 } 155 fmt.Printf("Num Points: %v\n", len(trainData.dataPoints)) 156 } 157 128 158 func (d *PointSet) ReadPointSet(filename string) { 129 159 ftotal, err := os.OpenFile(filename, os.O_RDONLY, 0) -
branches/2929_PrioritizedGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.PGE/3.3/go-code/go-pge/problems/problem.go
r16080 r16183 166 166 return list[0:i] 167 167 } 168 169 170 func (ep *ExprProblem) CreatePS(Name string, MaxIter int, HitRatio float64, SearchVar int, ProblemTypeString string) { //IndepNames []string, DepndNames []string, SysNames []string 171 ep.SearchType = ProblemTypeFromString(ProblemTypeString) 172 ep.Name = Name 173 174 ep.TrainFns = append(ep.TrainFns, "dummy") 175 ep.TestFns = append(ep.TestFns, "dummy") 176 177 ep.MaxIter = MaxIter 178 ep.HitRatio = HitRatio 179 ep.SearchVar = SearchVar 180 } -
branches/2929_PrioritizedGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.PGE/3.3/go-code/go-pge/problems/treeparams.go
r16080 r16183 297 297 tp.TmpMinSize, tp.TmpMinDepth = tp.MinSize, tp.MinDepth 298 298 } 299 300 301 func (TP *TreeParams) CreateTreeParams(Roots string, Nodes string, NonTrig string, Leafs string, UsableVars []int, MaxSize int, MinSize int, MaxDepth int, MinDepth int) { 302 TP.RootsS = strings.Fields(Roots) 303 TP.RootsT, TP.Roots = fillExprStuff(TP.RootsS) 304 305 TP.NodesS = strings.Fields(Nodes) 306 TP.NodesT, TP.Nodes = fillExprStuff(TP.NodesS) 307 308 TP.NonTrigS = strings.Fields(NonTrig) 309 TP.NonTrigT, TP.NonTrig = fillExprStuff(TP.NonTrigS) 310 311 TP.LeafsS = strings.Fields(Leafs) 312 TP.LeafsT, TP.Leafs = fillExprStuff(TP.LeafsS) 313 314 TP.UsableVars = UsableVars 315 316 TP.MaxSize = MaxSize 317 TP.MinSize = MinSize 318 TP.MaxDepth = MaxDepth 319 TP.MinDepth = MinDepth 320 }
Note: See TracChangeset
for help on using the changeset viewer.