mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-25 09:30:35 +00:00
Kendall for smClosest
This commit is contained in:
parent
9ed7e9213c
commit
d76c98084d
@ -242,6 +242,19 @@ pair<ld, ld> compute_mAP() {
|
|||||||
return make_pair(maprank / DN, meanrank / tgood);
|
return make_pair(maprank / DN, meanrank / tgood);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ld kendall;
|
||||||
|
void compute_kendall() {
|
||||||
|
compute_cost(); println(hlog, "cost = ", cost);
|
||||||
|
vector<vector<ld> > weights;
|
||||||
|
int DN = isize(sagid);
|
||||||
|
weights.resize(DN);
|
||||||
|
for(int i=0; i<DN; i++) weights[i].resize(DN, 0);
|
||||||
|
for(auto& e: sagedges) weights[e.i][e.j] += e.weight2, weights[e.j][e.i] += e.weight2;
|
||||||
|
vector<pair<int, ld>> kdata;
|
||||||
|
for(int i=0; i<DN; i++) for(int j=0; j<i; j++) kdata.emplace_back(sagdist[sagid[i]][sagid[j]], -weights[i][j]);
|
||||||
|
kendall = stats::kendall(kdata);
|
||||||
|
}
|
||||||
|
|
||||||
void prepare_method() {
|
void prepare_method() {
|
||||||
if(method == smLogistic) compute_loglik_tab();
|
if(method == smLogistic) compute_loglik_tab();
|
||||||
optimize_sag_loglik_auto();
|
optimize_sag_loglik_auto();
|
||||||
@ -272,6 +285,11 @@ int function_read_args() {
|
|||||||
compute_auto_rt();
|
compute_auto_rt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if(argis("-sag-kendall")) {
|
||||||
|
compute_kendall();
|
||||||
|
println(hlog, "kendall = ", kendall);
|
||||||
|
}
|
||||||
|
|
||||||
else if(argis("-sag-method-closest")) {
|
else if(argis("-sag-method-closest")) {
|
||||||
method = smClosest; prepare_method();
|
method = smClosest; prepare_method();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user