reorganisation of file structure, fix eval and script.sh

This commit is contained in:
gedin 2023-05-24 14:14:58 +02:00
parent aa8d03eeb3
commit 7efc54bcd6
6 changed files with 51 additions and 4 deletions

2
Jenkinsfile vendored
View File

@ -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([

View File

@ -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([

23
dockerfile_titanic Normal file
View File

@ -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

19
dockerfile_train Normal file
View File

@ -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

View File

@ -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')

View File

@ -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'