File size: 527 Bytes
4cba5e1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import json
def load_model(config_path="model_config.json"):
with open(config_path) as f:
return json.load(f)
def predict_length(gt_value, config):
coef = config["coefficients"]
if config["model_type"] == "log_log_power_regression":
return coef["a"] * (gt_value ** coef["b"])
else:
return coef["intercept"] + coef["slope"] * gt_value
if __name__ == "__main__":
cfg = load_model()
gt = float(input("Masukkan nilai GT: "))
print("Prediksi Length:", predict_length(gt, cfg))
|