Zadanie Domowe Zajęcia 5 (Jupyter + Docker)
This commit is contained in:
parent
6939565f78
commit
c5356d322b
@ -10,7 +10,10 @@ RUN pip3 install --user kaggle
|
|||||||
RUN pip3 install --user seaborn
|
RUN pip3 install --user seaborn
|
||||||
RUN pip3 install --user sklearn
|
RUN pip3 install --user sklearn
|
||||||
RUN pip3 install --user pandas
|
RUN pip3 install --user pandas
|
||||||
|
RUN pip3 install --user numpy
|
||||||
RUN pip3 install --user matplotlib
|
RUN pip3 install --user matplotlib
|
||||||
|
RUN pip3 install --user tensorflow
|
||||||
|
|
||||||
|
|
||||||
# Stwórzmy w kontenerze (jeśli nie istnieje) katalog /app i przejdźmy do niego (wszystkie kolejne polecenia RUN, CMD, ENTRYPOINT, COPY i ADD będą w nim wykonywane)
|
# Stwórzmy w kontenerze (jeśli nie istnieje) katalog /app i przejdźmy do niego (wszystkie kolejne polecenia RUN, CMD, ENTRYPOINT, COPY i ADD będą w nim wykonywane)
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@ -18,6 +21,7 @@ WORKDIR /app
|
|||||||
# Skopiujmy nasz skrypt do katalogu /app w kontenerze
|
# Skopiujmy nasz skrypt do katalogu /app w kontenerze
|
||||||
COPY ./test.sh ./
|
COPY ./test.sh ./
|
||||||
COPY ./Python_file.py ./
|
COPY ./Python_file.py ./
|
||||||
|
COPY ./Zadanie_5_Docker.py ./
|
||||||
|
|
||||||
# Domyślne polecenie, które zostanie uruchomione w kontenerze po jego starcie
|
# Domyślne polecenie, które zostanie uruchomione w kontenerze po jego starcie
|
||||||
CMD ./test.sh
|
CMD ./test.sh
|
2324
IUM_5_434788_wersja_Jupyter.ipynb
Normal file
2324
IUM_5_434788_wersja_Jupyter.ipynb
Normal file
File diff suppressed because one or more lines are too long
47
Zadanie_5_Docker.py
Normal file
47
Zadanie_5_Docker.py
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
from tensorflow.keras.models import Sequential, load_model
|
||||||
|
from tensorflow.keras.layers import Dense
|
||||||
|
from sklearn.metrics import accuracy_score, classification_report
|
||||||
|
import pandas as pd
|
||||||
|
from sklearn.model_selection import train_test_split
|
||||||
|
import wget
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
url = 'https://git.wmi.amu.edu.pl/s434788/ium_434788/raw/branch/master/winequality-red.csv'
|
||||||
|
wget.download(url, out='winequality-red.csv', bar=None)
|
||||||
|
|
||||||
|
wine=pd.read_csv('winequality-red.csv')
|
||||||
|
wine
|
||||||
|
|
||||||
|
y = wine.quality
|
||||||
|
y.head()
|
||||||
|
|
||||||
|
x = wine.drop(['quality'], axis= 1)
|
||||||
|
x.head()
|
||||||
|
|
||||||
|
x=((x-x.min())/(x.max()-x.min())) #Normalizacja
|
||||||
|
|
||||||
|
x_train, x_test, y_train, y_test = train_test_split(x,y , test_size=0.2,train_size=0.8, random_state=21)
|
||||||
|
|
||||||
|
def regression_model():
|
||||||
|
model = Sequential()
|
||||||
|
model.add(Dense(32,activation = "relu", input_shape = (x_train.shape[1],)))
|
||||||
|
model.add(Dense(64,activation = "relu"))
|
||||||
|
model.add(Dense(1,activation = "relu"))
|
||||||
|
|
||||||
|
model.compile(optimizer = "adam", loss = "mean_squared_error")
|
||||||
|
return model
|
||||||
|
|
||||||
|
model = regression_model()
|
||||||
|
model.fit(x_train, y_train, epochs = 600, verbose = 1)
|
||||||
|
|
||||||
|
y_pred = model.predict(x_test)
|
||||||
|
|
||||||
|
y_pred[:5]
|
||||||
|
|
||||||
|
y_pred = np.around(y_pred, decimals=0)
|
||||||
|
|
||||||
|
y_pred[:5]
|
||||||
|
|
||||||
|
print(accuracy_score(y_test, y_pred))
|
||||||
|
|
||||||
|
print(classification_report(y_test,y_pred))
|
@ -10,7 +10,10 @@ RUN pip3 install --user kaggle
|
|||||||
RUN pip3 install --user seaborn
|
RUN pip3 install --user seaborn
|
||||||
RUN pip3 install --user sklearn
|
RUN pip3 install --user sklearn
|
||||||
RUN pip3 install --user pandas
|
RUN pip3 install --user pandas
|
||||||
|
RUN pip3 install --user numpy
|
||||||
RUN pip3 install --user matplotlib
|
RUN pip3 install --user matplotlib
|
||||||
|
RUN pip3 install --user tensorflow
|
||||||
|
|
||||||
|
|
||||||
# Stwórzmy w kontenerze (jeśli nie istnieje) katalog /app i przejdźmy do niego (wszystkie kolejne polecenia RUN, CMD, ENTRYPOINT, COPY i ADD będą w nim wykonywane)
|
# Stwórzmy w kontenerze (jeśli nie istnieje) katalog /app i przejdźmy do niego (wszystkie kolejne polecenia RUN, CMD, ENTRYPOINT, COPY i ADD będą w nim wykonywane)
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@ -18,6 +21,7 @@ WORKDIR /app
|
|||||||
# Skopiujmy nasz skrypt do katalogu /app w kontenerze
|
# Skopiujmy nasz skrypt do katalogu /app w kontenerze
|
||||||
COPY ./test.sh ./
|
COPY ./test.sh ./
|
||||||
COPY ./Python_file.py ./
|
COPY ./Python_file.py ./
|
||||||
|
COPY ./Zadanie_5_Docker.py ./
|
||||||
|
|
||||||
# Domyślne polecenie, które zostanie uruchomione w kontenerze po jego starcie
|
# Domyślne polecenie, które zostanie uruchomione w kontenerze po jego starcie
|
||||||
CMD ./test.sh
|
CMD ./test.sh
|
47
Zajęcia4_oraz_5/Zadanie_5_Docker.py
Normal file
47
Zajęcia4_oraz_5/Zadanie_5_Docker.py
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
from tensorflow.keras.models import Sequential, load_model
|
||||||
|
from tensorflow.keras.layers import Dense
|
||||||
|
from sklearn.metrics import accuracy_score, classification_report
|
||||||
|
import pandas as pd
|
||||||
|
from sklearn.model_selection import train_test_split
|
||||||
|
import wget
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
url = 'https://git.wmi.amu.edu.pl/s434788/ium_434788/raw/branch/master/winequality-red.csv'
|
||||||
|
wget.download(url, out='winequality-red.csv', bar=None)
|
||||||
|
|
||||||
|
wine=pd.read_csv('winequality-red.csv')
|
||||||
|
wine
|
||||||
|
|
||||||
|
y = wine.quality
|
||||||
|
y.head()
|
||||||
|
|
||||||
|
x = wine.drop(['quality'], axis= 1)
|
||||||
|
x.head()
|
||||||
|
|
||||||
|
x=((x-x.min())/(x.max()-x.min())) #Normalizacja
|
||||||
|
|
||||||
|
x_train, x_test, y_train, y_test = train_test_split(x,y , test_size=0.2,train_size=0.8, random_state=21)
|
||||||
|
|
||||||
|
def regression_model():
|
||||||
|
model = Sequential()
|
||||||
|
model.add(Dense(32,activation = "relu", input_shape = (x_train.shape[1],)))
|
||||||
|
model.add(Dense(64,activation = "relu"))
|
||||||
|
model.add(Dense(1,activation = "relu"))
|
||||||
|
|
||||||
|
model.compile(optimizer = "adam", loss = "mean_squared_error")
|
||||||
|
return model
|
||||||
|
|
||||||
|
model = regression_model()
|
||||||
|
model.fit(x_train, y_train, epochs = 600, verbose = 1)
|
||||||
|
|
||||||
|
y_pred = model.predict(x_test)
|
||||||
|
|
||||||
|
y_pred[:5]
|
||||||
|
|
||||||
|
y_pred = np.around(y_pred, decimals=0)
|
||||||
|
|
||||||
|
y_pred[:5]
|
||||||
|
|
||||||
|
print(accuracy_score(y_test, y_pred))
|
||||||
|
|
||||||
|
print(classification_report(y_test,y_pred))
|
@ -1,2 +1,2 @@
|
|||||||
#Uruchomienie skryptu i wyświetlenie 10 pierwszych wierszy wyjściowej tabeli
|
#Uruchomienie skryptu i wyświetlenie 10 pierwszych wierszy wyjściowej tabeli
|
||||||
python3 Python_file.py
|
python3 Zadanie_5_Docker.py
|
2
zad8/Jenkinsfile
vendored
2
zad8/Jenkinsfile
vendored
@ -1,6 +1,6 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent {
|
agent {
|
||||||
docker { image 'snowycocoon/ium_434788:1' }
|
docker { image 'snowycocoon/ium_434788:2' }
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Test') {
|
stage('Test') {
|
||||||
|
Loading…
Reference in New Issue
Block a user