Skip to content
# 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 session
import 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

  1. check the dtypes
  2. spot the missing values
  3. describe numerical
  4. value counts for categorical
  5. visualize distributions
  6. check for correlations

Checking the dtypes.

  1. All dtypes are numeric
  2. TypeOfSteel_A300, TypeOfSteel_A400 are one-hot-encoded labels
  3. Target values are one-hot-encoded labels
train.dtypes

Missing values

No missing values in train and test

train.isna().sum()
test.isna().sum()

Stats

  1. Describe
  2. Let's have a look at the target value labels' counts
  3. Let's visualize the basic stats using boxplot
  4. Let's check the distribution using ridgeplot
train.describe()
train.head()
train.shape
import seaborn as sns
import matplotlib.pyplot as plt
num_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']