Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
X, y = dataset.classification_task()
# construct the standard splits by convention of the .meta attribute
splits = [m['split'] for m in dataset.meta]
train_idxs = [i for i, s in enumerate(splits) if s == 'train']
valid_idxs = [i for i, s in enumerate(splits) if s == 'valid']
test_idxs = [i for i, s in enumerate(splits) if s == 'test']
if len(splits) != len(X):
raise ValueError('Length of X does not match length of meta data')
if len(train_idxs) + len(valid_idxs) + len(test_idxs) != len(splits):
raise ValueError('meta contains splits other than train, valid, test.')
X_train = larray.reindex(X, train_idxs)
X_valid = larray.reindex(X, valid_idxs)
X_test = larray.reindex(X, test_idxs)
y_train = larray.reindex(y, train_idxs)
y_valid = larray.reindex(y, valid_idxs)
y_test = larray.reindex(y, test_idxs)
return (X_train, y_train), (X_valid, y_valid), (X_test, y_test)
valid_idxs = [i for i, s in enumerate(splits) if s == 'valid']
test_idxs = [i for i, s in enumerate(splits) if s == 'test']
if len(splits) != len(X):
raise ValueError('Length of X does not match length of meta data')
if len(train_idxs) + len(valid_idxs) + len(test_idxs) != len(splits):
raise ValueError('meta contains splits other than train, valid, test.')
X_train = larray.reindex(X, train_idxs)
X_valid = larray.reindex(X, valid_idxs)
X_test = larray.reindex(X, test_idxs)
y_train = larray.reindex(y, train_idxs)
y_valid = larray.reindex(y, valid_idxs)
y_test = larray.reindex(y, test_idxs)
return (X_train, y_train), (X_valid, y_valid), (X_test, y_test)
X, y = dataset.classification_task()
# construct the standard splits by convention of the .meta attribute
splits = [m['split'] for m in dataset.meta]
train_idxs = [i for i, s in enumerate(splits) if s == 'train']
valid_idxs = [i for i, s in enumerate(splits) if s == 'valid']
test_idxs = [i for i, s in enumerate(splits) if s == 'test']
if len(splits) != len(X):
raise ValueError('Length of X does not match length of meta data')
if len(train_idxs) + len(valid_idxs) + len(test_idxs) != len(splits):
raise ValueError('meta contains splits other than train, valid, test.')
X_train = larray.reindex(X, train_idxs)
X_valid = larray.reindex(X, valid_idxs)
X_test = larray.reindex(X, test_idxs)
y_train = larray.reindex(y, train_idxs)
y_valid = larray.reindex(y, valid_idxs)
y_test = larray.reindex(y, test_idxs)
return (X_train, y_train), (X_valid, y_valid), (X_test, y_test)
splits = [m['split'] for m in dataset.meta]
train_idxs = [i for i, s in enumerate(splits) if s == 'train']
valid_idxs = [i for i, s in enumerate(splits) if s == 'valid']
test_idxs = [i for i, s in enumerate(splits) if s == 'test']
if len(splits) != len(X):
raise ValueError('Length of X does not match length of meta data')
if len(train_idxs) + len(valid_idxs) + len(test_idxs) != len(splits):
raise ValueError('meta contains splits other than train, valid, test.')
X_train = larray.reindex(X, train_idxs)
X_valid = larray.reindex(X, valid_idxs)
X_test = larray.reindex(X, test_idxs)
y_train = larray.reindex(y, train_idxs)
y_valid = larray.reindex(y, valid_idxs)
y_test = larray.reindex(y, test_idxs)
return (X_train, y_train), (X_valid, y_valid), (X_test, y_test)
# construct the standard splits by convention of the .meta attribute
splits = [m['split'] for m in dataset.meta]
train_idxs = [i for i, s in enumerate(splits) if s == 'train']
valid_idxs = [i for i, s in enumerate(splits) if s == 'valid']
test_idxs = [i for i, s in enumerate(splits) if s == 'test']
if len(splits) != len(X):
raise ValueError('Length of X does not match length of meta data')
if len(train_idxs) + len(valid_idxs) + len(test_idxs) != len(splits):
raise ValueError('meta contains splits other than train, valid, test.')
X_train = larray.reindex(X, train_idxs)
X_valid = larray.reindex(X, valid_idxs)
X_test = larray.reindex(X, test_idxs)
y_train = larray.reindex(y, train_idxs)
y_valid = larray.reindex(y, valid_idxs)
y_test = larray.reindex(y, test_idxs)
return (X_train, y_train), (X_valid, y_valid), (X_test, y_test)
train_idxs = [i for i, s in enumerate(splits) if s == 'train']
valid_idxs = [i for i, s in enumerate(splits) if s == 'valid']
test_idxs = [i for i, s in enumerate(splits) if s == 'test']
if len(splits) != len(X):
raise ValueError('Length of X does not match length of meta data')
if len(train_idxs) + len(valid_idxs) + len(test_idxs) != len(splits):
raise ValueError('meta contains splits other than train, valid, test.')
X_train = larray.reindex(X, train_idxs)
X_valid = larray.reindex(X, valid_idxs)
X_test = larray.reindex(X, test_idxs)
y_train = larray.reindex(y, train_idxs)
y_valid = larray.reindex(y, valid_idxs)
y_test = larray.reindex(y, test_idxs)
return (X_train, y_train), (X_valid, y_valid), (X_test, y_test)