reorganisation of file structure, fix eval and script.sh
This commit is contained in:
parent
aa8d03eeb3
commit
7efc54bcd6
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
@ -1,6 +1,6 @@
|
|||||||
node {
|
node {
|
||||||
checkout scm
|
checkout scm
|
||||||
def dockerimage = docker.build("titanic-image")
|
def dockerimage = docker.build("titanic-image", "dockerfile_titanic")
|
||||||
dockerimage.inside {
|
dockerimage.inside {
|
||||||
stage('Preparation') {
|
stage('Preparation') {
|
||||||
properties([
|
properties([
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
node {
|
node {
|
||||||
checkout scm
|
checkout scm
|
||||||
def dockerimage = docker.build("train-image", "./train")
|
def dockerimage = docker.build("train-image", "dockerfile_train
|
||||||
|
")
|
||||||
dockerimage.inside {
|
dockerimage.inside {
|
||||||
stage('Preparation') {
|
stage('Preparation') {
|
||||||
properties([
|
properties([
|
||||||
|
23
dockerfile_titanic
Normal file
23
dockerfile_titanic
Normal 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
19
dockerfile_train
Normal 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
|
6
eval.py
6
eval.py
@ -4,7 +4,7 @@ import torch
|
|||||||
from torch import nn
|
from torch import nn
|
||||||
import pandas as pd
|
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
|
from sklearn.preprocessing import LabelEncoder
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
|
|
||||||
@ -39,5 +39,9 @@ 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)))
|
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')
|
np.savetxt('prediction.tsv', pred, delimiter='\t')
|
@ -3,5 +3,5 @@ kaggle competitions download -c titanic
|
|||||||
echo 'kaggle download completed'
|
echo 'kaggle download completed'
|
||||||
unzip titanic.zip
|
unzip titanic.zip
|
||||||
wc -l train.csv
|
wc -l train.csv
|
||||||
head -$1 train.csv | shuf > output.csv
|
head -n $1 train.csv > output.csv
|
||||||
echo 'script done'
|
echo 'script done'
|
||||||
|
Loading…
Reference in New Issue
Block a user