BPt.Dataset.get_permuted_Xy#

Dataset.get_permuted_Xy(problem_spec='default', random_state=None, blocks=None, within_grp=True, **problem_spec_params)[source]#

This method is otherwise identical to Dataset.get_Xy(), except a version of X, y where the values in y are permuted is returned. Permutations can further be customized if extra library neurotools is installed: sahahn/neurotools

Parameters
problem_specProblemSpec or ‘default’, optional
This argument accepts an instance of the params class ProblemSpec. This object is essentially a wrapper around commonly used parameters needs to define the context the model pipeline should be evaluated in. It includes parameters like problem_type, scorer, n_jobs, random_state, etc…
If left as ‘default’, then will initialize a ProblemSpec with default params.
See ProblemSpec for more information and for how to create an instance of this object.
default = 'default'
random_stateNone, int, optional

You may optionally specify that the permutation be conducted according to a fixed random state. By default a new random seed which be used each time, if this is left as None.

default = None
blocksNone, array, pd.Series or pd.DataFrame, optional

This parameter is only available when the neurotools library is installed. See: sahahn/neurotools

This parameter represents the underlying exchangability-block structure of the data passed. It is also used to constrain the possible permutations in some way.

See PALM’s documentation for an introduction on how to format ExchangeabilityBlocks: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/PALM/ExchangeabilityBlocks

This parameter accepts the same style input as PALM, except it is passed here as an array or DataFrame instead of as a file. The main requirement is that the shape of the structure match the number of subjects / data points in the first dimension.

default = None
within_grpbool, optional

This parameter is only relevant when a permutation structure / blocks is passed, in that case it describes how the left-most exchanability / permutation structure column should act. Specifically, if True, then it specifies that the left-most column should be treated as groups to act in a within group swap only manner. If False, then it will consider the left-most column groups to only be able to swap at the group level with other groups of the same size.

default = True
problem_spec_paramsProblemSpec params, optional

You may also pass any valid keywords here, which will override any values passed in the problem spec argument itself.

e.g.

X, y = get_permuted_Xy(problem_spec=problem_spec, problem_type='binary')
Returns
Xpandas DataFrame

DataFrame with the input data and columns as specified by the passed problem_spec. Note: the index will be sorted in identicially between X and y.

ypandas Series

Permuted series with the the target values as requested by the passed problem_spec. Note: the index will be sorted in identicially between X and y.