shapiq_benchmark.setups.UnsupervisedDataSetup¶
- class shapiq_benchmark.setups.UnsupervisedDataSetup(*, dataset, random_state=42, dataset_params=<factory>, n_samples=None, n_bins=20)[source]¶
Bases:
DatasetSetupAn
UnsupervisedDatagame on (a seeded sample of) a dataset.- Variables:
n_samples – Use a seeded sample of this many rows (
Nonefor all).n_bins – The number of equal-width bins per feature. Defaults to
20.
Examples
>>> UnsupervisedDataSetup(dataset="xor").build().n_players 4
- sample_rows(n_rows, n)¶
Return
nsorted row indices out ofn_rows, drawn withrandom_state.All rows are returned if
nisNoneor at leastn_rows.- Return type:
- stratified_rows(y, n, task)¶
Return
nsorted row indices, drawn withrandom_stateand stratified by class.The rows are stratified for classification where every class has enough rows. All rows are returned if
nisNoneor at least the number of rows.- Return type:
GenericAlias[integer]
- to_dict()¶
Return the setup as a JSON-serializable dictionary (the inverse of
setup_from_dict()).
- dataset¶
- dataset_params¶
- property key¶
A stable identifier of the game this setup builds, used as its cache key.
It is a digest of the setup’s name,
version,RECIPE_VERSION, and fields (runtime fields excluded), so it is the same across processes and machines.
- n_bins = 20¶
- n_samples = None¶
- name = 'unsupervised_data'¶
The registered name of the setup.
- random_state = 42¶
- tasks = ('classification', 'regression')¶
The tasks of the datasets the setup accepts.