MCPcopy Create free account
hub / github.com/antgroup/vsag / Train

Method Train

src/algorithm/hgraph.cpp:101–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99 resize(bottom_graph_->max_capacity_);
100}
101void
102HGraph::Train(const DatasetPtr& base) {
103 int64_t total_elements = base->GetNumElements();
104 int64_t dim = base->GetDim();
105 DatasetPtr train_data =
106 vsag::sample_train_data(base, total_elements, dim, train_sample_count_, allocator_);
107
108 const auto* data_ptr = get_data(train_data);
109 this->basic_flatten_codes_->Train(data_ptr, train_data->GetNumElements());
110 if (use_reorder_) {
111 this->high_precise_codes_->Train(data_ptr, train_data->GetNumElements());
112 }
113 if (create_new_raw_vector_) {
114 // nothing to do since raw_vector_ is fp32
115 this->raw_vector_->Train(data_ptr, train_data->GetNumElements());
116 }
117}
118
119std::vector<int64_t>
120HGraph::Build(const DatasetPtr& data) {

Callers 3

BuildMethod · 0.95
AddMethod · 0.95
TuneMethod · 0.45

Calls 3

sample_train_dataFunction · 0.85
GetNumElementsMethod · 0.45
GetDimMethod · 0.45

Tested by

no test coverage detected