<jupyter_start><jupyter_text>Electroencephalogram exampleThis dataset contains EEG recordings from human neonates. Multi-channel EEG was recorded from 79 term neonates admitted to the neonatal intensive care unit (NICU) at the Helsinki University Hospital. The median recording duration was 74 minutes (IQR: 64 to 96 minutes).<jupyter_code>import numpy as np
import mogptk
import pandas as pd
import torch

np.random.seed(1)<jupyter_output><empty_output><jupyter_text>MOGP prediction on the sensor valuesWe use eight of the twenty two sensor's values as channel, leaving us with eight channels to fit using multi output Gaussian processes in order to find cross correlations between the channels.<jupyter_code>dataset_pd = pd.read_csv('data/eeg.csv',header=0,index_col=0)
cols = ['EEG Fp1-Ref','EEG Fp2-Ref','EEG Fz-Ref','EEG Cz-Ref','EEG T3-Ref','EEG T4-Ref','EEG O1-Ref','EEG O2-Ref']
t = dataset_pd['time'].values
y = dataset_pd[cols].values

data = mogptk.DataSet()
for i in range(len(cols)):
    data.append(mogptk.Data(t, y[:, i], name=cols[i]))

for i, channel in enumerate(data):
    channel.transform(mogptk.TransformNormalize())
    channel.remove_randomly(pct=0.4)
    
    if i not in [0,1, 2, 3, 5, 7]:
        channel.remove_range(45, None)

# simulate sensor failure
data[0].remove_range(25, 35)
data[5].remove_range(None, 10)
data[7].remove_range(None, 10)        
data.plot();<jupyter_output><empty_output><jupyter_text>Model training<jupyter_code>model = mogptk.MOHSM(data, Q=2, P=2)
model.init_parameters('BNSE')
model.train(method='Adam', lr=0.1, iters=400, verbose=True, error='MAE')<jupyter_output>Starting optimization using Adam
‣ Model: MOHSM
‣ Channels: 8
‣ Parameters: 204
‣ Training points: 1265
‣ Initial loss: 1249.46
‣ Initial error: 2.88558e-05

Start Adam:
    0/400   0:00:03  loss=     1249.46  error= 2.88558e-05
    4/400   0:00:20  loss=     1204.49  error= 2.86722e-05
    8/400   0:00:37  loss=     1161.65  error= 2.87232e-05
   12/400   0:00:54  loss=     1119.39  error= 2.88007e-05
   16/400   0:01:10  loss=     1077.42  error= 2.87922e-05
   20/400   0:01:26  loss=     1036.37  error= 2.88113e-05
   24/400   0:01:44  loss=     995.901  error= 2.89047e-05
   28/400   0:02:00  loss=     956.301  error= 2.89434e-05
   32/400   0:02:17  loss=     917.417  error=  2.8951e-05
   36/400   0:02:33  loss=      879.38  error= 2.89157e-05
   40/400   0:02:50  loss=     842.203  error= 2.88625e-05
   44/400   0:03:07  loss=     806.025  error= 2.88363e-05
   48/400   0:03:24  loss=     770.834  error= 2.88819e-05
   52/400   0:03:40  loss=      736.62  error= 2.89305e-05
   [...]<jupyter_text>Prediction<jupyter_code>model.plot_prediction(transformed=True);<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12664714494875548, 'fraction_numerical': 0.14531478770131773, 'mean_word_length': 3.7530434782608695, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, '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': '383603', 'license': 'MIT', 'n_tokens_mistral': 1312, 'n_tokens_neox': 1059, 'n_words': 264, 'path': 'examples/example_eeg.ipynb', 'repo_name': 'GAMES-UChile/MultiOutputGP-Toolbox', 'size': '2732'}