{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Loading Fake Timeseries Surface Data\n", "\n", "This notebook is designed to explore some functionality with loading DataFiles and using Loaders.\n", "\n", "This example will require some extra optional libraries, including nibabel and nilearn! Note: while nilearn is not imported, when trying to import SingleConnectivityMeasure, if nilearn is not installed, this will give an ImportError.\n", "\n", "We will also use fake data for this example - so no special datasets required!" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import BPt as bp\n", "import nibabel as nib\n", "import numpy as np\n", "import pandas as pd\n", "import os" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "def save_fake_timeseries_data():\n", " '''Save fake timeseries and fake surface data.'''\n", " \n", " X = np.random.random(size = (20, 100, 10242))\n", " os.makedirs('fake_time_data', exist_ok=True)\n", " \n", " for x in range(len(X)):\n", " np.save('fake_time_data/' + str(x) + '_lh', X[x])\n", " for x in range(len(X)):\n", " np.save('fake_time_data/' + str(x) + '_rh', X[x])\n", " \n", "save_fake_timeseries_data()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Init a Dataset\n", "data = bp.Dataset()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next, we are interested in loading in the files to the dataset as data files. There are a few different ways to do this, but we will use the method add_data_files. We will try and load the timeseries data first.\n", "\n", "First we need a dictionary mapping desired column name to location or a file glob (which is easier so let's use that)." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "

Data

\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
timeseries_lhtimeseries_rh
13_lhLoc(0)nan
9_lhLoc(1)nan
8_lhLoc(2)nan
2_lhLoc(3)nan
16_lhLoc(4)nan
11_lhLoc(5)nan
6_lhLoc(6)nan
7_lhLoc(7)nan
1_lhLoc(8)nan
17_lhLoc(9)nan
19_lhLoc(10)nan
15_lhLoc(11)nan
10_lhLoc(12)nan
3_lhLoc(13)nan
14_lhLoc(14)nan
0_lhLoc(15)nan
18_lhLoc(16)nan
5_lhLoc(17)nan
4_lhLoc(18)nan
12_lhLoc(19)nan
11_rhnanLoc(20)
10_rhnanLoc(21)
12_rhnanLoc(22)
3_rhnanLoc(23)
0_rhnanLoc(24)
18_rhnanLoc(25)
1_rhnanLoc(26)
9_rhnanLoc(27)
14_rhnanLoc(28)
6_rhnanLoc(29)
15_rhnanLoc(30)
7_rhnanLoc(31)
4_rhnanLoc(32)
19_rhnanLoc(33)
5_rhnanLoc(34)
2_rhnanLoc(35)
13_rhnanLoc(36)
8_rhnanLoc(37)
16_rhnanLoc(38)
17_rhnanLoc(39)
\n", "
\n" ], "text/plain": [ " timeseries_lh timeseries_rh\n", "13_lh 0.0 NaN\n", "9_lh 1.0 NaN\n", "8_lh 2.0 NaN\n", "2_lh 3.0 NaN\n", "16_lh 4.0 NaN\n", "11_lh 5.0 NaN\n", "6_lh 6.0 NaN\n", "7_lh 7.0 NaN\n", "1_lh 8.0 NaN\n", "17_lh 9.0 NaN\n", "19_lh 10.0 NaN\n", "15_lh 11.0 NaN\n", "10_lh 12.0 NaN\n", "3_lh 13.0 NaN\n", "14_lh 14.0 NaN\n", "0_lh 15.0 NaN\n", "18_lh 16.0 NaN\n", "5_lh 17.0 NaN\n", "4_lh 18.0 NaN\n", "12_lh 19.0 NaN\n", "11_rh NaN 20.0\n", "10_rh NaN 21.0\n", "12_rh NaN 22.0\n", "3_rh NaN 23.0\n", "0_rh NaN 24.0\n", "18_rh NaN 25.0\n", "1_rh NaN 26.0\n", "9_rh NaN 27.0\n", "14_rh NaN 28.0\n", "6_rh NaN 29.0\n", "15_rh NaN 30.0\n", "7_rh NaN 31.0\n", "4_rh NaN 32.0\n", "19_rh NaN 33.0\n", "5_rh NaN 34.0\n", "2_rh NaN 35.0\n", "13_rh NaN 36.0\n", "8_rh NaN 37.0\n", "16_rh NaN 38.0\n", "17_rh NaN 39.0" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# The *'s just mean wildcard\n", "files = {'timeseries_lh': 'fake_time_data/*_lh*',\n", " 'timeseries_rh': 'fake_time_data/*_rh*'}\n", "\n", "# Now let's try loading with 'auto' as the file to subject function\n", "data.add_data_files(files, 'auto')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can see 'auto' doesn't work for us, so we can try writing our own function instead." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "

Data

\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
timeseries_lhtimeseries_rh
13Loc(0)Loc(36)
9Loc(1)Loc(27)
8Loc(2)Loc(37)
2Loc(3)Loc(35)
16Loc(4)Loc(38)
11Loc(5)Loc(20)
6Loc(6)Loc(29)
7Loc(7)Loc(31)
1Loc(8)Loc(26)
17Loc(9)Loc(39)
19Loc(10)Loc(33)
15Loc(11)Loc(30)
10Loc(12)Loc(21)
3Loc(13)Loc(23)
14Loc(14)Loc(28)
0Loc(15)Loc(24)
18Loc(16)Loc(25)
5Loc(17)Loc(34)
4Loc(18)Loc(32)
12Loc(19)Loc(22)
\n", "
\n" ], "text/plain": [ " timeseries_lh timeseries_rh\n", "13 0.0 36.0\n", "9 1.0 27.0\n", "8 2.0 37.0\n", "2 3.0 35.0\n", "16 4.0 38.0\n", "11 5.0 20.0\n", "6 6.0 29.0\n", "7 7.0 31.0\n", "1 8.0 26.0\n", "17 9.0 39.0\n", "19 10.0 33.0\n", "15 11.0 30.0\n", "10 12.0 21.0\n", "3 13.0 23.0\n", "14 14.0 28.0\n", "0 15.0 24.0\n", "18 16.0 25.0\n", "5 17.0 34.0\n", "4 18.0 32.0\n", "12 19.0 22.0" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "def file_to_subj(loc):\n", " return loc.split('/')[-1].split('_')[0]\n", "\n", "# Actually load it this time\n", "data = data.add_data_files(files, file_to_subj)\n", "data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "What's this though? Why are the files showing up as Loc(int). Whats going on is that the data files are really stored as just integers, see:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "13 0.0\n", "9 1.0\n", "8 2.0\n", "2 3.0\n", "16 4.0\n", "11 5.0\n", "6 6.0\n", "7 7.0\n", "1 8.0\n", "17 9.0\n", "19 10.0\n", "15 11.0\n", "10 12.0\n", "3 13.0\n", "14 14.0\n", "0 15.0\n", "18 16.0\n", "5 17.0\n", "4 18.0\n", "12 19.0\n", "Name: timeseries_lh, dtype: float64" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data['timeseries_lh']" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "They correspond to locations in a stored file mapping (note: you don't need to worry about any of this most of the time)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(DataFile(loc='/home/sage/BPt/Examples/Short_Examples/fake_time_data/13_lh.npy'),\n", " DataFile(loc='/home/sage/BPt/Examples/Short_Examples/fake_time_data/9_lh.npy'),\n", " DataFile(loc='/home/sage/BPt/Examples/Short_Examples/fake_time_data/8_lh.npy'))" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data.file_mapping[0], data.file_mapping[1], data.file_mapping[2] " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's add a fake target to our dataset now" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "

Data

\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
timeseries_lhtimeseries_rh
13Loc(0)Loc(36)
9Loc(1)Loc(27)
8Loc(2)Loc(37)
2Loc(3)Loc(35)
16Loc(4)Loc(38)
11Loc(5)Loc(20)
6Loc(6)Loc(29)
7Loc(7)Loc(31)
1Loc(8)Loc(26)
17Loc(9)Loc(39)
19Loc(10)Loc(33)
15Loc(11)Loc(30)
10Loc(12)Loc(21)
3Loc(13)Loc(23)
14Loc(14)Loc(28)
0Loc(15)Loc(24)
18Loc(16)Loc(25)
5Loc(17)Loc(34)
4Loc(18)Loc(32)
12Loc(19)Loc(22)
\n", "
\n", "
\n", "

Target

\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
t
130.656648
90.298354
80.495359
20.414660
160.606687
110.453163
60.853856
70.044329
10.916036
170.865733
190.015055
150.082130
100.731628
30.074572
140.589903
00.768409
180.536750
50.401537
40.580557
120.508457
\n", "
\n" ], "text/plain": [ " timeseries_lh timeseries_rh t\n", "13 0.0 36.0 0.656648\n", "9 1.0 27.0 0.298354\n", "8 2.0 37.0 0.495359\n", "2 3.0 35.0 0.414660\n", "16 4.0 38.0 0.606687\n", "11 5.0 20.0 0.453163\n", "6 6.0 29.0 0.853856\n", "7 7.0 31.0 0.044329\n", "1 8.0 26.0 0.916036\n", "17 9.0 39.0 0.865733\n", "19 10.0 33.0 0.015055\n", "15 11.0 30.0 0.082130\n", "10 12.0 21.0 0.731628\n", "3 13.0 23.0 0.074572\n", "14 14.0 28.0 0.589903\n", "0 15.0 24.0 0.768409\n", "18 16.0 25.0 0.536750\n", "5 17.0 34.0 0.401537\n", "4 18.0 32.0 0.580557\n", "12 19.0 22.0 0.508457" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data['t'] = np.random.random(len(data))\n", "data.set_target('t', inplace=True)\n", "data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next we will generate a Loader to apply a parcellation, then extract a measure of connectivity." ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "from BPt.extensions import SurfLabels\n", "\n", "lh_parc = SurfLabels(labels='data/lh.aparc.annot', vectorize=False)\n", "rh_parc = SurfLabels(labels='data/rh.aparc.annot', vectorize=False)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can see how this object works on example data first." ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(100, 10242)" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ex_lh = data.file_mapping[0].load()\n", "ex_lh.shape" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(100, 35)" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "trans = lh_parc.fit_transform(ex_lh)\n", "trans.shape" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We essentially get a reduction from 10242 features to 35." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next, we want to transform the matrix into a correlation matrix." ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "from BPt.extensions import SingleConnectivityMeasure\n", "scm = SingleConnectivityMeasure(kind='covariance', discard_diagonal=True, vectorize=True)" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(595,)" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "scm.fit_transform(trans).shape" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The single connectivity measure is just a wrapper designed to let the ConnectivityMeasure from nilearn work with a single subject's data at a time.\n", "\n", "Next, let's use the input special Pipe wrapper to compose these two objects into their own pipeline" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [], "source": [ "lh_loader = bp.Loader(bp.Pipe([lh_parc, scm]), scope='_lh')\n", "rh_loader = bp.Loader(bp.Pipe([rh_parc, scm]), scope='_rh')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Define a simple pipeline with just our loader steps, then evaluate with mostly default settings." ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "ee8b7bc1991f4995a160f3aa2aa124ce", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Folds: 0%| | 0/5 [00:00\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
timeseries_rh_0timeseries_rh_1timeseries_rh_2timeseries_rh_3timeseries_rh_4timeseries_rh_5timeseries_rh_6timeseries_rh_7timeseries_rh_8timeseries_rh_9...timeseries_lh_585timeseries_lh_586timeseries_lh_587timeseries_lh_588timeseries_lh_589timeseries_lh_590timeseries_lh_591timeseries_lh_592timeseries_lh_593timeseries_lh_594
0-0.0001650.000046-0.000077-0.0000750.000074-0.000011-0.0000490.000047-0.000024-0.000024...-8.290498e-06-0.000006-0.0000231.610693e-060.000015-0.0000064.867083e-06-1.215231e-04-0.000140-0.000048
10.0000510.000027-0.000011-0.0000030.0000220.0000330.0000490.0000720.000010-0.000014...9.147214e-06-0.000033-0.0000154.817195e-060.0000010.000009-3.010718e-055.807162e-05-0.0000700.000016
2-0.000019-0.000024-0.0000040.000027-0.0000540.0000130.000064-0.000118-0.0000650.000063...-8.021237e-06-0.0000590.000004-1.018778e-05-0.000026-0.0000031.120659e-05-3.874970e-050.000057-0.000008
30.0000370.0000270.0000500.0000800.0000380.000009-0.000094-0.0001170.000056-0.000005...2.637188e-07-0.000015-0.000011-6.939784e-060.0000220.000005-2.519195e-051.219129e-040.0000210.000074
4-0.0000300.000013-0.000048-0.0000020.000043-0.000021-0.0000210.0000450.000015-0.000008...-4.193627e-05-0.000005-0.000038-1.579288e-05-0.0000100.000007-2.074608e-051.288912e-040.0000480.000015
5-0.0000270.0000120.000049-0.0000400.000137-0.0000200.0000230.0000570.0000200.000018...-2.317345e-050.000047-0.000021-3.256373e-060.0000130.000006-2.017995e-053.174790e-05-0.000044-0.000050
6-0.0000030.0000110.000037-0.0000070.0000260.0000340.000007-0.000071-0.000019-0.000004...1.230251e-050.0000650.0000088.041033e-070.000001-0.000026-1.401379e-052.662647e-05-0.0000200.000032
70.0000380.0000190.0000060.000017-0.0001730.000027-0.0000580.0001200.000028-0.000029...-2.762708e-050.0000190.000015-5.296039e-06-0.0000210.000017-3.512035e-06-1.743649e-040.0000150.000002
8-0.0000090.0000070.000034-0.0000020.000032-0.000011-0.000021-0.0001130.0000400.000024...-1.286571e-06-0.000022-0.0000272.031265e-05-0.0000080.000035-5.331094e-06-5.483645e-050.000103-0.000014
90.000062-0.0000220.0000600.000010-0.0000170.000012-0.0000190.000093-0.0000020.000028...-1.272615e-050.000027-0.000015-1.022682e-05-0.000044-0.0000064.879025e-063.508208e-07-0.000069-0.000002
100.0000190.0001100.000062-0.0000190.000011-0.000007-0.000059-0.0000560.000022-0.000041...-1.971200e-050.0000550.000020-5.049802e-060.0000140.000014-4.576251e-07-3.902154e-050.000023-0.000025
110.000013-0.000036-0.000063-0.000026-0.000008-0.0000070.000029-0.0001170.0000520.000013...4.998446e-07-0.000018-0.000016-1.614390e-050.000006-0.0000061.069373e-05-6.800519e-060.000029-0.000103
12-0.000033-0.0000270.0000660.0000130.000021-0.0000120.0000610.0001050.0000200.000022...-3.358210e-06-0.000003-0.0000182.135645e-050.0000090.000002-1.748675e-052.181139e-040.000018-0.000078
130.000080-0.000046-0.0000400.000033-0.0000920.000013-0.000005-0.0000850.0000200.000096...-3.432920e-060.0000380.0000485.295833e-060.0000130.0000305.164307e-06-9.442774e-05-0.000010-0.000014
140.000077-0.000009-0.0001180.000056-0.0000490.000021-0.0000360.000130-0.0000810.000017...-9.383758e-06-0.000027-0.000019-2.622800e-060.0000050.000009-1.135353e-051.509882e-05-0.000070-0.000058
15-0.000113-0.0000450.0000400.000020-0.000040-0.000010-0.0000810.000031-0.0000660.000002...1.523565e-05-0.0000710.000031-6.086060e-06-0.0000130.0000031.540947e-061.604218e-040.0001400.000034
\n", "

16 rows × 1190 columns

\n", "" ], "text/plain": [ " timeseries_rh_0 timeseries_rh_1 timeseries_rh_2 timeseries_rh_3 \\\n", "0 -0.000165 0.000046 -0.000077 -0.000075 \n", "1 0.000051 0.000027 -0.000011 -0.000003 \n", "2 -0.000019 -0.000024 -0.000004 0.000027 \n", "3 0.000037 0.000027 0.000050 0.000080 \n", "4 -0.000030 0.000013 -0.000048 -0.000002 \n", "5 -0.000027 0.000012 0.000049 -0.000040 \n", "6 -0.000003 0.000011 0.000037 -0.000007 \n", "7 0.000038 0.000019 0.000006 0.000017 \n", "8 -0.000009 0.000007 0.000034 -0.000002 \n", "9 0.000062 -0.000022 0.000060 0.000010 \n", "10 0.000019 0.000110 0.000062 -0.000019 \n", "11 0.000013 -0.000036 -0.000063 -0.000026 \n", "12 -0.000033 -0.000027 0.000066 0.000013 \n", "13 0.000080 -0.000046 -0.000040 0.000033 \n", "14 0.000077 -0.000009 -0.000118 0.000056 \n", "15 -0.000113 -0.000045 0.000040 0.000020 \n", "\n", " timeseries_rh_4 timeseries_rh_5 timeseries_rh_6 timeseries_rh_7 \\\n", "0 0.000074 -0.000011 -0.000049 0.000047 \n", "1 0.000022 0.000033 0.000049 0.000072 \n", "2 -0.000054 0.000013 0.000064 -0.000118 \n", "3 0.000038 0.000009 -0.000094 -0.000117 \n", "4 0.000043 -0.000021 -0.000021 0.000045 \n", "5 0.000137 -0.000020 0.000023 0.000057 \n", "6 0.000026 0.000034 0.000007 -0.000071 \n", "7 -0.000173 0.000027 -0.000058 0.000120 \n", "8 0.000032 -0.000011 -0.000021 -0.000113 \n", "9 -0.000017 0.000012 -0.000019 0.000093 \n", "10 0.000011 -0.000007 -0.000059 -0.000056 \n", "11 -0.000008 -0.000007 0.000029 -0.000117 \n", "12 0.000021 -0.000012 0.000061 0.000105 \n", "13 -0.000092 0.000013 -0.000005 -0.000085 \n", "14 -0.000049 0.000021 -0.000036 0.000130 \n", "15 -0.000040 -0.000010 -0.000081 0.000031 \n", "\n", " timeseries_rh_8 timeseries_rh_9 ... timeseries_lh_585 \\\n", "0 -0.000024 -0.000024 ... -8.290498e-06 \n", "1 0.000010 -0.000014 ... 9.147214e-06 \n", "2 -0.000065 0.000063 ... -8.021237e-06 \n", "3 0.000056 -0.000005 ... 2.637188e-07 \n", "4 0.000015 -0.000008 ... -4.193627e-05 \n", "5 0.000020 0.000018 ... -2.317345e-05 \n", "6 -0.000019 -0.000004 ... 1.230251e-05 \n", "7 0.000028 -0.000029 ... -2.762708e-05 \n", "8 0.000040 0.000024 ... -1.286571e-06 \n", "9 -0.000002 0.000028 ... -1.272615e-05 \n", "10 0.000022 -0.000041 ... -1.971200e-05 \n", "11 0.000052 0.000013 ... 4.998446e-07 \n", "12 0.000020 0.000022 ... -3.358210e-06 \n", "13 0.000020 0.000096 ... -3.432920e-06 \n", "14 -0.000081 0.000017 ... -9.383758e-06 \n", "15 -0.000066 0.000002 ... 1.523565e-05 \n", "\n", " timeseries_lh_586 timeseries_lh_587 timeseries_lh_588 \\\n", "0 -0.000006 -0.000023 1.610693e-06 \n", "1 -0.000033 -0.000015 4.817195e-06 \n", "2 -0.000059 0.000004 -1.018778e-05 \n", "3 -0.000015 -0.000011 -6.939784e-06 \n", "4 -0.000005 -0.000038 -1.579288e-05 \n", "5 0.000047 -0.000021 -3.256373e-06 \n", "6 0.000065 0.000008 8.041033e-07 \n", "7 0.000019 0.000015 -5.296039e-06 \n", "8 -0.000022 -0.000027 2.031265e-05 \n", "9 0.000027 -0.000015 -1.022682e-05 \n", "10 0.000055 0.000020 -5.049802e-06 \n", "11 -0.000018 -0.000016 -1.614390e-05 \n", "12 -0.000003 -0.000018 2.135645e-05 \n", "13 0.000038 0.000048 5.295833e-06 \n", "14 -0.000027 -0.000019 -2.622800e-06 \n", "15 -0.000071 0.000031 -6.086060e-06 \n", "\n", " timeseries_lh_589 timeseries_lh_590 timeseries_lh_591 \\\n", "0 0.000015 -0.000006 4.867083e-06 \n", "1 0.000001 0.000009 -3.010718e-05 \n", "2 -0.000026 -0.000003 1.120659e-05 \n", "3 0.000022 0.000005 -2.519195e-05 \n", "4 -0.000010 0.000007 -2.074608e-05 \n", "5 0.000013 0.000006 -2.017995e-05 \n", "6 0.000001 -0.000026 -1.401379e-05 \n", "7 -0.000021 0.000017 -3.512035e-06 \n", "8 -0.000008 0.000035 -5.331094e-06 \n", "9 -0.000044 -0.000006 4.879025e-06 \n", "10 0.000014 0.000014 -4.576251e-07 \n", "11 0.000006 -0.000006 1.069373e-05 \n", "12 0.000009 0.000002 -1.748675e-05 \n", "13 0.000013 0.000030 5.164307e-06 \n", "14 0.000005 0.000009 -1.135353e-05 \n", "15 -0.000013 0.000003 1.540947e-06 \n", "\n", " timeseries_lh_592 timeseries_lh_593 timeseries_lh_594 \n", "0 -1.215231e-04 -0.000140 -0.000048 \n", "1 5.807162e-05 -0.000070 0.000016 \n", "2 -3.874970e-05 0.000057 -0.000008 \n", "3 1.219129e-04 0.000021 0.000074 \n", "4 1.288912e-04 0.000048 0.000015 \n", "5 3.174790e-05 -0.000044 -0.000050 \n", "6 2.662647e-05 -0.000020 0.000032 \n", "7 -1.743649e-04 0.000015 0.000002 \n", "8 -5.483645e-05 0.000103 -0.000014 \n", "9 3.508208e-07 -0.000069 -0.000002 \n", "10 -3.902154e-05 0.000023 -0.000025 \n", "11 -6.800519e-06 0.000029 -0.000103 \n", "12 2.181139e-04 0.000018 -0.000078 \n", "13 -9.442774e-05 -0.000010 -0.000014 \n", "14 1.509882e-05 -0.000070 -0.000058 \n", "15 1.604218e-04 0.000140 0.000034 \n", "\n", "[16 rows x 1190 columns]" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "results.get_X_transform_df(data, fold=0)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3.9.1 64-bit ('bpt': conda)", "language": "python", "name": "python39164bitbptconda7805b3f5d58e4b658b79cb94739371e6" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.1" } }, "nbformat": 4, "nbformat_minor": 4 }