(
        self,
        n_perms: Optional[Union[int, Vector]] = None,
        data_size: Optional[dict] = None,
        **kwargs,
    )
Parameters
        ----------
        n_perms :
            Number of permutations to perform. If an array
            is passed it has to be equal in size to the data_size array.
            Values in this array must be monotonically decreasing (performing
            more permutations for more data is not useful to reduce standard
            error of the mean).
            Default: None
        data_size :
            If None is passed, it performs conventional WithinSession evaluation.
            Contains the policy to pick the datasizes to
            evaluate, as well as the actual values. The dict has the
            key 'policy' with either 'ratio' or 'per_class', and the key
            'value' with the actual values as an numpy array. This array should be
            sorted, such that values in data_size are strictly monotonically increasing.
            Default: None
Parameters
        ----------
        n_perms :
            Number of permutations to perform. If an array
            is passed it has to be equal in size to the data_size array.
            Values in this array must be monotonically decreasing (performing
            more permutations for more data is not useful to reduce standard
            error of the mean).
            Default: None
        data_size :
            If None is passed, it performs conventional WithinSession evaluation.
            Contains the policy to pick the datasizes to
            evaluate, as well as the actual values. The dict has the
            key 'policy' with either 'ratio' or 'per_class', and the key
            'value' with the actual values as an numpy array. This array should be
            sorted, such that values in data_size are strictly monotonically increasing.
            Default: None
Parameters ---------- n_perms : Number of permutations to perform . If an array is passed it has to be equal in size to the data_size array . Values in this array must be monotonically decreasing ( performing more permutations for more data is not useful to reduce standard error of the mean ) . Default : None data_size : If None is passed it performs conventional WithinSession evaluation . Contains the policy to pick the datasizes to evaluate as well as the actual values . The dict has the key policy with either ratio or per_class and the key value with the actual values as an numpy array . This array should be sorted such that values in data_size are strictly monotonically increasing . Default : None
def __init__(
        self,
        n_perms: Optional[Union[int, Vector]] = None,
        data_size: Optional[dict] = None,
        **kwargs,
    ):
        """
        Parameters
        ----------
        n_perms :
            Number of permutations to perform. If an array
            is passed it has to be equal in size to the data_size array.
            Values in this array must be monotonically decreasing (performing
            more permutations for more data is not useful to reduce standard
            error of the mean).
            Default: None
        data_size :
            If None is passed, it performs conventional WithinSession evaluation.
            Contains the policy to pick the datasizes to
            evaluate, as well as the actual values. The dict has the
            key 'policy' with either 'ratio' or 'per_class', and the key
            'value' with the actual values as an numpy array. This array should be
            sorted, such that values in data_size are strictly monotonically increasing.
            Default: None
        """
        self.data_size = data_size
        self.n_perms = n_perms
        self.calculate_learning_curve = self.data_size is not None
        if self.calculate_learning_curve:
            # Check correct n_perms parameter
            if self.n_perms is None:
                raise ValueError(
                    "When passing data_size, please also indicate number of permutations"
                )
            if type(n_perms) is int:
                self.n_perms = np.full_like(self.data_size["value"], n_perms, dtype=int)
            elif len(self.n_perms) != len(self.data_size["value"]):
                raise ValueError(
                    "Number of elements in n_perms must be equal "
                    "to number of elements in data_size['value']"
                )
            elif not np.all(np.diff(n_perms) <= 0):
                raise ValueError(
                    "If n_perms is passed as an array, it has to be monotonically decreasing"
                )
            # Check correct data size parameter
            if not np.all(np.diff(self.data_size["value"]) > 0):
                raise ValueError(
                    "data_size['value'] must be sorted in strictly monotonically increasing order."
                )
            if data_size["policy"] not in WithinSessionEvaluation.VALID_POLICIES:
                raise ValueError(
                    f"{data_size['policy']} is not valid. Please use one of"
                    f"{WithinSessionEvaluation.VALID_POLICIES}"
                )
            self.test_size = 0.2  # Roughly similar to 5-fold CV
            add_cols = ["data_size", "permutation"]
            super().__init__(additional_columns=add_cols, **kwargs)
        else:
            # Perform default within session evaluation
            super().__init__(**kwargs)
def __init__ ( self , n_perms : Optional [ Union [ int , Vector ] ] = None , data_size : Optional [ dict ] = None , * * kwargs , ) : self . data_size = data_size self . n_perms = n_perms self . calculate_learning_curve = self . data_size is not None if self . calculate_learning_curve : # Check correct n_perms parameter if self . n_perms is None : raise ValueError ( "When passing data_size, please also indicate number of permutations" ) if type ( n_perms ) is int : self . n_perms = np . full_like ( self . data_size [ "value" ] , n_perms , dtype = int ) elif len ( self . n_perms ) != len ( self . data_size [ "value" ] ) : raise ValueError ( "Number of elements in n_perms must be equal " "to number of elements in data_size['value']" ) elif not np . all ( np . diff ( n_perms ) <= 0 ) : raise ValueError ( "If n_perms is passed as an array, it has to be monotonically decreasing" ) # Check correct data size parameter if not np . all ( np . diff ( self . data_size [ "value" ] ) > 0 ) : raise ValueError ( "data_size['value'] must be sorted in strictly monotonically increasing order." ) if data_size [ "policy" ] not in WithinSessionEvaluation . VALID_POLICIES : raise ValueError ( f"{data_size['policy']} is not valid. Please use one of" f"{WithinSessionEvaluation.VALID_POLICIES}" ) self . test_size = 0.2 # Roughly similar to 5-fold CV add_cols = [ "data_size" , "permutation" ] super ( ) . __init__ ( additional_columns = add_cols , * * kwargs ) else : # Perform default within session evaluation super ( ) . __init__ ( * * kwargs )