13 #ifndef FAISS_AUTO_TUNE_H
14 #define FAISS_AUTO_TUNE_H
44 const idx_t *gt_I_in);
52 virtual double evaluate (
const float *D,
const idx_t *I)
const = 0;
64 virtual double evaluate (
const float *D,
const idx_t *I)
const override;
76 virtual double evaluate (
const float *D,
const idx_t *I)
const override;
106 const std::string & prefix =
"");
111 bool add (
double perf,
double t,
const std::string & key,
size_t cno = 0);
117 void display (
bool only_optimal =
true)
const;
121 void optimal_to_gnuplot (
const char *fname)
const;
128 std::vector<double> values;
179 Index * index,
const std::string & name,
double val)
const;
184 double *upper_bound_perf,
185 double *lower_bound_t)
const;
194 size_t nq,
const float *xq,
void explore(Index *index, size_t nq, const float *xq, const AutoTuneCriterion &crit, OperatingPoints *ops) const
std::vector< ParameterRange > parameter_ranges
all tunable parameters
std::string key
key that identifies this op pt
long cno
integer identifer
void display(bool only_optimal=true) const
easy-to-read output
double perf
performance measure (output of a Criterion)
double t_for_perf(double perf) const
get time required to obtain a given performance measure
idx_t nnn
nb of NNs that the query should request
virtual double evaluate(const float *D, const idx_t *I) const override
bool add(double perf, double t, const std::string &key, size_t cno=0)
add a performance measure. Return whether it is an optimal point
size_t batchsize
maximum number of queries to submit at a time.
virtual double evaluate(const float *D, const idx_t *I) const =0
idx_t nq
nb of queries this criterion is evaluated on
std::vector< OperatingPoint > optimal_pts
optimal operating points, sorted by perf
void set_groundtruth(int gt_nnn, const float *gt_D_in, const idx_t *gt_I_in)
ParameterRange & add_range(const char *name)
add a new parameter
idx_t gt_nnn
nb of GT NNs required to evaluate crterion
void all_to_gnuplot(const char *fname) const
output to a format easy to digest by gnuplot
bool thread_over_batches
use multithreading over batches (useful to benchmark independent single-searches) ...
std::vector< OperatingPoint > all_pts
all operating points
long idx_t
all indices are this type
std::vector< float > gt_D
Ground-truth distances (size nq * gt_nnn)
std::string combination_name(size_t cno) const
get string representation of the combination
void update_bounds(size_t cno, const OperatingPoint &op, double *upper_bound_perf, double *lower_bound_t) const
virtual void initialize(const Index *index)
initialize with reasonable parameters for the index
int verbose
verbosity during exploration
int merge_with(const OperatingPoints &other, const std::string &prefix="")
add operating points from other to this, with a prefix to the keys
virtual void set_index_parameter(Index *index, const std::string &name, double val) const
set one of the parameters
size_t n_combinations() const
nb of combinations, = product of values sizes
void set_index_parameters(Index *index, size_t cno) const
set a combination of parameters on an index
void display() const
print a description on stdout
bool combination_ge(size_t c1, size_t c2) const
returns whether combinations c1 >= c2 in the tuple sense
possible values of a parameter, sorted from least to most expensive/accurate
Index * index_factory(int d, const char *description_in, MetricType metric)
int n_experiments
nb of experiments during optimization (0 = try all combinations)
std::vector< idx_t > gt_I
Ground-truth indexes (size nq * gt_nnn)
double t
corresponding execution time (ms)
MetricType
Some algorithms support both an inner product vetsion and a L2 search version.