Add cluster stats (#13)
Co-authored-by: bastien ollier <bastien.ollier@etu.uca.fr> Reviewed-on: https://codefirst.iut.uca.fr/git/clement.freville2/miner/pulls/13 Reviewed-by: Hugo PRADIER <hugo.pradier2@etu.uca.fr> Reviewed-by: Clément FRÉVILLE <clement.freville2@etu.uca.fr> Co-authored-by: Bastien OLLIER <bastien.ollier@noreply.codefirst.iut.uca.fr> Co-committed-by: Bastien OLLIER <bastien.ollier@noreply.codefirst.iut.uca.fr>
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import streamlit as st
|
||||
import matplotlib.pyplot as plt
|
||||
from sklearn.cluster import DBSCAN
|
||||
from clusters import DBSCAN_cluster
|
||||
|
||||
st.header("Clustering: dbscan")
|
||||
|
||||
|
||||
if "data" in st.session_state:
|
||||
data = st.session_state.data
|
||||
|
||||
@@ -17,8 +16,9 @@ if "data" in st.session_state:
|
||||
if len(data_name) >= 2 and len(data_name) <=3:
|
||||
x = data[data_name].to_numpy()
|
||||
|
||||
dbscan = DBSCAN(eps=eps, min_samples=min_samples)
|
||||
y_dbscan = dbscan.fit_predict(x)
|
||||
dbscan = DBSCAN_cluster(eps,min_samples,x)
|
||||
y_dbscan = dbscan.run()
|
||||
st.table(dbscan.get_stats())
|
||||
|
||||
fig = plt.figure()
|
||||
if len(data_name) == 2:
|
||||
@@ -28,8 +28,5 @@ if "data" in st.session_state:
|
||||
ax = fig.add_subplot(projection='3d')
|
||||
ax.scatter(x[:, 0], x[:, 1],x[:, 2], c=y_dbscan, s=50, cmap="viridis")
|
||||
st.pyplot(fig)
|
||||
|
||||
|
||||
|
||||
else:
|
||||
st.error("file not loaded")
|
Reference in New Issue
Block a user