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

Deprecate split_by_epochs and other similar functions #86

Open
bburan opened this issue May 18, 2018 · 1 comment
Open

Deprecate split_by_epochs and other similar functions #86

bburan opened this issue May 18, 2018 · 1 comment

Comments

@bburan
Copy link
Contributor

bburan commented May 18, 2018

These functions use NaN masks rather than tiled subsets. The problem with NaN values is that it requires the signal to be converted to a floating-point array (rather than preserving the original dtype if it is integer, boolean, etc.). Now that we are using select_times, these functions should be deprecated (or updated to use select_times under the hood.

@bburan
Copy link
Contributor Author

bburan commented May 18, 2018

Sample code for doing the split using select times while preserving the function signature for split_by_epochs:

def split_est_val_by_sequence(recording):
    epochs = recording.epochs
    m = epochs['name'].str.match('^SEQUENCE_')
    sequences = recording.epochs.loc[m, 'name'].unique()
    np.random.shuffle(sequences)
    val_size = round(len(sequences) * 0.2)
    val_epochs, est_epochs = sequences[:val_size], sequences[val_size:]
    m = epochs['name'].apply(lambda x: x in val_epochs)
    val_times = epochs.loc[m][['start', 'end']].values
    m = epochs['name'].apply(lambda x: x in est_epochs)
    est_times = epochs.loc[m][['start', 'end']].values
    val = recording.select_times(val_times)
    est = recording.select_times(est_times)
    return est, val

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

No branches or pull requests

1 participant