Update README.md
Browse files
README.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
| 1 |
# Optimized Item Selection Datasets
|
| 2 |
|
| 3 |
-
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
## Overview of Datasets
|
| 6 |
The datasets include:
|
|
@@ -9,13 +13,12 @@ The datasets include:
|
|
| 9 |
|
| 10 |
* [**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.
|
| 11 |
|
| 12 |
-
Each dataset in GoodReads and MovieLens contains
|
|
|
|
|
|
|
| 13 |
|
| 14 |
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.
|
| 15 |
|
| 16 |
-
[Selective](https://github.com/fidelity/selective) implements the multi-objective optimization approach from ([CPAIOR'21](https://link.springer.com/chapter/10.1007/978-3-030-78230-6_27), [DSO@IJCAI'22](https://arxiv.org/abs/2112.03105)) as part of `TextBased Selection`.
|
| 17 |
-
|
| 18 |
-
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.
|
| 19 |
|
| 20 |
## Quick Start
|
| 21 |
To run the example, install required packages by `pip install selective datasets`
|
|
@@ -26,7 +29,6 @@ from datasets import load_dataset
|
|
| 26 |
from textwiser import TextWiser, Embedding, Transformation
|
| 27 |
from feature.selector import Selective, SelectionMethod
|
| 28 |
|
| 29 |
-
|
| 30 |
# Load Text Contents
|
| 31 |
data = load_dataset('skadio/optimized_item_selection', data_files='book_recommenders_data/goodreads_1k_data.csv', split='train')
|
| 32 |
data = data.to_pandas()
|
|
@@ -39,9 +41,10 @@ labels.set_index('label', inplace=True)
|
|
| 39 |
# TextWiser featurization method to create text embeddings
|
| 40 |
textwiser = TextWiser(Embedding.TfIdf(), Transformation.NMF(n_components=20, random_state=1234))
|
| 41 |
|
| 42 |
-
# Text-based selection with the default
|
| 43 |
-
#
|
| 44 |
-
#
|
|
|
|
| 45 |
selector = Selective(SelectionMethod.TextBased(num_features=30, featurization_method=textwiser))
|
| 46 |
|
| 47 |
# Result
|
|
@@ -49,8 +52,11 @@ subset = selector.fit_transform(data, labels)
|
|
| 49 |
print("Reduction:", list(subset.columns))
|
| 50 |
```
|
| 51 |
## Advanced Usages
|
| 52 |
-
Text-based Selection provides access to multiple selection methods.
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
- (Default) Solve for Problem *P_max_cover@t* in **CPAIOR'21** - Selecting a subset of items that
|
| 56 |
maximizes coverage of labels and maximizes the diversity in latent embedding space within an upper
|
|
@@ -81,8 +87,11 @@ selector = Selective(SelectionMethod.TextBased(num_features=30,
|
|
| 81 |
optimization_method='exact',
|
| 82 |
cost_metric='unicost'))
|
| 83 |
```
|
|
|
|
|
|
|
|
|
|
| 84 |
- Selecting a subset by performing random selection. If num_features is not set, subset size is defined
|
| 85 |
-
by solving
|
| 86 |
```python
|
| 87 |
selector = Selective(SelectionMethod.TextBased(num_features=None, optimization_method='random'))
|
| 88 |
```
|
|
@@ -91,9 +100,12 @@ selector = Selective(SelectionMethod.TextBased(num_features=None, optimization_m
|
|
| 91 |
selector = Selective(SelectionMethod.TextBased(num_features=30,
|
| 92 |
optimization_method='random'))
|
| 93 |
```
|
|
|
|
|
|
|
|
|
|
| 94 |
- Selecting a subset by adding an item each time using a greedy heuristic in selection with a given
|
| 95 |
cost_metric, i.e. `diverse` by default or `unicost`. If num_features is not set, subset size is defined
|
| 96 |
-
by solving
|
| 97 |
```python
|
| 98 |
selector = Selective(SelectionMethod.TextBased(num_features=None,
|
| 99 |
optimization_method='greedy',
|
|
@@ -106,8 +118,11 @@ selector = Selective(SelectionMethod.TextBased(num_features=30,
|
|
| 106 |
optimization_method='greedy',
|
| 107 |
cost_metric='unicost'))
|
| 108 |
```
|
|
|
|
|
|
|
|
|
|
| 109 |
- Selecting a subset by clustering items into a number of clusters and the items close to the centroids
|
| 110 |
-
are selected. If num_features is not set, subset size is defined by solving
|
| 111 |
is not used in this method.
|
| 112 |
```python
|
| 113 |
selector = Selective(SelectionMethod.TextBased(num_features=None, optimization_method='kmeans'))
|
|
|
|
| 1 |
# Optimized Item Selection Datasets
|
| 2 |
|
| 3 |
+
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.
|
| 4 |
+
|
| 5 |
+
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.
|
| 6 |
+
|
| 7 |
+
The datasets are extracted and processed from their original public sources for research purposes as detailed below.
|
| 8 |
|
| 9 |
## Overview of Datasets
|
| 10 |
The datasets include:
|
|
|
|
| 13 |
|
| 14 |
* [**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.
|
| 15 |
|
| 16 |
+
Each dataset in GoodReads and MovieLens contains:
|
| 17 |
+
* `*_data.csv` that contains the text content (i.e., title + description) of the items, and
|
| 18 |
+
* `*_label.csv` that contains the labels (e.g., genre or language) and a binary 0/1 value denoting whether an item exbihits a label.
|
| 19 |
|
| 20 |
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.
|
| 21 |
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
## Quick Start
|
| 24 |
To run the example, install required packages by `pip install selective datasets`
|
|
|
|
| 29 |
from textwiser import TextWiser, Embedding, Transformation
|
| 30 |
from feature.selector import Selective, SelectionMethod
|
| 31 |
|
|
|
|
| 32 |
# Load Text Contents
|
| 33 |
data = load_dataset('skadio/optimized_item_selection', data_files='book_recommenders_data/goodreads_1k_data.csv', split='train')
|
| 34 |
data = data.to_pandas()
|
|
|
|
| 41 |
# TextWiser featurization method to create text embeddings
|
| 42 |
textwiser = TextWiser(Embedding.TfIdf(), Transformation.NMF(n_components=20, random_state=1234))
|
| 43 |
|
| 44 |
+
# Text-based selection with the default configuration
|
| 45 |
+
# The default configuration is optimization_method="exact" and cost_metric ="diverse"
|
| 46 |
+
# By default, multi-level optimization maximizes coverage and diversity as described in (CPAIOR'21, DSO@IJCAI'22)
|
| 47 |
+
# within an upper bound on subset size given as num_features
|
| 48 |
selector = Selective(SelectionMethod.TextBased(num_features=30, featurization_method=textwiser))
|
| 49 |
|
| 50 |
# Result
|
|
|
|
| 52 |
print("Reduction:", list(subset.columns))
|
| 53 |
```
|
| 54 |
## Advanced Usages
|
| 55 |
+
Text-based Selection provides access to multiple selection methods.
|
| 56 |
+
|
| 57 |
+
At a high-level, the configurations can be divided into exact, randomized, greedy or cluster-based optimization.
|
| 58 |
+
|
| 59 |
+
### Exact
|
| 60 |
|
| 61 |
- (Default) Solve for Problem *P_max_cover@t* in **CPAIOR'21** - Selecting a subset of items that
|
| 62 |
maximizes coverage of labels and maximizes the diversity in latent embedding space within an upper
|
|
|
|
| 87 |
optimization_method='exact',
|
| 88 |
cost_metric='unicost'))
|
| 89 |
```
|
| 90 |
+
|
| 91 |
+
### Randomized
|
| 92 |
+
|
| 93 |
- Selecting a subset by performing random selection. If num_features is not set, subset size is defined
|
| 94 |
+
by solving *P_unicost*.
|
| 95 |
```python
|
| 96 |
selector = Selective(SelectionMethod.TextBased(num_features=None, optimization_method='random'))
|
| 97 |
```
|
|
|
|
| 100 |
selector = Selective(SelectionMethod.TextBased(num_features=30,
|
| 101 |
optimization_method='random'))
|
| 102 |
```
|
| 103 |
+
|
| 104 |
+
### Greedy
|
| 105 |
+
|
| 106 |
- Selecting a subset by adding an item each time using a greedy heuristic in selection with a given
|
| 107 |
cost_metric, i.e. `diverse` by default or `unicost`. If num_features is not set, subset size is defined
|
| 108 |
+
by solving *P_unicost*.
|
| 109 |
```python
|
| 110 |
selector = Selective(SelectionMethod.TextBased(num_features=None,
|
| 111 |
optimization_method='greedy',
|
|
|
|
| 118 |
optimization_method='greedy',
|
| 119 |
cost_metric='unicost'))
|
| 120 |
```
|
| 121 |
+
|
| 122 |
+
### Clustering
|
| 123 |
+
|
| 124 |
- Selecting a subset by clustering items into a number of clusters and the items close to the centroids
|
| 125 |
+
are selected. If num_features is not set, subset size is defined by solving *P_unicost*. `cost_metric` argument
|
| 126 |
is not used in this method.
|
| 127 |
```python
|
| 128 |
selector = Selective(SelectionMethod.TextBased(num_features=None, optimization_method='kmeans'))
|