fatf.utils.data.transformation.dataset_row_masking¶
-
fatf.utils.data.transformation.dataset_row_masking(dataset: numpy.ndarray, data_row: Union[numpy.ndarray, numpy.void]) → numpy.ndarray[source]¶ Creates a binary representation of the
datasetby masking its rows.New in version 0.0.2.
The rows of the
datasetarray are compared against specifieddata_rowto determine which features values are the same and which are different. The same values are represented as1in the binary output and different ones are indicated by0.For a
['a', 'b']data_rowand[['x', 'b'], ['a', 'b'], ['a', 'x']]datasetthe binary representation would be[[0, 1], [1, 1], [1, 0]].- Parameters
- datasetnumpy.ndarray
A 2-dimensional numpy array used to generate the binary representation.
- data_rowUnion[numpy.ndarray, numpy.void]
A 1-dimensional numpy array for unstructured arrays or numpy void for structured rows containing feature values that will be compared against the
datasetrows.
- Returns
- binary_representationnumpy.ndarray
A binary (0’s and 1’s in an array of
numpy.int8type) representation of thedataset(with the same shape asdataset) achieved by “masking” it with thedata_row.
- Raises
- IncorrectShapeError
The
datasetis not a 2-dimensional array ordata_rowis not a 1-dimensional array. The length of thedata_rowis different to the number of columns in thedataset.- TypeError
The
datasetis not of a base type or thedata_row’s dtype is too different from thedataset’s dtype.