Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pes_to_spec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Machine Learning projects.
pes_to_spec
Commits
8323a157
Commit
8323a157
authored
2 years ago
by
Danilo Ferreira de Lima
Browse files
Options
Downloads
Patches
Plain Diff
Using two pipelines to split more evenly the preprocessing steps.
parent
eba3fc96
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!2
Restructured code to use classes compatible with joblib and minimize hacks when saving
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+2
-3
2 additions, 3 deletions
README.md
pes_to_spec/model.py
+346
-264
346 additions, 264 deletions
pes_to_spec/model.py
pes_to_spec/test/offline_analysis.py
+3
-4
3 additions, 4 deletions
pes_to_spec/test/offline_analysis.py
with
351 additions
and
271 deletions
README.md
+
2
−
3
View file @
8323a157
...
@@ -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.
Click to expand it.
pes_to_spec/model.py
+
346
−
264
View file @
8323a157
This diff is collapsed.
Click to expand it.
pes_to_spec/test/offline_analysis.py
+
3
−
4
View file @
8323a157
...
@@ -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
"
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment