diff options
author | Eric Dao <eric@erickhangdao.com> | 2023-05-12 14:09:07 -0400 |
---|---|---|
committer | Eric Dao <eric@erickhangdao.com> | 2023-05-12 14:09:07 -0400 |
commit | 191e4bd8beae134295d481773823142d2fdc6a98 (patch) | |
tree | aaca4e7f8e229f9bd551d9bb1583b8ecd7a59d4a /OASIS/C/inc/ekd_svm.h | |
parent | 186daed7e179241377c117e9d208ccd301d4d712 (diff) | |
download | ura-master.tar.gz ura-master.tar.bz2 ura-master.zip |
Diffstat (limited to 'OASIS/C/inc/ekd_svm.h')
-rw-r--r-- | OASIS/C/inc/ekd_svm.h | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/OASIS/C/inc/ekd_svm.h b/OASIS/C/inc/ekd_svm.h deleted file mode 100644 index 259eb5c..0000000 --- a/OASIS/C/inc/ekd_svm.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef EKD_SVM_H -#define EKD_SVM_H - -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <math.h> -#include <float.h> - -#include "ekd_pca.h" -#include "ekd_blas.h" - -#define NUM_DNEG_IMAGES 134 -#define NUM_DPOS_IMAGES 99 -#define NUM_IMAGES 233 -#define IMAGE_WIDTH 144 -#define IMAGE_HEIGHT 176 -#define FEATURE_VECTOR_SIZE 25344 -#define MAX_SVM_PASSES 100 -#define GAMMA 0.9 -#define SVM_TOLERANCE 1e-3 - -void svm_preprocess(float** input_matrix, uint32_t rows, uint32_t cols); -float rbf_kernel(float* sample_1, float* sample_2, uint32_t features, float gamma); -void kernel_matrix_transform(float** input_matrix, float** resultant_matrix, uint32_t samples, uint32_t features, float gamma); -void kernel_row_transform(float** input_matrix, float* query_row, float* resultant_row, uint32_t samples, uint32_t features, float gamma); -float get_error(uint32_t index, float* alphas, float** kernel_matrix, int32_t* labels, uint32_t num_samples); -uint32_t find_second_alpha(uint32_t first_index, float first_error_val, float* alphas, float** kernel_matrix, int32_t* labels, uint32_t num_samples); -void calculate_bounds(float first_label, float second_label, float first_alpha, float second_alpha, float penalty, float* lower_bound, float* upper_bound); -float clip_second_alpha_new(float second_alpha_new, float lower_bound, float upper_bound); -void update_alphas(float first_alpha_new, float second_alpha_new, float* alphas, uint32_t first_index, uint32_t second_index); -float calculate_bias(float first_error_val, float second_error_val, float first_alpha_new, float first_alpha, float second_alpha_new, float second_alpha, float kernel_val_ii, float kernel_val_ij, float kernel_val_jj, float first_label, float second_label, float penalty); -void update_errors(float* errors, uint32_t num_samples, uint32_t first_index, uint32_t second_index, float first_label, float second_label, float first_alpha_new, float first_alpha, float second_alpha_new, float second_alpha, float* bias, float** kernel_matrix); -uint8_t optimize_alphas(uint32_t first_index, uint32_t second_index, float* alphas, float* bias, float* errors, float** kernel_matrix, int32_t* labels, uint32_t num_samples, float penalty); -uint8_t verify_kkt(uint32_t first_index, float tolerance, float* alphas, float* bias, float* errors, float** kernel_matrix, int32_t* labels, uint32_t num_samples, float penalty); -void train_svm(float** data_matrix, uint32_t samples, uint32_t features, float* alphas, float* bias, int32_t* labels, float penalty); -float test_svm(float** data_test, int32_t* labels_test, uint32_t num_test, uint32_t num_components, float* alphas, float bias); - -#endif /* EKD_SVM_H */
\ No newline at end of file |