Skip to content

JuRenGithub/DWLR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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{ljrDWLR2024,
  title     = {DWLR: Domain Adaptation under Label Shift for Wearable Sensor},
  author    = {Li, Juren and Yang, Yang and Chen, Youmin and Zhang, Jianfeng and Lai, Zeyu and Pan, Lujia},
  booktitle = {Proceedings of the Thirty-Third International Joint Conference on
               Artificial Intelligence, {IJCAI-24}},
  publisher = {International Joint Conferences on Artificial Intelligence Organization},
  editor    = {Kate Larson},
  pages     = {4425--4433},
  year      = {2024},
  month     = {8},
  note      = {Main Track},
  doi       = {10.24963/ijcai.2024/489},
  url       = {https://doi.org/10.24963/ijcai.2024/489},
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published