This is the repo for Pattern Recognition Course Task 1, an implement of K-Means++ and VQ_LBG algorithms written in
Python. All codes were tested in Ubuntu 18.04.
Installing dependency packages may change your packages' version, so it would be a good choice to create a virtual environment.
conda create -n PR_Task1 python=3.7
conda activate PR_Task1
pip install -r requirements.txt
Change to folder sources
and command:
python main.py <mode> [<options>]
<mode>
should be one of the following:
KM
-Use K-Means to cluster the data.KMPP
-Use K-Means++ to cluster the data.VQ_LBG
-Use VQ_LBG to cluser the data.ALL
-Run the upper three algorithms in order and compare the results.
<options>
have default values or you can change it by yourself:
-visualize
[bool, True] Visualize the result using matplotlib-cluster_num
[int, 4]-sample_num
[int, 100]-center
[str, "2,2;8,2;5,8;4,4"] You can also set this argument as 'auto' to produce center points.-save_name
[str, None] The filename of the generated data, value 'None' will drop the data after running.-use_saved_data
[str, None] Use saved data to ensure the fairness of each test
Horace.Kem, Soochow University
E-mail:horacekem@163.com
GitHub