Skip to content
Snippets Groups Projects
Commit ac1a9cbd authored by DIANE's avatar DIANE
Browse files
parents f13be054 0b75c261
No related branches found
No related tags found
No related merge requests found
.idea/
GUI_Pinard.iml
__pycache__/
src/data/models/*
src/data/predictions/*
src/data/sample_selections/*
src/data/params/*
src/Report/*.pdf
src/Report/*.tex
src/Report/figures/
src/temp/*
config/config.json
\ No newline at end of file
File added
This diff is collapsed.
......@@ -5,7 +5,7 @@ from LWPLSR_ import LWPLSR
# loading the lwplsr_inputs.json
temp_path = Path("temp/")
for i in ['x_train_np', 'y_train_np', 'x_test_np', 'y_test_np']:#,'x_train_np_cv1', 'y_train_np_cv1', 'x_test_np_cv1', 'y_test_np_cv1', 'x_train_np_cv2', 'y_train_np_cv2', 'x_test_np_cv2', 'y_test_np_cv2', 'x_train_np_cv3', 'y_train_np_cv3', 'x_test_np_cv3', 'y_test_np_cv3',]:
for i in ['x_train_np', 'y_train_np', 'x_test_np', 'y_test_np','x_train_np_cv1', 'y_train_np_cv1', 'x_test_np_cv1', 'y_test_np_cv1', 'x_train_np_cv2', 'y_train_np_cv2', 'x_test_np_cv2', 'y_test_np_cv2', 'x_train_np_cv3', 'y_train_np_cv3', 'x_test_np_cv3', 'y_test_np_cv3',]:
globals()[i] = np.genfromtxt(temp_path / str(i + ".csv"), delimiter=',')
print('CSV imported')
print('start model creation')
......
......@@ -17,7 +17,7 @@ class Umap:
else:
self.categorical_data_encoded = None
self.model = UMAP(n_neighbors=20, n_components=3, min_dist=0.0, random_state=42,)
self.model = UMAP(n_neighbors=20, n_components=3, min_dist=0.0, )#random_state=42,)
self.model.fit(self.numerical_data, y = self.categorical_data_encoded)
self.scores_raw = self.model.transform(self.numerical_data)
self.scores = pd.DataFrame(self.scores_raw)
......
*
!.gitignore
\ No newline at end of file
* # git ignore tous les fichiers
!.gitignore # sauf celui-ci
\ No newline at end of file
* # git ignore tous les fichiers
!.gitignore # sauf celui-ci
\ No newline at end of file
* # git ignore tous les fichiers
!.gitignore # sauf celui-ci
\ No newline at end of file
{"meta_project": "Life of Brian", "meta_sample_species": "Life of Brian", "meta_sample_category": "Soil", "meta_sample_pretreatment": "Powder", "meta_machine_ID": "Life of Brian", "meta_sample_sub_category": "Green leave", "meta_sample_humidity": "Dry", "meta_scan_place": "Pace"}
\ No newline at end of file
......@@ -119,8 +119,12 @@ if not spectra.empty:
elif dim_red_method == dim_red_methods[2]:
if not meta_data.empty:
filter = md_df_st_.columns
filter = filter.insert(0, 'Nothing')
col = pc.selectbox('Supervised UMAP by:', options= filter, key=108)
supervised = md_df_st_[col]
if col == 'Nothing':
supervised = None
else:
supervised = md_df_st_[col]
else:
supervised = None
dr_model = Umap(numerical_data = MinMaxScale(spectra), cat_data = supervised)
......@@ -156,7 +160,8 @@ if not t.empty:
# 2- HDBSCAN clustering
elif clus_method == cluster_methods[2]:
optimized_hdbscan = Hdbscan(np.array(tcr))
all_labels, hdbscan_score, clu_centers = optimized_hdbscan.HDBSCAN_scores_
# all_labels, hdbscan_score, clu_centers = optimized_hdbscan.HDBSCAN_scores_
all_labels, clu_centers = optimized_hdbscan.HDBSCAN_scores_
labels = [f'cluster#{i+1}' if i !=-1 else 'Non clustered' for i in all_labels]
# 3- Affinity propagation
......@@ -221,9 +226,10 @@ if labels:
sam1.insert(loc=0, column='index', value=selected_samples_idx)
sam1.insert(loc=1, column='cluster', value=np.array(labels)[selected_samples_idx])
sam1.index = np.arange(len(selected_samples_idx))+1
st.write(f' - The total number of samples:{tcr.shape[0]}.\n- The number of selected samples for chemical analysis: {sam1.shape[0]}.')
st.write(f' - The total number of samples: {tcr.shape[0]}.\n- The number of selected samples for chemical analysis: {sam1.shape[0]}.')
sam = sam1
unclus = st.checkbox("Include non clustered samples (for HDBSCAN clustering)", value=True)
if clus_method == cluster_methods[2]:
unclus = st.checkbox("Include non clustered samples (for HDBSCAN clustering)", value=True)
if clus_method == cluster_methods[2]:
if selected_samples_idx:
......
* # git ignore tous les fichiers
!.gitignore # sauf celui-ci
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment