Filters¶
mllabs.DataFilter
¶
Base class for data filters used with :class:~mllabs.collector.SHAPCollector.
Subclasses implement :meth:_select to return a row index array.
The filter is applied to all arrays in the input data_dict identically.
__call__(data_dict)
¶
Apply the filter to every array in data_dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_dict
|
dict
|
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Filtered |
|
|
meth: |
mllabs.RandomFilter
¶
Bases: DataFilter
Randomly subsample rows from a data dict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
Absolute number of rows to sample. Mutually exclusive with frac. |
None
|
frac
|
float
|
Fraction of rows to sample (0–1). Mutually exclusive with n. |
None
|
random_state
|
int
|
Random seed for reproducibility. |
None
|
mllabs.IndexFilter
¶
Bases: DataFilter
Select rows whose index values appear in a provided index array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
array - like
|
The set of index values to keep. |
required |