Skip to content

Commit

Permalink
Skripts for lmi testing
Browse files Browse the repository at this point in the history
  • Loading branch information
YNedderhoff committed May 30, 2015
1 parent d2d24f5 commit c5bb531
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 32 deletions.
18 changes: 18 additions & 0 deletions create_screens.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

COUNTER=0
MAXIMUM=20
LINES=12741

while [ $COUNTER -le $MAXIMUM ]; do

let COUNTER2=$COUNTER+1

screen -dmS "teamlab"$COUNTER2 ./run1.sh $(($COUNTER*$LINES)) $(($COUNTER2*$LINES))

let COUNTER=COUNTER+1

done



17 changes: 17 additions & 0 deletions kill_screens.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

COUNTER=1
MAXIMUM=100

while [ $COUNTER -le $MAXIMUM ]; do

screen -S "teamlab"$COUNTER -X quit

let COUNTER=COUNTER+1

done





60 changes: 29 additions & 31 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,38 @@ EVALUATIONS="evaluations/"

affixes=0
train=1
test=1
evaluate=1
test=0
evaluate=0

head -20000 $CORPORA/train.col >> $CORPORA/train_top5000.col
head -20000 $CORPORA/dev.col >> $CORPORA/dev_top5000.col
#head -20000 $CORPORA/train.col >> $CORPORA/train_top5000.col
#head -20000 $CORPORA/dev.col >> $CORPORA/dev_top5000.col
#1178

# Finding possible features, e.g. Affixes.
if [ "$affixes" = 1 ]; then
python -u tagger.py -feat -i $CORPORA/train.col
fi
COUNTER=0
while read p; do
# Train the model
let COUNTER=COUNTER+1
if [ "$train" = 1 ]; then
#python -u tagger.py -train -i $CORPORA/train.col -t $p -e 5 -m $MODELS/model$COUNTER
python -u tagger.py -train -i $CORPORA/train_top5000.col -t $p -e 5 -m $MODELS/model$COUNTER
#python tagger.py -train -i $CORPORA/train_top5000.col -e 5 -m model
fi

# Test the model
if [ "$test" = 1 ]; then
#python -u tagger.py -test -i $CORPORA/dev.col -m $MODELS/model$COUNTER -o $PREDICTIONS/prediction$COUNTER.col
python -u tagger.py -test -i $CORPORA/dev_top5000.col -m $MODELS/model$COUNTER -o $PREDICTIONS/prediction$COUNTER.col
#python tagger.py -test -i $CORPORA/dev_top5000.col -m model -o prediction.col
rm -f $MODELS/model$COUNTER
fi

# Evaluate the results
if [ "$evaluate" = 1 ]; then
python -u tagger.py -ev -i $PREDICTIONS/prediction$COUNTER.col -o $EVALUATIONS/evaluation$COUNTER.txt
#python -u tagger.py -ev -i $CORPORA/test_stuff/nn.col -o evaluation.txt
#python -u tagger.py -ev -i $CORPORA/test_stuff/leer.col -o evaluation.txt
fi
done <lmi.txt
rm $CORPORA/train_top5000.col
rm $CORPORA/dev_top5000.col

if [ "$train" = 1 ]; then
python -u tagger.py -train -i $CORPORA/train.col -t 0 -e 5 -m model
#python -u tagger.py -train -i $CORPORA/train_top5000.col -t $p -e 5 -m $MODELS/model$COUNTER
#python tagger.py -train -i $CORPORA/train_top5000.col -e 5 -m model
fi

# Test the model
if [ "$test" = 1 ]; then
python -u tagger.py -test -i $CORPORA/dev.col -m model -o prediction.col
#python -u tagger.py -test -i $CORPORA/dev_top5000.col -m $MODELS/model$COUNTER -o $PREDICTIONS/prediction$COUNTER.col
#python tagger.py -test -i $CORPORA/dev_top5000.col -m model -o prediction.col
rm -f $MODELS/model$COUNTER
fi

# Evaluate the results
if [ "$evaluate" = 1 ]; then
python -u tagger.py -ev -i prediction.col -o evaluation.txt
#python -u tagger.py -ev -i $CORPORA/test_stuff/nn.col -o evaluation.txt
#python -u tagger.py -ev -i $CORPORA/test_stuff/leer.col -o evaluation.txt
fi

#rm $CORPORA/train_top5000.col
#rm $CORPORA/dev_top5000.col
57 changes: 57 additions & 0 deletions run1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

CORPORA="../team-lab-ss2015/data/pos"

MODELS="models"
PREDICTIONS="predictions"
EVALUATIONS="/mount/studenten/projekt-cl/WS-2013-2014/student-workspace/nedderyk/teamlabproject15/evaluations"

affixes=0
train=1
test=1
evaluate=1

#head -20000 $CORPORA/train.col >> $CORPORA/train_top5000.col
#head -20000 $CORPORA/dev.col >> $CORPORA/dev_top5000.col

# Finding possible features, e.g. Affixes.
if [ "$affixes" = 1 ]; then
python -u tagger.py -feat -i $CORPORA/train.col
fi

COUNTER=0

while read p; do
# Train the model
let COUNTER=COUNTER+1

if [ $COUNTER -ge $1 ] && [ $COUNTER -lt $2 ]; then


if [ "$train" = 1 ]; then
python -u tagger.py -train -i $CORPORA/train.col -t $p -e 5 -m $MODELS/model$COUNTER
#python -u tagger.py -train -i $CORPORA/train_top5000.col -t $p -e 5 -m $MODELS/model$COUNTER
#python tagger.py -train -i $CORPORA/train_top5000.col -e 5 -m model
fi

# Test the model
if [ "$test" = 1 ]; then
python -u tagger.py -test -i $CORPORA/dev.col -m $MODELS/model$COUNTER -o $PREDICTIONS/prediction$COUNTER.col
#python -u tagger.py -test -i $CORPORA/dev_top5000.col -m $MODELS/model$COUNTER -o $PREDICTIONS/prediction$COUNTER.col
#python tagger.py -test -i $CORPORA/dev_top5000.col -m model -o prediction.col
rm -f $MODELS/model$COUNTER
fi

# Evaluate the results
if [ "$evaluate" = 1 ]; then
python -u tagger.py -ev -i $PREDICTIONS/prediction$COUNTER.col -o $EVALUATIONS/evaluation$COUNTER.txt
#python -u tagger.py -ev -i $CORPORA/test_stuff/nn.col -o evaluation.txt
#python -u tagger.py -ev -i $CORPORA/test_stuff/leer.col -o evaluation.txt
rm -f $PREDICTIONS/prediction$COUNTER.col
fi
fi

done <lmi.txt

#rm $CORPORA/train_top5000.col
#rm $CORPORA/dev_top5000.col
2 changes: 1 addition & 1 deletion tagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def train(self, file_in, file_out, max_iterations, threshold):
classifiers = {}

lmi_calc = lmi.lmi(tokens, feat_vec)
lmi_dict = lmi_calc.compute_lmi
lmi_dict = lmi_calc.compute_lmi()

# instantiate a classifier for each pos tag type:
for tag in tag_set:
Expand Down
4 changes: 4 additions & 0 deletions testscript.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

touch "file"$1
touch "file"$2

0 comments on commit c5bb531

Please sign in to comment.