#NEWLINE# def resample_dataset( self , arr , weights , sample_fraction = 1.0 , rng_seed = None ) : #NEWLINE# #INDENT# 'Resamples unbalanaced dataset according to labels in `arr` and\n        `weights`. This modifies self.X and self.y.\n\n        Parameters\n        -------\n        arr: array-like, shape = [n_samples] or [n_samples, outputs]\n            Array of labels/class/group to balance.\n\n        class_weight: dict, list of dicts, "balanced", or None, optional\n            Weights associated with `arr` in the form ``{label: weight}``,\n            where the keys `label` are unique values present in arr and\n            weights are the percentage of which to sample. If not given, all\n            classes are set to weights of 1. For multi-output problems, a list\n            of dicts can be provided in the same order as the columns of y.\n\n\n            The "balanced" mode uses the values of y to automatically adjust\n            weights inversely proportional to class frequencies in the data.\n\n\n            For multi-output, the weights of each column of y will be\n            multiplied.\n\n        sample_fraction: float, default=1.0\n            Fraction of len(arr) to return when resampling dataset.\n            For example, if `sample_fraction=2.0`, will return arr of\n            ``len(2*len(arr))``.\n\n        rng_seed: int, default=None\n            Seed to random state that uses np.choice to select idxs of samples.\n\n        Returns\n        -------\n        idxs: ndarray, shape = (sample_fraction * len(arr))\n            Resampled indices of arr according to weights.\n            Will apply: self.X = self.X[idxs]\n                        self.y = self.y[idxs]\n        ' #NEWLINE# idxs = dtu . resample_data ( arr , weights , sample_fraction = sample_fraction , rng_seed = rng_seed ) #NEWLINE# self . X = self . X [ idxs ] #NEWLINE# self . y = self . y [ idxs ] #NEWLINE# print ( ( '[datumio] resampling dataset to len(X) = %s' % len ( self . X ) ) ) #NEWLINE# print ( '[datumio] ... Note: This is sampled with replacement. An epoch no longer means a pass through the dataset.' ) #NEWLINE# return idxs