Fixes for lab5, lab6
Some checks failed
s434704-training/pipeline/head There was a failure building this commit
Some checks failed
s434704-training/pipeline/head There was a failure building this commit
This commit is contained in:
parent
eab03a1f84
commit
9aa2b7d4ad
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
@ -18,7 +18,7 @@ stages {
|
|||||||
// sh "chmod 777 ./data_download.sh"
|
// sh "chmod 777 ./data_download.sh"
|
||||||
// sh "./data_download.sh"
|
// sh "./data_download.sh"
|
||||||
// Zapisanie artefaktów
|
// Zapisanie artefaktów
|
||||||
archiveArtifacts "results.txt"
|
archiveArtifacts "results_lab5.txt"
|
||||||
archiveArtifacts "MoviesOnStreamingPlatforms_updated.dev"
|
archiveArtifacts "MoviesOnStreamingPlatforms_updated.dev"
|
||||||
archiveArtifacts "MoviesOnStreamingPlatforms_updated.test"
|
archiveArtifacts "MoviesOnStreamingPlatforms_updated.test"
|
||||||
archiveArtifacts "MoviesOnStreamingPlatforms_updated.train"
|
archiveArtifacts "MoviesOnStreamingPlatforms_updated.train"
|
||||||
|
@ -23,24 +23,19 @@ test_Y = tf.convert_to_tensor(test_data[["IMDb"]])
|
|||||||
normalizer = preprocessing.Normalization(input_shape=[3,])
|
normalizer = preprocessing.Normalization(input_shape=[3,])
|
||||||
normalizer.adapt(train_X)
|
normalizer.adapt(train_X)
|
||||||
|
|
||||||
if os.path.isdir('linear_regression'):
|
model = keras.Sequential([
|
||||||
model = keras.models.load_model('linear_regression')
|
keras.Input(shape=(len(columns_to_use),)),
|
||||||
else:
|
normalizer,
|
||||||
model = keras.Sequential([
|
layers.Dense(30, activation='relu'),
|
||||||
keras.Input(shape=(len(columns_to_use),)),
|
layers.Dense(10, activation='relu'),
|
||||||
normalizer,
|
layers.Dense(25, activation='relu'),
|
||||||
layers.Dense(30, activation='relu'),
|
layers.Dense(1)
|
||||||
layers.Dense(10, activation='relu'),
|
])
|
||||||
layers.Dense(25, activation='relu'),
|
|
||||||
layers.Dense(1)
|
|
||||||
])
|
|
||||||
|
|
||||||
model.compile(loss='mean_absolute_error',
|
model.compile(loss='mean_absolute_error',
|
||||||
optimizer=tf.keras.optimizers.Adam(0.001))
|
optimizer=tf.keras.optimizers.Adam(0.001))
|
||||||
|
|
||||||
model.fit(train_X, train_Y, verbose=0, epochs=100)
|
model.fit(train_X, train_Y, verbose=0, epochs=100)
|
||||||
|
|
||||||
model.save('linear_regression')
|
|
||||||
|
|
||||||
# Predykcja na danych testowych
|
# Predykcja na danych testowych
|
||||||
results = model.predict(test_X)
|
results = model.predict(test_X)
|
||||||
|
29
training.py
29
training.py
@ -27,22 +27,19 @@ train_Y = tf.convert_to_tensor(train_data[["IMDb"]])
|
|||||||
normalizer = preprocessing.Normalization(input_shape=[3,])
|
normalizer = preprocessing.Normalization(input_shape=[3,])
|
||||||
normalizer.adapt(train_X)
|
normalizer.adapt(train_X)
|
||||||
|
|
||||||
if os.path.isdir('linear_regression'):
|
model = keras.Sequential([
|
||||||
model = keras.models.load_model('linear_regression')
|
keras.Input(shape=(len(columns_to_use),)),
|
||||||
else:
|
normalizer,
|
||||||
model = keras.Sequential([
|
layers.Dense(30, activation='relu'),
|
||||||
keras.Input(shape=(len(columns_to_use),)),
|
layers.Dense(10, activation='relu'),
|
||||||
normalizer,
|
layers.Dense(25, activation='relu'),
|
||||||
layers.Dense(30, activation='relu'),
|
layers.Dense(1)
|
||||||
layers.Dense(10, activation='relu'),
|
])
|
||||||
layers.Dense(25, activation='relu'),
|
|
||||||
layers.Dense(1)
|
|
||||||
])
|
|
||||||
|
|
||||||
model.compile(loss='mean_absolute_error',
|
model.compile(loss='mean_absolute_error',
|
||||||
optimizer=tf.keras.optimizers.Adam(0.001),
|
optimizer=tf.keras.optimizers.Adam(0.001),
|
||||||
metrics=[tf.keras.metrics.RootMeanSquaredError()])
|
metrics=[tf.keras.metrics.RootMeanSquaredError()])
|
||||||
|
|
||||||
model.fit(train_X, train_Y, verbose=verbose, epochs=epochs)
|
model.fit(train_X, train_Y, verbose=verbose, epochs=epochs)
|
||||||
|
|
||||||
model.save('linear_regression.h5')
|
model.save('linear_regression.h5')
|
Loading…
Reference in New Issue
Block a user