MCPcopy Create free account
hub / github.com/Xtra-Computing/thundersvm / load_from_dense

Method load_from_dense

src/thundersvm/dataset.cpp:150–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150void DataSet::load_from_dense(int row_size, int features, float* data, float* label){
151 y_.clear();
152 instances_.clear();
153 total_count_ = 0;
154 n_features_ = 0;
155 int off = 0;
156 for(int i = 0; i < row_size; i++){
157 int ind;
158 float v;
159 if(label != NULL)
160 y_.push_back(label[i]);
161 instances_.emplace_back();
162 for(int j = 1; j <= features; j++){
163 ind = j;
164 v = data[off];
165 off++;
166 instances_[total_count_].emplace_back(ind, v);
167 }
168 total_count_++;
169 }
170 n_features_ = features;
171 LOG(INFO)<<"#instances = "<<this->n_instances()<<", #features = "<<this->n_features();
172}
173
174const vector<int> &DataSet::count() const {//return the number of instances of each class
175 return count_;

Callers 3

dense_model_scikitFunction · 0.80
dense_predictFunction · 0.80
dense_decisionFunction · 0.80

Calls 3

n_instancesMethod · 0.95
n_featuresMethod · 0.95
clearMethod · 0.80

Tested by

no test coverage detected