This repo provides supporting Python code for the paper
Khim, J., Xu, Z., & Singh, S. (2020). Multiclass Classification via Class-Weighted Nearest Neighbors. arXiv preprint arXiv:2004.04715.
Requires conda with Python 3.7.
- Install dependencies with
conda env create -f environment.yml
- Download dataset with
./download_uci_data.sh
Before running experiments, make sure the conda environment is active by running source activate wknn
or conda activate wknn
.
There are 3 experiments scripts:
- The figures in section 5 showing convergence of the confusion matrix:
python knn_multiclass_example.py
. - The figures in section 6 for synthetic data are plotted in the Jupyter notebook
knn.ipynb
. - The results in section 6 for the real data:
real_exp.sh
Results of these scripts will appear in the results
directory.