s
This commit is contained in:
parent
8f458fd54a
commit
134226fa79
28
train.py
28
train.py
@ -1,13 +1,13 @@
|
||||
from sacred import Experiment
|
||||
from sacred.observers import MongoObserver, FileStorageObserver
|
||||
|
||||
ex = Experiment('s487187-training')
|
||||
ex.observers.append(MongoObserver(url='mongodb://admin:IUM_2021@172.17.0.1:27017', db_name='sacred'))
|
||||
ex.observers.append(FileStorageObserver('results'))
|
||||
ex.use_git = False
|
||||
# ex = Experiment('s487187-training')
|
||||
# ex.observers.append(MongoObserver(url='mongodb://admin:IUM_2021@172.17.0.1:27017', db_name='sacred'))
|
||||
# ex.observers.append(FileStorageObserver('results'))
|
||||
# ex.use_git = False
|
||||
|
||||
@ex.config
|
||||
def my_config():
|
||||
# @ex.config
|
||||
# def my_config():
|
||||
data_file = 'data.csv'
|
||||
model_file = 'model.h5'
|
||||
epochs = 10
|
||||
@ -15,8 +15,8 @@ def my_config():
|
||||
test_size = 0.2
|
||||
random_state = 42
|
||||
|
||||
@ex.capture
|
||||
def train_model(data_file, model_file, epochs, batch_size, test_size, random_state):
|
||||
# @ex.capture
|
||||
# def train_model(data_file, model_file, epochs, batch_size, test_size, random_state):
|
||||
import pandas as pd
|
||||
from sklearn.model_selection import train_test_split
|
||||
from sklearn.preprocessing import MinMaxScaler
|
||||
@ -60,10 +60,10 @@ def train_model(data_file, model_file, epochs, batch_size, test_size, random_sta
|
||||
|
||||
model.save(model_file)
|
||||
|
||||
return accuracy
|
||||
# return accuracy
|
||||
|
||||
@ex.main
|
||||
def run_experiment():
|
||||
accuracy = train_model()
|
||||
ex.log_scalar('accuracy', accuracy)
|
||||
ex.add_artifact('model.h5')
|
||||
# @ex.main
|
||||
# def run_experiment():
|
||||
# accuracy = train_model()
|
||||
# ex.log_scalar('accuracy', accuracy)
|
||||
# ex.add_artifact('model.h5')
|
||||
|
Loading…
Reference in New Issue
Block a user