neilzxu / weighted_knn_classification

Code for "Multiclass Classification via Class-Weighted Nearest Neighbors"

Home Page:https://arxiv.org/abs/2004.04715

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code for Multiclass Classification via Class-Weighted Nearest Neighbors

Setup

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.

  1. Install dependencies with conda env create -f environment.yml
  2. Download dataset with ./download_uci_data.sh

Experiment scripts

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.

About

Code for "Multiclass Classification via Class-Weighted Nearest Neighbors"

https://arxiv.org/abs/2004.04715


Languages

Language:Python 62.5%Language:Jupyter Notebook 34.9%Language:Shell 2.7%