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

PCA color filter

prediction using ipls model
parent 05f3b896
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,8 @@ from Class_Mod.DATA_HANDLING import * ...@@ -6,6 +6,8 @@ from Class_Mod.DATA_HANDLING import *
################################### Data Loading and Visualization ######################################## ################################### Data Loading and Visualization ########################################
container1 = st.container(border=True) container1 = st.container(border=True)
col2, col1 = st.columns([3, 1]) col2, col1 = st.columns([3, 1])
col1.header("Data Loading", divider='blue')
col2.header("Spectral Data Visualization", divider='blue')
container2 = st.container(border=True) container2 = st.container(border=True)
...@@ -15,8 +17,6 @@ influence, hotelling, qexp = st.columns([2, 2, 1]) ...@@ -15,8 +17,6 @@ influence, hotelling, qexp = st.columns([2, 2, 1])
with container1: with container1:
col1.header("Data Loading", divider='blue')
col2.header("Spectral Data Visualization", divider='blue')
# loader for csv file containing NIRS spectra # loader for csv file containing NIRS spectra
sselectx_csv = col1.file_uploader("Load NIRS Data", type=["csv","dx"], help=" :mushroom: select a csv matrix with samples as rows and lambdas as columns", key=5) sselectx_csv = col1.file_uploader("Load NIRS Data", type=["csv","dx"], help=" :mushroom: select a csv matrix with samples as rows and lambdas as columns", key=5)
if sselectx_csv is not None: if sselectx_csv is not None:
...@@ -59,9 +59,10 @@ with container1: ...@@ -59,9 +59,10 @@ with container1:
data = DxRead(path = tmp_path) data = DxRead(path = tmp_path)
data_import = data.specs_df_ data_import = data.specs_df_
st.success("The data have been loaded successfully", icon="") st.success("The data have been loaded successfully", icon="")
## Visualize spectra ## Visualize spectra
with col2: with col2:
fig, ax = plt.subplots(figsize = (30,7)) fig, ax = plt.subplots(figsize = (30,7))
data_import.T.plot(legend=False, ax = ax, color = 'blue') data_import.T.plot(legend=False, ax = ax, color = 'blue')
...@@ -85,11 +86,10 @@ with container1: ...@@ -85,11 +86,10 @@ with container1:
###################################################################################### ######################################################################################
############################## Exploratory data analysis ############################### ############################## Exploratory data analysis ###############################
plot_type=['', 'PCA','UMAP', 'NMF']
cluster_methods = ['', 'Kmeans','UMAP', 'AP']
with container2: with container2:
if sselectx_csv is not None: if sselectx_csv is not None:
plot_type=['', 'PCA','UMAP', 'NMF']
cluster_methods = ['', 'Kmeans','UMAP', 'AP']
with pc: with pc:
type_plot = st.selectbox("Dimensionality reduction techniques: ", options=plot_type, key=37) type_plot = st.selectbox("Dimensionality reduction techniques: ", options=plot_type, key=37)
type_cluster = st.selectbox("Clustering techniques: ", options=cluster_methods, key=38) type_cluster = st.selectbox("Clustering techniques: ", options=cluster_methods, key=38)
...@@ -128,8 +128,15 @@ with container2: ...@@ -128,8 +128,15 @@ with container2:
else: else:
fig = px.scatter_3d(t, x=axis1, y=axis2, z = axis3) if test == '.dx':
fig.update_traces(marker=dict(size=4)) filter = ['origin', 'date', 'time', 'spectrometer/data system']
col = st.selectbox('filter', options= filter)
fig = px.scatter_3d(t, x=axis1, y=axis2, z = axis3, color = data.md_df_[col])
fig.update_traces(marker=dict(size=4))
else:
fig = px.scatter_3d(t, x=axis1, y=axis2, z = axis3 )
fig.update_traces(marker=dict(size=4))
st.plotly_chart(fig) st.plotly_chart(fig)
......
...@@ -42,7 +42,7 @@ if NIRS_csv: ...@@ -42,7 +42,7 @@ if NIRS_csv:
if index: if index:
idx = pd.read_csv(index, sep=';', index_col=0).iloc[:,0].to_numpy() idx = pd.read_csv(index, sep=';', index_col=0).iloc[:,0].to_numpy()
result = '' #result = ''
if st.button("Predict"): if st.button("Predict"):
if s: if s:
......
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