image_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import scipy.io as sp

import seaborn as sns

import scipy.io as sp
import numpy as np
import pandas as pd
def load_data(file):
    file = sp.loadmat(file)
    load = file['o']
    data = pd.DataFrame(load['data'][0, 0])
    marker = pd.DataFrame(load['marker'][0, 0])
    datadf = pd.concat([data, marker], axis=1)
    datadf.columns = ['Fp1', 'Fp2', 'F3', 'F4', 'C3', 'C4', 'P3', 'P4', 'O1', 'O2', 'A1', 'A2', 'F7', 'F8', 'T3', 'T4', 'T5', 'T6', 'Fz', 'Cz', 'Pz', 'X5', 'label']
    return datadf
datadf = load_data('../input/bigdatasfinger/5F-SubjectB-151110-5St-SGLHand.mat')

data_asli = datadf.head(50000)
print(data_asli.shape,)
data_asli.info()

data_clean = data_asli

import matplotlib.pyplot as plt
import seaborn as sns
datakorelasi = data_clean.drop(['label'], axis=1).corr() * 100
plt.rcParams['figure.figsize'] = (15, 15)

data_label_0 = data_clean[data_clean.label == 0]

from pandas.plotting import lag_plot
def plot4_lag(data, label1, label2, label3, label4):
    fig, ax = plt.subplots(1, 8, figsize=(20, 5))
    ax[0].plot(data[label1], label=label1)
    ax[0].legend()
    pd.plotting.lag_plot(data[label1], lag=1, ax=ax[1], label=label1)
    ax[1].legend()
    ax[2].plot(data[label2], label=label2)
    ax[2].legend()
    pd.plotting.lag_plot(data[label2], lag=1, ax=ax[3], label=label2)
    ax[3].legend()
    ax[4].plot(data[label3], label=label3)
    ax[4].legend()
    pd.plotting.lag_plot(data[label3], lag=1, ax=ax[5], label=label3)
    ax[5].legend()
    ax[6].plot(data[label4], label=label4)
    ax[6].legend()
    pd.plotting.lag_plot(data[label4], lag=1, ax=ax[7], label=label4)
    ax[7].legend()
    return
def plot2_lag(data, label1, label2):
    fig, ax = plt.subplots(1, 4, figsize=(20, 5))
    ax[0].plot(data[label1], label=label1)
    ax[0].legend()
    pd.plotting.lag_plot(data[label1], lag=1, ax=ax[1], label=label1)
    ax[1].legend()
    ax[2].plot(data[label2], label=label2)
    ax[2].legend()
    pd.plotting.lag_plot(data[label2], lag=1, ax=ax[3], label=label2)
    ax[3].legend()
    return
plt_4_1 = plot4_lag(data_clean, 'Fp1', 'Fp2', 'F3', 'F4')
plt_4_2 = plot4_lag(data_clean, 'C3', 'C4', 'P3', 'P4')
plt_4_3 = plot4_lag(data_clean, 'O1', 'O2', 'A1', 'A2')
plt_4_4 = plot4_lag(data_clean, 'F7', 'F8', 'T3', 'T4')
plt_4_5 = plot4_lag(data_clean, 'T5', 'T6', 'Fz', 'Cz')
plt_2 = plot2_lag(data_clean, 'Pz', 'X5')