-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (27 loc) · 1.31 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
NUM_FEATURES=1000
MAX_ITER=400
TRAINING_PERCENT=100
all: check_predictions.txt
clean:
rm -f *.pyc *.vec *.json *.mat
top_words.vec:
python ./words.py ./all_items_listed.csv ${NUM_FEATURES} > top_words.vec
listed.vec: top_words.vec
python ./vectorize.py ./top_words.vec ./all_items_listed.csv > listed.vec
tags.vec:
python ./tags.py ./tagged_items.csv | sort -n > tags.vec
tagged_items.vec:
python ./tag.py ./tagged_items.csv > tagged_items.vec
training_tags.vec: tagged_items.vec
./split_tags.sh ./tagged_items.vec training_tags.vec testing_tags.vec ${TRAINING_PERCENT}
testing_tags.vec: tagged_items.vec
./split_tags.sh ./tagged_items.vec training_tags.vec testing_tags.vec ${TRAINING_PERCENT}
tags_listed.vec: listed.vec training_tags.vec
./join_csv.py training_tags.vec listed.vec:0:0 > tags_listed.vec
#TODO MAKE 22 A PARAMETER
theta.mat: tags_listed.vec tags.vec
octave ./calc_theta.m ./tags_listed.vec 22 ${MAX_ITER} theta.mat
item_predictions.vec: theta.mat listed.vec
octave ./calc_predictions.m ./listed.vec theta.mat item_predictions.vec
check_predictions.txt: item_predictions.vec testing_tags.vec
./join_csv.py testing_tags.vec item_predictions.vec:0:0 | tr "," " " | awk 'BEGIN{good=0; bad = 0}{if($$2==$$3){good++}else{bad++}}END{print good,bad,int(100*good/(good+bad))"%"}' | tee check_predictions.txt