Skip to content

factors for estimator #29

@chasingegg

Description

@chasingegg

Hi, I'm reading the code and find that the code is not consistent with the doc, is there a bug here?

    // 3 factors used for distance estimation, please refer to document for more info.
    // For f_rescale and 2nd item of f_add, we use the dot product of raw residual (rather
    // than the normalized one) as the denominator, thus we need to multiply another l2norm.
    // For (ip_cent_xucb / ip_resi_xucb), the norm of xucb does not matter since it is also
    // in numerator.
    if (metric_type == METRIC_L2) {
        f_add = l2_sqr + 2 * l2_sqr * ip_cent_xucb / ip_resi_xucb;
        f_rescale = -2 * l2_sqr / ip_resi_xucb;
        f_error = 2 * tmp_error;
    } else if (metric_type == METRIC_IP) {
        f_add = 1 - dot_product<T>(residual_arr.data(), centroid, dim) +
                l2_sqr * ip_cent_xucb / ip_resi_xucb;
        f_rescale = -l2_sqr / ip_resi_xucb;
        f_error = 1 * tmp_error;
    } else {
        std::cerr << "Unsupported metric type in quantization\n" << std::flush;
        exit(1);
    }

But as the doc said, f_add factor is, which is f_add = l2_sqr + 2 * sqrt(l2_sqr) * ip_cent_xucb / ip_resi_xucb;

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions