Skip to content

Instantly share code, notes, and snippets.

X_train, X_test, y_train, y_test = train_test_split(x_ros,y_ros,test_size=0.2,random_state=42)
y_train=to_categorical(y_train)
y_test=to_categorical(y_test)
print('X_train :',X_train.shape)
print('y_train :',y_train.shape)
print('X_test :',X_test.shape)
print('y_test :',y_test.shape)
from imblearn.over_sampling import RandomOverSampler
ros = RandomOverSampler(random_state=42)
x_ros, y_ros = ros.fit_resample(X, y)
X=df.drop('Type',axis=1)
X=normalize(X)
y=df['Type']
plt.figure(figsize=(10,10))
sns.countplot(x='Type', data=df, order=df['Type'].value_counts().index)
corr_mat=df.corr()
plt.figure(figsize=(16,10))
sns.heatmap(corr_mat,annot=True,fmt='.2f',alpha = 0.7, cmap= 'coolwarm')
plt.show()
df.drop_duplicates(keep='last',inplace=True)
df[df.duplicated()]
df.isna().sum()
df.describe()
df.info()