diff --git a/Jenkinsfile b/Jenkinsfile index 706df08..9dba130 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,6 @@ node { checkout scm - def dockerimage = docker.build("titanic-image") + def dockerimage = docker.build("titanic-image", "dockerfile_titanic") dockerimage.inside { stage('Preparation') { properties([ diff --git a/JenkinsfileTrain b/JenkinsfileTrain index ac16987..fbafffd 100644 --- a/JenkinsfileTrain +++ b/JenkinsfileTrain @@ -1,6 +1,7 @@ node { checkout scm - def dockerimage = docker.build("train-image", "./train") + def dockerimage = docker.build("train-image", "dockerfile_train + ") dockerimage.inside { stage('Preparation') { properties([ diff --git a/dockerfile_titanic b/dockerfile_titanic new file mode 100644 index 0000000..4e565dd --- /dev/null +++ b/dockerfile_titanic @@ -0,0 +1,23 @@ +FROM ubuntu:latest + +RUN apt-get update --fix-missing +RUN apt install python3-pip -y +RUN apt install unzip -y +RUN apt install git -y + +RUN pip install --user kaggle +RUN pip install --user pandas + + +RUN ln -s ~/.local/bin/kaggle /usr/bin/kaggle +ENV PATH="$PATH:~/.local/bin/kaggle" +ENV KAGGLE_USERNAME="wiktorbombola" +ENV KAGGLE_KEY="" + +# RUN echo "alias kaggle='~/.local/bin/kaggle'" >> ~/.bashrc + +COPY ./script.sh ./ +COPY ./learning.py ./ + +# CMD ./script.sh 300 +# CMD ./learning.py \ No newline at end of file diff --git a/dockerfile_train b/dockerfile_train new file mode 100644 index 0000000..a87600e --- /dev/null +++ b/dockerfile_train @@ -0,0 +1,19 @@ +FROM ubuntu:latest + +RUN apt-get update --fix-missing +RUN apt install python3-pip -y +RUN apt install unzip -y +RUN apt install git -y + +RUN pip install --user pandas +RUN pip install --user torch +RUN pip install --user keras +RUN pip install --user tensorflow +RUN pip install --user scikit-learn + +# RUN echo "alias kaggle='~/.local/bin/kaggle'" >> ~/.bashrc + +COPY ./../learning.py ./ + +# CMD ./script.sh 300 +# CMD ./learning.pyRUN pip install --user numpy diff --git a/eval.py b/eval.py index def2dae..ff153bd 100755 --- a/eval.py +++ b/eval.py @@ -4,7 +4,7 @@ import torch from torch import nn import pandas as pd -from sklearn.metrics import accuracy_score +from sklearn.metrics import accuracy_score, precision_score, recall_score from sklearn.preprocessing import LabelEncoder import torch.nn.functional as F @@ -39,5 +39,9 @@ x_test = torch.tensor(X.values, dtype=torch.float32) pred = model(x_test) pred = pred.detach().numpy() print ("The accuracy is", accuracy_score(Y, np.argmax(pred, axis=1))) +print ("The precission score is ", precision_score(Y, np.argmax(pred, axis=1))) +print ("The recall score is ", recall_score(Y, np.argmax(pred, axis=1))) + + np.savetxt('prediction.tsv', pred, delimiter='\t') \ No newline at end of file diff --git a/script.sh b/script.sh index 56792f2..70b233b 100755 --- a/script.sh +++ b/script.sh @@ -3,5 +3,5 @@ kaggle competitions download -c titanic echo 'kaggle download completed' unzip titanic.zip wc -l train.csv -head -$1 train.csv | shuf > output.csv +head -n $1 train.csv > output.csv echo 'script done'