Upload README.md
Browse files
README.md
CHANGED
@@ -1,16 +1,6 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
tags:
|
4 |
-
- optimized item selection
|
5 |
-
- recommender systems
|
6 |
-
- online experimentation
|
7 |
-
- multi-objective optimization
|
8 |
-
pretty_name: ISP
|
9 |
-
---
|
10 |
-
|
11 |
# Optimized Item Selection Datasets
|
12 |
|
13 |
-
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.
|
14 |
|
15 |
## Overview of Datasets
|
16 |
The datasets include:
|
@@ -27,31 +17,128 @@ Each column in the csv file is for an item, indexed by book/movie ID. The order
|
|
27 |
|
28 |
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.
|
29 |
|
30 |
-
##
|
|
|
31 |
```python
|
32 |
# Import Selective (for text-based selection) and TextWiser (for embedding space)
|
33 |
import pandas as pd
|
34 |
-
from
|
35 |
from textwiser import TextWiser, Embedding, Transformation
|
|
|
|
|
36 |
|
37 |
# Load Text Contents
|
38 |
-
data =
|
|
|
39 |
|
40 |
# Load Labels
|
41 |
-
labels =
|
|
|
42 |
labels.set_index('label', inplace=True)
|
43 |
|
44 |
# TextWiser featurization method to create text embeddings
|
45 |
textwiser = TextWiser(Embedding.TfIdf(), Transformation.NMF(n_components=20, random_state=1234))
|
46 |
|
47 |
-
# Text-based selection
|
|
|
|
|
48 |
selector = Selective(SelectionMethod.TextBased(num_features=30, featurization_method=textwiser))
|
49 |
|
50 |
# Result
|
51 |
subset = selector.fit_transform(data, labels)
|
52 |
print("Reduction:", list(subset.columns))
|
53 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
## Citation
|
56 |
If you use ISP in our research/applications, please cite as follows:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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. The datasets are extracted and processed from original public sources that will be introduced in the following, and are only used in our research study in ISP. Please kindly refrain from distributing the datasets.
|
4 |
|
5 |
## Overview of Datasets
|
6 |
The datasets include:
|
|
|
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 [Selective](https://github.com/fidelity/selective) by `pip install selective`
|
22 |
```python
|
23 |
# Import Selective (for text-based selection) and TextWiser (for embedding space)
|
24 |
import pandas as pd
|
25 |
+
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()
|
33 |
|
34 |
# Load Labels
|
35 |
+
labels = load_dataset('skadio/optimized_item_selection', data_files='book_recommenders_data/goodreads_1k_label.csv', split='train')
|
36 |
+
labels = labels.to_pandas()
|
37 |
labels.set_index('label', inplace=True)
|
38 |
|
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 selection method - Multi-Level Optimization that maximizes
|
43 |
+
# coverage and diversity within an upper bound on subset size [CPAIOR'21, DSO@IJCAI'22], by choosing
|
44 |
+
# the default configuration, i.e. optimization_method="exact" and cost_metric ="diverse".
|
45 |
selector = Selective(SelectionMethod.TextBased(num_features=30, featurization_method=textwiser))
|
46 |
|
47 |
# Result
|
48 |
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. The following configurations are
|
53 |
+
available to apply these methods:
|
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
|
57 |
+
bound on subset size.
|
58 |
+
```python
|
59 |
+
selector = Selective(SelectionMethod.TextBased(num_features=30,
|
60 |
+
featurization_method=textwiser,
|
61 |
+
optimization_method='exact',
|
62 |
+
cost_metric='diverse'))
|
63 |
+
```
|
64 |
+
- Solve for Problem *P_unicost* in **CPAIOR'21** - Selecting a subset of items that covers all labels.
|
65 |
+
```python
|
66 |
+
selector = Selective(SelectionMethod.TextBased(num_features=None,
|
67 |
+
optimization_method='exact',
|
68 |
+
cost_metric='unicost'))
|
69 |
+
```
|
70 |
+
- Solve for Problem *P_diverse* in **CPAIOR'21** - Selecting a subset of items with maximized diversity
|
71 |
+
in the latent embedding space while still maintaining the coverage over all labels.
|
72 |
+
```python
|
73 |
+
selector = Selective(SelectionMethod.TextBased(num_features=None,
|
74 |
+
featurization_method=textwiser,
|
75 |
+
optimization_method='exact',
|
76 |
+
cost_metric='diverse'))
|
77 |
+
```
|
78 |
+
- Selecting a subset of items that only maximizes coverage within an upper bound on subset size.
|
79 |
+
```python
|
80 |
+
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 #2.
|
86 |
+
```python
|
87 |
+
selector = Selective(SelectionMethod.TextBased(num_features=None, optimization_method='random'))
|
88 |
+
```
|
89 |
+
- Selecting a subset by performing random selection. Subset size is defined by num_features.
|
90 |
+
```python
|
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 #2.
|
97 |
+
```python
|
98 |
+
selector = Selective(SelectionMethod.TextBased(num_features=None,
|
99 |
+
optimization_method='greedy',
|
100 |
+
cost_metric='unicost'))
|
101 |
+
```
|
102 |
+
- Selecting a subset by adding an item each time using a greedy heuristic in selection with a given
|
103 |
+
cost_metric, i.e. `diverse` by default or `unicost`.
|
104 |
+
```python
|
105 |
+
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 #2. `cost_metric` argument
|
111 |
+
is not used in this method.
|
112 |
+
```python
|
113 |
+
selector = Selective(SelectionMethod.TextBased(num_features=None, optimization_method='kmeans'))
|
114 |
+
```
|
115 |
+
- Selecting a subset by clustering items into a number of clusters and the items close to the centroids
|
116 |
+
are selected. `cost_metric` argument is not used in this method.
|
117 |
+
```python
|
118 |
+
selector = Selective(SelectionMethod.TextBased(num_features=30,
|
119 |
+
optimization_method='kmeans'))
|
120 |
+
```
|
121 |
|
122 |
## Citation
|
123 |
If you use ISP in our research/applications, please cite as follows:
|
124 |
+
```bibtex
|
125 |
+
@inproceedings{cpaior2021,
|
126 |
+
title={Optimized Item Selection to Boost Exploration for Recommender Systems},
|
127 |
+
author={Serdar Kadıoğlu and Bernard Kleynhans and Xin Wang},
|
128 |
+
booktitle={Proceedings of Integration of Constraint Programming, Artificial Intelligence, and Operations Research: 18th International Conference, CPAIOR 2021, Vienna, Austria, July 5–8, 2021},
|
129 |
+
url={https://doi.org/10.1007/978-3-030-78230-6_27},
|
130 |
+
pages = {427–445},
|
131 |
+
year={2021}
|
132 |
+
}
|
133 |
+
```
|
134 |
|
135 |
+
```bibtex
|
136 |
+
@inproceedings{ijcai2022,
|
137 |
+
title={Active Learning Meets Optimized Item Selection},
|
138 |
+
author={Bernard Kleynhans and Xin Wang and Serdar Kadıoğlu},
|
139 |
+
booktitle={The IJCAI-22 Workshop: Data Science meets Optimisation}
|
140 |
+
publisher={arXiv},
|
141 |
+
url={https://arxiv.org/abs/2112.03105},
|
142 |
+
year={2022}
|
143 |
+
}
|
144 |
+
```
|