5 #ifndef THUNDERSVM_DATASET_H 6 #define THUNDERSVM_DATASET_H 8 #include "thundersvm.h" 17 node(
int index, float_type value) : index(index), value(value) {}
23 typedef vector<vector<DataSet::node>> node2d;
33 DataSet(
const DataSet::node2d &instances,
int n_features,
const vector<float_type> &
y);
44 size_t n_instances()
const;
46 size_t n_features()
const;
48 size_t n_classes()
const;
51 const vector<int> &
count()
const;
54 const vector<int> &
start()
const;
57 const vector<int> &
label()
const;
60 const vector<float_type> &
y()
const;
62 const node2d & instances()
const;
65 const node2d instances(
int y_i)
const;
68 const node2d instances(
int y_i,
int y_j)
const;
78 vector<float_type> y_;
87 #endif //THUNDERSVM_DATASET_H void load_from_file(string file_name)
load dataset from file
Definition: dataset.cpp:56
const vector< int > & label() const
mapping logical label (0,1,2,3,...) to real label (maybe 2,4,5,6,...)
Definition: dataset.cpp:254
const vector< int > original_index() const
mapping instance index (after grouped) to the original index (in file)
Definition: dataset.cpp:335
Dataset reader.
Definition: dataset.h:14
const vector< int > & start() const
the start position of instances for each class
Definition: dataset.cpp:246
const vector< float_type > & y() const
label for each instances, the instances are arranged as they are in file
Definition: dataset.cpp:353
void group_classes(bool classification=true)
group instances in same class
Definition: dataset.cpp:258
const vector< int > & count() const
the number of instances for each class
Definition: dataset.cpp:242
void load_from_python(float *y, char **x, int len)
load dataset from python
Definition: dataset.cpp:221