application_vnd.jupyter.stderr_output_1.png
from scipy.signal import resample

from sklearn.preprocessing import MinMaxScaler

from sklearn.utils import resample

import pandas as pd

import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

mit_test_data = pd.read_csv('../input/heartbeat/mitbih_test.csv', header=None)
mit_train_data = pd.read_csv('../input/heartbeat/mitbih_train.csv', header=None)

from sklearn.utils import resample
df_1 = mit_train_data[mit_train_data[187] == 1]
df_2 = mit_train_data[mit_train_data[187] == 2]
df_3 = mit_train_data[mit_train_data[187] == 3]
df_4 = mit_train_data[mit_train_data[187] == 4]
df_0 = mit_train_data[mit_train_data[187] == 0].sample(n=20000, random_state=42)
df_1_upsample = resample(df_1, replace=True, n_samples=20000, random_state=123)
df_2_upsample = resample(df_2, replace=True, n_samples=20000, random_state=124)
df_3_upsample = resample(df_3, replace=True, n_samples=20000, random_state=125)
df_4_upsample = resample(df_4, replace=True, n_samples=20000, random_state=126)
train_df = pd.concat([df_0, df_1_upsample, df_2_upsample, df_3_upsample, df_4_upsample])
df_11 = mit_test_data[mit_train_data[187] == 1]
df_22 = mit_test_data[mit_train_data[187] == 2]
df_33 = mit_test_data[mit_train_data[187] == 3]
df_44 = mit_test_data[mit_train_data[187] == 4]
df_00 = mit_test_data[mit_train_data[187] == 0].sample(n=20000, random_state=42)
df_11_upsample = resample(df_1, replace=True, n_samples=20000, random_state=123)
df_22_upsample = resample(df_2, replace=True, n_samples=20000, random_state=124)
df_33_upsample = resample(df_3, replace=True, n_samples=20000, random_state=125)
df_44_upsample = resample(df_4, replace=True, n_samples=20000, random_state=126)
test_df = pd.concat([df_00, df_11_upsample, df_22_upsample, df_33_upsample, df_44_upsample])
equilibre = train_df[187].value_counts()

test = pd.read_csv('../input/heartbeat/mitbih_test.csv', header=None)
test = test.iloc[0, 0:len(test.T) - 1]
test = pd.DataFrame(test)
from sklearn.preprocessing import MinMaxScaler
values = test.values
scaler = MinMaxScaler(feature_range=(0, 1))
scaler = scaler.fit(values)
normalized = scaler.transform(values)
normalized = pd.DataFrame(normalized)
normalized