Struct faiss::NNDescent

struct NNDescent

Public Types

using storage_idx_t = int
using KNNGraph = std::vector<nndescent::Nhood>

Public Functions

explicit NNDescent(const int d, const int K)
~NNDescent()
void build(DistanceComputer &qdis, const int n, bool verbose)
void search(DistanceComputer &qdis, const int topk, idx_t *indices, float *dists, VisitedTable &vt) const
void reset()
void init_graph(DistanceComputer &qdis)

Initialize the KNN graph randomly.

void nndescent(DistanceComputer &qdis, bool verbose)

Perform NNDescent algorithm.

void join(DistanceComputer &qdis)

Perform local join on each node.

void update()

Sample new neighbors for each node to peform local join later.

void generate_eval_set(DistanceComputer &qdis, std::vector<int> &c, std::vector<std::vector<int>> &v, int N)

Sample a small number of points to evaluate the quality of KNNG built.

float eval_recall(std::vector<int> &ctrl_points, std::vector<std::vector<int>> &acc_eval_set)

Evaluate the quality of KNNG built.

Public Members

bool has_built = false
int S = 10
int R = 100
int iter = 10
int search_L = 0
int random_seed = 2021
int K
int d
int L
int ntotal = 0
KNNGraph graph
std::vector<int> final_graph