Sowmith22 commited on
Commit
2b37d5e
Β·
verified Β·
1 Parent(s): 063869c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -4
app.py CHANGED
@@ -92,19 +92,20 @@ with tab2:
92
 
93
  st.subheader("πŸ“„ View Dataset Preview")
94
  if st.button("πŸ” Show Dataset Head"):
95
- st.dataframe(df.head())
96
 
97
  st.subheader("⚠️ Fault Distribution")
98
  fault_counts = df['Fault'].value_counts()
99
- st.bar_chart(fault_counts)
100
- st.write(df['Fault'].value_counts(normalize=True) * 100)
101
 
102
  st.subheader("πŸ“Š Correlation Heatmap")
103
  corr = df.corr()
104
  fig, ax = plt.subplots(figsize=(10, 8))
105
  sns.heatmap(corr, annot=True, fmt=".2f", cmap="coolwarm", ax=ax)
106
  st.pyplot(fig)
107
-
 
108
  st.markdown("### πŸ“‰ Feature Distributions by Fault")
109
  features = ['Brake_Pressure', 'Pad_Wear_Level', 'Wheel_Speed_FL', 'Wheel_Speed_FR',
110
  'Wheel_Speed_RL', 'Wheel_Speed_RR', 'Fluid_Temperature', 'Pedal_Position']
@@ -114,6 +115,8 @@ with tab2:
114
  fig, ax = plt.subplots()
115
  sns.kdeplot(data=df, x=feature, hue="Fault", fill=True, common_norm=False, alpha=0.4, ax=ax)
116
  st.pyplot(fig)
 
 
117
 
118
  st.markdown("### πŸ“¦ Boxplots to Compare Fault vs Normal")
119
  for feature in features:
@@ -121,6 +124,8 @@ with tab2:
121
  fig, ax = plt.subplots()
122
  sns.boxplot(data=df, x='Fault', y=feature, palette="Set2", ax=ax)
123
  st.pyplot(fig)
 
 
124
 
125
  st.markdown("### πŸ“ Scatterplots: Detect Patterns or Anomalies")
126
  st.markdown("These help you check combinations of features with color-coded fault info.")
@@ -129,11 +134,16 @@ with tab2:
129
  sns.scatterplot(data=df, x="Brake_Pressure", y="Pad_Wear_Level", hue="Fault", palette="Set1", ax=ax)
130
  ax.set_title("Brake Pressure vs Pad Wear Level")
131
  st.pyplot(fig)
 
 
132
 
133
  fig, ax = plt.subplots()
134
  sns.scatterplot(data=df, x="Pedal_Position", y="Fluid_Temperature", hue="Fault", palette="Set2", ax=ax)
135
  ax.set_title("Pedal Position vs Fluid Temperature")
136
  st.pyplot(fig)
 
 
 
137
 
138
  # ----------------------------- TAB 3 ---------------------------------
139
  with tab3:
 
92
 
93
  st.subheader("πŸ“„ View Dataset Preview")
94
  if st.button("πŸ” Show Dataset Head"):
95
+ st.dataframe(df.head()) # Displays the first few rows to understand the data format and structure
96
 
97
  st.subheader("⚠️ Fault Distribution")
98
  fault_counts = df['Fault'].value_counts()
99
+ st.bar_chart(fault_counts) # Insight: Helps us understand class imbalance. If faults are rare, classification might need balancing.
100
+ st.write(df['Fault'].value_counts(normalize=True) * 100) # Insight: Shows percentage distribution of Fault vs Normal.
101
 
102
  st.subheader("πŸ“Š Correlation Heatmap")
103
  corr = df.corr()
104
  fig, ax = plt.subplots(figsize=(10, 8))
105
  sns.heatmap(corr, annot=True, fmt=".2f", cmap="coolwarm", ax=ax)
106
  st.pyplot(fig)
107
+ # Insight: Shows correlation between features. Helps identify multicollinearity (e.g., front and rear wheel speeds may be strongly correlated).
108
+
109
  st.markdown("### πŸ“‰ Feature Distributions by Fault")
110
  features = ['Brake_Pressure', 'Pad_Wear_Level', 'Wheel_Speed_FL', 'Wheel_Speed_FR',
111
  'Wheel_Speed_RL', 'Wheel_Speed_RR', 'Fluid_Temperature', 'Pedal_Position']
 
115
  fig, ax = plt.subplots()
116
  sns.kdeplot(data=df, x=feature, hue="Fault", fill=True, common_norm=False, alpha=0.4, ax=ax)
117
  st.pyplot(fig)
118
+ # Insight: Helps compare how each feature behaves under Fault vs Normal.
119
+ # For example, if Faults have higher brake pressure, this plot will reveal it through overlapping or shifting distributions.
120
 
121
  st.markdown("### πŸ“¦ Boxplots to Compare Fault vs Normal")
122
  for feature in features:
 
124
  fig, ax = plt.subplots()
125
  sns.boxplot(data=df, x='Fault', y=feature, palette="Set2", ax=ax)
126
  st.pyplot(fig)
127
+ # Insight: Boxplots show outliers, spread, and median differences between Fault and No Fault.
128
+ # Useful to detect features with significant variance or skew in faulty cases.
129
 
130
  st.markdown("### πŸ“ Scatterplots: Detect Patterns or Anomalies")
131
  st.markdown("These help you check combinations of features with color-coded fault info.")
 
134
  sns.scatterplot(data=df, x="Brake_Pressure", y="Pad_Wear_Level", hue="Fault", palette="Set1", ax=ax)
135
  ax.set_title("Brake Pressure vs Pad Wear Level")
136
  st.pyplot(fig)
137
+ # Insight: Shows relationship between brake pressure and pad wear.
138
+ # You may find that high pressure and high wear are often associated with faults.
139
 
140
  fig, ax = plt.subplots()
141
  sns.scatterplot(data=df, x="Pedal_Position", y="Fluid_Temperature", hue="Fault", palette="Set2", ax=ax)
142
  ax.set_title("Pedal Position vs Fluid Temperature")
143
  st.pyplot(fig)
144
+ # Insight: Helps detect abnormal combinations (e.g., high pedal position with low fluid temperature) that could indicate a fault.
145
+
146
+
147
 
148
  # ----------------------------- TAB 3 ---------------------------------
149
  with tab3: