modify logs
Some checks failed
s444417-training/pipeline/head There was a failure building this commit
Some checks failed
s444417-training/pipeline/head There was a failure building this commit
This commit is contained in:
parent
56544cdd80
commit
98460d3504
@ -8,6 +8,6 @@ docker_env:
|
||||
entry_points:
|
||||
main:
|
||||
parameters:
|
||||
numberOfEpochParam: {type: float, default: 3}
|
||||
epochs: {type: float, default: 3}
|
||||
learning_rate: {type: float, default: 0.1}
|
||||
command: "python ./lab8/trainScript.py {numberOfEpochParam} {learning_rate}"
|
||||
command: "python ./lab8/trainScript.py {epochs} {learning_rate}"
|
||||
|
@ -9,8 +9,8 @@ import mlflow
|
||||
import mlflow.keras
|
||||
from urllib.parse import urlparse
|
||||
|
||||
|
||||
mlflow.set_tracking_uri("http://172.17.0.1:5000")
|
||||
mlflow.set_tracking_uri("http://127.0.0.1:5000")
|
||||
# mlflow.set_tracking_uri("http://172.17.0.1:5000")
|
||||
mlflow.set_experiment('s444417')
|
||||
|
||||
# train params
|
||||
@ -53,8 +53,8 @@ def train():
|
||||
normalize = layers.Normalization()
|
||||
normalize.adapt(house_price_features)
|
||||
|
||||
feature_test_sample = house_price_test.sample(10)
|
||||
labels_test_sample = feature_test_sample.pop('TARGET(PRICE_IN_LACS)')
|
||||
# feature_test_sample = house_price_test.sample(10)
|
||||
# labels_test_sample = feature_test_sample.pop('TARGET(PRICE_IN_LACS)')
|
||||
|
||||
house_price_test_features = house_price_test.copy()
|
||||
# pop column
|
||||
@ -97,16 +97,16 @@ def train():
|
||||
test_results['linear_model'] = linear_model.evaluate(
|
||||
house_price_test_features, house_price_test_expected, verbose=0)
|
||||
|
||||
pred = np.array(linear_model.predict(feature_test_sample))
|
||||
flatten_pred = flatten(pred)
|
||||
# pred = np.array(linear_model.predict(feature_test_sample))
|
||||
# flatten_pred = flatten(pred)
|
||||
#
|
||||
## with open(cwd + "/../result.txt", "w+") as resultFile:
|
||||
# resultFile.write("predictions: " + str(flatten_pred) + '\n')
|
||||
# resultFile.write("expected: " + str(labels_test_sample.to_numpy()))
|
||||
|
||||
with open(cwd + "/../result.txt", "w+") as resultFile:
|
||||
resultFile.write("predictions: " + str(flatten_pred) + '\n')
|
||||
resultFile.write("expected: " + str(labels_test_sample.to_numpy()))
|
||||
|
||||
mlflow.log_param('epochs number', numberOfEpochParam)
|
||||
mlflow.log_param('learning rate', learning_rate)
|
||||
mlflow.log_metric('val loss', min(hist["val_loss"]))
|
||||
mlflow.log_param('epochs', numberOfEpochParam)
|
||||
mlflow.log_param('learning_rate', learning_rate)
|
||||
mlflow.log_metric('final_loss', min(hist["val_loss"]))
|
||||
|
||||
signature = mlflow.models.signature.infer_signature(house_price_features, linear_model.predict(house_price_features))
|
||||
|
||||
@ -115,7 +115,7 @@ def train():
|
||||
sampleInp = [0.0, 0.0, 2.0, 904.129525, 1.000000, 1.000000, 20.098413, 79.107860]
|
||||
# expected value is 49.7
|
||||
if tracking_url_type_store != "file":
|
||||
mlflow.keras.log_model(linear_model, "linear-model", registered_model_name="HousePriceLinear", signature=signature, input_example=np.array(sampleInp))
|
||||
mlflow.keras.log_model(linear_model, "linear-model", registered_model_name="HousePriceLinear", signature=signature)
|
||||
else:
|
||||
mlflow.keras.log_model(linear_model, "model", signature=signature, input_example=np.array(sampleInp))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user