Skip to content
Snippets Groups Projects
Commit 3827237c authored by DIANE's avatar DIANE
Browse files

model creation

parent d762fd24
No related branches found
No related tags found
No related merge requests found
from utils.data_handling import st_var
from common import *
st.set_page_config(page_title="NIRS Utils", page_icon=":goat:", layout="wide")
......@@ -8,13 +7,11 @@ UiComponents(pagespath=pages_folder, csspath=css_file, imgpath=image_path,
header=True, sidebar=True, bgimg=False, colborders=True)
st_var(variable='counter', initialize=True, update=False)
st_var(variable='counter', initialize=True, update=False, type='increment')
################ clean the results dir #############
HandleItems.delete_files(keep=['.py', '.pyc', '.bib'])
for i in ['model', 'dataset', 'figures']:
dirpath = Path('./report/results/')
if not dirpath.exists():
dirpath.mkdir(parents=True, exist_ok=True)
Path('./report/results/model').mkdir(parents=True, exist_ok=True)
# ####################################### page preamble #######################################
st.header("Calibration Model Development") # page title
st.markdown("Create a predictive model, then use it for predicting your target variable (chemical data) from NIRS spectra")
......@@ -277,7 +274,7 @@ if not x_block.empty and not y.empty:
################################################### END : visualize and split the data #######################################################
# ################################################### BEGIN : Create Model ####################################################
################################################### BEGIN : Create Model ####################################################
model_type = None # initialize the selected regression algorithm
model = None # initialize the regression model object
intervalls_with_cols = DataFrame()
......@@ -348,9 +345,6 @@ if not x_block.empty and not y.empty:
'##### https://journals.sagepub.com/doi/abs/10.1366/0003702001949500')
st.markdown("-------------")
# # if model_type != st.session_state.model_type:
# # st.session_state.model_type = model_type
# # increment()
# Training set preparation for cross-validation(CV)
with c5: # Model columns
......@@ -492,7 +486,7 @@ if not x_block.empty and not y.empty:
max_value=500, value=10 if model_type == 'TPE-iPLS' else None, disabled=False if model_type == 'TPE-iPLS' else True)
remodel_button = st.button('re-model the data', type="primary", use_container_width=True,
disabled=False if model_type else True,
on_click=lambda: st_var(variable='counter', initialize=False, update=True))
on_click=lambda: st_var(variable='counter', initialize=False, update=True, type = 'increment'))
hash_ = ObjectHash(current=hash_, add=[
iternum, internum, st.session_state.counter, model_type])
......
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