-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultivariate_analysis.py
More file actions
32 lines (24 loc) · 978 Bytes
/
Multivariate_analysis.py
File metadata and controls
32 lines (24 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from abc import ABC, abstractmethod
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
class MultiVariateanalysisTemplete(ABC):
def analyze(self, df:pd.DataFrame):
self.generate_correlation_heatmap(df)
self.generate_pairplot(df)
@abstractmethod
def generate_correlation_heatmap(self, df:pd.DataFrame):
pass
@abstractmethod
def generate_pairplot(self, df: pd.DataFrame):
pass
class SimpleMultivariateAnalysis(MultiVariateanalysisTemplete):
def generate_correlation_heatmap(self, df: pd.DataFrame):
plt.figure(figsize=(12,10))
sns.heatmap(df.corr(), annot= True, fmt=".2f", cmap="cool")
plt.title("correlation Heatmap")
plt.show()
def generate_pairplot(self, df: pd.DataFrame):
sns.pairplot(df)
plt.suptitle("pair plot of selected features", y = 1.02)
plt.show()