query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
returns the list of unit vectors starting from the point p in the directions of the points in the list L | def normalize(p,L):
Norm = []
for k in L:
x = k - p
norm = x.dot(x)**0.5
if norm != 0:
Norm.append(x/norm)
else:
print('warning: attempt to normalize 0')
return Norm | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def side_points(p, v, L): \r\n u = np.array([-v[1], v[0]]) # positive normal of v:\r\n N = list() # list of points on one side of the line p,v:\r\n for k in range(len(L)):\r\n if (L[k] - p).dot(u) >= 0:\r\n N.append(L[k])\r\n \r\n return N",
"def dirVector(self,p1,p2):\n ... | [
"0.7249321",
"0.6657329",
"0.6594285",
"0.6303316",
"0.61692244",
"0.61162615",
"0.60545075",
"0.6046249",
"0.5992133",
"0.59580344",
"0.5950187",
"0.59496295",
"0.5939751",
"0.5914357",
"0.5907345",
"0.5898231",
"0.5875133",
"0.58323985",
"0.57652116",
"0.5761926",
"0.575315... | 0.63968056 | 3 |
Tests a set in the dataset directory. | def report(name):
# conf = None
# with open('./readset.yaml','r') as f:
# conf = yaml.load(f,Loader=yaml.FullLoader)
print("start")
data = dataset(name)
data.load_anatations()
data.error_calulation(0.3)
data.error_t_test()
data.create_latex_img_table(3)
print("end") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dataset_from_dir(dir_dataset):\n dummy = \"malesuada. Integer id magna et ipsum cursus vestibulum. Mauris magna.\"\n assert dir_dataset[0][0] == dummy\n assert dir_dataset[0][1] == '8'\n\n dummy = \"Sed molestie. Sed id risus quis diam luctus lobortis. Class\"\n assert dir_dataset[100][0] =... | [
"0.6974314",
"0.6640198",
"0.66231644",
"0.6573222",
"0.65249884",
"0.6366343",
"0.62636316",
"0.62386703",
"0.6210882",
"0.6197707",
"0.6182795",
"0.61113137",
"0.6057388",
"0.6049354",
"0.60399806",
"0.60049605",
"0.5953994",
"0.5941822",
"0.59358513",
"0.59217817",
"0.5909... | 0.0 | -1 |
x ~ N(mean, exp(logvar)) | def diag_gaussian_sample(key, mean, logvar, varmin=1e-16):
logvar_wm = np.log(np.exp(logvar) + varmin)
return mean + np.exp(0.5*logvar_wm) * random.normal(key, mean.shape) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_mean_exp(x, dim):\n return log_sum_exp(x, dim) - np.log(x.size(dim))",
"def gaussian_nll(x, mean, ln_var):\n\n x_prec = torch.exp(-ln_var)\n x_diff = x - mean\n x_power = (x_diff * x_diff) * x_prec * -0.5\n loss = (ln_var + math.log(2 * (math.pi))) / 2 - x_power\n return loss",
"def l... | [
"0.76624566",
"0.7323331",
"0.7199791",
"0.71741736",
"0.71741736",
"0.7132701",
"0.7126721",
"0.7120217",
"0.7101093",
"0.7070859",
"0.7070859",
"0.70393145",
"0.69663",
"0.69628793",
"0.6938927",
"0.69337225",
"0.69337225",
"0.6901096",
"0.6898874",
"0.6865729",
"0.6837068"... | 0.0 | -1 |
Compute the KL divergence between two diagonal Gaussian distributions. KL(q||p) = E_q[log q(z) log p(z))] | def kl_gauss_gauss(q_mean, q_logvar, p_mean, p_logvar, varmin=1e-16):
q_logvar = np.log(np.exp(q_logvar) + varmin)
p_logvar = np.log(np.exp(p_logvar) + varmin)
return (0.5 * (p_logvar - q_logvar + np.exp(q_logvar - p_logvar)
+ np.square((q_mean - p_mean) / np.exp(0.5 * p_logvar)) - 1.0)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kl_gaussian_gaussian_analytic(mu_q, logvar_q, mu_p, logvar_p):\n # init\n batch_size = mu_q.size(0)\n input_size = mu_q.size(1)\n mu_q = mu_q.view(batch_size, -1)\n logvar_q = logvar_q.view(batch_size, -1)\n mu_p = mu_p.view(batch_size, -1)\n logvar_p = logvar_p.view(batch_size, -1) \n\... | [
"0.78134155",
"0.7744562",
"0.7527965",
"0.74563766",
"0.7443335",
"0.7408912",
"0.7345353",
"0.72716194",
"0.7211469",
"0.713484",
"0.7128195",
"0.7121713",
"0.7084267",
"0.70221424",
"0.6984676",
"0.6983434",
"0.6938831",
"0.69337624",
"0.6858637",
"0.68448484",
"0.6836314"... | 0.6035975 | 85 |
Returns the total nonnegative information theory entropy, give the number of observations for each different group | def entropy(group_counts):
total = sum(group_counts)
entro = 0
for item_count in group_counts:
entro += item_entropy(item_count, total)
return entro | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entropy(Y):\n\n temp = np.unique(Y, return_counts=True)\n uniq_Y = list(temp[0])\n Y_count = list(temp[1])\n \n total = sum(Y_count)\n\n ent = 0\n for elem in uniq_Y:\n prob = Y_count[uniq_Y.index(elem)] / total\n # print(\"prob:\", prob)\n ent -= (prob * (math.log2(pr... | [
"0.70600384",
"0.68918896",
"0.68384033",
"0.67932045",
"0.67821366",
"0.6753284",
"0.673469",
"0.67291254",
"0.66924876",
"0.6660583",
"0.6636825",
"0.6634891",
"0.662265",
"0.65900844",
"0.65794265",
"0.6562032",
"0.65568435",
"0.6515372",
"0.650739",
"0.64776325",
"0.64713... | 0.777499 | 0 |
Initialize configuration with a YAML file. | def from_yaml(cls, yaml_file):
return cls(OrderedDict(yaml.load(open(yaml_file, "r"),
Loader=yaml.FullLoader))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_init(filename='./config.yml'):\n try:\n cfg = yaml.safe_load(open(filename))\n except IOError:\n msg = f'Loading config file ({filename}) failed.'\n raise IOError(msg)\n return cfg",
"def __init__(self, yaml_file_path: Path) -> None:\n with yaml_file_path.open(\"r\") as ... | [
"0.7809615",
"0.74069244",
"0.7384327",
"0.73629975",
"0.73415583",
"0.73108935",
"0.7249295",
"0.7246731",
"0.72033125",
"0.7130253",
"0.7094092",
"0.70894694",
"0.70328814",
"0.6991114",
"0.69764054",
"0.6941718",
"0.6938972",
"0.6927737",
"0.6869259",
"0.68413144",
"0.6789... | 0.0 | -1 |
Generate random key, given a number of characters | def gen_randomkey(length):
chars = string.letters + string.digits + string.punctuation
return ''.join([choice(chars) for _ in xrange(int(str(length)))]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_randomkey(length):\n chars = string.letters + string.digits\n return ''.join([choice(chars) for i in range(length)])",
"def generate_random_key(self):\n self.key = ''.join(choice(ascii_letters + digits) for i in range(300))",
"def generate_key(length):\n return ''.join(random.choic... | [
"0.865902",
"0.8624365",
"0.8619694",
"0.85314643",
"0.848325",
"0.8460386",
"0.8295212",
"0.82403344",
"0.82040894",
"0.8201711",
"0.80777353",
"0.80711746",
"0.8044759",
"0.7963985",
"0.7908226",
"0.78862023",
"0.78455067",
"0.7766843",
"0.76688725",
"0.7629633",
"0.7617503... | 0.8252191 | 7 |
Take file path as string; return text as string. Takes a string that is a file path, opens the file, and turns the file's contents as one string of text. | def open_and_read_file(file_path):
file = open(file_path)
file = file.read()
return file | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_and_read_file(file_path):\n\n # your code goes here\n text_file = open(file_path)\n text_string= text_file.read()\n text_file.close()\n return text_string",
"def open_and_read_file(file_path):\n\n text_file = open(file_path)\n full_text = text_file.read()\n\n return full_text",
... | [
"0.80689883",
"0.8046884",
"0.80130076",
"0.7990617",
"0.79206705",
"0.78633755",
"0.77989054",
"0.7678091",
"0.76585126",
"0.76138705",
"0.760622",
"0.7569624",
"0.7538406",
"0.7530203",
"0.75028515",
"0.75019044",
"0.7498211",
"0.74120235",
"0.73702693",
"0.73626786",
"0.73... | 0.69575304 | 34 |
returns the z for which P(Z >= z) = probability | def normal_lower_bound(probability, mu=0, sigma=1):
return inverse_normal_cdf(1 - probability, mu, sigma) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zprob(z):\r\n Z_MAX = 6.0 # maximum meaningful z-value\r\n if z == 0.0:\r\n x = 0.0\r\n else:\r\n y = 0.5 * math.fabs(z)\r\n if y >= (Z_MAX*0.5):\r\n x = 1.0\r\n elif (y < 1.0):\r\n w = y*y\r\n x = ((((((((0.000124818987 * w\r\n ... | [
"0.7923753",
"0.7625524",
"0.75491405",
"0.7405041",
"0.6838012",
"0.6697751",
"0.64589626",
"0.64409125",
"0.63929063",
"0.6382707",
"0.63141704",
"0.6314136",
"0.62904847",
"0.62522966",
"0.62209",
"0.61795706",
"0.6152627",
"0.6144414",
"0.6080992",
"0.6080628",
"0.6077197... | 0.0 | -1 |
Redefine the vector using a magnitude and rotation. Magnitude is virtual "length" of the vector. Direction is rotation, in degrees, between the positive x and positive y axis. For pygame, this is along the horizontal axis moving clockwise towards the vertical axis. | def contruct_two_part(self, magnitude=0.0, direction=0.0):
assert isinstance(magnitude, (int, float, long)), "You need to supply a scalar number as a magnitude."
assert isinstance(direction, (int, float, long)), "You need to supply a scalar number in degrees as a direction. "
#Obtain the X comp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setNormalVector(self, vector):\n self.angle = vector.angle + math.pi / 2",
"def setUnitVector(self, vector):\n self.angle = vector.angle",
"def accelerate(self, vector):\n (self.angle, self.speed) = addVectors((self.angle, self.speed), vector)",
"def setRotVelocity(self,r):\n ... | [
"0.706692",
"0.6779481",
"0.6501194",
"0.6397503",
"0.6393925",
"0.6348895",
"0.61255807",
"0.60843784",
"0.6034929",
"0.5998009",
"0.5970482",
"0.5912121",
"0.5900815",
"0.5887436",
"0.58806205",
"0.58663636",
"0.58367383",
"0.58329695",
"0.57772756",
"0.5775578",
"0.5761695... | 0.0 | -1 |
Returns the left value, a, from cons(a,b) | def car(pair):
def left_val(a,b):
return a
return pair(left_val) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left(self, value):\n\n pass",
"def left(self):\n return self.l",
"def left(t):\r\n return t(1)",
"def _left(self, index):\r\n return 2*index + 1",
"def pleft(self):\n return -self.pfill(1) + self.plen(-1, s=True)",
"def left(self, A, i):\n if 2*i +1 < len(A):\n ... | [
"0.65470445",
"0.65044916",
"0.645968",
"0.6447066",
"0.63504857",
"0.6160971",
"0.6160971",
"0.61589664",
"0.6132983",
"0.6131045",
"0.61287814",
"0.61182225",
"0.60772586",
"0.60720146",
"0.6027838",
"0.5987366",
"0.5964472",
"0.59199846",
"0.59199846",
"0.5900524",
"0.5897... | 0.0 | -1 |
Make __str__() accessible in admin listings. | def get_name(self):
return str(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return gettext('List of %s') % self.resource.__name__",
"def __str__(self) -> str:\n pass",
"def __str__(self):\n pass",
"def __str__(self):\n pass",
"def __str__(self):\n pass",
"def __str__(self):\n pass",
"def __str__(self):\n pas... | [
"0.74747986",
"0.7463298",
"0.74581516",
"0.74581516",
"0.74581516",
"0.74581516",
"0.74581516",
"0.74581516",
"0.74581516",
"0.74581516",
"0.74581516",
"0.74581516",
"0.74581516",
"0.74545926",
"0.74257123",
"0.7384501",
"0.7384501",
"0.7384501",
"0.7384501",
"0.7384501",
"0... | 0.0 | -1 |
Get a string of random length. | def get_random_string(length: int) -> str:
# With combination of lower and upper case
result_str = "".join(
random.choice(string.ascii_letters) for _ in range(length)
)
return result_str | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_string(length: int) -> str:\n return \"\".join(random.choices(string.ascii_letters + string.digits, k=length))",
"def get_random_string(self, length):\n letters = string.ascii_lowercase\n return ''.join(random.choice(letters) for i in range(length))",
"def get_random_str(len):\n... | [
"0.84313154",
"0.83794755",
"0.8367376",
"0.82973146",
"0.8292932",
"0.827324",
"0.8250785",
"0.82305974",
"0.8221469",
"0.8195441",
"0.814797",
"0.81407744",
"0.81395096",
"0.812562",
"0.81115806",
"0.8069311",
"0.80654496",
"0.8052179",
"0.80517536",
"0.8033762",
"0.8021048... | 0.78873897 | 30 |
Get or set the start time. | def startTime(self):
return self._startTime | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_start_time():\n __start = current_time_milli()",
"def start_time(self, value):\n self._start_time = value",
"def start_time(self) -> Optional[str]:\n return pulumi.get(self, \"start_time\")",
"def start_time(self):\n return self._get(\"start_time\")",
"def start_time(self) -... | [
"0.8370729",
"0.8153164",
"0.80068856",
"0.79680157",
"0.7948152",
"0.7948152",
"0.7840212",
"0.783627",
"0.783627",
"0.783627",
"0.783627",
"0.783627",
"0.783627",
"0.7818026",
"0.7818026",
"0.7815334",
"0.7815334",
"0.7810674",
"0.7810674",
"0.7810674",
"0.7810674",
"0.78... | 0.68514585 | 77 |
Get or set the end time. | def endTime(self):
return self._endTime | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_end_time(self):\n return self.__end_time",
"def end_time(self) -> Optional[str]:\n return pulumi.get(self, \"end_time\")",
"def end_time(self):\n return self._end_time",
"def end_time(self):\n return self._end_time",
"def end_time(self):\n return self._end_time",
"... | [
"0.8287686",
"0.81797576",
"0.8163283",
"0.8163283",
"0.8163283",
"0.8163283",
"0.8163283",
"0.8163283",
"0.81622374",
"0.81490916",
"0.81490916",
"0.80398595",
"0.80392814",
"0.80251455",
"0.8016694",
"0.8016694",
"0.790847",
"0.7901201",
"0.78902394",
"0.78576154",
"0.78576... | 0.7322398 | 33 |
Get or set the method type. | def method(self):
return self._method | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_type(self):\n return self.__type",
"def _get_type(self):\n return self.__type",
"def _get_type(self):\n return self.__type",
"def _get_type(self):\n return self.__type",
"def _get_type(self):\n return self.__type",
"def _get_type(self):\n return self.__type",
"def _get_type(s... | [
"0.6592943",
"0.6592943",
"0.6592943",
"0.6592943",
"0.6592943",
"0.6592943",
"0.6592943",
"0.6592943",
"0.6592943",
"0.6592943",
"0.6592943",
"0.6592943",
"0.6592943",
"0.6592943",
"0.6592943",
"0.6592943",
"0.6592943",
"0.6592943",
"0.6592943",
"0.6592943",
"0.6592943",
"... | 0.0 | -1 |
Get or set the performance description. | def description(self):
return self._description | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_desc(self):\n return self.__desc",
"def get_desc(self):\n return self._desc",
"def get_description(self):\n if self._visited is False:\n self._visited = True\n return self._desc\n else:\n return self._sdesc",
"def description(self):\n i... | [
"0.67029035",
"0.6629683",
"0.6476278",
"0.64431995",
"0.638377",
"0.638377",
"0.6366048",
"0.6336608",
"0.63336533",
"0.6312298",
"0.6312298",
"0.6312298",
"0.6312298",
"0.6312298",
"0.6312298",
"0.6312298",
"0.6312298",
"0.6312298",
"0.6312298",
"0.6312298",
"0.6312298",
... | 0.0 | -1 |
Maximum likelihood labels for training data. Can access with self.labels (no parens needed) | def labels(self):
return self.label(self.p_y_given_x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predLabel(self, DataMatrix):\n self.predict(DataMatrix)\n # Calculamos el valor mas alto, y a partir de este obtenemos el nombre de la etiqueta\n tags = [[self.classes[np.argmax(subrow)] for subrow in row] for row in self.data]\n return tags",
"def ... | [
"0.6732353",
"0.6662547",
"0.660384",
"0.6336747",
"0.6329177",
"0.6315187",
"0.6296933",
"0.62869954",
"0.6285906",
"0.628464",
"0.6256035",
"0.622267",
"0.6215733",
"0.6215733",
"0.6215733",
"0.6215733",
"0.61990917",
"0.61891234",
"0.6172154",
"0.6172154",
"0.61632484",
... | 0.63977796 | 3 |
Pickle a class instance. E.g., corex.save('saved.dat') | def save(self, filename):
import pickle
if path.dirname(filename) and not path.exists(path.dirname(filename)):
makedirs(path.dirname(filename))
pickle.dump(self, open(filename, 'wb'), protocol=-1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self): \n with open(self.path+self.name, \"wb\") as pfile:\n pickle.dump(self.pyObj, pfile)",
"def save(self):\n pickle.dump(self, open(self.path, \"wb\"))",
"def dumpPickle(obj, filepath):\n\tf = open(filepath, 'wb')\n\tpickle.dump(obj, f, protocol=2)\n\tf.close()",
"... | [
"0.74063575",
"0.7002336",
"0.6985037",
"0.69627327",
"0.68461734",
"0.68373597",
"0.68286145",
"0.6820848",
"0.68124884",
"0.6797875",
"0.67811656",
"0.67229074",
"0.6722504",
"0.6721765",
"0.671418",
"0.66993874",
"0.66747713",
"0.66746294",
"0.66634804",
"0.66398066",
"0.6... | 0.0 | -1 |
Sets the learning rate to the initial LR decayed by 10 every 30 epochs | def multistep_lr(optimizer, args, **kwargs):
def _lr_adjuster(epoch, iteration):
lr = args.lr * (args.lr_gamma ** (epoch // args.lr_adjust))
assign_learning_rate(optimizer, lr)
return lr
return _lr_adjuster | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr",
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #l... | [
"0.7913536",
"0.7906521",
"0.7849834",
"0.777524",
"0.77338326",
"0.77306354",
"0.7722718",
"0.77224237",
"0.771982",
"0.77092624",
"0.7693604",
"0.76742035",
"0.7665748",
"0.7665748",
"0.7665748",
"0.7655329",
"0.76419765",
"0.76399755",
"0.7637868",
"0.7626077",
"0.76247585... | 0.0 | -1 |
Sets the learning rate to the initial LR decayed by 10 at epoch 30 and 40 | def cos_multi_lr(optimizer, args, **kwargs):
def _lr_adjuster(epoch, iteration):
if epoch >= 30:
lr = args.lr * 0.1
if epoch >= 44:
lr = lr * 0.1
if epoch >= 54:
lr = lr * 0.1
if epoch >= 55:
e = epoch - args... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #lr = start_lr * (0.1 ** (epoch // 30))\n lr = start_lr * (0.3 ** (epoch // 5))\n if epoch==total_epoch_num:\n lr = lr * 0.3\n\n for param_group in optimizer.param_groups:\n param_group['lr'] = lr",
"def adjust_lea... | [
"0.80101687",
"0.79632473",
"0.79519963",
"0.7899229",
"0.7873571",
"0.7831768",
"0.78162926",
"0.78034043",
"0.7788768",
"0.7786944",
"0.77805924",
"0.7757504",
"0.77322036",
"0.77296597",
"0.77268463",
"0.7723613",
"0.77231395",
"0.7719245",
"0.77082205",
"0.77058977",
"0.7... | 0.0 | -1 |
Sets the learning rate to the initial LR decayed by 10 at epoch 30 and 40 | def xnor_lr(optimizer, args, **kwargs):
def _lr_adjuster(epoch, iteration):
if epoch >= 30:
lr = args.lr * 0.1
if epoch >= 44:
lr = lr * 0.1
if epoch >= 54:
lr = lr * 0.1
else:
lr = args.lr
assign_learning_r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #lr = start_lr * (0.1 ** (epoch // 30))\n lr = start_lr * (0.3 ** (epoch // 5))\n if epoch==total_epoch_num:\n lr = lr * 0.3\n\n for param_group in optimizer.param_groups:\n param_group['lr'] = lr",
"def adjust_lea... | [
"0.80101687",
"0.79632473",
"0.79519963",
"0.7899229",
"0.7873571",
"0.7831768",
"0.78162926",
"0.78034043",
"0.7788768",
"0.7786944",
"0.77805924",
"0.7757504",
"0.77322036",
"0.77296597",
"0.77268463",
"0.7723613",
"0.77231395",
"0.7719245",
"0.77082205",
"0.77058977",
"0.7... | 0.0 | -1 |
Sets the learning rate to the initial LR decayed by 10 at epoch 30 and 40 | def mpt132_w34_2_lr(optimizer, args, **kwargs):
def _lr_adjuster(epoch, iteration):
if epoch >= 27:
lr = args.lr * 0.1
if epoch >= 44:
lr = lr * 0.1
if epoch >= 54:
lr = lr * 0.01
else:
lr = args.lr
assign_le... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #lr = start_lr * (0.1 ** (epoch // 30))\n lr = start_lr * (0.3 ** (epoch // 5))\n if epoch==total_epoch_num:\n lr = lr * 0.3\n\n for param_group in optimizer.param_groups:\n param_group['lr'] = lr",
"def adjust_lea... | [
"0.80101687",
"0.79632473",
"0.79519963",
"0.7899229",
"0.7873571",
"0.7831768",
"0.78162926",
"0.78034043",
"0.7788768",
"0.7786944",
"0.77805924",
"0.7757504",
"0.77322036",
"0.77296597",
"0.77268463",
"0.7723613",
"0.77231395",
"0.7719245",
"0.77082205",
"0.77058977",
"0.7... | 0.0 | -1 |
Sets the learning rate to the initial LR decayed by 10 at epoch 30 and 40 | def mpt11_w34_2_v2_lr(optimizer, args, **kwargs):
def _lr_adjuster(epoch, iteration):
if epoch >= 50:
lr = args.lr * 0.1
if epoch >= 62:
lr = lr * 0.1
if epoch >= 70:
lr = lr * 0.01
else:
lr = args.lr
assign_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #lr = start_lr * (0.1 ** (epoch // 30))\n lr = start_lr * (0.3 ** (epoch // 5))\n if epoch==total_epoch_num:\n lr = lr * 0.3\n\n for param_group in optimizer.param_groups:\n param_group['lr'] = lr",
"def adjust_lea... | [
"0.80101687",
"0.79632473",
"0.79519963",
"0.7899229",
"0.7873571",
"0.7831768",
"0.78162926",
"0.78034043",
"0.7788768",
"0.7786944",
"0.77805924",
"0.7757504",
"0.77322036",
"0.77296597",
"0.77268463",
"0.7723613",
"0.77231395",
"0.7719245",
"0.77082205",
"0.77058977",
"0.7... | 0.0 | -1 |
Sets the learning rate to the initial LR decayed by 10 at epoch 30 and 40 | def mpt11_w18_2_lr(optimizer, args, **kwargs):
def _lr_adjuster(epoch, iteration):
if epoch >= 46:
lr = args.lr * 0.1
if epoch >= 65:
lr = lr * 0.1
if epoch >= 80:
lr = lr * 0.01
else:
lr = args.lr
assign_lea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #lr = start_lr * (0.1 ** (epoch // 30))\n lr = start_lr * (0.3 ** (epoch // 5))\n if epoch==total_epoch_num:\n lr = lr * 0.3\n\n for param_group in optimizer.param_groups:\n param_group['lr'] = lr",
"def adjust_lea... | [
"0.80101687",
"0.79632473",
"0.79519963",
"0.7899229",
"0.7873571",
"0.7831768",
"0.78162926",
"0.78034043",
"0.7788768",
"0.7786944",
"0.77805924",
"0.7757504",
"0.77322036",
"0.77296597",
"0.77268463",
"0.7723613",
"0.77231395",
"0.7719245",
"0.77082205",
"0.77058977",
"0.7... | 0.0 | -1 |
Sets the learning rate to the initial LR decayed by 10 at epoch 30 and 40 | def mpt11_w18_2_v2_lr(optimizer, args, **kwargs):
def _lr_adjuster(epoch, iteration):
if epoch >= 35:
lr = args.lr * 0.1
if epoch >= 50:
lr = lr * 0.1
if epoch >= 60:
lr = lr * 0.01
else:
lr = args.lr
assign_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #lr = start_lr * (0.1 ** (epoch // 30))\n lr = start_lr * (0.3 ** (epoch // 5))\n if epoch==total_epoch_num:\n lr = lr * 0.3\n\n for param_group in optimizer.param_groups:\n param_group['lr'] = lr",
"def adjust_lea... | [
"0.80101687",
"0.79632473",
"0.79519963",
"0.7899229",
"0.7873571",
"0.7831768",
"0.78162926",
"0.78034043",
"0.7788768",
"0.7786944",
"0.77805924",
"0.7757504",
"0.77322036",
"0.77296597",
"0.77268463",
"0.7723613",
"0.77231395",
"0.7719245",
"0.77082205",
"0.77058977",
"0.7... | 0.0 | -1 |
Make the TraitType instances set their default values on the instance. | def __new__(cls, *args, **kwargs):
# This is needed because in python 2.6 object.__new__ only accepts the
# cls argument.
new_meth = super(Model, cls).__new__
if new_meth is object.__new__:
inst = new_meth(cls)
else:
inst = new_meth(cls, **kwargs)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_to_pype_default(self):\n raise NotImplementedError(\n \"{} Method `reset_to_pype_default` not implemented!\".format(\n repr(self)\n )\n )",
"def set_defaults(self):\n\n for k, v in self.DEFAULTS.items():\n if not getattr(self, k, None... | [
"0.6427622",
"0.6390875",
"0.62136376",
"0.61868507",
"0.6167313",
"0.5956596",
"0.590064",
"0.58638906",
"0.57418615",
"0.5686113",
"0.56458",
"0.5632298",
"0.56186885",
"0.560501",
"0.55762774",
"0.55534923",
"0.5542775",
"0.5527768",
"0.55195785",
"0.551061",
"0.5508856",
... | 0.53381777 | 44 |
Build a dictionary representation of this Model instance. | def to_dict(self):
state = self.__getstate__()
for (trait_name, trait_value) in state.iteritems():
if isinstance(trait_value, list):
new_list = []
for element in trait_value:
if isinstance(element, Model):
element_d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_dict(self):\n d = self.__dict__\n # convert to list to be json safe\n d['words'] = {value: list(words) for value, words in self.words.items()}\n d['model'] = dict(self.model.get_params())\n return d",
"def to_dict(self) -> Dict[str, Union[str, Number, dict, list]]:\n ... | [
"0.7691641",
"0.765941",
"0.7552094",
"0.74996877",
"0.7496666",
"0.7485603",
"0.7443178",
"0.7373025",
"0.73724586",
"0.7367959",
"0.736765",
"0.7366286",
"0.7366286",
"0.7366286",
"0.7345838",
"0.73393184",
"0.73326224",
"0.7324766",
"0.7323485",
"0.7319859",
"0.73120064",
... | 0.0 | -1 |
Predict action probabilities given states. | def predict_proba(self, states):
states = Variable(torch.FloatTensor(states))
probas = F.softmax(self.network.forward(states))
return probas.data.numpy() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(self, states, actions):\n obs = normalize(states,self.normalization['observations'][0],self.normalization['observations'][1])\n #delta = normalize(delta,normalization['delta'])\n acs = normalize(actions,self.normalization['actions'][0],self.normalization['actions'][1])\n don... | [
"0.7889162",
"0.7832179",
"0.7518147",
"0.73917705",
"0.738475",
"0.73525226",
"0.7326451",
"0.73138726",
"0.7172609",
"0.6978528",
"0.6906683",
"0.6872568",
"0.6853886",
"0.67995584",
"0.6768523",
"0.67283815",
"0.6702249",
"0.6667121",
"0.66327345",
"0.6601041",
"0.65962446... | 0.6968039 | 10 |
Take an integer vector (tensor of variable) and convert it to 1hot matrix. | def to_one_hot(self, y, n_dims=None):
y_tensor = y.data if isinstance(y, Variable) else y
y_tensor = y_tensor.type(torch.LongTensor).view(-1, 1)
n_dims = n_dims if n_dims is not None else int(
torch.max(y_tensor)) + 1
y_one_hot = torch.zeros(
y_tensor.size... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_one_hot(v):\n n = len(v)\n m = max(v) + 1\n out = np.zeros((n, m))\n out[np.arange(n), v] = 1\n return out",
"def one_hot_encode(vector, values = 10):\n n = len(vector)\n out = numpy.zeros( (n, values) )\n out[range(n), vector] = 1\n return out",
"def convert_to_onehot(vector,... | [
"0.8391626",
"0.7929691",
"0.7789748",
"0.77540445",
"0.76539844",
"0.7617844",
"0.7534543",
"0.7510506",
"0.74716616",
"0.74194384",
"0.72777975",
"0.7276192",
"0.7221585",
"0.72042435",
"0.71805406",
"0.7138245",
"0.71158314",
"0.7106408",
"0.71049434",
"0.70753795",
"0.707... | 0.0 | -1 |
Compute energy of a protein. | def compute_energy(self, protein):
return utils.score_pose(protein.pose, self.scorefxn) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def energy_tot(P,F,H,molecule):\n return energy_el(P,F,H) + energy_n(molecule)",
"def energy(self):\n energy = -0.5*np.sum(self.phi)+0.5*np.sum(self.mass*np.sqrt(self.particles.momentum[:,0]**2+self.particles.momentum[:,1]**2)**2)\n return energy",
"def energy(p,m):\n return math.sqrt(p*p +... | [
"0.72012615",
"0.715897",
"0.71059984",
"0.70766",
"0.70726967",
"0.70589584",
"0.7055935",
"0.70316356",
"0.69816923",
"0.6975418",
"0.6911739",
"0.67674965",
"0.67373985",
"0.67346823",
"0.6701098",
"0.6694987",
"0.66668403",
"0.66624516",
"0.6649281",
"0.664188",
"0.664176... | 0.82101876 | 0 |
Just contain one linear layer. The weight of this layer is the W in the paper. | def __init__(self, inp, k=1):
super().__init__()
self.ln = nn.Linear(inp, k, bias=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linear_layer(self, W, b, x, use_relu=True):\n\n if use_relu is True:\n return np.maximum(W @ x + b, 0)\n return W @ x + b",
"def linear(x,output_dim):\n w=tf.get_variable(\"w\", [x.get_shape()[1], output_dim])\n b=tf.get_variable(\"b\", [output_dim], initializer=tf.constant_initial... | [
"0.6872348",
"0.65485746",
"0.6389892",
"0.62076986",
"0.6201997",
"0.6183468",
"0.61048377",
"0.605932",
"0.6037952",
"0.5961057",
"0.5922112",
"0.5916453",
"0.58776754",
"0.58508384",
"0.5837626",
"0.58352983",
"0.5830746",
"0.58018184",
"0.5759371",
"0.5757995",
"0.575531"... | 0.5301274 | 92 |
MAC address of client. | def client(self) -> str:
return (
self.raw.get("user")
or self.raw.get("client")
or self.raw.get("guest")
or ""
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_mac_address(self):\n str_hex_mac = uuid.UUID(int=uuid.getnode()).hex[-12:]\n return str_hex_mac",
"def mac_address(self) -> str:\n return self._device.mac",
"def mac_address(self):\n return self._mac_address",
"def get_mac_address(self):\n\t\treturn call_sdk_function('Pr... | [
"0.8004023",
"0.7955754",
"0.7858903",
"0.7816766",
"0.76688665",
"0.7640662",
"0.7638786",
"0.7559636",
"0.75422275",
"0.75134987",
"0.74855626",
"0.74855626",
"0.7460963",
"0.7417136",
"0.7411463",
"0.7411463",
"0.73055845",
"0.72539866",
"0.72374225",
"0.7214891",
"0.71740... | 0.0 | -1 |
Tests a gzip file that does not have a ".gz" extension. | def test_gzip_file_no_extension(self):
# Write the data to a file
temp_file = tempfile.NamedTemporaryFile()
with gzip.open(temp_file.name, 'wb') as out:
for item in self.data:
serialzed = json.dumps(item).encode()
out.write(serialzed + b'\n')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_gz_file(f):\n with open(f, \"rb\") as fin:\n return binascii.hexlify(fin.read(2)) == b\"1f8b\"",
"def is_zip(filepath):\n\treturn os.path.splitext(filepath)[1] == '.gz'",
"def isgzip(filename):\n magic_number = b'\\x1f\\x8b\\x08'\n with open(filename, 'rb') as f:\n file_start = f.... | [
"0.72655106",
"0.72278327",
"0.70145774",
"0.70042586",
"0.6835112",
"0.6823039",
"0.6789966",
"0.6779903",
"0.64722043",
"0.6465986",
"0.6386121",
"0.6308988",
"0.6225748",
"0.61549723",
"0.6135114",
"0.6135114",
"0.6079712",
"0.606086",
"0.60572934",
"0.6033975",
"0.6029802... | 0.69814986 | 4 |
Can't create a user if unauthenticated. | def test_new_user_not_authenticated(self):
setup_identity_cache()
url = "/v1/actions/InviteUser"
headers = {}
data = {
"email": "test@example.com",
"roles": ["member"],
"project_id": "test_project_id",
}
response = self.client.post(ur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_if_not_created_authenticated_permissions(self):\r\n payload = {\r\n \"email\": \"t@t.pl\",\r\n \"password\": \"password\",\r\n \"name\": \"asdasd\",\r\n \"is_superuser\": False,\r\n }\r\n\r\n res = self.client_authenticated.post(reverse(CREA... | [
"0.79452384",
"0.7918731",
"0.7724506",
"0.75947505",
"0.72145396",
"0.7070708",
"0.7060885",
"0.7049024",
"0.703807",
"0.6940618",
"0.68214333",
"0.67603564",
"0.67569745",
"0.67550474",
"0.674168",
"0.672881",
"0.67038894",
"0.6700604",
"0.6695356",
"0.6650697",
"0.66398937... | 0.70047665 | 9 |
Ensure the update email workflow goes as expected. Create task, create token, submit token. | def test_update_email_task(self):
user = fake_clients.FakeUser(
name="test@example.com", password="123", email="test@example.com"
)
setup_identity_cache(users=[user])
url = "/v1/actions/UpdateEmail"
headers = {
"project_name": "test_project",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_email_task_send_email_current_name_not_email(self):\n\n user = fake_clients.FakeUser(\n name=\"nkdfslnkls\", password=\"123\", email=\"test@example.com\"\n )\n\n setup_identity_cache(users=[user])\n\n url = \"/v1/actions/UpdateEmail\"\n headers = {\n ... | [
"0.6641487",
"0.65933645",
"0.63793033",
"0.5988052",
"0.58915395",
"0.5823073",
"0.5801181",
"0.56437814",
"0.5622126",
"0.556626",
"0.5563945",
"0.5509865",
"0.55096465",
"0.5467318",
"0.54488516",
"0.54419976",
"0.54326904",
"0.5379935",
"0.53690886",
"0.5351489",
"0.53484... | 0.72772837 | 0 |
Tests the email update workflow when USERNAME_IS_EMAIL=False, and ensures that when setup to send a confirmation email to the old email address it does. | def test_update_email_task_send_email_current_name_not_email(self):
user = fake_clients.FakeUser(
name="nkdfslnkls", password="123", email="test@example.com"
)
setup_identity_cache(users=[user])
url = "/v1/actions/UpdateEmail"
headers = {
"project_name"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_admin_approval_email_falls_back_to_django_default_from_email(self):\n new_user = UserModel().objects.create_user(**self.user_info)\n profile = self.registration_profile.objects.create_profile(new_user)\n profile.activated = True\n self.registration_profile.objects.send_admin_ap... | [
"0.72047496",
"0.7074778",
"0.7028207",
"0.69693005",
"0.69014025",
"0.68750113",
"0.68310523",
"0.6771183",
"0.6763269",
"0.67563814",
"0.6717591",
"0.670736",
"0.65680236",
"0.65484416",
"0.6509865",
"0.6506638",
"0.6498472",
"0.6448855",
"0.644545",
"0.6423543",
"0.6414982... | 0.6679355 | 12 |
The additional email actions should not send an email if the action is invalid. | def test_email_additional_action_invalid(self):
setup_identity_cache()
url = "/v1/actions/InviteUser"
headers = {
"project_name": "test_project",
"project_id": "test_project_id",
"roles": "project_admin,member,project_mod",
"username": "test@exam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_email_disabled(self):\r\n test_email = {\r\n 'action': 'Send email',\r\n 'send_to': 'myself',\r\n 'subject': 'test subject for myself',\r\n 'message': 'test message for myself'\r\n }\r\n response = self.client.post(self.send_mail_url, test_e... | [
"0.65730184",
"0.6376346",
"0.62104857",
"0.6187945",
"0.60576475",
"0.59244066",
"0.59205645",
"0.5912073",
"0.58782667",
"0.58319366",
"0.58272535",
"0.5803269",
"0.5791973",
"0.57378376",
"0.57144916",
"0.571216",
"0.57079375",
"0.5701372",
"0.56703043",
"0.5663843",
"0.56... | 0.7289466 | 0 |
When can_edit_users is false, and a new signup comes in, the task should be marked as invalid if it needs to create a new user. Will return OK (as task doesn't auto_approve), but task will actually be invalid. | def test_project_create_cant_edit_users(self):
setup_identity_cache()
url = "/v1/actions/CreateProjectAndUser"
data = {"project_name": "test_project", "email": "test@example.com"}
response = self.client.post(url, data, format="json")
self.assertEqual(response.status_code, status... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_project_create_cant_edit_users_existing_user(self):\n user = fake_clients.FakeUser(name=\"test@example.com\")\n\n setup_identity_cache(users=[user])\n\n url = \"/v1/actions/CreateProjectAndUser\"\n data = {\"project_name\": \"test_project\", \"email\": \"test@example.com\"}\n ... | [
"0.66085404",
"0.64380985",
"0.640038",
"0.62846017",
"0.6143267",
"0.61050075",
"0.6069316",
"0.60530555",
"0.5980463",
"0.5970805",
"0.59477574",
"0.59021604",
"0.5873239",
"0.58261275",
"0.5819795",
"0.57675356",
"0.5758916",
"0.5753213",
"0.5694632",
"0.5676942",
"0.56321... | 0.65307754 | 1 |
Delete lab group created for this test. | def tearDown(self):
self.labGroup.delete()
super(NoLabForUser, self).tearDown() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown(self):\n self.labGroup.delete()",
"def test_080_group_delete(self):\n\n testflow.step(RMV_GRP_MSG, TEST_GROUP_DELETE)\n assert GROUP_CLI.run(\n 'delete',\n TEST_GROUP_DELETE\n )[0], \"Failed to delete group '%s'\" % TEST_GROUP_DELETE",
"def test_de... | [
"0.7756964",
"0.7504123",
"0.7410745",
"0.7410745",
"0.71553904",
"0.7152201",
"0.7146864",
"0.7118825",
"0.70905834",
"0.69932044",
"0.69028074",
"0.68564326",
"0.6846669",
"0.6827288",
"0.6780487",
"0.6777484",
"0.6720246",
"0.67015165",
"0.66451526",
"0.66316086",
"0.66052... | 0.7369651 | 4 |
Create inconsistency between CAS number and name. | def setUpFormData(self):
super(InconsistentCASName, self).setUpFormData()
self.formData['CAS_ID'] = '290-37-9'
self.formData['CSID'] = '8904' # consistent values for pyrazine. | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self, cr, user, vals, context=None):\n if ('name' not in vals) or (vals.get('name')=='/'): \n vals['name'] = self.pool.get('ir.sequence').get(cr, user, 'services.contracts.archive')\n return super(env_and_safety_allowances_archive, self).create(cr, user, vals, context)",
"def... | [
"0.55365926",
"0.5442971",
"0.5290361",
"0.52699053",
"0.52344525",
"0.5213541",
"0.51775724",
"0.5171424",
"0.5146217",
"0.5143811",
"0.5137238",
"0.5084902",
"0.505352",
"0.5047763",
"0.5042051",
"0.49853882",
"0.49819195",
"0.49509123",
"0.49481195",
"0.4940359",
"0.494035... | 0.5477288 | 1 |
Determines if previous minimum skew and/or kurtosis should be replaced. | def checkMin(oldskew,oldkurt,newskew,newkurt,oldtransform,newtransform):
if (newskew < oldskew and newkurt < oldkurt) or (newkurt < oldkurt and (newskew-oldskew) < 2.0*(oldkurt-newkurt) ):
return (newskew,newkurt,newtransform)
elif newskew < oldskew:
return (oldskew,oldkurt,oldtransform)
eli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def support_skewed(self):\n\t\tif all([item in self.__class__.__dict__ for item in ['init_agg','last_agg','finalize']]):\n\t\t\treturn True\n\t\telse:\n\t\t\treturn False",
"def accept_move(misfit_current, likelihood_current, misfit_proposednext):\n if misfit_proposednext <= misfit_current:\n return Tr... | [
"0.56515265",
"0.55337745",
"0.5429516",
"0.5419026",
"0.53508544",
"0.53044164",
"0.52709705",
"0.52291274",
"0.51787686",
"0.5175725",
"0.5167837",
"0.5161958",
"0.5158973",
"0.51454186",
"0.51088625",
"0.5101634",
"0.5093021",
"0.50878626",
"0.50746673",
"0.5050008",
"0.50... | 0.60877913 | 0 |
Close all sessions, unless session management is set to MANDATORY | def close_sessions(self):
if self._session_management != MANDATORY:
self._provider_sessions = dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_all_sessions() -> None:\n\n for sess in _sessions.values():\n sess.close()",
"def close_all(cls) -> None:\n\n close_all_sessions()",
"def close_all(cls):\n for sess in cls._session_registry.values():\n sess.close()",
"def close_sessions(self):\n if self._se... | [
"0.8069694",
"0.7919251",
"0.78704804",
"0.7759464",
"0.7459878",
"0.72732544",
"0.7217262",
"0.70671594",
"0.7067076",
"0.70469946",
"0.70124066",
"0.700974",
"0.6959029",
"0.6959029",
"0.6959029",
"0.6921884",
"0.6890681",
"0.68874145",
"0.6872762",
"0.68708336",
"0.6870833... | 0.7968633 | 1 |
Pass through to provider CatalogAdminSession.can_update_catalogs | def can_update_catalogs(self):
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.can_update_bins
return self._get_provider_session('catalog_admin_session').can_update_catalogs() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_update_books(self):\n # Implemented from template for\n # osid.resource.BinAdminSession.can_update_bins\n # NOTE: It is expected that real authentication hints will be\n # handled in a service adapter above the pay grade of this impl.\n if self._catalog_session is not Non... | [
"0.76364976",
"0.6954973",
"0.67726964",
"0.67226964",
"0.6306999",
"0.6272507",
"0.62427044",
"0.6209875",
"0.6097616",
"0.6068694",
"0.6023836",
"0.5938341",
"0.5894968",
"0.58353955",
"0.5790709",
"0.57722265",
"0.5749628",
"0.5745617",
"0.57250977",
"0.56373686",
"0.55659... | 0.882789 | 0 |
Gets the Id of this catalog. | def get_catalog_id(self):
return self._catalog_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def catalog_id(self):\n return self._catalog_id",
"def getId(self):\n return _libsbml.Compartment_getId(self)",
"def getId(self):\n\n return self.__id",
"def get_id(self):\n return self._id",
"def get_id(self):\n return self._id",
"def get_id(self):\n return self... | [
"0.8678884",
"0.7484622",
"0.73726004",
"0.7355493",
"0.7355493",
"0.7355493",
"0.7355493",
"0.7355493",
"0.7355493",
"0.7279988",
"0.72571033",
"0.72358394",
"0.72195864",
"0.72195864",
"0.7185139",
"0.7183837",
"0.7183837",
"0.7183837",
"0.7183837",
"0.7183837",
"0.7183837"... | 0.86728644 | 1 |
Close all sessions currently being managed by this Manager to save memory. | def close_sessions(self):
if self._session_management != MANDATORY:
self._provider_sessions = dict()
else:
raise IllegalState() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_all(cls):\n for sess in cls._session_registry.values():\n sess.close()",
"def close_all(cls) -> None:\n\n close_all_sessions()",
"def close(self):\n for session in self.sessions.copy().values():\n session.close(SessionCloseErrorCode.SESSION_DIED)",
"def cl... | [
"0.85203636",
"0.84580284",
"0.8267901",
"0.8259492",
"0.81117254",
"0.77354926",
"0.7728167",
"0.76213837",
"0.733938",
"0.733938",
"0.733938",
"0.7241081",
"0.7178671",
"0.71661013",
"0.7129895",
"0.70922834",
"0.70922834",
"0.70922834",
"0.70922834",
"0.70922834",
"0.70922... | 0.747098 | 8 |
Return the API version. | def version(self):
_, body = self.request('/', 'GET')
return body.get('version', None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version(self):\n return self.api_version",
"def api_version(self):\n\n\t\treturn self._api_version",
"def api_version(self) -> Optional[str]:\n return pulumi.get(self, \"api_version\")",
"def api_version(self) -> Optional[str]:\n return pulumi.get(self, \"api_version\")",
"def ... | [
"0.9072185",
"0.8835297",
"0.8812084",
"0.8812084",
"0.8812084",
"0.8812084",
"0.8812084",
"0.8812084",
"0.8812084",
"0.8812084",
"0.8812084",
"0.8812084",
"0.8812084",
"0.8812084",
"0.8812084",
"0.8812084",
"0.8812084",
"0.8812084",
"0.8812084",
"0.8812084",
"0.8812084",
"... | 0.8487389 | 34 |
Returns a list of all the endpoints currently being managed by the reactor. | def endpoint_list(self):
_, body = self.request('/v1.1/endpoints', 'GET')
return body | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoints(self):\n return self[\"endpoints\"]",
"def get_flask_endpoints(self):\n urls = self.endpoints.keys()\n return urls",
"def endpoints(self):\n return self.settings[\"endpoints\"]",
"def get_endpoints(self):\n return self.endpoints.values()",
"async def Availab... | [
"0.77835125",
"0.7656806",
"0.75507295",
"0.75212026",
"0.7391385",
"0.7229766",
"0.7081538",
"0.7042687",
"0.7039604",
"0.7015201",
"0.66251105",
"0.66251105",
"0.65999174",
"0.65949714",
"0.65367913",
"0.6516309",
"0.651511",
"0.6484123",
"0.648212",
"0.6472074",
"0.6465471... | 0.7719079 | 1 |
Return the endpoint's configuration. | def endpoint_config(self, endpoint_name=None):
if endpoint_name is None:
_, body = self.request('/v1.1/endpoint', 'GET')
else:
_, body = self.request('/v1.1/endpoints/%s' % endpoint_name, 'GET')
return body | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self):\n return self.config",
"def get_configuration(self) -> dict:\n return self.config",
"def _est_config(self):\n return self._est_method.config",
"def describe_endpoint_config(EndpointConfigName=None):\n pass",
"def _get_config(self):\n return self.__config",
... | [
"0.7586859",
"0.75094473",
"0.7406959",
"0.7339215",
"0.7338158",
"0.7338158",
"0.7338158",
"0.7338158",
"0.7338158",
"0.7338158",
"0.7338158",
"0.7338158",
"0.7338158",
"0.7338158",
"0.7338158",
"0.7338158",
"0.7338158",
"0.7338158",
"0.7338158",
"0.7338158",
"0.7338158",
... | 0.82205737 | 0 |
Returns a list of all configured managers. | def manager_configs_list(self):
_, body = self.request('/v1.1/managers/configs', 'GET')
return body | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manager_active_list(self):\n _, body = self.request('/v1.1/managers/active', 'GET')\n return body",
"def manager_agents(self):\n return self.get(\"manager_agents\")",
"def list_podmanager(cls):\n return cls.dbdriver.list_podmanager()",
"def get_managers_list(self):\n tr... | [
"0.6901478",
"0.67316854",
"0.65988505",
"0.6525097",
"0.646066",
"0.6366126",
"0.633342",
"0.62295026",
"0.61671317",
"0.61062044",
"0.6025322",
"0.6015233",
"0.59620667",
"0.58453923",
"0.5841155",
"0.5767544",
"0.57509774",
"0.57332975",
"0.5725349",
"0.57098037",
"0.56826... | 0.8021785 | 0 |
Return the manager's configuration. | def manager_config(self, manager):
_, body = self.request('/v1.1/managers/configs/%s' % manager, 'GET')
return body | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self):\n return self.config",
"def get_configuration(self) -> dict:\n return self.config",
"def getConfig(self):\n \n return self.config",
"def config(self):\n return self.__config",
"def config(self):\n return self.__config",
"def config(self):\n ... | [
"0.8012625",
"0.799986",
"0.7858629",
"0.78259075",
"0.78259075",
"0.7732619",
"0.7732619",
"0.7732619",
"0.77212644",
"0.7713746",
"0.7709552",
"0.7693966",
"0.76747704",
"0.7667241",
"0.76168424",
"0.7599402",
"0.7599402",
"0.75130105",
"0.75130105",
"0.75130105",
"0.751301... | 0.81382024 | 0 |
Changes the API key in the system. | def api_key_set(self, api_key):
self.request('/v1.1/auth_key', 'POST', body={'auth_key': api_key}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_key(self, key):\n self._api_key = key",
"def set_api_key(new_api_key):\n global api_key\n api_key = new_api_key",
"def SetAPIKey(self, api_key):\n self._api_key = api_key",
"def SetAPIKey(self, api_key):\n self._api_key = api_key",
"async def statset_apikey(self, key):\n ... | [
"0.8156307",
"0.8134097",
"0.7974873",
"0.7974873",
"0.75523436",
"0.75226176",
"0.7504637",
"0.7319665",
"0.7314684",
"0.7278507",
"0.7187179",
"0.7146972",
"0.7134908",
"0.7088247",
"0.7040954",
"0.7038947",
"0.70106614",
"0.6955816",
"0.6947242",
"0.6890323",
"0.68025786",... | 0.7569212 | 4 |
Replaces url address with "" | def removeURL(text):
text = re.sub('((www\.[^\s]+)|(https?://[^\s]+))','',text)
text = re.sub(r'#([^\s]+)', r'\1', text)
return text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_url(text):\n return re.sub(r'http\\S+', ' ', text)",
"def fix_url(cls, url: str):\r\n ...",
"def replace_urls(text):\n text = re.sub('(?P<url>https?://[^\\s]+)', 'URL', text)\n return text",
"def _fix_url(url):\n\n if not url.startswith('http'):\n url = 'http://' ... | [
"0.7368126",
"0.73346287",
"0.7288253",
"0.72780865",
"0.7239034",
"0.7233785",
"0.72125304",
"0.7167282",
"0.712819",
"0.70591354",
"0.6990988",
"0.69698226",
"0.6965881",
"0.6943929",
"0.69328344",
"0.69201005",
"0.68846107",
"0.6881799",
"0.6870744",
"0.6861691",
"0.685592... | 0.67515975 | 23 |
Test whether the values of the two variables satisfy this constraint. I.e. they are unequal and none of them is None. | def satisfied(self):
if self.var1.get_value() is None or self.var2.get_value() is None:
return False
return self.var1.get_value() != self.var2.get_value() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def consistent(self):\n if self.var1.get_value() is None or self.var2.get_value() is None:\n return True\n\n return self.var1.value != self.var2.value",
"def different_values_constraint(A, a, B, b):\r\n return a != b",
"def are_equal(value1, value2):\n if value1 == None or va... | [
"0.7522352",
"0.6936751",
"0.64573216",
"0.63982296",
"0.6393524",
"0.6193469",
"0.61556596",
"0.6091048",
"0.60448384",
"0.60233563",
"0.6018725",
"0.6015719",
"0.60001034",
"0.5994941",
"0.5994036",
"0.5992229",
"0.59880143",
"0.59744596",
"0.59511423",
"0.59370166",
"0.592... | 0.7880472 | 0 |
Return homogeneous rotation matrix from quaternion. >>> M = quaternion_matrix([0.99810947, 0.06146124, 0, 0]) >>> numpy.allclose(M, rotation_matrix(0.123, [1, 0, 0])) True >>> M = quaternion_matrix([1, 0, 0, 0]) >>> numpy.allclose(M, numpy.identity(4)) True >>> M = quaternion_matrix([0, 1, 0, 0]) >>> numpy.allclose(M, ... | def quaternion_matrix(quaternion):
q = np.array(quaternion, dtype=np.float64, copy=True)
n = np.dot(q, q)
if n < _EPS:
return np.identity(4)
q *= math.sqrt(2.0 / n)
q = np.outer(q, q)
return np.array([
[1.0-q[2, 2]-q[3, 3], q[1, 2]-q[3, 0], q[1, 3]+q[2, 0], 0.0],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quaternion_matrix(quaternion):\r\n q = numpy.array(quaternion, dtype=numpy.float64, copy=True)\r\n n = numpy.dot(q, q)\r\n if n < _EPS:\r\n return numpy.identity(4)\r\n q *= math.sqrt(2.0 / n)\r\n q = numpy.outer(q, q)\r\n return numpy.array([\r\n [1.0-q[2, 2]-q[3, 3], q[1, ... | [
"0.8176703",
"0.77508014",
"0.77371943",
"0.76750696",
"0.7629185",
"0.7474152",
"0.7352647",
"0.7350256",
"0.73472387",
"0.7302246",
"0.7297654",
"0.72916245",
"0.72045976",
"0.71670586",
"0.7166169",
"0.7158307",
"0.71241397",
"0.69924235",
"0.69899726",
"0.6885203",
"0.681... | 0.81266844 | 1 |
Convert a dict into a str according with the format. | def _convert_to_str(self, data):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dict_str(d: dict) -> str:\n\treturn str({str(u): str(v) for u, v in d.items()})",
"def dict2str(d):\n els = ['%s=%s' % (k,v) for k,v in sorted(d.items())]\n return seq2str(els)",
"def _dict_to_string(self, dictionary):\n st = ''\n for i in range(len(dictionary)):\n st = s... | [
"0.7853464",
"0.76915544",
"0.7510587",
"0.73835045",
"0.73617476",
"0.7301429",
"0.7274565",
"0.72485006",
"0.7109382",
"0.70389986",
"0.6938125",
"0.6933378",
"0.6916324",
"0.6895732",
"0.6863117",
"0.6827486",
"0.68206555",
"0.67706454",
"0.6665074",
"0.6655854",
"0.665074... | 0.0 | -1 |
corpus > a sequence of Ngram | def __init__(self, corpus, n, ignore_unigram):
self.corpus = corpus
self.n = n
self.ignore_unigram = ignore_unigram | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ngrams(seq, n):\n return",
"def generate_ngram(corpus,n=2):\r\n def generate_ngram_str(text,n):\r\n text = tokenizer.tokenize(text)\r\n for i in range(0, len(text)-n+1):\r\n yield text[i:i+n]\r\n if isinstance(corpus,str):\r\n for ngram in generate_ngram_str(corpu... | [
"0.7429169",
"0.73828626",
"0.7322935",
"0.7101602",
"0.7089031",
"0.6927202",
"0.68964124",
"0.68951744",
"0.6883546",
"0.68695235",
"0.6866422",
"0.6849745",
"0.68389016",
"0.6835506",
"0.6829065",
"0.6823784",
"0.6819843",
"0.67331564",
"0.6720472",
"0.6718855",
"0.6619507... | 0.672292 | 18 |
Load the pretrained ResNet and replace top fc layer. | def __init__(self, embed_size, sequence_size, encoder_name, n_classes=400, input_size=224, pretrained=True,
mode='rfbdiff', layer_norm=True):
super().__init__()
self.mode = mode
motion_sequence_size = sequence_size
input_channels = 3
if self.mode == "flow":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet18(pretrained=False, **kwargs):\n model = ResNet(BasicBlock, [2, 2, 2, 2], **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet18']))\n fc = transfer_fc(model.fc)\n model.fc = fc\n return model",
"def resnet46(pretrained=False):\n model = Res... | [
"0.6811012",
"0.67155004",
"0.6621989",
"0.6617007",
"0.65557915",
"0.64424235",
"0.6435703",
"0.64266276",
"0.6412902",
"0.6396817",
"0.6364002",
"0.6352301",
"0.6352301",
"0.6352301",
"0.6352301",
"0.6352301",
"0.63310635",
"0.6327962",
"0.6324604",
"0.63218015",
"0.6319623... | 0.0 | -1 |
Start from a very low initial learning rate, then gradually increases it up to a big lr until loss blows up | def find_lr(
self, lr0: float=1e-7, lr_final: float=10.0, warmup: int=15,
beta: float=0.67, verbose: bool=True, display: bool=True, callbacks: Optional[List['Callback']]=None
) -> Tuple[float, float]:
assert warmup > 0
model_state_dict = deepcopy(self.model.state_dict())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate_D(start_lr, optimizer, epoch):\n #lr = start_lr * (0.1 ** (epoch // 30))\n lr = start_lr * (0.3 ** (epoch // 5))\n for param_group in optimizer.param_groups:\n param_group['lr'] = lr",
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #lr = star... | [
"0.7161229",
"0.7145179",
"0.7074516",
"0.69243044",
"0.6874017",
"0.68520033",
"0.68509305",
"0.6804311",
"0.6800852",
"0.67969143",
"0.67872965",
"0.6781752",
"0.6781314",
"0.6769267",
"0.6753761",
"0.67524993",
"0.67513436",
"0.6748471",
"0.6746292",
"0.6740401",
"0.674015... | 0.0 | -1 |
check x is 3dlist([[[1], []]]) or 2d empty list([[], []]) or 1d empty list([]). | def is_3dlist(x):
if not isinstance(x, list):
return False
if len(x) == 0:
return True
for sub_x in x:
if not is_2dlist(sub_x):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_2dlist(x):\n if not isinstance(x, list):\n return False\n if len(x) == 0:\n return True\n\n return all(isinstance(item, list) for item in x)",
"def _is_ragged_in_1st_dim_only(value: Union[np.ndarray, list]) -> bool:\n if isinstance(value, np.ndarray) and value.dtype != np.dtype(\... | [
"0.7362723",
"0.617094",
"0.61675197",
"0.61438113",
"0.6074036",
"0.58569556",
"0.58543783",
"0.58528244",
"0.5845413",
"0.57743174",
"0.5768154",
"0.5654776",
"0.5634541",
"0.5631094",
"0.5625256",
"0.5615522",
"0.56082004",
"0.56069666",
"0.5593049",
"0.55906504",
"0.55785... | 0.83740175 | 0 |
Checks if word exists and returns either True or False. | def _word_exists(self, word):
try:
self.vault[word]
return True
except KeyError:
log('w', 'No vault entry for %s.' % word)
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exists(self, word):\n result = self.find(word)\n return False if result is None else result.is_word",
"def check_word(words, word):\r\n if word in words:\r\n return True\r\n else:\r\n return False",
"def check_word(self, word):\n word = word.lower().strip()\n ... | [
"0.86547995",
"0.82102096",
"0.8009888",
"0.7910883",
"0.7845656",
"0.7803392",
"0.75933236",
"0.7525578",
"0.74714047",
"0.742806",
"0.7388265",
"0.7340481",
"0.72884864",
"0.7287156",
"0.72861063",
"0.7266704",
"0.72548884",
"0.71501285",
"0.71345466",
"0.71182513",
"0.7072... | 0.8113708 | 2 |
Blurring the edge of logo image. 1. blur the whole image. 2. create a mask covering the actual logo, and erode the mask as nonblur part of image. 3. replace the blurred image at mask part with source logo image. | def edge_blur(src, point_list=None):
src = cv2.cvtColor(np.asarray(src), cv2.COLOR_RGBA2BGRA)
src_cp = src[:, :, :3]
src_blur = cv2.GaussianBlur(src_cp, (13, 13), 0)
# src_blur = cv2.GaussianBlur(src,(13,13),0)
idx = np.where(src[:, :, 3] > 15)
mask = np.zeros(src.shape[:2], dtype=np.uint8)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blurImage(self):\n\n print (\"--Blurring Main Image--\")\n self.blurButton.setDown(True)\n im = Image.open(self.ActivePhoto)\n blurred_image = im.filter(ImageFilter.GaussianBlur(1))\n blurred_image.save(self.ActivePhoto)\n self.photo.setPixmap(QtGui.QPixmap(self.Active... | [
"0.67700124",
"0.6544492",
"0.6544492",
"0.6504161",
"0.6428526",
"0.6373834",
"0.63457865",
"0.6328325",
"0.6292298",
"0.62576646",
"0.62189054",
"0.6192302",
"0.6185745",
"0.6184596",
"0.61684376",
"0.6164008",
"0.61238533",
"0.6121264",
"0.610144",
"0.6034971",
"0.60074365... | 0.5934018 | 22 |
virutal the edge of image. Simply blur the alpha channels and keep actual logo region. 1. create a alpha channel and copy blur the alpha copy. 2. create a mask covering the actual logo and erode the mask. 3. replacing the parts in blurred alpha with alpha according the mask region. | def edge_virtual(src, point_list=None):
src = cv2.cvtColor(np.asarray(src), cv2.COLOR_RGBA2BGRA)
alpha = src[:, :, 3]
alpha_blur = cv2.GaussianBlur(alpha, (7, 7), 0)
idx = np.where(alpha > 15)
mask = np.zeros(src.shape[:2], dtype=np.uint8)
mask[idx] = 255
kernel = cv2.getStructuringElement(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enhance_edges(image):\n working_image = image.copy()\n working_image = cv2.cvtColor(working_image, cv2.COLOR_BGR2GRAY)\n # Blur away fine details.\n working_image = cv2.GaussianBlur(working_image, (5, 5), 0)\n return working_image",
"def render_foreground(img: Image) -> Image:\n canvas = Im... | [
"0.6671844",
"0.6474478",
"0.63987243",
"0.6383426",
"0.63737947",
"0.62035346",
"0.6188182",
"0.60482764",
"0.6046845",
"0.6019579",
"0.6004537",
"0.5996884",
"0.5994891",
"0.59862465",
"0.5979857",
"0.5954939",
"0.59415096",
"0.59355277",
"0.59355277",
"0.59309536",
"0.5909... | 0.5973793 | 15 |
Excludes any questions that aren't published yet. | def get_queryset(self):
return Question.objects.filter(pub_date__lte=timezone.now()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n # the filter says that it only returns those w/ the pub_date\n # less or equal to timezone.now() (earlier or now)\n questions = Question.objects.filter(\n pub_date__lte=timezone.now()\n ).order_by('-pub_date')\n\n excludes = []\n for qu... | [
"0.66057587",
"0.6447535",
"0.6222388",
"0.6170101",
"0.6170101",
"0.6101224",
"0.6100283",
"0.6083196",
"0.6055842",
"0.60525465",
"0.5971601",
"0.5893893",
"0.5893893",
"0.5890032",
"0.5882812",
"0.58696455",
"0.58696455",
"0.58696455",
"0.58696455",
"0.58689994",
"0.585721... | 0.62109476 | 13 |
Determine if a repository is a Thunderbird repository. | def is_thunderbird_repo(repo):
try:
if len(repo) and repo[0].hex() == THUNDERBIRD_ROOT_NODE:
return True
except error.FilteredRepoLookupError:
pass
# Backdoor for testing.
return repo.vfs.exists('IS_THUNDERBIRD_REPO') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_git_repo(template_repo):\n return template_repo.startswith(\"git@\") or \\\n template_repo.startswith(\"https://\")",
"def is_git_repo(template_repo):\n return template_repo.startswith(\"git@\") or \\\n template_repo.startswith(\"https://\")",
"def is_docker_hub(repository):\n ret... | [
"0.6485536",
"0.6485536",
"0.63009167",
"0.6284621",
"0.62410414",
"0.62088764",
"0.60371786",
"0.57730424",
"0.57722294",
"0.5746184",
"0.57141906",
"0.5656342",
"0.5609316",
"0.54819727",
"0.54176277",
"0.53619325",
"0.52856714",
"0.5241295",
"0.51687944",
"0.5166422",
"0.5... | 0.8249476 | 0 |
Initialises trie with a root node and root handler | def __init__(self, root_handler=None):
self.root = RouteTrieNode(root_handler) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, handler=None):\n self.root = RouteTrieNode(handler=handler)",
"def __init__(self):\n self.root = self.TrieNode(0)",
"def __init__(self):\n self.root = self.TrieNode(None)",
"def __init__(self):\n self.root=TrieNode()",
"def __init__(self):\n self.root=T... | [
"0.80115473",
"0.78774226",
"0.7809918",
"0.77427226",
"0.77427226",
"0.77102625",
"0.7547998",
"0.75354844",
"0.7342355",
"0.7339628",
"0.73328793",
"0.7313797",
"0.7303609",
"0.7303609",
"0.7302819",
"0.7302819",
"0.7302819",
"0.7302819",
"0.7302819",
"0.7302819",
"0.730281... | 0.81519413 | 0 |
Splits path into its constituent parts | def __split_path(path: str) -> List[str]:
return [part for part in path.split('/') if part] # Splits path at '/', handles extra slashes in the process | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def splitpath(path):\n\n # FIXME perhaps call op.split repetitively would be better.\n #s = string.split( path, '/' ) # we work with fwd slash only inside.\n\n#We have decided to use all kind of separator\n s = []\n while True:\n first, second = op.split(path)\n s.append(second)\n ... | [
"0.8204391",
"0.8174964",
"0.8085845",
"0.8003212",
"0.7822543",
"0.78090787",
"0.7783582",
"0.7781801",
"0.7724184",
"0.7705158",
"0.7695372",
"0.7639305",
"0.76013774",
"0.75980574",
"0.75946397",
"0.75852054",
"0.7545167",
"0.74679285",
"0.73923457",
"0.73623455",
"0.73456... | 0.82463825 | 0 |
Create and return Treasury. | def treasury():
room = Room()
room.name = "Treasury"
""" Set up the game and initialize the variables. """
# Sprite lists
room.wall_list = arcade.SpriteList()
room.item_list = arcade.SpriteList()
# collect pies
# Set up the items
for i in range(10):
# Create the item instan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_treasury_data(path,start,end):\r\n \r\n if start == '01/01/1990':\r\n treasury_data = None\r\n print('no treasury data for this date')\r\n elif int(start.rsplit('/',2)[2]) < 1990:\r\n treasury_data = None\r\n print('no treasury data for this date')\r\n else:\r\n ... | [
"0.54100394",
"0.5274024",
"0.5240068",
"0.52332515",
"0.5171372",
"0.506678",
"0.50582486",
"0.5055193",
"0.50479007",
"0.49994266",
"0.49877214",
"0.4981148",
"0.49650547",
"0.49407914",
"0.49037242",
"0.48880604",
"0.4867174",
"0.48551303",
"0.48395875",
"0.48348832",
"0.4... | 0.0 | -1 |
Gets the number of elements in the data. | def count_data_points(conversation, parse_text, i, **kwargs):
data = conversation.temp_dataset.contents['X']
num_elements = len(data)
parse_op = gen_parse_op_text(conversation)
if len(parse_op) > 0:
description_text = f" where <b>{parse_op}</b>"
else:
description_text = ""
mes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(self):\r\n return self.data_array.size",
"def data_count(self):\n return(len(self.data))",
"def getNumData(self):\n return len(self.data)",
"def size(self):\n ret = 0\n for ii in self.__data:\n ret += int(ii.get_size())\n return ret",
"def getNrEntries(self):\n ... | [
"0.8377622",
"0.8254526",
"0.82347274",
"0.8026508",
"0.79575896",
"0.7782295",
"0.77628374",
"0.7751743",
"0.7732264",
"0.7729267",
"0.770419",
"0.7695821",
"0.76809967",
"0.7639148",
"0.7635148",
"0.7634195",
"0.7634195",
"0.7634195",
"0.7634195",
"0.7634195",
"0.7628831",
... | 0.0 | -1 |
Marks class instance as frozen. | def __post_init__(self) -> None:
setattr(self, _FROZEN, True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def freeze(self,):\n pass",
"def freeze(self):\n raise NotImplementedError()",
"def _Freeze(self) -> None:\n self._SetNodes(_FROZEN_NODE_COUNT)",
"def freeze(self,):\n if self.frozen: return\n\n self.id_lock.acquire()\n #Set logfile to None. Put current logfile into wait... | [
"0.70113003",
"0.6854403",
"0.6634687",
"0.6429866",
"0.6266501",
"0.61127234",
"0.6065183",
"0.6056304",
"0.601558",
"0.6010609",
"0.6010609",
"0.6010609",
"0.6010609",
"0.6010609",
"0.6010609",
"0.6010609",
"0.6010609",
"0.6010609",
"0.6010609",
"0.6010609",
"0.6010609",
... | 0.6708864 | 2 |
Computes the accuracy over the k top predictions for the specified values of k | def accuracy(output, target, topk=(1,)):
with torch.no_grad():
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.reshape(1, -1).expand_as(pred))
res = []
for k in topk:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topk_accuracy(y, y_pred, k=2):\n pred = []\n for i in range(len(y)):\n if y[i] in y_pred[i][:k]:\n pred.append(1)\n else:\n pred.append(0)\n return sum(pred) / len(pred)",
"def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actua... | [
"0.8331214",
"0.8284662",
"0.82381004",
"0.8229767",
"0.82202226",
"0.81864446",
"0.81847763",
"0.8175173",
"0.8171541",
"0.81699467",
"0.81664646",
"0.81645083",
"0.81637454",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"... | 0.7861433 | 76 |
Evaluating knn accuracy in feature space. Calculates only top1 accuracy (returns 0 for top5) | def knn(model, device, val_loader, criterion, args, writer, epoch=0):
model.eval()
features = []
labels = []
with torch.no_grad():
end = time.time()
for i, data in enumerate(val_loader):
images, target = data[0].to(device), data[1]
# compute output
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accuracy(output, target, topk=(1,)):\n maxk = max(topk)\n batch_size = target.size(0)\n #print('output:',output)\n #print('target:',target)\n #print('maxk:',maxk)\n ###TOP 5 NAO EXISTE NAS MAAMAS OU NO GEO. TEM QUE TRATAR\n maxk = 3 # Ignorando completamente o top5\n\n _, pred = output.... | [
"0.7861024",
"0.771958",
"0.7717629",
"0.77164525",
"0.7716179",
"0.7708495",
"0.7707744",
"0.7706846",
"0.7706846",
"0.77021635",
"0.7701117",
"0.7697853",
"0.7694914",
"0.7694914",
"0.7694914",
"0.7694914",
"0.7694914",
"0.7694914",
"0.7694914",
"0.7694914",
"0.7694914",
... | 0.0 | -1 |
Parses a string containing a indexset pattern and returns an IndexSet. | def parse(self, target, pattern):
indexset = IndexSet(target)
return self.read(indexset, pattern, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_range(raw):\n if not raw:\n return None\n\n indices = set()\n try:\n with open(raw, 'r') as f:\n for l in f:\n l = l.strip()\n if len(l) == 0 or l[0] == '#':\n continue\n if \" \" in l:\n ... | [
"0.5334464",
"0.5226054",
"0.5198872",
"0.5191598",
"0.51036763",
"0.50414246",
"0.49094805",
"0.4886336",
"0.4885104",
"0.47790274",
"0.47279197",
"0.47008738",
"0.46219444",
"0.462135",
"0.45989233",
"0.45287374",
"0.45258093",
"0.45004886",
"0.44923663",
"0.44205198",
"0.4... | 0.5955374 | 0 |
Returns true if it OK add the olunteer to this slot as far as experience goes. That is if the other person assigned to the slot is experienced. Only returns false if someone else already assigned to slot and the current volunteer is inexperienced. so seeks to avoid all inexperienced persons at slot. | def experience_match(volunteer, volunteers, slot):
if not volunteer.first_time:
return True
elif slot.type != 'coach2':
return True #Brittle alert. Uses knowledge of the task: that this only matters currently for persons at coach 2
else:
for volunteer2 in volunteers:
for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fully_booked(slots, attendees, user_name):\n if len(attendees) >= 2:\n return False\n else:\n return True",
"def check_if_enough_skill_points(self):\r\n for skill_string in self.__skills:\r\n if (self.__skills[skill_string].points_to_up >\r\n self.__sk... | [
"0.5966585",
"0.58720344",
"0.57698774",
"0.57312316",
"0.5658507",
"0.5489901",
"0.5485378",
"0.5485378",
"0.546458",
"0.54519045",
"0.54474586",
"0.54375637",
"0.5426604",
"0.54058903",
"0.5361417",
"0.5335454",
"0.53330934",
"0.53311485",
"0.5301933",
"0.52844775",
"0.5264... | 0.64037406 | 0 |
check if bullet kills enemy | def kill(self, enemys):
for enemy in enemys:
for bullet in self.bullets:
if enemy.rect.colliderect(bullet.rect):
enemy.take_damage(bullet.power)
if(enemy.hp <= 0):
enemys.remove(enemy)
self.bullets.re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_bullet_cooldown(self):\n time_now = pygame.time.get_ticks()\n if time_now - self.last_bullet_fired >= self.bullet_cooldown:\n self.shoot_disabled = False",
"def is_dead(self, bullet_list):\n enemy_rect = self.get_drawables().get_rect()\n bullet_rects = [bullet.ge... | [
"0.71654177",
"0.70908314",
"0.705061",
"0.7009115",
"0.6786154",
"0.67080456",
"0.6669324",
"0.65762883",
"0.6521095",
"0.6305862",
"0.63049525",
"0.6264556",
"0.6249239",
"0.62274694",
"0.61464405",
"0.61428374",
"0.6124914",
"0.61155367",
"0.6105315",
"0.6089474",
"0.60762... | 0.6648403 | 7 |
Export data to external csv file. | def export(path, data):
os.makedirs(os.path.dirname(path), exist_ok=True)
if isinstance(data, list):
data = np.array(data)
if isinstance(data, np.ndarray):
np.save(path, data)
elif isinstance(data, pd.DataFrame):
data.to_csv(path + '.csv')
elif hasattr(data, '__dict__'):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_csv(self, filename): # DONE\n self.data.to_csv(filename)",
"def export_csv(self):\n outputfile = tkinter.filedialog.asksaveasfilename(\n defaultextension=\".csv\",\n filetypes=((\"comma seperated values\", \"*.csv\"),\n (\"All Files\", \"*.*\")))... | [
"0.79008645",
"0.7876046",
"0.75984704",
"0.7540196",
"0.7514463",
"0.7497576",
"0.7482735",
"0.74797446",
"0.7434177",
"0.74080837",
"0.73143417",
"0.73129934",
"0.7183025",
"0.71750164",
"0.7171378",
"0.71522546",
"0.71522546",
"0.7125868",
"0.7125563",
"0.7123929",
"0.7105... | 0.0 | -1 |
Generate a list sequence of prime numbers | def prime_generator() -> Iterator[int]:
num = 2
while True:
if is_prime(num):
yield num
num += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_primes():\n\tyield 2\n\tyield 3\n\tprime_list = [2, 3]\n\twhile 1:\n\t\tnext = prime_list[-1] + 2\n\t\ti = 0\n\t\twhile i < len(prime_list):\n\t\t\tif next%prime_list[i] == 0:\n\t\t\t\tnext+=2\n\t\t\t\ti=0\n\t\t\telse:\n\t\t\t\ti+=1\n\t\tprime_list.append(next)\n\t\tyield next",
"def sieve(upto):\n re... | [
"0.7810915",
"0.7774648",
"0.77615887",
"0.7761348",
"0.7742106",
"0.75964713",
"0.75673556",
"0.7507845",
"0.7503896",
"0.7501219",
"0.7487869",
"0.74656427",
"0.74589115",
"0.74466044",
"0.744515",
"0.74403936",
"0.7437973",
"0.7401531",
"0.7379557",
"0.7379557",
"0.7378264... | 0.69510895 | 67 |
Random Weight Initializer initializes an array of weights randomly with numbers betwen 1 and 1 Param | def random_weight_init(_p: Perceptron):
_p.weights = [rd.choice([1-rd.random(), -1+rd.random()]) for _ in range(_p.input_size)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def WeightInitializer():\n return np.random.uniform(-1, 1)",
"def weights_initializer(self):\n self.weights = [np.random.normal(0, 1 / np.sqrt(x), (x, y)) for x, y in list(zip(self.structure[1:], self.structure[:-1]))]",
"def default_weight_initializer(self):\n self.biases = [np.random.randn(y... | [
"0.84953207",
"0.81807816",
"0.79619515",
"0.7908796",
"0.7852183",
"0.77809584",
"0.773432",
"0.7730899",
"0.7676583",
"0.7633248",
"0.76114285",
"0.75941163",
"0.7542768",
"0.75197214",
"0.7509652",
"0.74617696",
"0.7455631",
"0.7370203",
"0.73685706",
"0.73684114",
"0.7352... | 0.7793355 | 5 |
Simple Sign function returns 1 if the input is greater or equal to 0, otherwise returns 1 | def sign(num: float):
return 1 if num >= 0 else -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign(x):\n if x >= 0:\n return 1\n else:\n return -1",
"def sign(x):\n if x >= 0:\n return 1\n return -1",
"def sign(a) :\n return (a>0) - (a<0)",
"def sign(a):\n return (a > 0) - (a < 0)",
"def sign(n):\n return (n > 0) - (n < 0)",
"def sign(n: float... | [
"0.8337212",
"0.8331917",
"0.8076697",
"0.79257095",
"0.780409",
"0.7684588",
"0.7639175",
"0.7535404",
"0.74627334",
"0.7416896",
"0.7410498",
"0.72631663",
"0.7165667",
"0.70079464",
"0.69767493",
"0.6917908",
"0.6915701",
"0.678594",
"0.6774612",
"0.6751785",
"0.67247015",... | 0.81088483 | 2 |
Apply ETag and CORS headers to all HTTP responses generated by this blueprint | def after_request(response):
response.headers['Access-Control-Allow-Origin'] = '*'
response.headers['Access-Control-Allow-Methods'] = \
'OPTIONS, HEAD, GET, PUT, POST, DELETE'
response.headers['Access-Control-Allow-Headers'] = \
'authorization, content-type'
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response_headers():\n # Pending swaggerUI update\n # https://github.com/swagger-api/swagger-ui/issues/3850\n headers = MultiDict(request.args.items(multi=True))\n response = jsonify(list(headers.lists()))\n\n while True:\n original_data = response.data\n d = {}\n for key in ... | [
"0.6683652",
"0.6577067",
"0.657232",
"0.6537983",
"0.6509857",
"0.6468428",
"0.6446507",
"0.6387318",
"0.63582194",
"0.63169557",
"0.62713706",
"0.6240311",
"0.62362164",
"0.6234698",
"0.6210513",
"0.6181706",
"0.61773133",
"0.6145452",
"0.61405516",
"0.61084014",
"0.6092534... | 0.6396098 | 7 |
Creates a grid image from a list of tiles. | def build_grid(tiles, tile_size, grid_rows=None, grid_cols=None):
if grid_rows is None or grid_cols is None:
grid_rows = int(math.sqrt(len(tiles)))
grid_cols = int(math.ceil(len(tiles) / grid_rows))
grid = np.zeros(
(grid_rows * tile_size[1], grid_cols * tile_size[0], 3), np.uint8)
for tile_id, tile ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_grid(images, n_rows=4, n_cols=4):\n k = min(n_rows * n_cols, len(images))\n indices = [i for i in range(k)]\n return _create_grid(images, indices, n_rows, n_cols)",
"def createTiles():\n Renderer.Clear()\n map = []\n w, h = len(testmap[0]), len(testmap)\n x, y = 0, 0\n for row ... | [
"0.70259213",
"0.6990671",
"0.6980882",
"0.6948259",
"0.68473595",
"0.6711176",
"0.66005284",
"0.65379393",
"0.6532611",
"0.65262944",
"0.6488695",
"0.64755493",
"0.64710665",
"0.6470593",
"0.6410475",
"0.6399757",
"0.6379704",
"0.6372506",
"0.634613",
"0.634",
"0.63370925",
... | 0.73709124 | 0 |
This function loads pretrained ImageNet weights onto a defined VGG19. | def load_vgg19(model_url):
model = VGG19()
param_names = list(model.state_dict())
model_dict = {k: None for k in param_names}
state_dict = hub.load_state_dict_from_url(model_url)
i = 0
for v in state_dict.values():
model_dict[param_names[i]] = v
i += 1
model.load_state_dic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vgg19(pretrained=False, **kwargs):\n if pretrained:\n kwargs['init_weights'] = False\n model = VGG(make_layers(cfg['E']), **kwargs)\n\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['vgg19'],\n model_dir='../'))\n ... | [
"0.73139536",
"0.7011104",
"0.6953019",
"0.6921812",
"0.6901063",
"0.6887716",
"0.66658145",
"0.6558509",
"0.65049964",
"0.64597994",
"0.6410409",
"0.63636124",
"0.63599277",
"0.6310789",
"0.6306399",
"0.6306022",
"0.62947273",
"0.62714624",
"0.62508434",
"0.62495905",
"0.623... | 0.67208976 | 6 |
Setup 3D projection for window | def on_resize(width, height):
glViewport(0, 0, width, height)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(40, 1.0*width/height, 0.1, 1000.0)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_3D( self ):\r\n # ~ Modes and Flags ~\r\n # Use 'GL_DEPTH_TEST' to ensure that OpenGL maintains a sensible drawing order for polygons no matter the viewing angle\r\n glEnable( GL_DEPTH_TEST ) # Do these setup functions really have to be run every single frame? # TODO: Try moving thes... | [
"0.7262124",
"0.6718136",
"0.6642335",
"0.6417522",
"0.6385091",
"0.63562876",
"0.62895787",
"0.62201834",
"0.6179506",
"0.61635756",
"0.61635756",
"0.61635756",
"0.61579174",
"0.6131828",
"0.6119185",
"0.6086708",
"0.6066355",
"0.60659647",
"0.605472",
"0.6050109",
"0.601386... | 0.0 | -1 |
Determines whether or not the specified value is a numeric type, either integer or float. | def is_number(value):
return isinstance(value, (int, long, float)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_numeric(value):\n return isinstance(value, int) or isinstance(value, float)",
"def is_numeric(val):\n if \\\n isinstance(val, int) or \\\n isinstance(val, float):\n return True\n elif \\\n isinstance(val, str) and \\\n val.isdigit():\n return True\n else:\n return False"... | [
"0.8820602",
"0.7970011",
"0.7925245",
"0.7850405",
"0.7818092",
"0.77298516",
"0.7687284",
"0.7654275",
"0.75871944",
"0.75768054",
"0.75602263",
"0.74946487",
"0.74944764",
"0.7472672",
"0.744229",
"0.7437326",
"0.74366224",
"0.74335366",
"0.7422405",
"0.74064416",
"0.73754... | 0.76036334 | 8 |
Calculates the euclidean distance between the two labels and the predictions. | def distance_metric(y_true, y_pred):
diff = y_true - y_pred
sqr = K.square(diff)
total = K.sum(sqr, axis=1)
return K.sqrt(total) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def LevDistMultilabels(y_true, y_pred):\n \n n = y_pred.shape[0]\n D = 0\n for i in range(n):\n D += LevenshteinDistance(y_pred[i,:], y_true[i,:])[-1, -1]\n return D/n",
"def euclideanDistance(data1, data2):\n distance = 0\n for x in range(14):\n data1[x] = truncate(data1[x], 3... | [
"0.7383842",
"0.7026889",
"0.6977112",
"0.69555247",
"0.6952029",
"0.68401",
"0.6823526",
"0.67569906",
"0.67405534",
"0.67359006",
"0.6658021",
"0.66576433",
"0.6644144",
"0.6634221",
"0.66333306",
"0.6625327",
"0.6588581",
"0.65771985",
"0.6573899",
"0.65667194",
"0.6559554... | 0.7344262 | 1 |
For each label, extract the features from its segment and returns the list with the features from all of them. | def features_from_labels(audio_file, segments):
segments_features = []
#for each segment
for segment in segments:
features = features_from_label(audio_file, segment)
#and append it to the list
segments_features.append(features)
return segments_features | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def features_from_label(audio_file, segment):\n duration = segment['end'] - segment['start']\n audio, sample_rate = librosa.core.load(\n audio_file,\n duration=duration,\n offset=segment['start']\n )\n features = fe.get_features(audio, sample_rate)\n return features",
"def fea... | [
"0.69634634",
"0.656113",
"0.64468277",
"0.63244975",
"0.63244975",
"0.63244975",
"0.6308826",
"0.6191861",
"0.6083943",
"0.60839206",
"0.6039162",
"0.60375446",
"0.5988831",
"0.59702706",
"0.5932434",
"0.59319234",
"0.5916766",
"0.5876143",
"0.58422124",
"0.5826482",
"0.5819... | 0.81941056 | 0 |
Calculation of the threestage floating catchment accessibility ratio, from DataFrames with precomputed distances. | def three_stage_fca(
demand_df,
supply_df,
cost_df,
max_cost,
demand_index="geoid",
demand_name="demand",
supply_index="geoid",
supply_name="supply",
cost_origin="origin",
cost_dest="dest",
cost_name="cost",
weight_fn=None,
normalize=False,
):
# create preference... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculateDistances(df):\n return",
"def compute_distance(df):\n pass",
"def evaluate_percentage_of_class_for_each_flight(df_flights_info):\n df_new = df_flights_info[['FlightId', 'FareClass', 'Booking']]\n df_new = df_new.pivot(index='FlightId', columns='FareClass', values='Booking').astype(flo... | [
"0.6514555",
"0.64703304",
"0.595401",
"0.57895386",
"0.5771122",
"0.57547134",
"0.5754563",
"0.57423955",
"0.57262343",
"0.568908",
"0.56739485",
"0.5670631",
"0.5659746",
"0.5640281",
"0.5616535",
"0.560453",
"0.5602904",
"0.55886614",
"0.55534106",
"0.554699",
"0.5539966",... | 0.0 | -1 |
Whether the interval overlaps the given point, range or Interval. | def overlaps(self, begin, end=None):
if end is not None:
# An overlap means that some C exists that is inside both ranges:
# begin <= C < end
# and
# self.begin <= C < self.end
# See https://stackoverflow.com/questions/3269434/whats-the-most-effic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ranges_overlap(start1, end1, start2, end2):\n return start1 <= end2 and end1 >= start2",
"def overlaps(x1, x2, y1, y2):\n\n return x1 <= y2 and y1 <= x2",
"def contains_interval(self, other):\n return (\n self.begin <= other.begin and\n self.end >= other.end\n )",
... | [
"0.7450774",
"0.72448725",
"0.72238123",
"0.7217159",
"0.721403",
"0.72099704",
"0.71903545",
"0.7162582",
"0.71042466",
"0.704064",
"0.7011865",
"0.6966663",
"0.69630086",
"0.6934209",
"0.69117546",
"0.6827023",
"0.68079567",
"0.6803514",
"0.67905587",
"0.67840844",
"0.67825... | 0.7603803 | 0 |
Whether the Interval contains p. | def contains_point(self, p):
return self.begin <= p < self.end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains(self, p):\n return self.distance(p=p) < self.tolerance",
"def contains(self, p):\n p = base.getvector(p)\n if len(p) == 2:\n p = np.r_[p, 1]\n return base.iszero(self.line * p)",
"def containsPoint(self, p):\n return self.frameGeometry().contains(p)",
... | [
"0.7817759",
"0.7427082",
"0.7307771",
"0.71583736",
"0.70834273",
"0.70834273",
"0.7017026",
"0.6873289",
"0.68610114",
"0.68444407",
"0.6707772",
"0.6675187",
"0.66390264",
"0.65507036",
"0.651224",
"0.6506173",
"0.64738977",
"0.64628136",
"0.642916",
"0.6428434",
"0.64103"... | 0.8188833 | 0 |
Whether the begins equal and the ends equal. Compare __eq__(). | def range_matches(self, other):
return (
self.begin == other.begin and
self.end == other.end
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equals(self, other):\n return (self.start == other.start and self.end == other.end)",
"def __eq__(self, other):\n return self.start == other.start and self.end == other.end",
"def __eq__(self, other):\n return (self.start == other.start and self.end == other.end)",
"def __eq__(self, ... | [
"0.8324873",
"0.82829165",
"0.8235992",
"0.7883903",
"0.78155273",
"0.769224",
"0.755033",
"0.75422394",
"0.75085664",
"0.7382262",
"0.73692536",
"0.7351881",
"0.73157984",
"0.72711235",
"0.72664964",
"0.72664964",
"0.7192009",
"0.7192009",
"0.7176195",
"0.7170465",
"0.716870... | 0.0 | -1 |
Whether this equals the null interval. | def is_null(self):
return self.begin >= self.end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_null(self):\n return self.value is None",
"def is_null(self):\n return self.length2 < pygonal.EPSILON2",
"def is_null(self) -> bool:\n return self.allele1 == -1 and self.allele2 == -1",
"def is_null(self) -> bool:\n for y in range(0, self.num_of_rows):\n for x in... | [
"0.7243578",
"0.70753247",
"0.7025592",
"0.7005975",
"0.69593084",
"0.673967",
"0.67244315",
"0.67244315",
"0.67244315",
"0.67244315",
"0.67244315",
"0.671538",
"0.6705342",
"0.6700119",
"0.6637087",
"0.66299367",
"0.66105014",
"0.657015",
"0.65618104",
"0.6559858",
"0.642357... | 0.774378 | 0 |
The distance covered by this Interval. | def length(self):
if self.is_null():
return 0
return self.end - self.begin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(self):\n return self._distance",
"def _distance_covered(self):\n\n # Calculation of distance traveled compared to the previous point\n self.gap = math.sqrt((self.x - self.x_ant)**2\n + (self.y - self.y_ant)**2)\n\n self.x_ant = self.x\n ... | [
"0.7392355",
"0.73684525",
"0.7051579",
"0.69804794",
"0.69793993",
"0.6828439",
"0.6747621",
"0.6747621",
"0.6747621",
"0.6747621",
"0.6747621",
"0.6747621",
"0.6747621",
"0.6731186",
"0.6661583",
"0.66497314",
"0.6642946",
"0.6624956",
"0.6599536",
"0.6582651",
"0.65807444"... | 0.0 | -1 |
Strictly less than. Returns True if no part of this Interval extends higher than or into other. | def lt(self, other):
self._raise_if_null(other)
return self.end <= getattr(other, 'begin', other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lower_contains_interval(self, other):\n if not self.contains_interval(other):\n return False\n for (i, j) in other.decreasing_cover_relations():\n if not self.le(i, j):\n return False\n return True",
"def __lt__(self, other):\n return self <= o... | [
"0.7944911",
"0.75660753",
"0.7447035",
"0.7352023",
"0.7352023",
"0.73056626",
"0.7252079",
"0.72477645",
"0.72130007",
"0.72061926",
"0.7148701",
"0.7129769",
"0.7129769",
"0.7092339",
"0.7083568",
"0.7079827",
"0.70707583",
"0.70707583",
"0.70650065",
"0.70585513",
"0.7053... | 0.6921718 | 32 |
Less than or overlaps. Returns True if no part of this Interval extends higher than other. | def le(self, other):
self._raise_if_null(other)
return self.end <= getattr(other, 'end', other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lower_contains_interval(self, other):\n if not self.contains_interval(other):\n return False\n for (i, j) in other.decreasing_cover_relations():\n if not self.le(i, j):\n return False\n return True",
"def upper_contains_interval(self, other):\n ... | [
"0.78417975",
"0.7763183",
"0.7758505",
"0.7757606",
"0.7726597",
"0.7676218",
"0.7533597",
"0.73393947",
"0.73230696",
"0.7305834",
"0.72713095",
"0.7244353",
"0.7232609",
"0.715858",
"0.715858",
"0.711619",
"0.71111834",
"0.7103568",
"0.70883614",
"0.70755786",
"0.7058517",... | 0.6398206 | 92 |
Greater than or overlaps. Returns True if no part of this Interval extends lower than other. | def ge(self, other):
self._raise_if_null(other)
return self.begin >= getattr(other, 'begin', other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lower_contains_interval(self, other):\n if not self.contains_interval(other):\n return False\n for (i, j) in other.decreasing_cover_relations():\n if not self.le(i, j):\n return False\n return True",
"def upper_contains_interval(self, other):\n ... | [
"0.8123772",
"0.8018592",
"0.7658814",
"0.7657782",
"0.7559422",
"0.7545664",
"0.74623996",
"0.73954064",
"0.7209262",
"0.72028774",
"0.71972144",
"0.71972144",
"0.7183714",
"0.718001",
"0.7157911",
"0.71233785",
"0.7122133",
"0.7112735",
"0.7085074",
"0.70646673",
"0.6996404... | 0.66040057 | 47 |
Split an s3 uri into the bucket and object name | def split_uri(s3_uri):
if not s3_uri.startswith("s3://"):
# This is a local path, indicate using None
raise ValueError(f"failed to parse s3 uri: {s3_uri}")
bucket, key = s3_uri.split("s3://")[1].split("/", 1)
return bucket, key | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_uri(uri):\n if not uri.startswith(\"s3://\"):\n raise ValueError(\"Expected S3 URI\")\n\n bucket_name, key = uri.replace(\"s3://\", \"\").split(\"/\", 1)\n return bucket_name, key",
"def split_s3_path(url):\n\tparsed = urlparse (url)\n\tif not parsed.netloc or not parsed.path:\n\t\trais... | [
"0.84234256",
"0.79439884",
"0.78763926",
"0.78763926",
"0.767611",
"0.76380134",
"0.7330717",
"0.71763176",
"0.69720215",
"0.69384485",
"0.69290155",
"0.6860623",
"0.6848078",
"0.674747",
"0.65667576",
"0.6564563",
"0.63594395",
"0.635297",
"0.6327186",
"0.630025",
"0.629873... | 0.83376247 | 1 |
Converts a first or second level batch to human readable | def first_or_second_level_to_human_readable(batch):
job_level_batches = db.get_child_batch_metadata(
batch[Attributes.BATCH_ID], BatchMetadataType.JOB_LEVEL
)
job_responses = [
job_level_to_human_readable(job_level_batch) for job_level_batch in job_level_batches
]
return {
"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input_batch_to_human_readable(batch):\n\n # User should only be querying for parent batches of type \"INPUT\", not frame\n # level batches.\n if batch[Attributes.BATCH_METADATA_TYPE] != BatchMetadataType.INPUT:\n logger.error(\n \"User requested existing batch, but it is of the wrong... | [
"0.7052451",
"0.6277633",
"0.6207949",
"0.59580165",
"0.5956875",
"0.56889665",
"0.5668856",
"0.5634892",
"0.5634892",
"0.5634892",
"0.55901664",
"0.55360013",
"0.549158",
"0.5428135",
"0.5394302",
"0.5389692",
"0.53437525",
"0.53286153",
"0.5324247",
"0.5321802",
"0.52739024... | 0.7289912 | 0 |
strips all whitespace from a string | def remove_whitespace(text):
# type (str) -> str
if text is None:
return ""
return "".join(text.split()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trim_whitespace(str):\n return str.strip()",
"def _clean(s):\n return re.sub(r'\\s+', ' ', s.strip())",
"def _clean(self, string):\n return re.sub('\\s+', ' ', string).strip()",
"def strip_space(string):\n return string.replace(' ', '')",
"def space_strip(string):\n string= r... | [
"0.8742746",
"0.85726047",
"0.8514521",
"0.84255403",
"0.8333356",
"0.8329239",
"0.82323754",
"0.82323754",
"0.8212639",
"0.80750555",
"0.8071841",
"0.8051658",
"0.78290564",
"0.78236127",
"0.77796584",
"0.7687632",
"0.7665496",
"0.76565623",
"0.76445335",
"0.75834715",
"0.75... | 0.7701834 | 15 |
Gets the direction to the left of the car, from the perspective of the direction that the car is facing. E.g., if the car is facing UP, this will return LEFT, and if it's facing DOWN, this will return RIGHT | def get_direction_to_left(self, direction):
return direction_to_left[direction] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def directionLeft(self):\n return self.__directionLeft",
"def turn_left(self):\n self.facing_direction -= self.config\n if self.facing_direction < 0:\n self.facing_direction += 8\n self.x, self.y = self.compute_positions()",
"def get_left(self):\n return -self.l_mo... | [
"0.7663516",
"0.73489416",
"0.71305645",
"0.69870096",
"0.6913713",
"0.68939495",
"0.68638486",
"0.68636286",
"0.6823035",
"0.6767186",
"0.6711137",
"0.6702193",
"0.6595132",
"0.6579246",
"0.6517725",
"0.6501973",
"0.6487817",
"0.6425401",
"0.64018047",
"0.6377863",
"0.636999... | 0.76009375 | 1 |
r"""Returns date object if parsed date is in future, otherwise raises error | def ymdate(string):
try:
date = datetime.datetime.strptime(string,"%Y-%m-%d")
today = datetime.datetime.today()
today = today.replace(hour=0,minute=0,second=0)
if(date >= today):
return date
else:
raise argparse.ArgumentTypeError("%s is not fut... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_date_not_in_future(self, date):\n if date is None:\n pass\n else:\n assert (\n date <= datetime.datetime.now()\n ), \"Provided date cannot be in the future\"",
"def test_validate_date_entry_returns_correct_outOfBounds_if_future(self):\n ... | [
"0.686091",
"0.65784186",
"0.643042",
"0.6375988",
"0.6305772",
"0.63049906",
"0.6235764",
"0.6222578",
"0.6048042",
"0.60270596",
"0.5947087",
"0.5937667",
"0.5924745",
"0.5903828",
"0.58875686",
"0.58380574",
"0.5826963",
"0.5818195",
"0.5803635",
"0.58022845",
"0.5788929",... | 0.5558157 | 34 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.