Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing the default sampling frequency from create_from_X_y, #143. #256

Merged
merged 1 commit into from
Jun 21, 2021

Conversation

vytjan
Copy link
Collaborator

@vytjan vytjan commented Jun 21, 2021

Fixes the #143
Also, not sure if it's fine to swap the order of arguments of the create_from_X_y, but as drop_last_window seems to be an optional, it could be better to assign a default value for it maybe?

And finally, since 4 of us (@Ann-KathrinKiessner, @dcwil, @HenrikBons) worked on this small issue for introduction, we'd like to know if (or how) we should add ourselves to the author's list of the respective files.

@robintibor
Copy link
Contributor

uh why did you swap argument order? drop_last_window should not have a default window, we have discussed about this before. Different users may have different expectations there and it is good if they have to think about this argument once.

@robintibor
Copy link
Contributor

you can swap the argument order back and just change the function calls accordingly

@vytjan vytjan force-pushed the mandatory_sfreq branch from 9caba40 to 0a8384f Compare June 21, 2021 13:26
@vytjan
Copy link
Collaborator Author

vytjan commented Jun 21, 2021

Thanks for the feedback, just swapped the order back.

sfreq: common sampling frequency of all trials
ch_names: array-like
channel names of the trials
sfreq: int
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sfreq: int
sfreq: float

ch_names: array-like
channel names of the trials
sfreq: int
common sampling frequency of all trials
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
common sampling frequency of all trials
Sampling frequency of signals.

drop_last_window: bool
whether or not have a last overlapping window, when
windows/windows do not equally divide the continuous signal
ch_names: array-like
channel names of the trials
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
channel names of the trials
Names of the channels.

@@ -88,12 +88,12 @@ def test_cropped_decoding():
# Perform forward pass to determine how many outputs per input
n_preds_per_input = get_output_shape(model, in_chans, input_window_samples)[2]

train_set = create_from_X_y(X[:60], y[:60],
train_set = create_from_X_y(X[:60], y[:60], 100,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
train_set = create_from_X_y(X[:60], y[:60], 100,
train_set = create_from_X_y(X[:60], y[:60], sfreq=100,

drop_last_window=False,
window_size_samples=input_window_samples,
window_stride_samples=n_preds_per_input)

valid_set = create_from_X_y(X[60:], y[60:],
valid_set = create_from_X_y(X[60:], y[60:], 100,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
valid_set = create_from_X_y(X[60:], y[60:], 100,
valid_set = create_from_X_y(X[60:], y[60:], sfreq=100,

@@ -148,12 +148,12 @@ def test_eeg_classifier():
out = model(test_input)
n_preds_per_input = out.cpu().data.numpy().shape[2]

train_set = create_from_X_y(X[:48], y[:48],
train_set = create_from_X_y(X[:48], y[:48], 100,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
train_set = create_from_X_y(X[:48], y[:48], 100,
train_set = create_from_X_y(X[:48], y[:48], sfreq=100,

drop_last_window=False,
window_size_samples=input_window_samples,
window_stride_samples=n_preds_per_input)

valid_set = create_from_X_y(X[48:60], y[48:60],
valid_set = create_from_X_y(X[48:60], y[48:60], 100,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
valid_set = create_from_X_y(X[48:60], y[48:60], 100,
valid_set = create_from_X_y(X[48:60], y[48:60], sfreq=100,

@@ -87,7 +87,7 @@ def test_cropped_trial_epoch_scoring():
predictions_cases, y_true_cases, expected_accuracies_cases
):
dataset_valid = create_from_X_y(
np.zeros((4, 1, 10)), np.concatenate(y_true),
np.zeros((4, 1, 10)), np.concatenate(y_true), 100,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
np.zeros((4, 1, 10)), np.concatenate(y_true), 100,
np.zeros((4, 1, 10)), np.concatenate(y_true), sfreq=100,

@@ -14,7 +14,7 @@


def create_from_X_y(
X, y, drop_last_window, sfreq=None, ch_names=None, window_size_samples=None,
X, y, sfreq, drop_last_window, ch_names=None, window_size_samples=None,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an API change.

@robintibor deprecation cycle or you can live with it?

@vytjan vytjan force-pushed the mandatory_sfreq branch from 0a8384f to cd92163 Compare June 21, 2021 14:04
@vytjan
Copy link
Collaborator Author

vytjan commented Jun 21, 2021

@agramfort thank you for the corrections.
Apparently, before I didn't manage to amend my changes to the commit (basically all your corrections, which @Ann-KathrinKiessner, @dcwil, @HenrikBons and I have agreed on).

@robintibor
Copy link
Contributor

Can you still add to what's new page? https://github.com/vytjan/braindecode/blob/mandatory_sfreq/docs/whats_new.rst create new subheading of current version API changes (copy heading from below), and add a sentence about this, also add all your names

@gemeinl gemeinl linked an issue Jun 21, 2021 that may be closed by this pull request
@vytjan vytjan force-pushed the mandatory_sfreq branch from cd92163 to b082ac8 Compare June 21, 2021 15:31
@vytjan
Copy link
Collaborator Author

vytjan commented Jun 21, 2021

Can you still add to what's new page? https://github.com/vytjan/braindecode/blob/mandatory_sfreq/docs/whats_new.rst create new subheading of current version API changes (copy heading from below), and add a sentence about this, also add all your names

Added the PR info to the what's new section (under the Current (0.5.2.dev0) tag, correct?).

@robintibor robintibor merged commit 765cd04 into braindecode:master Jun 21, 2021
@robintibor
Copy link
Contributor

Looks good! Merged! Thanks so much! @vytjan @Ann-KathrinKiessner @dcwil @HenrikBons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default sfreq in create_from_X_y
3 participants