2013-11-14 02:50:38 +08:00
|
|
|
#ifndef MATRIX_H
|
|
|
|
#define MATRIX_H
|
2019-01-07 04:51:38 +08:00
|
|
|
#include "darknet.h"
|
|
|
|
|
|
|
|
//typedef struct matrix{
|
|
|
|
// int rows, cols;
|
|
|
|
// float **vals;
|
|
|
|
//} matrix;
|
2013-11-14 02:50:38 +08:00
|
|
|
|
2018-12-11 20:59:23 +08:00
|
|
|
typedef struct {
|
|
|
|
int *assignments;
|
|
|
|
matrix centers;
|
|
|
|
} model;
|
|
|
|
|
|
|
|
|
|
|
|
model do_kmeans(matrix data, int k);
|
2013-11-14 02:50:38 +08:00
|
|
|
matrix make_matrix(int rows, int cols);
|
|
|
|
void free_matrix(matrix m);
|
|
|
|
void print_matrix(matrix m);
|
|
|
|
|
|
|
|
matrix csv_to_matrix(char *filename);
|
2016-03-14 14:18:42 +08:00
|
|
|
void matrix_to_csv(matrix m);
|
2013-11-14 02:50:38 +08:00
|
|
|
matrix hold_out_matrix(matrix *m, int n);
|
2014-12-12 05:15:26 +08:00
|
|
|
float matrix_topk_accuracy(matrix truth, matrix guess, int k);
|
2013-12-08 01:38:50 +08:00
|
|
|
void matrix_add_matrix(matrix from, matrix to);
|
2016-03-14 14:18:42 +08:00
|
|
|
void scale_matrix(matrix m, float scale);
|
|
|
|
matrix resize_matrix(matrix m, int size);
|
2013-11-14 02:50:38 +08:00
|
|
|
|
2014-01-29 08:28:42 +08:00
|
|
|
float *pop_column(matrix *m, int c);
|
2013-11-14 02:50:38 +08:00
|
|
|
|
|
|
|
#endif
|