Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- EDA.py +44 -0
- business_problem.py +67 -0
EDA.py
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import seaborn as sns
|
4 |
+
import matplotlib.pyplot as plt
|
5 |
+
import streamlit as st
|
6 |
+
import pandas as pd
|
7 |
+
import numpy as np
|
8 |
+
|
9 |
+
# Load the dataset
|
10 |
+
df = pd.read_csv(r"C:\Users\91879\Downloads\data.csv")
|
11 |
+
|
12 |
+
st.title("π Exploratory Data Analysis")
|
13 |
+
|
14 |
+
|
15 |
+
# Fill missing values
|
16 |
+
df.fillna(df.mean(), inplace=True)
|
17 |
+
st.subheader("π View Dataset Preview")
|
18 |
+
|
19 |
+
if st.button("π Show Dataset Head"):
|
20 |
+
st.dataframe(df.head())
|
21 |
+
|
22 |
+
|
23 |
+
features = [
|
24 |
+
'Brake_Pressure', 'Pad_Wear_Level', 'ABS_Status',
|
25 |
+
'Wheel_Speed_FL', 'Wheel_Speed_FR',
|
26 |
+
'Wheel_Speed_RL', 'Wheel_Speed_RR',
|
27 |
+
'Fluid_Temperature', 'Pedal_Position'
|
28 |
+
]
|
29 |
+
|
30 |
+
st.subheader("β οΈ Fault Distribution")
|
31 |
+
fault_counts = df['Fault'].value_counts()
|
32 |
+
st.bar_chart(fault_counts)
|
33 |
+
st.write(df['Fault'].value_counts(normalize=True) * 100)
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
st.subheader("π Correlation Heatmap")
|
38 |
+
corr = df.corr()
|
39 |
+
fig, ax = plt.subplots(figsize=(10, 8))
|
40 |
+
sns.heatmap(corr, annot=True, fmt=".2f", cmap="coolwarm", ax=ax)
|
41 |
+
st.pyplot(fig)
|
42 |
+
|
43 |
+
|
44 |
+
|
business_problem.py
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
import streamlit as st
|
4 |
+
|
5 |
+
st.header("π Brake System Fault Detection")
|
6 |
+
|
7 |
+
|
8 |
+
|
9 |
+
feature_desc = {
|
10 |
+
'Brake_Pressure': "Pressure applied to the brake pedal.",
|
11 |
+
'Pad_Wear_Level': "Indicates the wear level of brake pads.",
|
12 |
+
'ABS_Status': "1 if Anti-lock Braking System is active, else 0.",
|
13 |
+
'Wheel_Speed_FL': "Speed of the front-left wheel.",
|
14 |
+
'Wheel_Speed_FR': "Speed of the front-right wheel.",
|
15 |
+
'Wheel_Speed_RL': "Speed of the rear-left wheel.",
|
16 |
+
'Wheel_Speed_RR': "Speed of the rear-right wheel.",
|
17 |
+
'Fluid_Temperature': "Temperature of the brake fluid.",
|
18 |
+
'Pedal_Position': "How far the brake pedal is pressed."
|
19 |
+
}
|
20 |
+
|
21 |
+
selected = st.selectbox("Select a feature to understand:", list(feature_desc.keys()))
|
22 |
+
st.info(f"π **{selected}**: {feature_desc[selected]}")
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
# π― Goal
|
28 |
+
st.markdown("### π― Goal")
|
29 |
+
st.markdown("""
|
30 |
+
Build a data-driven model that detects braking system faults using sensor data such as brake pressure, wheel speeds, fluid temperature, and pedal position.
|
31 |
+
""")
|
32 |
+
|
33 |
+
# πΌ Business Objective
|
34 |
+
st.markdown("### π Business Objective")
|
35 |
+
st.markdown("""
|
36 |
+
- Detect faults early to reduce vehicle failure risks.
|
37 |
+
- Analyze sensor behavior during fault vs non-fault conditions.
|
38 |
+
- Support preventive maintenance using historical data patterns.
|
39 |
+
""")
|
40 |
+
st.markdown("### π Data Understanding")
|
41 |
+
|
42 |
+
st.markdown("""
|
43 |
+
The dataset contains **real-time sensor readings** collected from a vehicle's braking system to detect faults. Below are the details of each feature:
|
44 |
+
|
45 |
+
#### π’ Numerical Features:
|
46 |
+
|
47 |
+
- **Brake_Pressure**: Pressure applied to the braking system (in bar or psi).
|
48 |
+
- **Pad_Wear_Level**: Indicates how much the brake pads have worn down (in % or mm).
|
49 |
+
- **Wheel_Speed_FL**: Speed of the **front-left** wheel (in km/h).
|
50 |
+
- **Wheel_Speed_FR**: Speed of the **front-right** wheel (in km/h).
|
51 |
+
- **Wheel_Speed_RL**: Speed of the **rear-left** wheel (in km/h).
|
52 |
+
- **Wheel_Speed_RR**: Speed of the **rear-right** wheel (in km/h).
|
53 |
+
- **Fluid_Temperature**: Temperature of the brake fluid (in Β°C).
|
54 |
+
- **Pedal_Position**: Position of the brake pedal, indicating how far it is pressed (0β100%).
|
55 |
+
|
56 |
+
#### π Categorical Feature:
|
57 |
+
|
58 |
+
- **ABS_Status**: Anti-lock Braking System status β
|
59 |
+
- `1`: Active
|
60 |
+
- `0`: Inactive
|
61 |
+
|
62 |
+
#### π― Target Variable:
|
63 |
+
|
64 |
+
- **Fault**:
|
65 |
+
- `0`: Normal (No issue detected)
|
66 |
+
- `1`: Fault Detected (Brake system problem)
|
67 |
+
""")
|