-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathdataset.h
38 lines (33 loc) · 1.49 KB
/
dataset.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/***************************************************************************
* Author: Nikos Karampatziakis <[email protected]>, Copyright (C) 2008 *
* *
* Description: Declarations of data structures for storing the input *
* *
* License: See LICENSE file that comes with this distribution *
***************************************************************************/
#ifndef DATASET_H
#define DATASET_H
#include <stdio.h>
/* Example-Value pair. Similar to feature value pair
* when indexing by example
*/
typedef struct evpair_t{
int example; /* id of example */
float value; /* value of feature for this example */
}evpair_t;
typedef struct dataset_t{
evpair_t** feature; /* array of arrays of example value pairs */
int* size; /* size[i]=number of examples with non-zero feature i */
/* Would it be better if these were short/char?*/
int* cont; /* Is the ith feature continuous? */
int* target; /* Target values */
float* weight; /* Weight of the ith example */
int nfeat; /* number of features */
int nex; /* number of examples */
int* oobvotes;
}dataset_t;
void loadData(const char* name, dataset_t* d);
int getDimensions(FILE* fp, int* examples, int* features);
int readExample(FILE* fp, int maxline, float* example, int nfeat, int* target);
void freeData(dataset_t* d);
#endif /* DATASET_H */