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:
|
entry_points:
|
||||||
main:
|
main:
|
||||||
parameters:
|
parameters:
|
||||||
numberOfEpochParam: {type: float, default: 3}
|
epochs: {type: float, default: 3}
|
||||||
learning_rate: {type: float, default: 0.1}
|
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
|
import mlflow.keras
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
mlflow.set_tracking_uri("http://127.0.0.1:5000")
|
||||||
mlflow.set_tracking_uri("http://172.17.0.1:5000")
|
# mlflow.set_tracking_uri("http://172.17.0.1:5000")
|
||||||
mlflow.set_experiment('s444417')
|
mlflow.set_experiment('s444417')
|
||||||
|
|
||||||
# train params
|
# train params
|
||||||
@ -53,8 +53,8 @@ def train():
|
|||||||
normalize = layers.Normalization()
|
normalize = layers.Normalization()
|
||||||
normalize.adapt(house_price_features)
|
normalize.adapt(house_price_features)
|
||||||
|
|
||||||
feature_test_sample = house_price_test.sample(10)
|
# feature_test_sample = house_price_test.sample(10)
|
||||||
labels_test_sample = feature_test_sample.pop('TARGET(PRICE_IN_LACS)')
|
# labels_test_sample = feature_test_sample.pop('TARGET(PRICE_IN_LACS)')
|
||||||
|
|
||||||
house_price_test_features = house_price_test.copy()
|
house_price_test_features = house_price_test.copy()
|
||||||
# pop column
|
# pop column
|
||||||
@ -97,16 +97,16 @@ def train():
|
|||||||
test_results['linear_model'] = linear_model.evaluate(
|
test_results['linear_model'] = linear_model.evaluate(
|
||||||
house_price_test_features, house_price_test_expected, verbose=0)
|
house_price_test_features, house_price_test_expected, verbose=0)
|
||||||
|
|
||||||
pred = np.array(linear_model.predict(feature_test_sample))
|
# pred = np.array(linear_model.predict(feature_test_sample))
|
||||||
flatten_pred = flatten(pred)
|
# 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:
|
mlflow.log_param('epochs', numberOfEpochParam)
|
||||||
resultFile.write("predictions: " + str(flatten_pred) + '\n')
|
mlflow.log_param('learning_rate', learning_rate)
|
||||||
resultFile.write("expected: " + str(labels_test_sample.to_numpy()))
|
mlflow.log_metric('final_loss', min(hist["val_loss"]))
|
||||||
|
|
||||||
mlflow.log_param('epochs number', numberOfEpochParam)
|
|
||||||
mlflow.log_param('learning rate', learning_rate)
|
|
||||||
mlflow.log_metric('val loss', min(hist["val_loss"]))
|
|
||||||
|
|
||||||
signature = mlflow.models.signature.infer_signature(house_price_features, linear_model.predict(house_price_features))
|
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]
|
sampleInp = [0.0, 0.0, 2.0, 904.129525, 1.000000, 1.000000, 20.098413, 79.107860]
|
||||||
# expected value is 49.7
|
# expected value is 49.7
|
||||||
if tracking_url_type_store != "file":
|
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:
|
else:
|
||||||
mlflow.keras.log_model(linear_model, "model", signature=signature, input_example=np.array(sampleInp))
|
mlflow.keras.log_model(linear_model, "model", signature=signature, input_example=np.array(sampleInp))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user