-
Notifications
You must be signed in to change notification settings - Fork 9
/
Arguments.py
119 lines (77 loc) · 2.46 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
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-StdGP
#
# Copyright ©2019-2022 J. E. Batista
#
# Operators to be used by the models
# Only these operators are available. To add mode, edit m3gp.Node.calculate(self, sample)
#OPERATORS = [("+",2),("-",2),("*",2),("/",2),("log2",1), ("max", 3)] # Example
OPERATORS = [("+",2),("-",2),("*",2),("/",2)] # Default
# Initial Maximum depth
MAX_DEPTH = 6
# Number of models in the population
POPULATION_SIZE = 500
# Maximum number of iterations
MAX_GENERATION = 100
# Fraction of the dataset to be used as training (used by Main_M3GP_standalone.py)
TRAIN_FRACTION = 0.70
# Number of individuals to be used in the tournament
TOURNAMENT_SIZE = 5
# Number of best individuals to be automatically moved to the next generation
ELITISM_SIZE = 1
# Shuffle the dataset (used by Main_M3GP_standalone.py)
SHUFFLE = True
# Dimensions maximum depth
LIMIT_DEPTH=17
# Number of runs (used by Main_M3GP_standalone.py)
RUNS = 30
# Verbose
VERBOSE = True
# Number of CPU Threads to be used
THREADS = 1
# Random state
RANDOM_STATE = 42
# Models wrapped by the StdGP models
MODEL_NAME = ["SimpleThresholdClassifier"][0]
# Fitness used by the M3GP models
FITNESS_TYPE = ["Accuracy", "MSE", "WAF", "2FOLD"][0]
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 "-runs" in argv:
RUNS = int(argv[argv.index("-runs")+1])
if "-op" in argv:
OPERATORS = argv[argv.index("-op")+1].split(";")
for i in range(len(OPERATORS)):
OPERATORS[i] = OPERATORS[i].split(",")
OPERATORS[i][1] = int(OPERATORS[i][1])
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("-tf")+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 "-s" in argv:
VERBOSE = False
if "-t" in argv:
THREADS = int(argv[argv.index("-t")+1])
if "-rs" in argv:
RANDOM_STATE = int(argv[argv.index("-rs")+1])