# Exercies from Sleep stage classification from polysomnography (PSG) data Page

**URL:** <https://mne.discourse.group/t/exercies-from-sleep-stage-classification-from-polysomnography-psg-data-page/5721>\
**Category:** Support & Discussions\
**Tags:** eeg, epochs\
**Created:** [October 12, 2022, 8:19am UTC](https://mne.discourse.group/t/exercies-from-sleep-stage-classification-from-polysomnography-psg-data-page/5721 "2022-10-12T08:19:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phatk14](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/phatk14/32/1963_2.png) [@phatk14](https://mne.discourse.group/u/phatk14)\
**Post date:** [October 12, 2022, 8:19am UTC](https://mne.discourse.group/t/exercies-from-sleep-stage-classification-from-polysomnography-psg-data-page/5721/1 "2022-10-12T08:19:32Z")

</div>

The task is to: Fetch 50 subjects from the Physionet database and run a 5-fold cross-validation leaving each time 10 subjects out in the test set.

Do you have a suggestion on how to do this?

To use the eeg\_power\_band function ([epochs ([mne.Epochs — MNE 1.2.0 documentation](https://mne.tools/stable/generated/mne.Epochs.html#mne.Epochs))), it only accepts mne epoch data. Hence, I concatenate the data for 40 subjects in the training set and 10 subjects in the testing set to run [pipe](https://scikit-learn.org/stable/modules/generated/sklearn.pipeline.Pipeline.html#sklearn.pipeline.Pipeline) = [make\_pipeline](https://scikit-learn.org/stable/modules/generated/sklearn.pipeline.make_pipeline.html#sklearn.pipeline.make_pipeline)([FunctionTransformer](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.FunctionTransformer.html#sklearn.preprocessing.FunctionTransformer)(eeg\_power\_band, validate=False), [RandomForestClassifier](https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html#sklearn.ensemble.RandomForestClassifier)(n\_estimators=100, random\_state=42)).

Could I create an array of mne epoch to run instead? How would I do this?
