Skip to content
Snippets Groups Projects
Commit 8323a157 authored by Danilo Ferreira de Lima's avatar Danilo Ferreira de Lima
Browse files

Using two pipelines to split more evenly the preprocessing steps.

parent eba3fc96
No related branches found
No related tags found
1 merge request!2Restructured code to use classes compatible with joblib and minimize hacks when saving
...@@ -32,12 +32,11 @@ model.fit(low_resolution_raw_data, ...@@ -32,12 +32,11 @@ model.fit(low_resolution_raw_data,
high_resolution_photon_energy) high_resolution_photon_energy)
# save it for later usage: # save it for later usage:
model.save("model.h5") model.save("model.joblib")
# when performing inference: # when performing inference:
# load a model: # load a model:
model = Model() model = Model.load("model.joblib")
model.load("model.h5")
# and use it to map a low-resolution spectrum to a high-resolution one # and use it to map a low-resolution spectrum to a high-resolution one
# as before, the low_resolution_raw_data refers to a dictionary mapping the channel name # as before, the low_resolution_raw_data refers to a dictionary mapping the channel name
......
This diff is collapsed.
...@@ -139,18 +139,17 @@ def main(): ...@@ -139,18 +139,17 @@ def main():
spec_raw_pe[train_idx, :]) spec_raw_pe[train_idx, :])
t += [time_ns() - start] t += [time_ns() - start]
t_names += ["Fit"] t_names += ["Fit"]
spec_smooth = model.preprocess_high_res(spec_raw_int, spec_raw_pe) spec_smooth = model.preprocess_high_res(spec_raw_int)
print("Saving the model") print("Saving the model")
start = time_ns() start = time_ns()
model.save("model.h5") model.save("model.joblib")
t += [time_ns() - start] t += [time_ns() - start]
t_names += ["Save"] t_names += ["Save"]
print("Loading the model") print("Loading the model")
start = time_ns() start = time_ns()
model = Model() model = Model.load("model.joblib")
model.load("model.h5")
t += [time_ns() - start] t += [time_ns() - start]
t_names += ["Load"] t_names += ["Load"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment