not user local installs on pip + eval metrics file creation
s470618-evaluation/pipeline/head There was a failure building this commit Details

This commit is contained in:
gedin 2023-05-24 15:58:36 +02:00
parent 35579a7eb3
commit 41c655024d
2 changed files with 15 additions and 9 deletions

View File

@ -5,12 +5,12 @@ RUN apt install python3-pip -y
RUN apt install unzip -y RUN apt install unzip -y
RUN apt install git -y RUN apt install git -y
RUN pip install --user numpy RUN pip install numpy
RUN pip install --user pandas RUN pip install pandas
RUN pip install --user torch RUN pip install torch
RUN pip install --user keras RUN pip install keras
RUN pip install --user tensorflow RUN pip install tensorflow
RUN pip install --user scikit-learn RUN pip install scikit-learn
# RUN echo "alias kaggle='~/.local/bin/kaggle'" >> ~/.bashrc # RUN echo "alias kaggle='~/.local/bin/kaggle'" >> ~/.bashrc

View File

@ -38,10 +38,16 @@ model.load_state_dict(torch.load('model.pt'))
x_test = torch.tensor(X.values, dtype=torch.float32) x_test = torch.tensor(X.values, dtype=torch.float32)
pred = model(x_test) pred = model(x_test)
pred = pred.detach().numpy() pred = pred.detach().numpy()
print ("The accuracy is", accuracy_score(Y, np.argmax(pred, axis=1))) acc = accuracy_score(Y, np.argmax(pred, axis=1))
print ("The precission score is ", precision_score(Y, np.argmax(pred, axis=1))) prec = precision_score(Y, np.argmax(pred, axis=1))
print ("The recall score is ", recall_score(Y, np.argmax(pred, axis=1))) recall = recall_score(Y, np.argmax(pred, axis=1))
print ("The accuracy is", acc)
print ("The precission score is ", prec)
print ("The recall score is ", recall)
file = open('metrics.txt', 'w')
file.write(str(acc) + '\t' + str(prec) + '\t' + str(recall))
file.close()
np.savetxt('prediction.tsv', pred, delimiter='\t') np.savetxt('prediction.tsv', pred, delimiter='\t')