- Python
3.9.10 - Packages and package versions as in
requirements.txt
Run the following commands in the repository root to create a virtual environment with all dependencies:
python -m venv setml-env
source setml-env/bin/activate
python -m pip install -r requirements.txtFrom the repository root, move to the setml folder and clone the
Set Transformer repository:
git clone https://github.com/juho-lee/set_transformer.gitas well as the FSPool repository:
git clone https://github.com/Cyanogenoid/fspool.gitTo set up an experiment, change the config/config.yaml file to the desired
experimental setup, then in the root directory of this repository run:
python main.pyTo run models optimized for the Desperate Student M-Tuple task, use the following commands:
python main.py model.type=deepsets_ds1t model.latent_dim=5python main.py model.type=sorted_mlp_ds1t model.latent_dim=5python main.py model.type=set_transformer_ds1t model.latent_dim=64 experiment.batch_size=16 experiment.use_batch_sampler=True| Model | model_type |
|---|---|
| DeepSets with MLP | deepsets_mlp |
| Principal Neighbourhood Aggregation | pna |
| Small Set Transformer | small_set_transformer |
| MLP | mlp |
| Sorted MLP | sorted_mlp |
| DeepSets with MLP and FSPool | deepsets_mlp_fspool |
| Name | label | Description | Set→Label | Multiset→Label |
|---|---|---|---|---|
| Sum | sum |
Sum of all elements in set | {4, 2, 1}→7 | {4, 2, 1, 1}→8 |
| Mean | mean |
Mean of all elements in set | {4, 2, 1}→2.333.. | {4, 2, 1, 1}→2 |
| Mode | mode |
Mode value in the Set | NA | {4, 2, 1, 1}→1 |
| Maximum | max |
Maximum value in the Set | {4, 2, 1}→4 | {4, 2, 1, 1}→4 |
| Cardinality | cardinality |
Cardinality (size) of the set | {4, 2, 1}→3 | {4, 2, 1, 1}→4 |
| Longest Sequence Length | longest_seq_length |
Length of the longest monotonically increasing sequence | {2, 1, 4}→2 | {2, 1, 1, 4}→3 |
| Longest Contiguous Sum | largest_contiguous_sum |
Largest sum of the subset of the set | {2, 1, 4, -10, 7}→14 | {2, 1, 1, 4, -10}→8 |
| Largest pair sum | largest_pair_sum |
Largest sum of a pair of numbers in the set | {2, 1, 4, -10, 7}→11 | {2, 1, 1, 4, -10}→6 |
| Largest triplet sum | largest_triple_sum |
Largest sum of a triplet of numbers in the set | {2, 1, 4, -10, 7}→13 | {2, 1, 1, 4, -10}→7 |
| Contains even number | contains_even |
1 if the set contains an even number, 0 otherwise | {2, 1, 4, -10, 7}→1 | {3, 1, 1, 5, -9}→0 |
For the Desperate Student M-Tuple task, use:
desperate_student_<M>_tuple
and replace <M> by the desired order of the tuple, available are 1 to 6 so
for example use for triples use:
desperate_student_3_tuple
We use pytest for unit testing. To run the unit tests, execute the following
command in the root directory of this repository:
pytest --ignore=setml/fspool