-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
326 lines (273 loc) · 11.7 KB
/
Makefile
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
###########################################
# MAKEFILE #
# #
# AUTHORS: Ares Aguilar Sotos #
# Daniel Gimenez Llorente #
###########################################
# ARGUMENTS
INPUT_FILE ?= no_input
OUTPUT_FILE ?= out/out.txt
# INPUT FILES
P1_FILE = data/databases/problema_real1.txt
P2_FILE = data/databases/problema_real2.txt
P2_NE_FILE = data/databases/problema_real2_no_etiquetados.txt
P3_FILE = data/databases/problema-real-3clases.txt
P4_FILE = data/databases/problema-real4.txt
NAND_FILE = data/databases/nand.txt
NOR_FILE = data/databases/nor.txt
XOR_FILE = data/databases/xor.txt
PERCEPTRON_FILE = data/models/perceptron.txt
ADALINE_FILE = data/models/adaline.txt
MULTILAYER_FILE = data/models/multilayer.txt
# DIRECTORIES
IDIR = include
SDIR = src
ODIR = obj
BDIR = bin
# FILES
TARGET = neural-network
SOURCES := $(wildcard $(SDIR)/*.c)
INCLUDES := $(wildcard $(IDIR)/*.h)
OBJECTS := $(SOURCES:$(SDIR)/%.c=$(ODIR)/%.o)
CHK_SOURCES := $(SOURCES) $(INCLUDES)
# VARIABLES
# Compiler
CC = gcc -c
CFLAGS = -Wall -I$(IDIR)
# Linker
LINKER = gcc -o
LFLAGS = -Wall -I$(IDIR) -lm
# Others
rm = rm -f
ln = ln -sf
# Compiles all programs in project
compile: $(BDIR)/$(TARGET)
@$(ln) $(BDIR)/$(TARGET) $(TARGET)
@echo "INFO: All targets compiled"
$(BDIR)/$(TARGET): $(OBJECTS)
@$(LINKER) $@ $(OBJECTS) $(LFLAGS)
@echo "INFO: Linking completed"
$(OBJECTS):$(ODIR)/%.o: $(SDIR)/%.c
@$(CC) $(CFLAGS) -c $< -o $@
@echo "INFO: Compiled "$<" successfully"
# P1
# P1.2 McCulloch-Pitts Network
# p1.2-mcculloch-pits: compile
# ifeq ($(INPUT_FILE),no_input)
# ./$(TARGET) --preset mcculloch --output-file $(OUTPUT_FILE)
# else
# ./$(TARGET) --preset mcculloch --input-file $(INPUT_FILE) --output-file $(OUTPUT_FILE)
# endif
# # P1.3.1 Perceptron
# p1.3.1-perceptron: compile
# ifeq ($(INPUT_FILE),no_input)
# ./$(TARGET) --mode perceptron --input-file $(P1_FILE) --output-file $(OUTPUT_FILE)
# else
# ./$(TARGET) --mode perceptron --input-file $(INPUT_FILE) --output-file $(OUTPUT_FILE)
# endif
# # P1.3.1 Adelaide
# p1.3.1-adaline: compile
# ifeq ($(INPUT_FILE),no_input)
# ./$(TARGET) --mode adaline --input-file $(P1_FILE) --output-file $(OUTPUT_FILE)
# else
# ./$(TARGET) --mode adaline --input-file $(INPUT_FILE) --output-file $(OUTPUT_FILE)
# endif
# # P1.3.2 NAND
# p1.3.2-nand: compile
# ifeq ($(INPUT_FILE),no_input)
# ./$(TARGET) --mode perceptron --input-file $(NAND_FILE) --output-file $(OUTPUT_FILE) -t 100
# else
# ./$(TARGET) --mode perceptron --input-file $(INPUT_FILE) --output-file $(OUTPUT_FILE) -t 100
# endif
# # P1.3.2 NOR
# p1.3.2-nor: compile
# ifeq ($(INPUT_FILE),no_input)
# ./$(TARGET) --mode perceptron --input-file $(NOR_FILE) --output-file $(OUTPUT_FILE) -t 100
# else
# ./$(TARGET) --mode perceptron --input-file $(INPUT_FILE) --output-file $(OUTPUT_FILE) -t 100
# endif
# # P1.3.2 XOR
# p1.3.2-xor: compile
# ifeq ($(INPUT_FILE),no_input)
# ./$(TARGET) --mode perceptron --input-file $(XOR_FILE) --output-file $(OUTPUT_FILE) -t 100
# else
# ./$(TARGET) --mode perceptron --input-file $(INPUT_FILE) --output-file $(OUTPUT_FILE) -t 100
# endif
# # P1.3.3 Perceptron
# p1.3.3-perceptron: compile
# ifeq ($(INPUT_FILE),no_input)
# ./$(TARGET) --mode perceptron --input-file $(P2_FILE) --output-file $(OUTPUT_FILE)
# else
# ./$(TARGET) --mode perceptron --input-file $(INPUT_FILE) --output-file $(OUTPUT_FILE)
# endif
# # P1.3.3 Adelaide
# p1.3.3-adaline: compile
# ifeq ($(INPUT_FILE),no_input)
# ./$(TARGET) --mode adaline --input-file $(P2_FILE) --output-file $(OUTPUT_FILE)
# else
# ./$(TARGET) --mode adaline --input-file $(INPUT_FILE) --output-file $(OUTPUT_FILE)
# endif
# # P1.3.3.1 Predicciones Preceptron
# p1.3.3.1-perceptron-predict: compile
# ifeq ($(INPUT_FILE),no_input)
# ./$(TARGET) --mode perceptron --input-file $(P2_FILE) -s -n $(PERCEPTRON_FILE)
# ./$(TARGET) --mode perceptron --input-file $(P2_NE_FILE) -n $(PERCEPTRON_FILE) -o $(OUTPUT_FILE) -f
# else
# ./$(TARGET) --mode perceptron --input-file $(P2_FILE) -s -n $(PERCEPTRON_FILE)
# ./$(TARGET) --mode perceptron --input-file $(INPUT_FILE) -n $(PERCEPTRON_FILE) -o $(OUTPUT_FILE) -f
# endif
# # P1.3.3.1 Predicciones Adaline
# p1.3.3.1-adaline-predict: compile
# ifeq ($(INPUT_FILE),no_input)
# ./$(TARGET) --mode adaline --input-file $(P2_FILE) -s -n $(ADALINE_FILE)
# ./$(TARGET) --mode adaline --input-file $(P2_NE_FILE) -n $(ADALINE_FILE) -o $(OUTPUT_FILE) -f
# else
# ./$(TARGET) --mode adaline --input-file $(P2_FILE) -s -n $(ADALINE_FILE)
# ./$(TARGET) --mode adaline --input-file $(INPUT_FILE) -n $(ADALINE_FILE) -o $(OUTPUT_FILE) -f
# endif
# P2
# p2: p2.2.1-multilayer4 p2.2.1-multilayer9 p2.2.2-xor p2.2.3-problema2 p2.3-problema3 p2.4-problema4 p2.5-normalizado p2.6-predicciones
# p2.2.1-multilayer4: compile
# ifeq ($(INPUT_FILE),no_input)
# ./$(TARGET) --mode multilayer --input-file $(P2_FILE) -l 0.1 -h 4
# else
# ./$(TARGET) --mode multilayer --input-file $(INPUT_FILE) -l 0.1 -h 4
# endif
# p2.2.1-multilayer9: compile
# ifeq ($(INPUT_FILE),no_input)
# ./$(TARGET) --mode multilayer --input-file $(P2_FILE) -l 0.1 -h 9
# else
# ./$(TARGET) --mode multilayer --input-file $(INPUT_FILE) -l 0.1 -h 9
# endif
# p2.2.2-xor: compile
# ifeq ($(INPUT_FILE),no_input)
# ./$(TARGET) --mode multilayer --input-file $(XOR_FILE) -l 0.02 -h 9 -t 100 -e 6000
# else
# ./$(TARGET) --mode multilayer --input-file $(INPUT_FILE) -l 0.02 -h 9 -t 100 -e 6000
# endif
# p2.2.3-problema2: compile
# ifeq ($(INPUT_FILE),no_input)
# ./$(TARGET) --mode multilayer --input-file $(P2_FILE) -l 0.02 -h 4
# else
# ./$(TARGET) --mode multilayer --input-file $(INPUT_FILE) -l 0.02 -h 4
# endif
# p2.3-problema3: compile
# ifeq ($(INPUT_FILE),no_input)
# ./$(TARGET) --mode multilayer --input-file $(P3_FILE) -l 0.02 -h 9
# else
# ./$(TARGET) --mode multilayer --input-file $(INPUT_FILE) -l 0.02 -h 9
# endif
# p2.4-problema4: compile
# ifeq ($(INPUT_FILE),no_input)
# ./$(TARGET) --mode multilayer --input-file $(P4_FILE) -l 0.02 -h 4
# else
# ./$(TARGET) --mode multilayer --input-file $(INPUT_FILE) -l 0.02 -h 4
# endif
# p2.5-normalizado: compile
# ifeq ($(INPUT_FILE),no_input)
# ./$(TARGET) --mode multilayer --input-file $(P4_FILE) -l 0.02 -h 9 -z
# else
# ./$(TARGET) --mode multilayer --input-file $(INPUT_FILE) -l 0.02 -h 9 -z
# endif
# p2.6-predicciones: compile
# ifeq ($(INPUT_FILE),no_input)
# ./$(TARGET) --mode multilayer --input-file $(P2_FILE) -h 8 -l 0.1 -t 70 -s -n $(MULTILAYER_FILE)
# ./$(TARGET) --mode multilayer --input-file $(P2_NE_FILE) -n $(MULTILAYER_FILE) -o $(OUTPUT_FILE) -f
# else
# ./$(TARGET) --mode multilayer --input-file $(P2_FILE) -h 8 -l 0.1 -t 70 -s -n $(MULTILAYER_FILE)
# ./$(TARGET) --mode multilayer --input-file $(INPUT_FILE) -n $(MULTILAYER_FILE) -o $(OUTPUT_FILE) -f
# endif
p3: p3-databases p3.2.2-alfabeto p3.2.3-alfabeto-ruido1 p3.2.3-alfabeto-ruido3 p3.2.3-alfabeto-ruido5 p3.3.1.1-timeserie1 p3.3.1.1-timeserie2 p3.3.1.1-timeserie5 p3.3.1.2-timeserie1 p3.3.1.2-timeserie2 p3.3.1.2-timeserie5 p3.3.1.3-recursiva p3.3.2.2-timeserie1 p3.3.2.2-timeserie5 p3.3.2.3-timeserie5 p3.3.2.3-timeserie15 p3.3.2.4-recursiva
p3-databases:
gawk -f script/genera-ruido.awk --n_pixel 1 --n_reps 10 data/databases/alfabeto.txt > data/databases/alfabeto1.txt
gawk -f script/genera-ruido.awk --n_pixel 3 --n_reps 10 data/databases/alfabeto.txt > data/databases/alfabeto3.txt
gawk -f script/genera-ruido.awk --n_pixel 5 --n_reps 10 data/databases/alfabeto.txt > data/databases/alfabeto5.txt
p3.2.2-alfabeto: compile
./$(TARGET) -i data/databases/alfabeto.txt -m autoencoder -h 12 -t 100 -s -n data/models/autoencoder.txt
p3.2.3-alfabeto-ruido1: compile p3.2.2-alfabeto p3-databases
./$(TARGET) -n data/models/autoencoder.txt -m autoencoder -f -i data/databases/alfabeto1.txt
p3.2.3-alfabeto-ruido3: compile p3.2.2-alfabeto p3-databases
./$(TARGET) -n data/models/autoencoder.txt -m autoencoder -f -i data/databases/alfabeto3.txt
p3.2.3-alfabeto-ruido5: p3.2.2-alfabeto p3-databases compile
./$(TARGET) -n data/models/autoencoder.txt -m autoencoder -f -i data/databases/alfabeto5.txt
p3.2.4-alfabeto-ruido1: p3-databases compile
./$(TARGET) -i data/databases/alfabeto1.txt -m autoencoder -h 12 -t 100
p3.2.4-alfabeto-ruido3: p3-databases compile
./$(TARGET) -i data/databases/alfabeto3.txt -m autoencoder -h 12 -t 100
p3.2.4-alfabeto-ruido5: p3-databases compile
./$(TARGET) -i data/databases/alfabeto5.txt -m autoencoder -h 12 -t 100
p3.3.1.1-timeserie1: compile
./$(TARGET) -i data/databases/p3_serie1.txt -m timeserie -h 12 -t 50 -a 1 -d 1
p3.3.1.1-timeserie2: compile
./$(TARGET) -i data/databases/p3_serie1.txt -m timeserie -h 12 -t 50 -a 2 -d 1
p3.3.1.1-timeserie5: compile
./$(TARGET) -i data/databases/p3_serie1.txt -m timeserie -h 12 -t 25 -a 1 -d 1 -o salida.txt
p3.3.1.2-timeserie1: compile
./$(TARGET) -i data/databases/p3_serie1.txt -m timeserie -h 12 -t 25 -a 1 -d 1 -o salida.txt
p3.3.1.2-timeserie2: compile
./$(TARGET) -i data/databases/p3_serie1.txt -m timeserie -h 12 -t 25 -a 2 -d 1 -o salida.txt
p3.3.1.2-timeserie5: compile
./$(TARGET) -i data/databases/p3_serie1.txt -m timeserie -h 12 -t 25 -a 5 -d 1 -o salida.txt
p3.3.1.3-recursiva: compile
./$(TARGET) -i data/databases/p3_serie1.txt -m timeserie -h 20 -t 50 -a 5 -d 1 -b 0 -j 200 -o valores.txt
p3.3.2.2-timeserie1: compile
./$(TARGET) -i data/databases/p3_serie2N.txt -m timeserie -h 12 -t 50 -a 1 -d 1
p3.3.2.2-timeserie5: compile
./$(TARGET) -i data/databases/p3_serie2N.txt -m timeserie -h 12 -t 50 -a 5 -d 1
p3.3.2.3-timeserie5: compile
./$(TARGET) -i data/databases/p3_serie2N.txt -m timeserie -h 12 -t 25 -a 5 -d 1
p3.3.2.3-timeserie15: compile
./$(TARGET) -i data/databases/p3_serie2N.txt -m timeserie -h 12 -t 25 -a 15 -d 1
p3.3.2.4-recursiva: compile
./$(TARGET) -i data/databases/p3_serie2N.txt -m timeserie -h 12 -t 50 -a 5 -d 1 -b 0 -j 200 -o valores.txt
# Flycheck (emacs) requirement
.PHONEY: check-syntax
check-syntax:
@$(LINKER) nul $(LFLAGS) -S ${CHK_SOURCES}
etags:
find . -type f -iname "*.[ch]" | etags -
# Displays the help for this makefile
help:
@echo "NEURAL NETWORK MAKEFILE"
@echo "Targets:"
@echo " - compile"
@echo " Compiles all sources and generates the executable."
# @echo " - p1.2-mcculloch-pitts"
# @echo " Executes the McCulloch-Pitts network."
# @echo " - p1.3.1-perceptron"
# @echo " Executes the perceptron classifier for dataset problema_real1.txt."
# @echo " - p1.3.1-adaline"
# @echo " Executes the adaline classifier for dataset problema_real1.txt."
# @echo " - p1.3.2-nand"
# @echo " Executes the simulation for nand.txt."
# @echo " - p1.3.2-nor"
# @echo " Executes the simulation for nor.txt."
# @echo " - p1.3.2-xor"
# @echo " Executes the simulation for xor.txt."
# @echo " - p1.3.3-perceptron"
# @echo " Executes the perceptron classifier for dataset problema_real2.txt."
# @echo " - p1.3.3-adaline"
# @echo " Executes the adaline classifier for dataset problema_real2.txt."
# @echo " - p1.3.3.1-perceptron-predict"
# @echo " Executes the perceptron classifier for dataset problema_real2.txt and predicts problema_real2_no_etiquetados.txt."
# @echo " - p1.3.3.1-adaline-predict"
# @echo " Executes the adaline classifier for dataset problema_real2.txt and predicts problema_real2_no_etiquetados.txt."
# @echo " -p2"
# @echo " Executes all simulations for P2."
@echo " - p3"
@echo " Executes all simulations for P3."
@echo " - p3-databases"
@echo " Generates files with noise for alfabeto.txt."
@echo " - clean"
@echo " Removes all objects."
@echo " - help"
@echo " Shows this help."
@echo "Arguments:"
@echo " - INPUT_FILE"
@echo " File to read from"
@echo " - OUTPUT_FILE"
@echo " File to write to. out/out.txt by default"
.PHONEY: clean
clean:
@$(rm) $(OBJECTS)
@echo "INFO: Cleaning completed"