-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrain.bat
150 lines (136 loc) · 3.4 KB
/
train.bat
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
@echo off
prompt $
cls
title OddOrEven AI Training [ Getting Ready ]
set values=""
goto :warningGOTO
:checkInt
setlocal
set "input=%~1"
set /a num=%input% 2>nul
if "%input%" neq "%num%" (
endlocal & set "error=1"
) else (
endlocal & set "error=0"
)
goto :eof
:checkFloat
echo %~1 | python -c "import sys; sys.exit(1 if not isinstance(float(sys.stdin.read().strip()), float) else 0)"
if errorlevel 1 (
set "error=1"
) else (
set "error=0"
)
goto :eof
:warningGOTO
cls
echo WARNING: Beware of overfitting and underfitting.
echo Do /back when you want to go back a question
echo.
echo Overfitting is the AI memorizing the data rather than learning
echo Underfitting is the AI not being able to learn the data due to too little neurons or layers
echo.
pause
cls
:hiddenLayerCountGOTO
echo How many Hidden Layers do you want? (Default is 2)
set /p hiddenLayerCount=
if /i "%hiddenLayerCount%" == "/back" (
cls
goto warningGOTO
)
call :checkInt %hiddenLayerCount%
if "%error%" == "1" (
cls
echo Invalid input. Please enter an integer value.
echo.
goto hiddenLayerCountGOTO
)
if %hiddenLayerCount% leq 0 (
cls
echo Invalid input. Hidden layer count must be greater than 0.
echo.
goto hiddenLayerCountGOTO
)
cls
:hiddenLayerNeuronCountGOTO
echo Input as a list: 64, 48, 32, 24, etc...
echo.
echo How many Hidden Layer Neurons do you want? (Default is 24, 16)
set /p hiddenLayerNeuronCount=
if /i "%hiddenLayerNeuronCount%" == "/back" (
cls
goto hiddenLayerCountGOTO
)
:: Remove all spaces from hiddenLayerNeuronCount
set "hiddenLayerNeuronCount=%hiddenLayerNeuronCount: =%"
set "validList=1"
set "neuronCount=0"
for %%a in (%hiddenLayerNeuronCount%) do (
call :checkInt %%a
if "%error%" == "1" (
set "validList=0"
cls
echo Invalid input. Each hidden layer neuron count must be an integer.
echo.
goto hiddenLayerNeuronCountGOTO
)
set /a neuronCount+=1
)
if %neuronCount% neq %hiddenLayerCount% (
cls
echo Invalid input. Number of neuron counts must match the number of hidden layers.
echo.
goto hiddenLayerNeuronCountGOTO
)
cls
:learningRateGOTO
echo What learning rate? (Default is 0.01)
set /p learningRate=
if /i "%learningRate%" == "/back" (
cls
goto hiddenLayerNeuronCountGOTO
)
call :checkFloat %learningRate%
if "%error%" == "1" (
cls
echo Invalid input. Please enter a float value.
echo.
goto learningRateGOTO
)
cls
:epochsGOTO
echo How many epochs do you want? (Default is 100)
set /p epochs=
if /i "%epochs%" == "/back" (
cls
goto learningRateGOTO
)
call :checkInt %epochs%
if "%error%" == "1" (
cls
echo Invalid input. Please enter an integer value.
echo.
goto epochsGOTO
)
cls
:batchSizeGOTO
echo What is the batch size? (Default is 10)
set /p batchSize=
if /i "%batchSize%" == "/back" (
cls
goto epochsGOTO
)
call :checkInt %batchSize%
if "%error%" == "1" (
cls
echo Invalid input. Please enter an integer value.
echo.
goto batchSizeGOTO
)
cls
set inputLayerNeuronCount=32
set outputLayerNeuronCount=2
title OddOrEven AI Training [ Training... ]
py .\\src\\train.py %inputLayerNeuronCount% %outputLayerNeuronCount% %hiddenLayerCount% [%hiddenLayerNeuronCount%] %learningRate% %epochs% %batchSize%
pause