The dataset viewer is not available for this split.
Cannot extract the features (columns) for the split 'train' of the config 'default' of the dataset.
Error code:   FeaturesError
Exception:    ArrowTypeError
Message:      Expected bytes, got a 'int' object
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/split/first_rows.py", line 323, in compute
                  compute_first_rows_from_parquet_response(
                File "/src/services/worker/src/worker/job_runners/split/first_rows.py", line 88, in compute_first_rows_from_parquet_response
                  rows_index = indexer.get_rows_index(
                File "/src/libs/libcommon/src/libcommon/parquet_utils.py", line 631, in get_rows_index
                  return RowsIndex(
                File "/src/libs/libcommon/src/libcommon/parquet_utils.py", line 512, in __init__
                  self.parquet_index = self._init_parquet_index(
                File "/src/libs/libcommon/src/libcommon/parquet_utils.py", line 529, in _init_parquet_index
                  response = get_previous_step_or_raise(
                File "/src/libs/libcommon/src/libcommon/simple_cache.py", line 566, in get_previous_step_or_raise
                  raise CachedArtifactError(
              libcommon.simple_cache.CachedArtifactError: The previous step failed.
              
              During handling of the above exception, another exception occurred:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/split/first_rows.py", line 241, in compute_first_rows_from_streaming_response
                  iterable_dataset = iterable_dataset._resolve_features()
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 2216, in _resolve_features
                  features = _infer_features_from_batch(self.with_format(None)._head())
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 60, in _infer_features_from_batch
                  pa_table = pa.Table.from_pydict(batch)
                File "pyarrow/table.pxi", line 1812, in pyarrow.lib._Tabular.from_pydict
                File "pyarrow/table.pxi", line 5275, in pyarrow.lib._from_pydict
                File "pyarrow/array.pxi", line 374, in pyarrow.lib.asarray
                File "pyarrow/array.pxi", line 344, in pyarrow.lib.array
                File "pyarrow/array.pxi", line 42, in pyarrow.lib._sequence_to_array
                File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
                File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
              pyarrow.lib.ArrowTypeError: Expected bytes, got a 'int' object

Need help to make the dataset viewer work? Open a discussion for direct support.

YAML Metadata Warning: empty or missing yaml metadata in repo card (https://huggingface.co/docs/hub/datasets-cards)

Optimized Item Selection Datasets

We provide the datasets that are used to test the multi-level optimization framework (CPAIOR'21, DSO@IJCAI'22), for solving Item Selection Problem (ISP) to boost exploration in Recommender Systems.

The the multi-objective optimization framework is implemented in Selective as part of TextBased Selection. By solving the ISP with Text-based Selection in Selective, we select a smaller subset of items with maximum diversity in the latent embedding space of items and maximum coverage of labels.

The datasets are extracted and processed from their original public sources for research purposes as detailed below.

Overview of Datasets

The datasets include:

  • GoodReads datasets for book recommenders. Two datasets are randomly selected from the source data GoodReads Book Reviews, a small version with 1000 items and a large version with 10,000 items. For book recommendations, there are 11 different genres (e.g., fiction, non-fiction, children), 231 different publishers (e.g. Vintage, Penguin Books, Mariner Books), and genre-publisher pairs. This leads to 574 and 1,322 unique book labels for the small and large datasets, respectively.

  • MovieLens datasets for movie recommenders. Two datasets are randomly selected from the source data MovieLens Movie Ratings, a small version with 1000 items and a large version with 10,000 items. For movie recommendations, there are 19 different genres (e.g. action, comedy, drama, romance), 587 different producers, 34 different languages (e.g. English, French, Mandarin), and genre-language pairs. This leads to 473 and 1,011 unique movie labels for the small and large datasets, respectively.

Each dataset in GoodReads and MovieLens contains:

  • *_data.csv that contains the text content (i.e., title + description) of the items, and
  • *_label.csv that contains the labels (e.g., genre or language) and a binary 0/1 value denoting whether an item exbihits a label.

Each column in the csv file is for an item, indexed by book/movie ID. The order of columns in data and label files are the same.

Quick Start

To run the example, install required packages by pip install selective datasets

# Import Selective (for text-based selection) and TextWiser (for embedding space)
import pandas as pd
from datasets import load_dataset
from textwiser import TextWiser, Embedding, Transformation
from feature.selector import Selective, SelectionMethod

# Load Text Contents
data = load_dataset('skadio/optimized_item_selection', data_files='book_recommenders_data/goodreads_1k_data.csv', split='train')
data = data.to_pandas()

# Load Labels 
labels = load_dataset('skadio/optimized_item_selection', data_files='book_recommenders_data/goodreads_1k_label.csv', split='train')
labels = labels.to_pandas()
labels.set_index('label', inplace=True)

# TextWiser featurization method to create text embeddings
textwiser = TextWiser(Embedding.TfIdf(), Transformation.NMF(n_components=20, random_state=1234))

# Text-based selection with the default configuration
# The default configuration is optimization_method="exact" and cost_metric ="diverse"
# By default, multi-level optimization maximizes coverage and diversity as described in (CPAIOR'21, DSO@IJCAI'22)
# within an upper bound on subset size given as num_features
selector = Selective(SelectionMethod.TextBased(num_features=30, featurization_method=textwiser))

# Result
subset = selector.fit_transform(data, labels)
print("Reduction:", list(subset.columns))

Advanced Usages

Text-based Selection provides access to multiple selection methods.

At a high-level, the configurations can be divided into exact, randomized, greedy or cluster-based optimization.

Exact

  • (Default) Solve for Problem P_max_cover@t in CPAIOR'21 - Selecting a subset of items that maximizes coverage of labels and maximizes the diversity in latent embedding space within an upper bound on subset size.
selector = Selective(SelectionMethod.TextBased(num_features=30, 
                                               featurization_method=textwiser,
                                               optimization_method='exact', 
                                               cost_metric='diverse'))
  • Solve for Problem P_unicost in CPAIOR'21 - Selecting a subset of items that covers all labels.
selector = Selective(SelectionMethod.TextBased(num_features=None, 
                                               optimization_method='exact', 
                                               cost_metric='unicost'))
  • Solve for Problem P_diverse in CPAIOR'21 - Selecting a subset of items with maximized diversity in the latent embedding space while still maintaining the coverage over all labels.
selector = Selective(SelectionMethod.TextBased(num_features=None,
                                               featurization_method=textwiser, 
                                               optimization_method='exact', 
                                               cost_metric='diverse'))
  • Selecting a subset of items that only maximizes coverage within an upper bound on subset size.
selector = Selective(SelectionMethod.TextBased(num_features=30, 
                                               optimization_method='exact', 
                                               cost_metric='unicost'))

Randomized

  • Selecting a subset by performing random selection. If num_features is not set, subset size is defined by solving P_unicost.
selector = Selective(SelectionMethod.TextBased(num_features=None, optimization_method='random'))
  • Selecting a subset by performing random selection. Subset size is defined by num_features.
selector = Selective(SelectionMethod.TextBased(num_features=30, 
                                               optimization_method='random'))

Greedy

  • Selecting a subset by adding an item each time using a greedy heuristic in selection with a given cost_metric, i.e. diverse by default or unicost. If num_features is not set, subset size is defined by solving P_unicost.
selector = Selective(SelectionMethod.TextBased(num_features=None, 
                                               optimization_method='greedy',
                                               cost_metric='unicost'))
  • Selecting a subset by adding an item each time using a greedy heuristic in selection with a given cost_metric, i.e. diverse by default or unicost.
selector = Selective(SelectionMethod.TextBased(num_features=30,
                                               optimization_method='greedy',
                                               cost_metric='unicost'))

Clustering

  • Selecting a subset by clustering items into a number of clusters and the items close to the centroids are selected. If num_features is not set, subset size is defined by solving P_unicost. cost_metric argument is not used in this method.
selector = Selective(SelectionMethod.TextBased(num_features=None, optimization_method='kmeans'))
  • Selecting a subset by clustering items into a number of clusters and the items close to the centroids are selected. cost_metric argument is not used in this method.
selector = Selective(SelectionMethod.TextBased(num_features=30,
                                               optimization_method='kmeans'))

Citation

If you use ISP in our research/applications, please cite as follows:

  @inproceedings{cpaior2021,
    title={Optimized Item Selection to Boost Exploration for Recommender Systems},
    author={Serdar Kadıoğlu and Bernard Kleynhans and Xin Wang},
    booktitle={Proceedings of Integration of Constraint Programming, Artificial Intelligence, and Operations Research: 18th International Conference, CPAIOR 2021, Vienna, Austria, July 5–8, 2021},
    url={https://doi.org/10.1007/978-3-030-78230-6_27},
    pages = {427–445},
    year={2021}
  }
@inproceedings{ijcai2022,
      title={Active Learning Meets Optimized Item Selection}, 
      author={Bernard Kleynhans and Xin Wang and Serdar Kadıoğlu},
      booktitle={The IJCAI-22 Workshop: Data Science meets Optimisation}
      publisher={arXiv},
      url={https://arxiv.org/abs/2112.03105},
      year={2022}
}
Downloads last month
0
Edit dataset card