update several minor in conjugate graph#147
Conversation
768d717 to
8a50245
Compare
| // return result | ||
| while (results.size() > k) { | ||
| results.pop(); | ||
| } |
There was a problem hiding this comment.
comparing with original search process, here only move partial pop operations from hnswalg to hnsw. So it wouldn't affect the search speed.
| Timer t(time_cost); | ||
| if (use_conjugate_graph_ and params.use_conjugate_graph_search) { | ||
| k = LOOK_AT_K; | ||
| } |
There was a problem hiding this comment.
here adjust k to provide enough information for conjugate graph to enhance result
| if (this->is_empty()) { | ||
| return 0; | ||
| } | ||
|
|
There was a problem hiding this comment.
here allow use conjugate graph as default setting without influencing search process
| auto& neighbor_set = conjugate_graph_[from_tag_id]; | ||
| if (neighbor_set.size() >= MAXIMUM_DEGREE) { | ||
| return false; | ||
| } |
There was a problem hiding this comment.
here limit out degree to limit graph size and enhance latency
| try { | ||
| Timer t(time_cost); | ||
| if (use_conjugate_graph_ and params.use_conjugate_graph_search) { | ||
| k = LOOK_AT_K; |
There was a problem hiding this comment.
consider the situation when k > LOOK_AT_K
|
|
||
| auto vector = query->GetFloat32Vectors(); | ||
| const void* vector; | ||
| if (type_ == DataTypes::DATA_TYPE_INT8) { |
There was a problem hiding this comment.
use get_vectors here to replace the judgement.
| const int8_t* topk_data; | ||
| auto base = Dataset::Make(); | ||
| auto generated_query = Dataset::Make(); | ||
| if (type_ == DataTypes::DATA_TYPE_INT8) { |
| for (const int64_t& base_tag_id : base_tag_ids) { | ||
| try { | ||
| base->Float32Vectors(this->alg_hnsw_->getDataByLabel(base_tag_id)); | ||
| if (type_ == DataTypes::DATA_TYPE_INT8) { |
| for (int d = 0; d < dim_; d++) { | ||
| generated_data.get()[d] = vsag::GENERATE_OMEGA * base->GetFloat32Vectors()[d] + | ||
| (1 - vsag::GENERATE_OMEGA) * topk_data[d]; | ||
| if (type_ == DataTypes::DATA_TYPE_INT8) { |
0c3eeb7 to
1068b44
Compare
1068b44 to
2ea5ac9
Compare
| ->Owner(false) | ||
| ->NumElements(num_element); | ||
| } else if (type_ == DataTypes::DATA_TYPE_INT8) { | ||
| base->Int8Vectors((int8_t*)vectors_ptr)->Dim(dim_)->Owner(false)->NumElements(num_element); |
| } else if (type_ == DataTypes::DATA_TYPE_INT8) { | ||
| base->Int8Vectors((int8_t*)vectors_ptr)->Dim(dim_)->Owner(false)->NumElements(num_element); | ||
| } else { | ||
| throw std::invalid_argument(fmt::format("no support for this metric: {}", (int)type_)); |
There was a problem hiding this comment.
no support for this data type: ?
26f2be5 to
64e3f4d
Compare
ec373ec to
dd48c34
Compare
dd48c34 to
642866a
Compare
Signed-off-by: zhongxiaoyao.zxy <zhongxiaoyao.zxy@antgroup.com>
Signed-off-by: zhongxiaoyao.zxy <zhongxiaoyao.zxy@antgroup.com>
Signed-off-by: zhongxiaoyao.zxy <zhongxiaoyao.zxy@antgroup.com> Signed-off-by: LHT129 <tianlan.lht@antgroup.com>
Signed-off-by: zhongxiaoyao.zxy <zhongxiaoyao.zxy@antgroup.com> Signed-off-by: Sia Sheerland <x1075956441x@163.com> Signed-off-by: Sia Sheerland <x1075956441x@163.com>
This PR contains several minor changes in conjugate graph: