<jupyter_start><jupyter_text>Definição de dataset<jupyter_code>import numpy as np 
import pandas as pd 
import os 


PATH = os.getcwd().replace('notebooks','')
#dw = np.load(PATH+'data/train_n_seizure.npy',columns=['path','freq','dur','montage'])
dn = pd.DataFrame(data=np.load(PATH+'data/train_n_seizure.npy'),columns=['path','freq','dur','montage'])
dn
dw = pd.DataFrame(data=np.load(PATH+'data/train_seizure.npy'),columns=['path','start','end','type','freq','dur','montage'])
dw<jupyter_output><empty_output><jupyter_text>EMG<jupyter_code>emg_n = []

for i in range(len(dn)):
    for ii in dn['montage'].to_numpy()[i]:
        if 'EMG' in ii:
            emg_n.append(dn.iloc[i].to_numpy())
emg_n = pd.DataFrame(data=emg_n,columns=dn.columns)
emg_n.to_csv('EMG_train_semcrise.csv')
emg_n
emg_w = []

for i in range(len(dw)):
    for ii in dw['montage'].to_numpy()[i]:
        if 'EMG' in ii:
            emg_w.append(dw.iloc[i].to_numpy())
emg_w = pd.DataFrame(data=emg_w,columns=dw.columns)

emg_w.to_csv('EMG_train_comcrise.csv')

emg_w
np.unique(emg_w['type'],return_counts=True)<jupyter_output><empty_output><jupyter_text>ECG<jupyter_code>ecg_n = []

for i in range(len(dn)):
    for ii in dn['montage'].to_numpy()[i]:
        if 'EKG' in ii:
            ecg_n.append(dn.iloc[i].to_numpy())
ecg_n = pd.DataFrame(data=ecg_n,columns=dn.columns)
ecg_n.shape
ecg_w = []

for i in range(len(dw)):
    for ii in dw['montage'].to_numpy()[i]:
        if 'EKG' in ii:
            ecg_w.append(dw.iloc[i].to_numpy())
ecg_w = pd.DataFrame(data=ecg_w,columns=dw.columns)
ecg_w.to_csv('ecg_trian.csv')
np.unique(ecg_w['type'],return_counts=True)<jupyter_output><empty_output><jupyter_text>Tipos de crises<jupyter_code>tp = pd.read_excel(PATH+"docs/seizures_v32r.xlsx")
col = tp.iloc[20].to_numpy()

tp.iloc[21:]
tipos = pd.DataFrame(data=tp.iloc[21:,[0,2,5,7,9]].to_numpy())
tipos
tipos.iloc[:,4].to_numpy()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19264629725530813, 'fraction_numerical': 0.0072501294665976174, 'mean_word_length': 5.755244755244755, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '144191', 'license': 'MIT', 'n_tokens_mistral': 879, 'n_tokens_neox': 869, 'n_words': 102, 'path': 'notebooks/explore1.ipynb', 'repo_name': 'davicn/ECG-EMG', 'size': '1931'}