-
Notifications
You must be signed in to change notification settings - Fork 0
/
Arguments.py
94 lines (80 loc) · 1.91 KB
/
Arguments.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
from sys import argv
#
# By using this file, you are agreeing to this product's EULA
#
# This product can be obtained in https://github.com/jespb/Python-GSGP
#
# Copyright ©2019-2023 J. E. Batista
#
OPERATORS = [("+",2),("-",2),("*",2),("/",2)]
MAX_DEPTH = 6 # max depth of the initial trees
POPULATION_SIZE = 500
MAX_GENERATION = 1000
TOURNAMENT_SIZE = 10
ELITISM_SIZE = 1
MUTATION_STEP = 0.01
THREADS = 1
VERBOSE = True
RUNS = 30
SHUFFLE = True
TRAIN_FRACTION = 0.70
DATASETS_DIR = "datasets/"
OUTPUT_DIR = "results/"
DATASETS = ["heart.csv"]
OUTPUT = "Classification"
if "-dsdir" in argv:
DATASETS_DIR = argv[argv.index("-dsdir")+1]
if "-odir" in argv:
OUTPUT_DIR = argv[argv.index("-odir")+1]
if "-d" in argv:
DATASETS = argv[argv.index("-d")+1].split(";")
if "-r" in argv:
OUTPUT = "Regression"
if "-runs" in argv:
RUNS = int(argv[argv.index("-runs")+1])
if "-op" in argv:
OPERATORS = argv[argv.index("-op")+1].split(";")
if "-md" in argv:
MAX_DEPTH = int(argv[argv.index("-md")+1])
if "-ps" in argv:
POPULATION_SIZE = int(argv[argv.index("-ps")+1])
if "-mg" in argv:
MAX_GENERATION = int(argv[argv.index("-mg")+1])
if "-tf" in argv:
TRAIN_FRACTION = float(argv[argv.index("-train")+1])
if "-ts" in argv:
TOURNAMENT_SIZE = int(argv[argv.index("-ts")+1])
if "-es" in argv:
ELITISM_SIZE = int(argv[argv.index("-es")+1])
if "-dontshuffle" in argv:
SHUFFLE = False
if "-ms" in argv:
MUTATION_STEP = float(argv[argv.index("-ms")+1])
out = None
def openFile(name):
global out
out = open(name,"w")
def writeToFile(msg):
global out
out.write(msg)
def closeFile():
global out
out.close()
terminals = None
def setTerminals(l):
global terminals
terminals = l
def getTerminals():
return terminals
trainingSet = None
def setTrainingSet(ds):
global trainingSet
trainingSet = ds
def getTrainingSet():
return trainingSet
testSet = None
def setTestSet(ds):
global testSet
testSet = ds
def getTestSet():
return testSet