#include "dmatrix.h"
Go to the source code of this file.
Data Structures | |
| struct | buffer_t |
Defines | |
| #define | TYPE_E 0 |
| #define | TYPE_G 1 |
| #define | BUFFER_INC_SIZE 1024 |
| #define | BUFFER_SIZE_DOUBLE sizeof(double) |
| #define | BUFFER_SIZE_INT sizeof(int) |
Functions | |
| void | buffer_new (buffer_t **buf, int elemsize, int length) |
| void | buffer_free (buffer_t *buf) |
| int | buffer_write (buffer_t *buf, void *src, int n) |
| int | condense_solution (const int len, double *sol, int *idx) |
| Condense solution by removing zeros. | |
| double | find_lambdamax (const dmatrix *X, const double *b, const int sflag) |
| Returns the maximum value of the regularization parameter lambda that gives a non-zero solution. | |
| void | standardize_data (dmatrix *X, const double *b, double **average, double **stddev, double **acol, double **arow) |
| Standardizes the data. | |
| int | read_mm_new_matrix (const char *file_x, dmatrix **out_mat) |
| Read a matrix file. | |
| int | read_mm_new_matrix_transpose (const char *file, dmatrix **out_mat) |
| int | read_mm_new_vector (const char *file_x, double **out_vec) |
| Read a vector file. | |
| int | write_mm_vector (const char *file, const int m, const double *vec, const char *comments, const int type) |
| int | write_mm_matrix (const char *file, dmatrix *mat, const char *comments, const int type) |
| int | write_mm_matrix_crd_header (FILE *fp, const int m, const int n, const int nnz, const char *comments) |
| int | write_mm_matrix_crd_column (FILE *fp, const int len, const int col, const double *vec) |
| int | write_mm_matrix_crd_column_threshold (FILE *fp, const int len, const int col, const double *vec, const double threshold) |
| int | get_mm_info (const char *file, int *m, int *n, int *nz) |
| int | show_histogram (const int n, const double *coeff) |
| double | userinput_threshold (void) |
| Gets a threshold value from standard input. | |
| int | thresholding (const int n, double *coeff, double threshold) |
| Thresholds coefficients. | |
| int condense_solution | ( | const int | len, | |
| double * | sol, | |||
| int * | idx | |||
| ) |
Condense solution by removing zeros.
Truncates coefficients if their absolute values are below the threshold.
| len | size of the original solution vector | |
| sol | solution vector | |
| idx | array of non-zero index in solution |
| double find_lambdamax | ( | const dmatrix * | X, | |
| const double * | b, | |||
| const int | sflag | |||
| ) |
Returns the maximum value of the regularization parameter lambda that gives a non-zero solution.
| X | feature matrix | |
| b | class vector | |
| sflag | standardization flag
|
References dmat_copy(), dmat_diagscale(), dmat_duplicate(), dmat_free(), dmat_norminf(), dmat_yAmpqTx(), dmatrix::m, dmatrix::n, and standardize_data().
| int read_mm_new_matrix | ( | const char * | file, | |
| dmatrix ** | out_mat | |||
| ) |
Read a matrix file.
Reads a Matrix Market formatted matrix from a file.
| file | matrix file name | |
| out_mat | matrix data |
References dmatrix::idx, dmatrix::jdx, dmatrix::m, dmatrix::n, dmatrix::nz, dmatrix::rdx, and dmatrix::val.
Referenced by main().
| int read_mm_new_vector | ( | const char * | file, | |
| double ** | out_vec | |||
| ) |
Read a vector file.
Reads a Matrix Market formatted vector from a file. Returns pointer to dense vector.
| file | vector file name | |
| out_vec | vector data |
Referenced by main().
| void standardize_data | ( | dmatrix * | X, | |
| const double * | b, | |||
| double ** | average, | |||
| double ** | stddev, | |||
| double ** | acol, | |||
| double ** | arow | |||
| ) |
Standardizes the data.
Standardizes the feature matrix.

where
is column average and
is column deviation.
| X | feature matrix | |
| b | class vector | |
| average | column average | |
| stddev | column standard deviation | |
| acol | column vector used for implicit standardization | |
| arow | row vector used for implicit standardization |
References dmat_colavg(), dmat_colstd(), dmat_diagscale(), dmat_elemdivi(), dmat_vcopy(), dmat_vset(), dmatrix::m, dmatrix::n, dmatrix::nz, and dmatrix::val.
Referenced by find_lambdamax(), and l1_logreg_train().
| int thresholding | ( | const int | n, | |
| double * | coeff, | |||
| double | threshold | |||
| ) |
Thresholds coefficients.
Truncates coefficients if their absolute values are below the threshold.
| n | number of coefficients | |
| coeff | vector of coefficients | |
| threshold | threshold value |
| double userinput_threshold | ( | void | ) |
Gets a threshold value from standard input.