Spaces:
Build error
Build error
Update app.py
Browse files178 unmodified lines17918018118218318418538 unmodified lines224225226227228229230231232233234235236237238239240241242243244245246178 unmodified lines# Option to toggle PCAuse_pca = st.checkbox('Use PCA for Visualization', value=True)# Create a DataFrame for easier plotting with plotlydf_transformed = pd.DataFrame(X_transformed, columns=['Feature1', 'Feature2'])38 unmodified lines# Update layoutfig.update_layout(width=1200, height=500)st.write("""### Visualizing Groups##### Here are the groups from our tidying method. Each color has a number at its center, representing its group.""")st.plotly_chart(fig)if use_pca:st.write("""##### 🧠 PCA (Principal Component Analysis) is like looking at a messy room from the best angle to see the most mess. It helps us see our data more clearly!""")# Apply PCA for dimensionality reductionpca = PCA(n_components=2)X_transformed = pca.fit_transform(X)user_features_transformed = pca.transform([user_features])[0]else:X_transformed = X[:, :2] # Just use the first two features for visualizationuser_features_transformed = user_features[:2]st.write(f"##### Overlapping clusters mean some flowers are very similar and hard to tell apart just by looking at these features.")st.write(f"# Based on your flower data (⭐), it likely belongs to **Group {dmojis[predicted_cluster[0]+1]}**")178 unmodified lines17918018118218318418518618718818919019119219319419519619719819920020120238 unmodified lines241242243244245246247178 unmodified lines# Option to toggle PCAuse_pca = st.checkbox('Use PCA for Visualization', value=True)st.write("""### Visualizing Groups##### Here are the groups from our tidying method. Each color has a number at its center, representing its group.""")st.plotly_chart(fig)if use_pca:st.write("""##### 🧠 PCA (Principal Component Analysis) is like looking at a messy room from the best angle to see the most mess. It helps us see our data more clearly!""")# Apply PCA for dimensionality reductionpca = PCA(n_components=2)X_transformed = pca.fit_transform(X)user_features_transformed = pca.transform([user_features])[0]else:X_transformed = X[:, :2] # Just use the first two features for visualizationuser_features_transformed = user_features[:2]# Create a DataFrame for easier plotting with plotlydf_transformed = pd.DataFrame(X_transformed, columns=['Feature1', 'Feature2'])38 unmodified lines# Update layoutfig.update_layout(width=1200, height=500)st.write(f"##### Overlapping clusters mean some flowers are very similar and hard to tell apart just by looking at these features.")st.write(f"# Based on your flower data (⭐), it likely belongs to **Group {dmojis[predicted_cluster[0]+1]}**")
app.py+19-18