JuRenGithub / DWLR

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DWLR: Domain Adaptation under Label Shift for Wearable Sensor

Juren Li$^1$, Yang Yang$^{1*}$, Youmin Chen$^1$, Jianfeng Zhang$^2$, Zeyu Lai$^1$, Lujia Pan$^2$. ( $^*$ Correspondence )

$^1$ College of Computer Science and Technology, Zhejiang University

$^2$ Huawei Noah’s Ark Lab


PaperPDF Blog

This repo is the implementation of paper "DWLR: Domain Adaptation under Label Shift for Wearable Sensor" accepted by IJCAI' 24.

The Appendix to the paper is available in this repository.

DWLR

Framework

In this work, we propose Domain adaptation under label shift for Wearable sensor with Learnable Reweighting (DWLR) to handle both feature and label shifts. Specifically, DWLR employs learnable reweighting to align label distributions between source and target domains. It incorporates elements of information gain during the reweighting process to counter potential distribution shift that could emerge from over-reliance on data with high-confidence pseudo labels. Additionally, DWLR performs reweighting and alignment in the time domain and frequency domain, respectively.

Requirements

The recommended requirements for DWLR are specified as follow:

  • Python 3.9
  • torch==1.13.0
  • numpy==1.21.5
  • scikit-learn==1.0.2
  • pandas==1.4.2

The dependencies can be installed by:

pip install -r requirements.txt

File Structure

.
├── assets
│   └── DWLR.png
├── data
│   └── wisdm
├── DWLR
│   ├── dataset.py
│   ├── common.py
│   ├── backbone.py
│   └── DWLR_model.py
├── Appendix.pdf
├── main.py
├── process_data.ipynb
├── README.md
└── requirements.txt

Dataset

This repository provides the preprocessing code for WISDM dataset.

  • Download the WISDM dataset and unzip it to ./data/wisdm.
  • run process_data.ipynb to preprocess the dataset.

You can also download and process other dataset: UCIHAR, HHAR and SleepEDF

Run

To run DWLR on the WISDM dataset, directly use the following script:

python main.py \
    --freq\
    --time\
    --adv_loss_weight 0.5\
    --batch_size 256\
    --class_num 6\
    --confidence 1.0\
    --cuda 0\
    --d_model 64\
    --emb_dim 64\
    --encoder cnn\
    --epochs 50\
    --IG 2\
    --in_dim 3\
    --label_regular 2.0\
    --lr 0.001\
    --l2 0.001\
    --n_freq 32\
    --n_head 2\
    --n_layer 4\
    --patch_len 8\
    --q_k_dim 32\
    --reweight_weight 2.\
    --seq_len 128\
    --source 20\
    --target 6\
    --T 100\
    --v_dim 32

Contact

If you have any question about the code or the paper, feel free to contact me through email.

Citation

If you find DWLR useful in your research or applications, please kindly cite:

@inproceedings{li2024dwlr,
  title={DWLR: Domain Adaptation under Label Shift for Wearable Sensor},
  author={Juren Li and Yang Yang and Youmin Chen and Jianfeng Zhang and Zeyu Lai and Lujia Pan},
  booktitle={Proceedings of the International Joint Conference on Artificial Intelligence (IJCAI)},
  year={2024},
  note={Accepted}
}

About


Languages

Language:Python 88.1%Language:Jupyter Notebook 11.9%