ML done
This commit is contained in:
parent
718dbe45c7
commit
fa2f7b4d1b
@ -4,6 +4,9 @@ RUN apt update && apt install -y python3 python3-pip
|
|||||||
|
|
||||||
RUN pip3 install kaggle
|
RUN pip3 install kaggle
|
||||||
RUN pip3 install pandas
|
RUN pip3 install pandas
|
||||||
|
RUN pip3 install tensorflow
|
||||||
|
RUN pip3 install numpy
|
||||||
|
RUN pip3 install matplotlib
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
5
Jenkinsfile
vendored
5
Jenkinsfile
vendored
@ -2,11 +2,6 @@ pipeline{
|
|||||||
agent any
|
agent any
|
||||||
properties([parameters([text(defaultValue: '50', description: 'Number of lines to cutoff', name: 'CUTOFF')])])
|
properties([parameters([text(defaultValue: '50', description: 'Number of lines to cutoff', name: 'CUTOFF')])])
|
||||||
stages{
|
stages{
|
||||||
stage('Stage 1'){
|
|
||||||
steps{
|
|
||||||
echo 'Hello World!'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('checkout: Check out from version control'){
|
stage('checkout: Check out from version control'){
|
||||||
steps{
|
steps{
|
||||||
git url: 'https://github.com/jfrogdev/project-examples.git'
|
git url: 'https://github.com/jfrogdev/project-examples.git'
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
pipeline{
|
||||||
|
agent any
|
||||||
|
properties([parameters([
|
||||||
|
buildSelector(
|
||||||
|
defaultSelector: lastSuccessful(),
|
||||||
|
description: 'Which build to use for copying artifacts',
|
||||||
|
name: 'BUILD_SELECTOR')
|
||||||
|
])])
|
||||||
|
stages{
|
||||||
|
stage('checkout: Check out from version control'){
|
||||||
|
steps{
|
||||||
|
git credentialsId: 'b4ba8ec9-8fc6-4f68-bf24-695634cec73e', url: 'https://git.wmi.amu.edu.pl/s437622/ium_s437622.git'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('copy artifacts'){
|
||||||
|
copyArtifacts filter: 'dev.csv, train.csv, test.csv', fingerprintArtifacts: true, projectName: 's437622-create-dataset', selector: buildParameter('BUILD_SELECTOR')
|
||||||
|
}
|
||||||
|
stage('sh: Shell Script'){
|
||||||
|
steps{
|
||||||
|
./stats.sh
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Archive artifacts'){
|
||||||
|
steps{
|
||||||
|
archiveArtifacts 'stats.txt'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1 +1,5 @@
|
|||||||
test3
|
15.05
|
||||||
|
ML - uczenie działa
|
||||||
|
przewiduje same zera (czyli nie działa)
|
||||||
|
wynik jest zapisywany do pliku results.csv
|
||||||
|
do Dockera dodane są biblioteki potrzebne do ML
|
||||||
|
40116
chess.csv.shuf
40116
chess.csv.shuf
File diff suppressed because it is too large
Load Diff
51
zad5.py
51
zad5.py
@ -1,7 +1,54 @@
|
|||||||
import os
|
import os
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
|
from tensorflow import keras
|
||||||
|
from tensorflow.keras import layers
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
print("TensorFlow version: {}".format(tf.__version__))
|
|
||||||
print("Eager execution: {}".format(tf.executing_eagerly()))
|
model_name="model"
|
||||||
|
|
||||||
|
train=pd.read_csv('train.csv', header=None, skiprows=1)
|
||||||
|
indexNames = train[train[1] ==2].index
|
||||||
|
train.drop(indexNames, inplace=True)
|
||||||
|
cols=[0,2,3]
|
||||||
|
X=train[cols].to_numpy()
|
||||||
|
y=train[1].to_numpy()
|
||||||
|
X=np.asarray(X).astype('float32')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
model = keras.Sequential(name="winner")
|
||||||
|
model.add(keras.Input(shape=(3), name="game_info"))
|
||||||
|
model.add(layers.Dense(4, activation="relu", name="layer1"))
|
||||||
|
model.add(layers.Dense(8, activation="relu", name="layer2"))
|
||||||
|
model.add(layers.Dense(8, activation="relu", name="layer3"))
|
||||||
|
model.add(layers.Dense(5, activation="relu", name="layer4"))
|
||||||
|
model.add(layers.Dense(1, activation="relu", name="output"))
|
||||||
|
|
||||||
|
model.compile(
|
||||||
|
optimizer=keras.optimizers.RMSprop(),
|
||||||
|
loss=keras.losses.MeanSquaredError(),
|
||||||
|
)
|
||||||
|
|
||||||
|
history = model.fit(
|
||||||
|
X,
|
||||||
|
y,
|
||||||
|
batch_size=16,
|
||||||
|
epochs=15,)
|
||||||
|
|
||||||
|
model.save(model_name)
|
||||||
|
|
||||||
|
test=pd.read_csv('test.csv', header=None, skiprows=1)
|
||||||
|
cols=[0,2,3]
|
||||||
|
indexNames = test[test[1] ==2].index
|
||||||
|
test.drop(indexNames, inplace=True)
|
||||||
|
X_test=test[cols].to_numpy()
|
||||||
|
y_test=test[1].to_numpy()
|
||||||
|
X_test=np.asarray(X_test).astype('float32')
|
||||||
|
|
||||||
|
predictions=model.predict(X_test)
|
||||||
|
pd.DataFrame(predictions).to_csv('results.csv', sep='\t', index=False, header=False)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user