smote_cd.dataset_generation.generate_betas#

smote_cd.dataset_generation.generate_betas(n_features, n_classes, random_state=None)#

Randomly generate a betas matrix of the regression coefficients, that will be used to generate the dataset.

Parameters:
n_featuresint

The number of desired features.

n_classesint

The number of desired classes.

random_stateint, optional

The random state for the generation.

Returns:
array_like, shape (n_classes, n_features+1)

The generated matrix.

Notes

The shape of the returned betas matrix is (n_classes, n_features+1) because its first column corresponds to the intercept.

Examples

With 2 features and 3 classes, the returned matrix will be of dimension (3,3).

>>> from smote_cd import dataset_generation
>>> dataset_generation.generate_betas(n_features=2,n_classes=3,random_state=0)
array([[0.5488135 , 0.71518937, 0.60276338],
       [0.54488318, 0.4236548 , 0.64589411],
       [0.43758721, 0.891773  , 0.96366276]])

With 3 features and 2 classes, the returned matrix will be of dimension (2,4).

>>> dataset_generation.generate_betas(n_features=3,n_classes=2,random_state=0)
array([[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
       [0.4236548 , 0.64589411, 0.43758721, 0.891773  ]])