This commit is contained in:
parent
02a091883a
commit
6bb9783533
@ -24,7 +24,7 @@ node {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Archive artifacts') {
|
stage('Archive artifacts') {
|
||||||
archiveArtifacts "neural_network_evaluation.txt, neural_network_model"
|
archiveArtifacts "neural_network_evaluation.txt, model/**"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
import datetime
|
||||||
import os
|
import os
|
||||||
import pprint
|
import pprint
|
||||||
import sys
|
import sys
|
||||||
@ -40,8 +41,9 @@ def load_trained_model(abs_path, model_name):
|
|||||||
return load_model(os.path.join(abs_path, model_name))
|
return load_model(os.path.join(abs_path, model_name))
|
||||||
|
|
||||||
|
|
||||||
def save_model(model, abs_path, model_name):
|
def save_model(model):
|
||||||
model.save(os.path.join(abs_path, model_name), save_format='h5')
|
model_name = 'neural_net_' + datetime.datetime.today().strftime('%d-%b-%Y-%H:%M:%S')
|
||||||
|
model.save(os.path.join(os.getcwd(), 'model', model_name), save_format='h5', overwrite=True)
|
||||||
|
|
||||||
|
|
||||||
def train_model(model, x_train, y_train):
|
def train_model(model, x_train, y_train):
|
||||||
@ -82,7 +84,7 @@ def main():
|
|||||||
x_train, x_test, vocab_size = tokenize(pd.concat([x_train, x_test]), x_train, x_test, 100)
|
x_train, x_test, vocab_size = tokenize(pd.concat([x_train, x_test]), x_train, x_test, 100)
|
||||||
model = get_model(50, vocab_size)
|
model = get_model(50, vocab_size)
|
||||||
train_model(model, x_train, y_train)
|
train_model(model, x_train, y_train)
|
||||||
save_model(model, abs_data_path, 'neural_network_model')
|
save_model(model)
|
||||||
evaluate_and_save(model, x_test, y_test, abs_data_path)
|
evaluate_and_save(model, x_test, y_test, abs_data_path)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user