Gaussian Navie Bayes Classifier was applied on IRIS dataset. Different types of normality tests were used to introduce the normality concepts. Implementation of Gaussian Naive Bayes Model is done to demonstrate its working.
First, we need to import the libraries
Pandas, Numpy, Seaborn, Matplotlib, Sklearn, Scipy
Second, need to prepare the data
-
Exploratory Data Analysis
profile = ProfileReport(df, title='Profile Reports', explorative=True)
-
Standardization : Through StandardScaler
-
Checking Null cells
-
Train/Test Split
Third, Normality Test *check p value according to tests
-
Skewness - Kurtosis Test
print(stats.kurtosis(X))
print(stats.skew(X))
-
Shapiro - Wilk Test
stat, p = shapiro(X[i])
-
Kolmogorov-Smirnov Test
stat1, p1 = kstest(X[i], 'norm')
Fourth, Applying Gaussian Naive-Bayes Model
Model accuracy was found to be 97.7%
Fifth, Confusion Matrix & Classification Report
-
Confusion Matrix Plot (heatmap)
sns.heatmap(confusion_mat, annot = True)
-
CLassification Report
Finally, Predict the outcomes