image_output_1.png
from matplotlib.colors import ListedColormap

from mpl_toolkits.mplot3d import Axes3D

from mpl_toolkits.mplot3d import Axes3D

from pandas.plotting import autocorrelation_plot

import matplotlib.pyplot as plt

import matplotlib.pyplot as plt

import numpy as np

import numpy as np

import pandas as pd

import pandas as pd

import pandas as pd

import scipy.io as sp

import seaborn as sns

import seaborn as sns

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')  

from pandas.plotting import autocorrelation_plot
plt.rcParams['figure.figsize'] = (15, 15)

import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from mpl_toolkits.mplot3d import Axes3D

fig = plt.figure(figsize=(10,10))
ax = fig.add_subplot(111, projection = '3d')
def dscat(data,label1,label2):
    x = data[label1]
    y = data[label1]
    z = data[label2]
    ax.set_xlabel("pembanding")
    ax.set_ylabel("chanel")
    ax.set_zlabel("index chanel")
    ax.scatter(x, y, z,s=10, c=x, marker='o',alpha=1)
    return

dscat( data_clean, 'Fp1','Fp2')
dscat( data_clean, 'F3','F4'  )
dscat( data_clean, 'C4','C3'  )
dscat( data_clean, 'P3','P4'  )
dscat( data_clean, 'O1','O2'  )
dscat( data_clean, 'A1','A2'  )
dscat( data_clean, 'F7','F8'  )
dscat( data_clean, 'T3','T4'  )
dscat( data_clean, 'T5','T6'  )
dscat( data_clean, 'Fz','Cz'  )
dscat( data_clean, 'Pz','X5'  )

import re, seaborn as sns
import numpy as np

from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.colors import ListedColormap

df = (data_clean).unstack().reset_index()
df.columns=["X","Y","Z"]
df['X'] = pd.Categorical(df['X'])
df['X'] = df['X'].cat.codes

x = np.array(df['X'])
y = np.array(df['Y'])
z = df['Z']

print(x.shape,y.shape,z.shape)
fig = plt.figure(figsize=(6,6))
ax = Axes3D(fig, auto_add_to_figure=False)
fig.add_axes(ax)
cmap = ListedColormap(sns.color_palette("husl", 256).as_hex())
sc = ax.scatter(x, y, z, s=40, c=x, marker='o', cmap=cmap, alpha=1)
ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')
plt.legend(*sc.legend_elements(), bbox_to_anchor=(1.05, 1), loc=2)

plt.rcParams['figure.figsize'] = (5, 5)
import pandas as pd
import seaborn as sns
pd.plotting.radviz(data_clean, 'label')

data = data_clean
plt.rcParams['figure.figsize'] = (5, 5)
plt.hist(data.label)