diff --git a/src/pages/2-model_creation.py b/src/pages/2-model_creation.py index e425bdfb5414c52335c769e206b5b7d14fbd8398..276f330a53df4f012d7cc619465cd2c64d4445f3 100644 --- a/src/pages/2-model_creation.py +++ b/src/pages/2-model_creation.py @@ -1,4 +1,3 @@ -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])