import numpy as np
from sklearn.metrics import average_precision_score
def chance_level_ap(n_all, n_positive, trials=1000):
return np.mean([
average_precision_score([1] * n_positive + [0] * (n_all - n_positive), np.random.permutation(n_all))
for _ in range(trials)])
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use crate::*; | |
mod normal_distribution { | |
const S2PI: f64 = 2.50662827463100050242E0; | |
// https://github.com/scipy/scipy/blob/v1.5.4/scipy/special/cephes/ndtri.c | |
const P0: [f64; 5] = [ | |
-5.99633501014107895267E1, | |
9.80010754185999661536E1, | |
-5.66762857469070293439E1, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import itertools | |
import sys | |
import os | |
import subprocess | |
import jinja2 | |
def enumerate_combinations(**params): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
TARGET_DIR="$(dirname $(readlink -m $0))/.local" | |
WORKING_DIR="/tmp/" | |
LIBJPEG_VERSION="1.5.3" | |
OPENCV_VERSION="3.4.1" | |
eval "$(pyenv init -)" | |
PYENV_VERSION=$(pyenv version | cut -f 1 -d ' ') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RangeWithTimeout(object): | |
def __init__(self, n=None, timeout_seconds=None): | |
self.n = n | |
self.timeout_seconds = timeout_seconds | |
self.i = 0 | |
def __iter__(self): | |
self.start_datetime = datetime.datetime.now() |
NewerOlder