/HCR-Project3

Skeleton Data and Feature Extraction using SVMs

Primary LanguagePerl

Code created by Chance Cardona.
To crease LIBSVM compatable data simply type:
    python3 skeleton_repr.py <optional bin number>
also you can optionally enter your number of bins. The default is 15. The best results have been found with
    python3 skeleton_repr.py 20

Next, to fit the SVM's run
    python fit_svm.py

The skeleton_repr.py should take care of the rest needed and use the training data directory provided 
in this package to generate rad_d2, rad_d2.t, cust_d2, and cust_d2.t frequency data
in LIBSVM format. Note running as 'python' will generate empty files. Must run as python3.
All histograms are generated with numpy's histogram with the bin number specified. 

The cust format returns a 2x5 matrix for each sample as well, but measures
different distances and angles I figured would be helpful such as hand to hand
angle/distance, and extremety distance/angle relative to knees/elbows and hip/shoulder.

The fit_svm.py package automatically loads the custom and RAD representations, performs cross validation
(plots are saved in current directory) and tests to the test datasets. It also returns a confusion matrix.
All of this is printed to the screen.

Best Results are (bins=20):
RAD: 
	Parameters: {'c': 0.03125, 'g': 2.0}
	Confusion:
	[[8. 0. 0. 0. 0. 0.]
	 [0. 7. 0. 1. 0. 0.]
	 [0. 3. 2. 0. 0. 3.]
	 [0. 1. 0. 6. 0. 1.]
	 [0. 2. 0. 1. 4. 1.]
	 [0. 6. 0. 0. 0. 2.]]
	Accuracy = 60.4167% (29/48) (classification)
Custom:
	Parameters: {'c': 0.03125, 'g': 2.0} 
	Confusion:
	[[7. 0. 1. 0. 0. 0.]
	 [0. 2. 0. 0. 1. 5.]
	 [0. 2. 3. 0. 1. 2.]
	 [0. 0. 2. 6. 0. 0.]
	 [1. 1. 0. 0. 3. 3.]
	 [0. 2. 0. 0. 1. 5.]]
	Accuracy = 54.1667% (26/48) (classification)



Note: You must have a working version of libsvm in this directory! with the name 'libsvm'.
I recommend these commands (starting from in this directory) to do this:
git clone https://github.com/cjlin1/libsvm
cd libsvm
make
cd python
make