add stats

This commit is contained in:
bastien ollier
2024-06-21 15:57:34 +02:00
committed by clfreville2
parent 4d82767c68
commit c8cf0fe045
3 changed files with 74 additions and 14 deletions

View File

@@ -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")