utils.membership_calc

Contain all functions supporting for computing fuzzy membership values in various ways.

hbbrain.utils.membership_calc.asym_similarity_val_one_many_hyperboxes(xl, xu, V, W, g=1, asimil_type='max')[source]

Calculate the asymetrical similarity value of a specific hyperbox (lower bound - xl, upper bound - xu) and hyperboxes having lower and upper bounds stored in two matrix V and W respectively

Parameters:
xlarray-like of shape (n_features,)

Lower bound of an input hyperbox.

xuarray-like of shape (n_features,)

Upper bound of an input hyperbox.

Varray-like of shape (n_hyperboxes, n_features)

A matrix stores all minimal points of all existing hyperboxes, in which each row is a minimal point of a hyperbox.

Warray-like of shape (n_hyperboxes, n_features)

A matrix stores all maximal points of all existing hyperboxes, in which each row is a maximal point of a hyperbox.

gfloat or ndarray of shape (n_features,), optional, default=1

A sensitivity parameter describing the speed of decreasing of the membership function in each dimension.

asimil_type{‘max’, ‘min’}, optional, default=’max’

Type of handling asymmetric similarity matrix.

Returns:
barray-like of shape (n_hyperboxes,)

Similarity values of the specific hyperbox with all hyperboxes having lower and upper bounds in V and W.

hbbrain.utils.membership_calc.bitwise_membership(x_cat, D)[source]

Compute membership values between categorical features in the input pattern X_cat and all categorical features of existing hyperboxes stored in D.

Parameters:
x_catarray-like of shape (n_cat_features, )

Categorical features of an input pattern. Each feature is represented by an array of one-hot encoded values.

Darray-like of shape (n_hyperboxes, n_cat_features)

A matrix stores all bounds of categorical features for all existing hyperboxes, in which each row stores categorical features of a hyperbox.

Returns:
mem_valarray-like of shape (n_hyperboxes, ).

An array stores the degrees of membership from the input pattern to all existing hyperboxes which are computed based on categorical features.

hbbrain.utils.membership_calc.f_sim_freq_cat_features(x_cat, E, similarity_of_cat_vals)[source]

Compute similarity values in each categorical dimension between a input categorical features x_cat and each element in the current list of categorical bounds of existing hyperboxes.

Parameters:
x_catarray-like of shape (n_cat_features, )

Categorical features of an input pattern.

Earray-like of shape (n_hyperboxes, n_cat_features)

A matrix stores all bounds of categorical features for all existing hyperboxes, in which each row stores categorical features of a hyperbox.

similarity_of_cat_valsarray-like of shape (n_cat_features,)

An array stores all similarity values among all pairs of categorical values for each categorical feature index. Each element in this array is an dictionary with keys being a hashed value of two categorical values and values of this dictionary being a similarity value.

Returns:
sim_valsarray-like of shape (n_hyperboxes, n_cat_features)

A matrix stores similarity values in each categorical dimension between the input categorical features and all bounds of categorical features of existing hyperboxes.

hbbrain.utils.membership_calc.get_membership_extended_iol_gfmm_all_classes(Xl, Xu, X_cat, V, W, D, C, g=1, alpha=0.5)[source]

Return membership values (according to the membership function of the GFMM classifiers) with respect to all class labels between the continuoues input patterns stored in two lower and upper bound input matrices Xl and Xu while categorical input patterns stored in the matrix Xd and existing hyperboxes represented by two matrices of minimum and maximum points V and W for continuous features and the matrix of categorical features D together with corresponding class labels in vector C.

Parameters:
Xlarray-like of shape (n_samples, n_continuous_features) or (n_continuous_features, )

Lower bounds of input samples.

Xuarray-like of shape (n_samples, n_continuous_features) or (n_continuous_features, )

Upper bounds of input samples.

X_catarray-like of shape (n_samples, n_cat_features) or (n_cat_features, )

Categorical bounds of input samples.

Varray-like of shape (n_hyperboxes, n_continuous_features)

Minimum points of the existing hyperboxes in the trained model.

Warray-like of shape (n_hyperboxes, n_continuous_features)

Maximum points of the existing hyperboxes in the trained model.

Darray-like of shape (n_hyperboxes, n_cat_features)

Categorical bound of the existing hyperboxes in the trained model.

Carray-like of shape (n_hyperboxes,)

Class labels of all existing hyperboxes corresponding to the values stored in V, W, and D.

gfloat or ndarray of shape (n_continuous_features,), optional, default=1

A sensitivity parameter describing the speed of decreasing of the membership function in each continuous dimension.

alphafloat, optional, default=0.5

The trade-off weighting factor between the impacts of categorical features and numerical features on the outputs of membership values.

Returns:
mem_vals_matrixarray-like of shape (n_samples, n_classes)

Membership values with regard to all class labels for each input sample. Each row is a vector of membership values. Each column represents an index of a class label sorted in an ascending order of class labels.

hyperbox_ids_matrixarray-like of shape (n_samples, n_classes)

Storing the indices of hyperboxes corresponding to membership values for classes.

hbbrain.utils.membership_calc.get_membership_fmnn_all_classes(X, V, W, C, g=1)[source]

Return membership values (according to the membership function of the FMNN classifiers) with respect to all class labels between the input patterns stored in the matrix X and existing hyperboxes represented by two matrices of minimum and maximum points V and W together with the corresponding class labels in the vector C.

Parameters:
Xarray-like of shape (n_samples, n_features) or (n_features, )

Input samples.

Varray-like of shape (n_hyperboxes, n_features)

Minimum points of the existing hyperboxes in the trained model.

Warray-like of shape (n_hyperboxes, n_features)

Maximum points of the existing hyperboxes in the trained model.

Carray-like of shape (n_hyperboxes,)

Class labels of all existing hyperboxes corresponding to the values stored in V and W.

gfloat or ndarray of shape (n_features,), optional, default=1

A sensitivity parameter describing the speed of decreasing of the membership function in each dimension.

Returns:
mem_vals_matrixarray-like of shape (n_samples, n_classes)

Membership values with respect to all class labels for each input sample. Each row is a vector of membership values. Each column represents an index of a class label sorted in an ascending order of class labels.

hyperbox_ids_matrixarray-like of shape (n_samples, n_classes)

Storing the indices of hyperboxes corresponding to membership values for classes.

hbbrain.utils.membership_calc.get_membership_free_range_gfmm_all_classes(Xl, Xu, V, W, C, g=1)[source]

Return membership values (according to the membership function of the GFMM classifiers with unbounded range) with respect to all class labels between the input patterns stored in two lower and upper bound input matrices Xl and Xu and existing hyperboxes represented by two matrices of minimum and maximum points V and W together with corresponding class labels in vector C.

Parameters:
Xlarray-like of shape (n_samples, n_features) or (n_features, )

Lower bounds of input samples.

Xuarray-like of shape (n_samples, n_features) or (n_features, )

Upper bounds of input samples.

Varray-like of shape (n_hyperboxes, n_features)

Minimum points of the existing hyperboxes in the trained model.

Warray-like of shape (n_hyperboxes, n_features)

Maximum points of the existing hyperboxes in the trained model.

Carray-like of shape (n_hyperboxes,)

Class labels of all existing hyperboxes corresponding to the values stored in V and W.

gfloat or ndarray of shape (n_features,), optional, default=1

A sensitivity parameter describing the speed of decreasing of the membership function in each dimension.

Returns:
mem_vals_matrixarray-like of shape (n_samples, n_classes)

Membership values with regard to all class labels for each input sample. Each row is a vector of membership values. Each column represents an index of a class label sorted in an ascending order of class labels.

hyperbox_ids_matrixarray-like of shape (n_samples, n_classes)

Storing the indices of hyperboxes corresponding to membership values for classes.

hbbrain.utils.membership_calc.get_membership_freq_cat_gfmm_all_classes(Xl, Xu, X_cat, V, W, E, F, C, similarity_of_cat_vals, g=1)[source]

Return membership values (according to the membership function of the GFMM classifiers) with respect to all class labels between the input patterns stored in two lower and upper bound matrices for input continuous features Xl and Xu and two lower and upper bound matrices for input categorical features and existing hyperboxes represented by four matrices of minimum and maximum points for continuous features V and W and lower and upper bounds for categorical features E and F together with corresponding class labels in vector C.

Parameters:
Xlarray-like of shape (n_samples, n_continuous_features) or (n_continuous_features, )

Lower bounds of continuous features of all input samples. If None, there are no continous features.

Xuarray-like of shape (n_samples, n_continuous_features) or (n_continuous_features, )

Lower bounds of continuous features of all input samples. If None, there are no continous features.

X_catarray-like of shape (n_samples, n_cat_features) or (n_cat_features, )

Categorical features of all input patterns. If None, there are no categorical features.

Varray-like of shape (n_hyperboxes, n_continuous_features)

Minimum points of all continuous features of the existing hyperboxes in the trained model. If None, there are no continous features.

Warray-like of shape (n_hyperboxes, n_continuous_features)

Maximum points of all continuous features of the existing hyperboxes in the trained model. If None, there are no continous features.

Earray-like of shape (n_hyperboxes, n_cat_features)

Lower bounds of all categorical features of the existing hyperboxes in the trained model. If None, there are no categorical features.

Farray-like of shape (n_hyperboxes, n_cat_features)

Upper bounds of all categorical features of the existing hyperboxes in the trained model. If None, there are no categorical features.

Carray-like of shape (n_hyperboxes,)

Class labels of all existing hyperboxes corresponding to the values stored in V, W, and E, F.

similarity_of_cat_valsarray-like of shape (n_cat_features,)

An array stores all similarity values among all pairs of categorical values for each categorical feature index. Each element in this array is an dictionary with keys being a hashed value of two categorical values and values of this dictionary being a similarity value.

gfloat or ndarray of shape (n_continuous_features,), optional, default=1

A sensitivity parameter describing the speed of decreasing of the membership function in each continous dimension.

Returns:
mem_vals_matrixarray-like of shape (n_samples, n_classes)

Membership values with regard to all class labels for each input sample. Each row is a vector of membership values. Each column represents an index of a class label sorted in an ascending order of class labels.

hyperbox_ids_matrixarray-like of shape (n_samples, n_classes)

Storing the indices of hyperboxes corresponding to membership values for classes.

hbbrain.utils.membership_calc.get_membership_gfmm_all_classes(Xl, Xu, V, W, C, g=1)[source]

Return membership values (according to the membership function of the GFMM classifiers) with respect to all class labels between the input patterns stored in two lower and upper bound input matrices Xl and Xu and existing hyperboxes represented by two matrices of minimum and maximum points V and W together with corresponding class labels in vector C.

Parameters:
Xlarray-like of shape (n_samples, n_features) or (n_features, )

Lower bounds of input samples.

Xuarray-like of shape (n_samples, n_features) or (n_features, )

Upper bounds of input samples.

Varray-like of shape (n_hyperboxes, n_features)

Minimum points of the existing hyperboxes in the trained model.

Warray-like of shape (n_hyperboxes, n_features)

Maximum points of the existing hyperboxes in the trained model.

Carray-like of shape (n_hyperboxes,)

Class labels of all existing hyperboxes corresponding to the values stored in V and W.

gfloat or ndarray of shape (n_features,), optional, default=1

A sensitivity parameter describing the speed of decreasing of the membership function in each dimension.

Returns:
mem_vals_matrixarray-like of shape (n_samples, n_classes)

Membership values with regard to all class labels for each input sample. Each row is a vector of membership values. Each column represents an index of a class label sorted in an ascending order of class labels.

hyperbox_ids_matrixarray-like of shape (n_samples, n_classes)

Storing the indices of hyperboxes corresponding to membership values for classes.

hbbrain.utils.membership_calc.get_membership_onehot_gfmm_all_classes(Xl, Xu, Xd, V, W, D, C, g=1)[source]

Return membership values (according to the membership function of the GFMM classifiers) with respect to all class labels between the input patterns stored in two lower and upper bound input matrices Xl and Xu and existing hyperboxes represented by two matrices of minimum and maximum points V and W together with corresponding class labels in vector C.

Parameters:
Xlarray-like of shape (n_samples, n_continuous_features) or (n_continuous_features, )

Lower bounds of continuous features of all input samples. If None, there are no continous features.

Xuarray-like of shape (n_samples, n_continuous_features) or (n_continuous_features, )

Lower bounds of continuous features of all input samples. If None, there are no continous features.

Xdarray-like of shape (n_samples, n_cat_features) or (n_cat_features, )

Bounds of categorical features of all input patterns. If None, there are no categorical features.

Varray-like of shape (n_hyperboxes, n_continuous_features)

Minimum points of all continuous features of the existing hyperboxes in the trained model. If None, there are no continous features.

Warray-like of shape (n_hyperboxes, n_continuous_features)

Maximum points of all continuous features of the existing hyperboxes in the trained model. If None, there are no continous features.

Darray-like of shape (n_hyperboxes, n_cat_features)

Bounds of all categorical features of the existing hyperboxes in the trained model. If None, there are no categorical features.

Carray-like of shape (n_hyperboxes,)

Class labels of all existing hyperboxes corresponding to the values stored in V, W, and D.

gfloat or ndarray of shape (n_continuous_features,), optional, default=1

A sensitivity parameter describing the speed of decreasing of the membership function in each continous dimension.

Returns:
mem_vals_matrixarray-like of shape (n_samples, n_classes)

Membership values with regard to all class labels for each input sample. Each row is a vector of membership values. Each column represents an index of a class label sorted in an ascending order of class labels.

hyperbox_ids_matrixarray-like of shape (n_samples, n_classes)

Storing the indices of hyperboxes corresponding to membership values for classes.

hbbrain.utils.membership_calc.membership_cat_feature_eiol_gfmm(x_cat, D)[source]

Compute membership degrees between input categorical features and all bounds of categorical features of existing hyperboxes for the extended improved online learning algorithm of general fuzzy min-max neural network.

Parameters:
x_catarray-like of shape (n_cat_features, )

Categorical features of an input pattern.

Darray-like of shape (n_hyperboxes, n_cat_features)

A matrix stores all bounds of categorical features for all existing hyperboxes, in which each row stores a categorical features bound for a hyperbox. Each element \(d_{ij} \in D\) is a set of symbolic values with their cardinalities for the j-th categorical dimension of the hyperbox \(B_i\). For example, \(d_{i1} = \{apple : 5, orange : 1\}\) means that the first categorical feature of the hyperbox \(B_i\) contains 5 values of apple and 1 value of orange.

Returns:
barray-like of shape (n_hyperboxes, ).

An array stores the degrees of membership from the input pattern to all existing hyperboxes which are computed based on categorical features.

hbbrain.utils.membership_calc.membership_func_extended_iol_gfmm(xl, xu, x_cat, V, W, D, g=1, alpha=0.5)[source]

Compute fuzzy membership values between an input pattern and a list of existing hyperboxes of a general fuzzy min-max neural network with mixed-attribute data.

Note

This function provides the degrees of membership b of an input pattern x (in form of upper bound xu and lower bound xl for continuous features and categorical features x_cat) with respect to the existing hyperboxes represented by minimal points V and maximal points W for continuous features and the bound D for categorical features. The sensitivity parameter g regulates how fast the membership values decrease when an input continuous pattern is separeted from hyperbox core. The parameter alpha is the trade-off factor between impacts of continuous features and categorical features on the output of membership values. Each element \(d_{ij} \in D\) is a set of symbolic values with their cardinalities for the j-th categorical dimension of the hyperbox \(B_i\). For example, \(d_{i1} = \{apple : 5, orange : 1\}\) means that the first categorical feature of the hyperbox \(B_i\) contains 5 values of apple and 1 value of orange.

Parameters:
xlarray-like of shape (n_continuous_features,)

Lower bound of continous features of an input pattern.

xuarray-like of shape (n_continuous_features,)

Upper bound of continous features of an input pattern.

x_catarray-like of shape (n_cat_features, )

Categorical features of an input pattern.

Varray-like of shape (n_hyperboxes, n_continuous_features)

A matrix stores all minimal points for continuous features of all existing hyperboxes, in which each row is a minimal point of a hyperbox.

Warray-like of shape (n_hyperboxes, n_continuous_features)

A matrix stores all maximal points for continuous features of all existing hyperboxes, in which each row is a minimal point of a hyperbox.

Darray-like of shape (n_hyperboxes, n_cat_features)

A matrix stores a special structure for categorical features of all existing hyperboxes. Each element in D stores a set of symbolic values with their cardinalities for the j-th categorical dimension of a given hyperbox.

gfloat or ndarray of shape (n_features,), optional, default=1

A sensitivity parameter describing the speed of decreasing of the membership function in each continous dimension.

alphafloat, optional, default=0.5

The trade-off weighting factor between the impacts of categorical features and numerical features on the outputs of membership values.

Returns:
barray-like of shape (n_hyperboxes,)

Degrees of membership of the input pattern x=[xl, xu, x_cat] corresponding to each hyperbox in the current list of existing hyperboxes.

hbbrain.utils.membership_calc.membership_func_fmnn(x, V, W, g=1)[source]

Compute fuzzy membership values between an input pattern and a list of existing hyperboxes of a fuzzy min-max neural network and its improved versions.

For more details regarding how to calculate fuzzy membership values, please refer to the publication [1].

Note

This function provides the degrees of membership b of an input pattern x with respect to the existing hyperboxes described by minimal points V and maximal points W. The sensitivity parameter g regulates how fast the membership values decrease when an input pattern is separeted from hyperbox core.

Parameters:
xarray-like of shape (n_features,)

An input pattern.

Varray-like of shape (n_hyperboxes, n_features)

A matrix stores all minimal points of all existing hyperboxes, in which each row is a minimal point of a hyperbox.

Warray-like of shape (n_hyperboxes, n_features)

A matrix stores all maximal points of all existing hyperboxes, in which each row is a maximal point of a hyperbox.

gfloat or ndarray of shape (n_features,), optional, default=1

A sensitivity parameter describing the speed of decreasing of the membership function in each dimension.

Returns:
barray-like of shape (n_hyperboxes,)

Degrees of membership of the input pattern X=[Xl, Xu] corresponding to each hyperbox in the current list of existing hyperboxes.

References

[1]

Simpson, P. (1992). Fuzzy min—max neural networks—Part 1: Classification. IEEE transactions on neural networks, 3(5), 776-786.

hbbrain.utils.membership_calc.membership_func_free_range_gfmm(xl, xu, V, W, g=1)[source]

Compute fuzzy membership values between an input pattern and a list of existing hyperboxes of a general fuzzy min-max neural network. This membership function does not require the coordinates located in the range of [0, 1].

Note

This function provides the degrees of membership b of an input pattern x (in form of upper bound xu and lower bound xl) with respect to the existing hyperboxes described by minimal points V and maximal points W. The sensitivity parameter g regulates how fast the membership values decrease when an input pattern is separeted from hyperbox core.

Parameters:
xlarray-like of shape (n_features,)

Lower bound of an input pattern.

xuarray-like of shape (n_features,)

Upper bound of an input pattern.

Varray-like of shape (n_hyperboxes, n_features)

A matrix stores all minimal points of all existing hyperboxes, in which each row is a minimal point of a hyperbox.

Warray-like of shape (n_hyperboxes, n_features)

A matrix stores all maximal points of all existing hyperboxes, in which each row is a maximal point of a hyperbox.

gfloat or ndarray of shape (n_features,), optional, default=1

A sensitivity parameter describing the speed of decreasing of the membership function in each dimension.

Returns:
barray-like of shape (n_hyperboxes,)

Degrees of membership of the input pattern X=[Xl, Xu] corresponding to each hyperbox in the current list of existing hyperboxes.

hbbrain.utils.membership_calc.membership_func_freq_cat_gfmm(xl, xu, x_cat, V, W, E, F, similarity_of_cat_vals, g=1)[source]

Compute the membership values between an input pattern with respect to all hyperboxes (including continous and categorical features). The membership values for categorical features is computed based on the occurrence frequency values of different class labels with regards to each categorical values in each categorical feature.

For more details regarding how to calculate fuzzy membership values, please refer to the publications [1] and [2].

Parameters:
xlarray-like of shape (n_continuous_features, )

Lower bounds of input continuous features of the input pattern.

xuarray-like of shape (n_continuous_features, )

Upper bounds of input continuous features of the input pattern.

x_catarray-like of shape (n_cat_features, )

Categorical features of an input pattern.

Varray-like of shape (n_hyperboxes, n_continuous_features)

Minimum points of continuous features of the existing hyperboxes in the trained model.

Warray-like of shape (n_hyperboxes, n_continuous_features)

Maximum points of continuous features of the existing hyperboxes in the trained model.

Earray-like of shape (n_hyperboxes, n_cat_features)

A matrix stores all lower bounds of categorical features for all existing hyperboxes, in which each row stores a lower categorical features bound for a hyperbox.

Farray-like of shape (n_hyperboxes, n_cat_features)

A matrix stores all upper bounds of categorical features for all existing hyperboxes, in which each row stores a upper categorical features bound for a hyperbox.

similarity_of_cat_valsarray-like of shape (n_cat_features,)

An array stores all similarity values among all pairs of categorical values for each categorical feature index. Each element in this array is an dictionary with keys being a hashed value of two categorical values and values of this dictionary being a similarity value.

gfloat or ndarray of shape (n_features,), optional, default=1

A sensitivity parameter describing the speed of decreasing of the membership function in each continuous dimension.

Returns:
barray-like of shape (n_hyperboxes,)

Degrees of membership of the input pattern X=[Xl, Xu] corresponding to each hyperbox in the current list of existing hyperboxes.

References

[1]

T.T. Khuat, B. Gabrys, “An in-depth comparison of methods handling mixed-attribute data for general fuzzy min–max neural network”, Neurocomputing, vol. 464, pp. 175-202, 2021.

[2]

P.R. Castillo, J. Cardenosa, “Fuzzy min–max neural networks for categorical data: application to missing data imputation”, Neural Computing and Applications, vol. 21, pp. 1349–1362, 2012.

hbbrain.utils.membership_calc.membership_func_gfmm(xl, xu, V, W, g=1)[source]

Compute fuzzy membership values between an input pattern and a list of existing hyperboxes of a general fuzzy min-max neural network.

For more details regarding how to calculate fuzzy membership values, please refer to the publications [1] and [2].

Note

This function provides the degrees of membership b of an input pattern x (in form of upper bound xu and lower bound xl) with respect to the existing hyperboxes described by minimal points V and maximal points W. The sensitivity parameter g regulates how fast the membership values decrease when an input pattern is separeted from hyperbox core.

Parameters:
xlarray-like of shape (n_features,)

Lower bound of an input pattern.

xuarray-like of shape (n_features,)

Upper bound of an input pattern.

Varray-like of shape (n_hyperboxes, n_features)

A matrix stores all minimal points of all existing hyperboxes, in which each row is a minimal point of a hyperbox.

Warray-like of shape (n_hyperboxes, n_features)

A matrix stores all maximal points of all existing hyperboxes, in which each row is a maximal point of a hyperbox.

gfloat or ndarray of shape (n_features,), optional, default=1

A sensitivity parameter describing the speed of decreasing of the membership function in each dimension.

Returns:
barray-like of shape (n_hyperboxes,)

Degrees of membership of the input pattern X=[Xl, Xu] corresponding to each hyperbox in the current list of existing hyperboxes.

References

[1]

Gabrys, B., & Bargiela, A. (2000). General fuzzy min-max neural network for clustering and classification. IEEE transactions on neural networks, 11(3), 769-783.

[2]

Khuat, T. T., & Gabrys, B. (2021). Accelerated learning algorithms of general fuzzy min-max neural network using a novel hyperbox selection rule. Information Sciences, 547, 887-909.

hbbrain.utils.membership_calc.membership_func_onehot_gfmm(xl, xu, xd, V, W, D, g=1)[source]

Compute membership values between an input pattern of which continuous features are represented by the lower bound xl and the upper bound xu while categorical features are presented by the bound xd and all existing hyperboxes with lower and upper bounds stored in V and W and the categorical bound stored in D.

Parameters:
xlarray-like of shape (n_continuous_features,)

Lower bound of continous features of an input pattern.

xuarray-like of shape (n_continuous_features,)

Upper bound of continous features of an input pattern.

xdarray-like of shape (n_cat_features,)

Categorical features of an input pattern.

Varray-like of shape (n_hyperboxes, n_continuous_features)

A matrix stores all minimal points of continous features for all existing hyperboxes, in which each row is a minimal point of a hyperbox.

Warray-like of shape (n_hyperboxes, n_continuous_features)

A matrix stores all maximal points of continuous features for all existing hyperboxes, in which each row is a maximal point of a hyperbox.

Darray-like of shape (n_hyperboxes, n_cat_features)

A matrix stores all bounds of categorical features for all existing hyperboxes, in which each row contains the bound of a hyperbox.

gfloat or ndarray of shape (n_continuous_features,), optional, default=1

A sensitivity parameter describing the speed of decreasing of the membership function in continuous dimensions.

Returns:
barray-like of shape (n_hyperboxes,)

Degrees of membership of the input pattern x=[xl, xu, xd] corresponding to each hyperbox in the current list of existing hyperboxes.

hbbrain.utils.membership_calc.membership_function_freq_cat(x_cat, E, F, similarity_of_cat_vals)[source]

Compute membership degrees between input categorical features and all lower and upper bounds of categorical features of existing hyperboxes.

Parameters:
x_catarray-like of shape (n_cat_features, )

Categorical features of an input pattern.

Earray-like of shape (n_hyperboxes, n_cat_features)

A matrix stores all lower bounds of categorical features for all existing hyperboxes, in which each row stores a lower categorical features bound for a hyperbox.

Farray-like of shape (n_hyperboxes, n_cat_features)

A matrix stores all upper bounds of categorical features for all existing hyperboxes, in which each row stores a upper categorical features bound for a hyperbox.

similarity_of_cat_valsarray-like of shape (n_cat_features,)

An array stores all similarity values among all pairs of categorical values for each categorical feature index. Each element in this array is an dictionary with keys being a hashed value of two categorical values and values of this dictionary being a similarity value.

Returns:
barray-like of shape (n_hyperboxes, ).

An array stores the degrees of membership from the input pattern to all existing hyperboxes which are computed based on categorical features.

hbbrain.utils.membership_calc.n_cat_features_containing_bit_one(v)[source]

This function is to count number of categorical features in v in which there is at least one bit 1