Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NIRS_Workflow
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CEFE
PACE
NIRS_Workflow
Commits
2cd400f0
Commit
2cd400f0
authored
7 months ago
by
DIANE
Browse files
Options
Downloads
Patches
Plain Diff
preprocessed spectra plot visualization + report
parent
6ec8e4c7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Report/report.py
+10
-3
10 additions, 3 deletions
src/Report/report.py
src/pages/2-model_creation.py
+7
-6
7 additions, 6 deletions
src/pages/2-model_creation.py
with
17 additions
and
9 deletions
src/Report/report.py
+
10
−
3
View file @
2cd400f0
...
...
@@ -340,9 +340,16 @@ def report(*args):
\label{fig:importance}
\end{figure}
"""
elif
"
LW-PLS
"
in
to_report
:
""""""
elif
"
LW-PLS
"
in
to_report
:
latex_report
+=
r
"""
The average of raw and preprocessed spectra is visualized in \cref{fig:importance}. \par
\begin{figure}[h]
\centering
\includegraphics[width=1\linewidth]{Variable_importance.png}
\caption{Visualizing the average spectrum computed for raw and preprocessed spectra}
\label{fig:importance}
\end{figure}
"""
elif
"
TPE-iPLS
"
in
to_report
:
latex_report
+=
r
"""
Many research papers have proved that interval selection methods, with different number of intervalls, helps reduce noise and model overfitting,
...
...
This diff is collapsed.
Click to expand it.
src/pages/2-model_creation.py
+
7
−
6
View file @
2cd400f0
...
...
@@ -186,8 +186,8 @@ if not spectra.empty and not y.empty:
#M2.dataframe(Pin.pred_data_)
elif
regression_algo
==
reg_algo
[
2
]:
M
1
.
write
(
'
KFold for Cross-Validation
=
'
+
str
(
nb_folds
))
info
=
M
1
.
info
(
'
Starting LWPLSR model creation... Please wait a few minutes.
'
)
M
20
.
write
(
f
'
K
-
Fold for Cross-Validation
(K =
{
str
(
nb_folds
)
}
)
'
)
info
=
M
20
.
info
(
'
Starting LWPLSR model creation... Please wait a few minutes.
'
)
# export data to csv for Julia train/test
data_to_work_with
=
[
'
x_train_np
'
,
'
y_train_np
'
,
'
x_test_np
'
,
'
y_test_np
'
]
x_train_np
,
y_train_np
,
x_test_np
,
y_test_np
=
X_train
.
to_numpy
(),
y_train
.
to_numpy
(),
X_test
.
to_numpy
(),
y_test
.
to_numpy
()
...
...
@@ -260,14 +260,15 @@ if not spectra.empty and not y.empty:
## plots
Reg
.
cv_data_
=
KF_CV
().
meas_pred_eq
(
y
=
np
.
array
(
y_train
),
ypcv
=
Reg
.
cv_data_
[
'
YpredCV
'
],
folds
=
folds
)
Reg
.
pretreated_spectra_
=
preReg
.
pretreated_spectra_
Reg
.
best_hyperparams_print
=
{
**
preReg
.
best_hyperparams_
,
**
Reg
.
best_hyperparams_
}
Reg
.
best_hyperparams_
=
{
**
preReg
.
best_hyperparams_
,
**
Reg
.
best_hyperparams_
}
info
.
empty
()
M
1
.
success
(
'
Model created!
'
)
M
20
.
success
(
'
Model created!
'
)
except
FileNotFoundError
as
e
:
# Display error message on the interface if modeling is wrong
info
.
empty
()
M
1
.
warning
(
'
- ERROR during model creation -
'
)
M
20
.
warning
(
'
- ERROR during model creation -
'
)
Reg
=
None
for
i
in
data_to_work_with
:
os
.
unlink
(
temp_path
/
str
(
i
+
"
.csv
"
))
...
...
@@ -481,8 +482,8 @@ if not spectra.empty and not y.empty and regression_algo:
if
regression_algo
in
reg_algo
[
1
:]
and
Reg
is
not
None
:
fig
,
(
ax1
,
ax2
)
=
plt
.
subplots
(
2
,
1
,
figsize
=
(
12
,
4
),
sharex
=
True
)
ax1
.
plot
(
colnames
,
np
.
mean
(
X_train
,
axis
=
0
),
color
=
'
black
'
,
label
=
'
Average spectrum (Raw)
'
)
if
regression_algo
!=
reg_algo
[
2
]:
ax2
.
plot
(
colnames
,
np
.
mean
(
Reg
.
pretreated_spectra_
,
axis
=
0
),
color
=
'
black
'
,
label
=
'
Average spectrum (
p
retreated)
'
)
#
if regression_algo != reg_algo[2]:
ax2
.
plot
(
colnames
,
np
.
mean
(
Reg
.
pretreated_spectra_
,
axis
=
0
),
color
=
'
black
'
,
label
=
'
Average spectrum (
P
retreated)
'
)
ax2
.
set_xlabel
(
'
Wavelenghts
'
)
plt
.
tight_layout
()
...
...
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