File size: 8,673 Bytes
b7e6284 ddbd344 b7e6284 ddbd344 b7e6284 de2543d cefe732 b7e6284 de2543d b7e6284 de2543d b7e6284 de2543d b7e6284 de2543d b7e6284 ddbd344 b7e6284 de2543d ddbd344 de2543d ddbd344 de2543d ddbd344 de2543d ddbd344 de2543d ddbd344 de2543d ddbd344 de2543d ddbd344 de2543d b7e6284 de2543d b7e6284 de2543d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# Optimized Item Selection Datasets
We provide the datasets that are used to test the multi-level optimization framework ([CPAIOR'21](https://link.springer.com/chapter/10.1007/978-3-030-78230-6_27), [DSO@IJCAI'22](https://arxiv.org/abs/2112.03105)), for solving Item Selection Problem (ISP) to boost exploration in Recommender Systems.
The the multi-objective optimization framework is implemented in [Selective](https://github.com/fidelity/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**](book_recommenders_data/) for book recommenders. Two datasets are randomly selected from the source data [GoodReads Book Reviews](https://dl.acm.org/doi/10.1145/3240323.3240369), 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**](movie_recommenders_data/) for movie recommenders. Two datasets are randomly selected from the source data [MovieLens Movie Ratings](https://dl.acm.org/doi/10.1145/2827872), 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`
```python
# 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.
```python
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.
```python
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.
```python
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.
```python
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*.
```python
selector = Selective(SelectionMethod.TextBased(num_features=None, optimization_method='random'))
```
- Selecting a subset by performing random selection. Subset size is defined by num_features.
```python
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*.
```python
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`.
```python
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.
```python
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.
```python
selector = Selective(SelectionMethod.TextBased(num_features=30,
optimization_method='kmeans'))
```
## Citation
If you use ISP in our research/applications, please cite as follows:
```bibtex
@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}
}
```
```bibtex
@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}
}
``` |