Commit 665375a8 authored by Sebastian N.'s avatar Sebastian N.
Browse files

Fixed some syntax

parent 94fe11a1
Pipeline #193069 failed with stages
in 17 seconds
...@@ -249,15 +249,15 @@ class ${tc.fileNameWithoutEnding}: ...@@ -249,15 +249,15 @@ class ${tc.fileNameWithoutEnding}:
sentence = '' sentence = ''
for batchEntry in batch.label: for batchEntry in batch.label:
sentence += dict[int(batchEntry[index].asscalar())] + ' ' sentence += dict[int(batchEntry[index].asscalar())] + ' '
print "############################" print("############################")
print "label: ", sentence print("label: ", sentence)
print "prediction: ", prediction[index] print("prediction: ", prediction[index])
BLEUscore = nltk.translate.bleu_score.sentence_bleu([sentence], prediction[index]) BLEUscore = nltk.translate.bleu_score.sentence_bleu([sentence], prediction[index])
NISTscore = nltk.translate.nist_score.sentence_nist([sentence], prediction[index]) NISTscore = nltk.translate.nist_score.sentence_nist([sentence], prediction[index])
print "BLEU: ", BLEUscore print("BLEU: ", BLEUscore)
print "NIST: ", NISTscore print("NIST: ", NISTscore)
print "############################" print("############################")
metric.update(preds=predictions, labels=labels) metric.update(preds=predictions, labels=labels)
train_metric_score = metric.get()[1] train_metric_score = metric.get()[1]
......
...@@ -247,15 +247,15 @@ class CNNSupervisedTrainer_Alexnet: ...@@ -247,15 +247,15 @@ class CNNSupervisedTrainer_Alexnet:
sentence = '' sentence = ''
for batchEntry in batch.label: for batchEntry in batch.label:
sentence += dict[int(batchEntry[index].asscalar())] + ' ' sentence += dict[int(batchEntry[index].asscalar())] + ' '
print "############################" print("############################")
print "label: ", sentence print("label: ", sentence)
print "prediction: ", prediction[index] print("prediction: ", prediction[index])
BLEUscore = nltk.translate.bleu_score.sentence_bleu([sentence], prediction[index]) BLEUscore = nltk.translate.bleu_score.sentence_bleu([sentence], prediction[index])
NISTscore = nltk.translate.nist_score.sentence_nist([sentence], prediction[index]) NISTscore = nltk.translate.nist_score.sentence_nist([sentence], prediction[index])
print "BLEU: ", BLEUscore print("BLEU: ", BLEUscore)
print "NIST: ", NISTscore print("NIST: ", NISTscore)
print "############################" print("############################")
metric.update(preds=predictions, labels=labels) metric.update(preds=predictions, labels=labels)
train_metric_score = metric.get()[1] train_metric_score = metric.get()[1]
......
...@@ -247,15 +247,15 @@ class CNNSupervisedTrainer_CifarClassifierNetwork: ...@@ -247,15 +247,15 @@ class CNNSupervisedTrainer_CifarClassifierNetwork:
sentence = '' sentence = ''
for batchEntry in batch.label: for batchEntry in batch.label:
sentence += dict[int(batchEntry[index].asscalar())] + ' ' sentence += dict[int(batchEntry[index].asscalar())] + ' '
print "############################" print("############################")
print "label: ", sentence print("label: ", sentence)
print "prediction: ", prediction[index] print("prediction: ", prediction[index])
BLEUscore = nltk.translate.bleu_score.sentence_bleu([sentence], prediction[index]) BLEUscore = nltk.translate.bleu_score.sentence_bleu([sentence], prediction[index])
NISTscore = nltk.translate.nist_score.sentence_nist([sentence], prediction[index]) NISTscore = nltk.translate.nist_score.sentence_nist([sentence], prediction[index])
print "BLEU: ", BLEUscore print("BLEU: ", BLEUscore)
print "NIST: ", NISTscore print("NIST: ", NISTscore)
print "############################" print("############################")
metric.update(preds=predictions, labels=labels) metric.update(preds=predictions, labels=labels)
train_metric_score = metric.get()[1] train_metric_score = metric.get()[1]
......
...@@ -247,15 +247,15 @@ class CNNSupervisedTrainer_VGG16: ...@@ -247,15 +247,15 @@ class CNNSupervisedTrainer_VGG16:
sentence = '' sentence = ''
for batchEntry in batch.label: for batchEntry in batch.label:
sentence += dict[int(batchEntry[index].asscalar())] + ' ' sentence += dict[int(batchEntry[index].asscalar())] + ' '
print "############################" print("############################")
print "label: ", sentence print("label: ", sentence)
print "prediction: ", prediction[index] print("prediction: ", prediction[index])
BLEUscore = nltk.translate.bleu_score.sentence_bleu([sentence], prediction[index]) BLEUscore = nltk.translate.bleu_score.sentence_bleu([sentence], prediction[index])
NISTscore = nltk.translate.nist_score.sentence_nist([sentence], prediction[index]) NISTscore = nltk.translate.nist_score.sentence_nist([sentence], prediction[index])
print "BLEU: ", BLEUscore print("BLEU: ", BLEUscore)
print "NIST: ", NISTscore print("NIST: ", NISTscore)
print "############################" print("############################")
metric.update(preds=predictions, labels=labels) metric.update(preds=predictions, labels=labels)
train_metric_score = metric.get()[1] train_metric_score = metric.get()[1]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment