I have some Json files. The naming convention of the file is dataset_ML-Model_params.json. For example, House_Lasso_params.json,
House_RF_params.json, Bike_Lasso_params.json, and Bike_RF_params.json.
All of these files contains tuning-hyperparameters in dict format. I can open 1 file using the below code
filename = f"{args.dataset}_Lasso_params.json"
outfile = HT_OUT / filename
with open(outfile, "r") as file:
d_loaded = json.load(file)
Passing the value to the model.
Lasso(**d_loaded, precompute=True)
Again for another file
filename = f"{args.dataset}_RF_params.json"
outfile = HT_OUT / filename
with open(outfile, "r") as file:
rf_loaded = json.load(file)
RF(**rf_loaded)
Here, args.dataset contains the dataset name. Could you tell me, how can I load these 2 files and save them in different variables. So that later i can pass the variable to the model. Like
# After opening and saving the json file in different variable
Lasso(**lasso_params, precompute=True)
RF(**rf_params)