utils.matrix_transformation
The hbbrain.utils.matrix_transformation
submodule implements various
functions for matrix transformation measures.
- hbbrain.utils.matrix_transformation.hashing(a, b)[source]
Transform a pair of positive integer numbers into a unique number and this value is have commutation ability.
- Parameters:
- apositive int
The first value.
- bpositive int
The second value.
- Returns:
- cpostivie int
A unique transformed value from the two input values.
- hbbrain.utils.matrix_transformation.hashing_mat(A, B)[source]
Transform each pair of items in two matrices A and B to a unique number
- Parameters:
- Aarray-like of shape (n_samples, n_features)
The first matrix.
- Barray-like of shape (n_samples, n_features)
The second matrix.
- Returns:
- Carray-like of shape (n_samples, n_features)
A matrix that each element is a combination of two corresponding elements in two input matrices at the same position.
- hbbrain.utils.matrix_transformation.split_matrix(A, asimil_type='max', is_sort=True)[source]
Split an input matrix A into a maxtrix with three columns:
The first column contains the row indices of A
The second column contains the column indices of A
The third column contains the values corresponding to each row and column
- Parameters:
- Andarray of shape (n_samples, n_features)
Input matrix needs to be split.
- asimil_typestr, optional, default=’max’
Use the minimum or maximum values of \(a_{ij}\) or \(a_{ij}\) for the third column if the matrix A is assymetric. Get a value of ‘max’ or ‘min’.
- is_sortboolean, optional, default=True
Sort the values of the third column in a descending order or not.
- Returns:
- Xndarray of shape (n_samples, n_features)
The outcome of the input matrix A after transformation.