# How to get the decision value of each time point in each epoch?

**URL:** <https://mne.discourse.group/t/how-to-get-the-decision-value-of-each-time-point-in-each-epoch/2895>\
**Category:** Support & Discussions\
**Tags:** machine-learning\
**Created:** [March 28, 2021, 1:10pm UTC](https://mne.discourse.group/t/how-to-get-the-decision-value-of-each-time-point-in-each-epoch/2895 "2021-03-28T13:10:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![YuZhou](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/yuzhou/32/76_2.png) [@YuZhou](https://mne.discourse.group/u/YuZhou)\
**Post date:** [March 28, 2021, 1:10pm UTC](https://mne.discourse.group/t/how-to-get-the-decision-value-of-each-time-point-in-each-epoch/2895/1 "2021-03-28T13:10:33Z")

</div>

Hi! Alex,  
Thank you very much for your reply 💖, actually I had solved that problem with ‘mne.decoding.SlidingEstimator’, which helps me to train and test at each time point. But I have a new question, which is how to get the decision value of each time point in each epoch, here is my code snippet:

```python
scores = []
epochs_data_train = epochs_train.get_data()
cv = LeaveOneOut()
clf = make_pipeline(LinearDiscriminantAnalysis(solver='lsqr', shrinkage='auto'), verbose=True)
time_decod = SlidingEstimator(clf, n_jobs=-1, scoring=None, verbose=True) # scoring: Score function (or loss function).
scores_fea_col = cross_val_multiscore(time_decod, epochs_data_train, labels_fea_col, cv=cv, n_jobs=-1)

```

the contents of ‘scores\_fea\_col’ is a ndarray which gives 0 or 1 for each time point in each epoch, but no decision value returns, I’m so confused how to get the decision value, and I found a method called [`decision_function`](https://mne.tools/stable/generated/mne.decoding.SlidingEstimator.html#mne.decoding.SlidingEstimator.decision_function)(X), the interpretation of it is: Estimate distances of each data slice to the hyperplanes. I think it’s what I need, but, I don’t know how to combine this decision\_function(X) with my code above. Do you know how to do it?(very hope you know 😌)  
And another question is if it is okay to leave the `scoring=None` in the `time_decod = SlidingEstimator(clf, n_jobs=-1, scoring=None, verbose=True)` , I have no idea what is the appropriate loss function should be applied here for the LDA. Do you have any suggestions?  
Thank you again, you guys are really nice and helpful @richard @agramfort , and I appreciate very very very much ❤ ❤ ❤

---

<div class="post-metadata">

**Author:** ![agramfort](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@agramfort](https://mne.discourse.group/u/agramfort)\
**Post date:** [March 28, 2021, 7:13pm UTC](https://mne.discourse.group/t/how-to-get-the-decision-value-of-each-time-point-in-each-epoch/2895/2 "2021-03-28T19:13:04Z")

</div>

to get access to the decision function I fear you need to get inspiration from the mne code:

> <https://github.com/mne-tools/mne-python/blob/main/mne/decoding/base.py#L358-L443>

you will have to modify it for your needs to copy it somewhere.

Alex
