Skip to content
Steel Plate Defect VISUAL EDA
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
# Input data files are available in the read-only "../input/" directory
# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory
import os
for dirname, _, filenames in os.walk('/kaggle/input'):
for filename in filenames:
print(os.path.join(dirname, filename))
# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using "Save & Run All"
# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current sessionimport warnings
from pandas.errors import SettingWithCopyWarning
warnings.filterwarnings("ignore", category = FutureWarning)
warnings.filterwarnings("ignore", category = SettingWithCopyWarning)train = pd.read_csv('train.csv')
test = pd.read_csv('test.csv')Plan for today
- check the dtypes
- spot the missing values
- describe numerical
- value counts for categorical
- visualize distributions
- check for correlations
Checking the dtypes.
- All dtypes are numeric
- TypeOfSteel_A300, TypeOfSteel_A400 are one-hot-encoded labels
- Target values are one-hot-encoded labels
train.dtypesMissing values
No missing values in train and test
train.isna().sum()test.isna().sum()Stats
- Describe
- Let's have a look at the target value labels' counts
- Let's visualize the basic stats using boxplot
- Let's check the distribution using ridgeplot
train.describe()train.head()train.shapeimport seaborn as sns
import matplotlib.pyplot as pltnum_col = ['X_Minimum', 'X_Maximum', 'Y_Minimum', 'Y_Maximum', 'Pixels_Areas', 'X_Perimeter', 'Y_Perimeter', 'Sum_of_Luminosity', 'Minimum_of_Luminosity', 'Maximum_of_Luminosity', 'Length_of_Conveyer', 'Steel_Plate_Thickness', 'Edges_Index', 'Empty_Index', 'Square_Index', 'Outside_X_Index', 'Edges_X_Index', 'Edges_Y_Index', 'Outside_Global_Index', 'LogOfAreas', 'Log_X_Index', 'Log_Y_Index', 'Orientation_Index', 'Luminosity_Index', 'SigmoidOfAreas']
target_col = ['Pastry', 'Z_Scratch','K_Scatch', 'Stains', 'Dirtiness', 'Bumps', 'Other_Faults']