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
Convert a 1d array of cluster assignments into a binary clustering matrix format.
def convert_codes_to_csc_matrix(codes, depth): nr_codes = 1 << depth nr_elements = len(codes) indptr = np.cumsum(np.bincount(codes + 1, minlength=(nr_codes + 1)), dtype=np.uint64) indices = np.argsort(codes * np.float64(nr_elements) + np.arange(nr_elements)) C = smat_util.csc_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjacency_matrix(cluster_pred):\n #print('adjacency start')\n x = cluster_pred.copy()\n if(len(x.shape) == 1):\n x = x[:, np.newaxis]\n # Force the cluster indexing to be positive integers\n if(x.min() <= 0):\n x += -x.min() + 1\n\n A = np.dot(x**-1., x.T) == 1\n #print('adja...
[ "0.5944641", "0.58824354", "0.5776835", "0.5450348", "0.53823674", "0.5348318", "0.53395844", "0.53218985", "0.53201497", "0.531528", "0.5293228", "0.5291523", "0.5237126", "0.52305835", "0.52202624", "0.5193246", "0.5193092", "0.51650304", "0.51632756", "0.5118175", "0.51015...
0.0
-1
Get the PostProcessor instance from name.
def get(cls, name): cls.initialize() if isinstance(name, cls): return name else: return cls.mapping[name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_postprocessor(self) -> Optional[Postprocessor]:\n\n if self.lvp == LVP.COBOL_TO_CSHARP_9:\n return COBOLToCSharp9Postprocessor(self.itl)\n\n return Postprocessor()", "def get_instance(self, name):\n klass = self.get_class(name)\n return klass()", "def get_prepro...
[ "0.60957783", "0.6073131", "0.60189795", "0.6015558", "0.5971188", "0.58620197", "0.57180065", "0.57180065", "0.5665293", "0.56478566", "0.56100184", "0.560695", "0.5492398", "0.5425049", "0.54160684", "0.54078543", "0.5396875", "0.5375093", "0.53543603", "0.5339036", "0.5290...
0.53907084
17
The number of clusters.
def nr_codes(self): return self.C.shape[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_clusters(self):\n return len(self.clusters)", "def n_clusters(self):\n return self.model.n_clusters", "def get_cluster_count(self) -> int:\n return len(self.get_all_cluster_ids())", "def cluster_count(self) -> int:\n cluster_count = max(1, round(16**3 * (self.vein.purity / 1...
[ "0.90770864", "0.8770899", "0.8740967", "0.85587204", "0.79343665", "0.7782609", "0.7593966", "0.754406", "0.75056577", "0.74485517", "0.7431507", "0.74101084", "0.73721766", "0.72819096", "0.7266387", "0.7247217", "0.7159796", "0.7137192", "0.71235263", "0.7120876", "0.71100...
0.0
-1
Create label embedding by doing convexcombination of pifa embedding and existing label embedding. To use this function, Input feature (X) dimension should be the same as existing label feature (Z) dimension.
def pifa_lf_convex_combine(Y, X, Z, alpha=0.5, threads=-1, normalized_Y=True): if X.shape[1] != Z.shape[1]: raise ValueError( f"X and Z should have same dimension to do convex combination. {X.shape[1]}!={X.shape[1]}." ) if isinstance(alpha, np.ndarray): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pifa_lf_concat(Y, X, Z, threads=-1, normalized_Y=True):\n\n pifa = LabelEmbeddingFactory.pifa(Y, X, threads=threads, normalized_Y=normalized_Y)\n if not isinstance(pifa, (smat.csr_matrix, np.ndarray)) or not isinstance(\n Z, (smat.csr_matrix, np.ndarray)\n ):\n raise ...
[ "0.57877356", "0.5531563", "0.5423148", "0.5339438", "0.53028643", "0.52179", "0.5179449", "0.51564217", "0.5142913", "0.51412994", "0.51360196", "0.5126329", "0.5116066", "0.5088218", "0.50796896", "0.50665027", "0.505623", "0.50417304", "0.5040875", "0.50404876", "0.5028736...
0.62399524
0
The end date of the current term
def end_date(self) -> Optional[str]: return pulumi.get(self, "end_date")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_date(self) -> str:\n return pulumi.get(self, \"end_date\")", "def end_date(self) -> str:\n return pulumi.get(self, \"end_date\")", "def end_date(self):\n return self.__end_date", "def end_date(self):\n return self._end_date", "def end_date(self):\n return self._en...
[ "0.8014741", "0.8014741", "0.7927234", "0.78036445", "0.78036445", "0.78036445", "0.77622783", "0.75670964", "0.75133187", "0.7305878", "0.72916895", "0.7013241", "0.69441676", "0.69337654", "0.6813395", "0.6737494", "0.6737494", "0.6670866", "0.6643577", "0.6623826", "0.6601...
0.7624856
7
The start date of the current term
def start_date(self) -> Optional[str]: return pulumi.get(self, "start_date")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_start_date(self):\n return \"%d%02d\" % (self.year, self.term)", "def start_date(self) -> str:\n return pulumi.get(self, \"start_date\")", "def start_date(self) -> str:\n return pulumi.get(self, \"start_date\")", "def start_date(self):\n return self.__start_date", "def s...
[ "0.8313013", "0.77163315", "0.77163315", "0.7669511", "0.7624826", "0.75638956", "0.75638956", "0.75638956", "0.75638956", "0.7483072", "0.7297139", "0.7262415", "0.716523", "0.7146404", "0.7104689", "0.70259964", "0.6978446", "0.696415", "0.6856978", "0.6804855", "0.6799373"...
0.72893286
11
The created date of this resource.
def created(self) -> str: return pulumi.get(self, "created")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def created_date(self):\n return self._created_date", "def created_date(self):\n return self._created_date", "def date_created(self):\n return self._date_created", "def date_created(self):\n return self._date_created", "def date_created(self):\n return self._date_created"...
[ "0.8752678", "0.8752678", "0.8514051", "0.8514051", "0.8514051", "0.84255594", "0.83635926", "0.83635926", "0.83635926", "0.8300944", "0.8245852", "0.82184666", "0.8198086", "0.813445", "0.8043646", "0.8043646", "0.79941124", "0.7802316", "0.7742131", "0.77390605", "0.7710792...
0.7867446
18
Whether the ProfessionalService subscription will auto renew upon term end.
def auto_renew(self) -> Optional[bool]: return pulumi.get(self, "auto_renew")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_renewal(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"enable_renewal\")", "def auto_renew(self) -> pulumi.Output[Optional[bool]]:\n return pulumi.get(self, \"auto_renew\")", "def auto_renew(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"a...
[ "0.7418297", "0.7314621", "0.7263111", "0.7263111", "0.6769483", "0.65011126", "0.6419326", "0.6162644", "0.6084027", "0.60409683", "0.60080487", "0.5987263", "0.59204906", "0.5907228", "0.5893116", "0.5887998", "0.5840166", "0.5812856", "0.5787807", "0.5710325", "0.56988174"...
0.7660485
0
The Payment channel for the ProfessionalServiceSubscription.
def payment_channel_type(self) -> Optional[str]: return pulumi.get(self, "payment_channel_type")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def channel(self) -> 'Channel': # stub\n return self._channel", "def getChannel(self):\r\n return self.channel", "def channel(self):\n if not hasattr(self, '_channel'):\n self._channel = self.new_channel()\n return self._channel", "def channel(self):\n return se...
[ "0.61375487", "0.61137915", "0.6095195", "0.6064248", "0.6064248", "0.6060338", "0.60300255", "0.5991423", "0.5962759", "0.5948172", "0.58050066", "0.57658273", "0.57658273", "0.5711671", "0.5691761", "0.56885844", "0.5660841", "0.56378996", "0.5581936", "0.5581936", "0.55819...
0.63715065
0
The quote id which the ProfessionalService will be purchase with.
def quote_id(self) -> Optional[str]: return pulumi.get(self, "quote_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order_id(self) -> str:\n return pulumi.get(self, \"order_id\")", "def product_id(self):\n return self._product_id", "def product_id(self):\n return self._product_id", "def product_id(self):\n return self._product_id", "def product_id(self):\n return self._product_id",...
[ "0.64345473", "0.61856604", "0.61856604", "0.61856604", "0.61856604", "0.6106804", "0.5992978", "0.5960804", "0.58486474", "0.584414", "0.5833194", "0.5833194", "0.58055466", "0.58055466", "0.58055466", "0.58055466", "0.58055466", "0.58055466", "0.58055466", "0.58055466", "0....
0.82456964
0
The ProfessionalService Subscription Status.
def status(self) -> Optional[str]: return pulumi.get(self, "status")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_service_status(self):\n return self.service.status()", "def get_status(self):\n\t\treturn call_sdk_function('PrlLic_GetStatus', self.handle)", "async def status(ctx):\n redis = await RedisDB.create()\n user = ctx.message.author\n try:\n subscription_id = await get_subscription_id...
[ "0.6869046", "0.6556913", "0.6547009", "0.6528922", "0.6309315", "0.62895375", "0.62541044", "0.62502533", "0.62355095", "0.6233977", "0.62305117", "0.62305117", "0.62305117", "0.62093824", "0.6191496", "0.61901534", "0.61901534", "0.61895096", "0.61771303", "0.61726195", "0....
0.0
-1
Get the default config path for experiments.
def get_config_filepath(config: configs.Config) -> str: return os.path.join(config.model_training.dir_out, configs.DEFAULT_FILENAME_CONFIG)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_config_file(self):\n return DEFAULT_CONFIG_FILEPATH", "def get_default_config(self):\n return config.read(pathlib.Path(__file__).parent / \"ext.conf\")", "def get_default_config_file() -> Path:\n return get_path_to_pyflow() / \"pyflow\" / \"conf\" / CONFIG_FILE", "def getConfigPa...
[ "0.7820701", "0.75383955", "0.75244564", "0.7482554", "0.7299632", "0.72946477", "0.7243117", "0.72027284", "0.71528786", "0.7136344", "0.71099794", "0.71000916", "0.7093821", "0.70760745", "0.69760495", "0.6910145", "0.6893281", "0.6893019", "0.6873742", "0.6823642", "0.6815...
0.70989406
12
Get the default model training history path for experiments.
def get_history_filepath(config: configs.Config) -> str: return os.path.join(config.model_training.dir_out, histories.DEFAULT_FILENAME_HISTORY)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_history_path(spec_name):\n return root_location + \"specialists/\" + model_name(spec_name) + \"/train_history\"", "def get_history_filepath():\n try:\n user_fp = os.environ[HISTORY_FILE_ENVAR]\n return os.path.expanduser(user_fp)\n except KeyError:\n return os.path.expandu...
[ "0.6973911", "0.6490478", "0.6180203", "0.60814", "0.60081", "0.59983665", "0.5982291", "0.5898837", "0.5891037", "0.5872718", "0.58373094", "0.583178", "0.5786342", "0.57520497", "0.5749846", "0.5748232", "0.5734844", "0.5715807", "0.57089585", "0.56987476", "0.56987476", ...
0.7542328
0
Get the default model path for experiments.
def get_model_filepath(config: configs.Config) -> str: return os.path.join(config.model_training.dir_out, models.DEFAULT_FILENAME_MODEL)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model_path():\n misc_path = pkg_resources.resource_filename('sst', 'misc/')\n return os.path.abspath(os.path.join(misc_path, 'model.pickle'))", "def _get_default_path(self):\n return os.path.join(cfg.ROOT_DIR, 'data', 'KITTI')", "def _get_default_path(self):\n return os.path.join(cfg.DA...
[ "0.73609257", "0.711327", "0.706814", "0.69689775", "0.6921504", "0.6881273", "0.6844046", "0.679698", "0.679698", "0.6777568", "0.6761588", "0.66798484", "0.66459346", "0.6603538", "0.6597902", "0.6594425", "0.6500211", "0.6453417", "0.6451742", "0.6407781", "0.6392173", "...
0.73120934
1
The SymPy Wigner 3j form of the expression. It may not be the same as the original one if mutation happened.
def expr(self): args = [] for i in self.indices: args.extend((i.j, i.m)) return Wigner3j(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exp_so3(W):\n theta = np.sqrt(W[2][1]**2 + W[0][2]**2 + W[1][0]**2)\n return np.eye(3) + np.sin(theta)/theta*W + (1-np.cos(theta))/(theta**2)*np.dot(W, W)", "def _mat3(self):\n if self.frame.orientation == HillFrame.DEFAULT_ORIENTATION:\n return np.identity(3)\n else:\n ...
[ "0.6194117", "0.5986359", "0.5873323", "0.5816163", "0.57903767", "0.5741107", "0.5604622", "0.55811805", "0.55420655", "0.5525014", "0.5474543", "0.54699546", "0.54216194", "0.54023105", "0.5389347", "0.5364736", "0.53354955", "0.53272015", "0.5309751", "0.5298262", "0.52816...
0.6326948
0
Project out the components of the vector on the given bases. The bases are assumed to be orthogonal, not necessarily normalized.
def _proj_out(bases, vec): for i in bases: vec -= vec.project(i) return vec
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_vectors(self, vectors):\n X = vectors - self._mean\n return np.dot(X, self.components.T)", "def project_vectors(self, vectors):\n return np.dot(vectors, self.components.T)", "def parallel_component(self, basis: Vector) -> Vector:\n b_norm = basis.normalize()\n ret...
[ "0.6590692", "0.65152144", "0.60111266", "0.59600186", "0.5843495", "0.576913", "0.5752058", "0.5752058", "0.57068765", "0.56684464", "0.5656666", "0.56137633", "0.5591189", "0.55321616", "0.5510458", "0.54859984", "0.54766124", "0.54664105", "0.5438712", "0.5433287", "0.5432...
0.730592
0
return a^k mod n
def ModExpo(a, k, n): ret = 1 while k > 0: if k % 2: ret = ret * a % n k //= 2 a = (a * a) % n return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ModExp(n, k, m):\n a = list(bin(k))[2:]\n a.reverse()\n s = 1\n for i in a:\n if i == '1':\n s = (s * n) % m\n n = (n * n) % m\n return s", "def kth_root_modulo(a, k, n):\n # x = g^y => x^k = (g^k)^y = a\n # => y = log_{g^k} a (mod n)\n g = primitive_root(n)\n...
[ "0.7949561", "0.77885807", "0.7624659", "0.73468274", "0.72925013", "0.72891295", "0.7229456", "0.71995234", "0.71661806", "0.71565515", "0.708678", "0.70707726", "0.7066294", "0.7061343", "0.7058341", "0.7046603", "0.70336837", "0.7025398", "0.701398", "0.6968092", "0.696574...
0.8530872
0
return whether n is a quadratic residue modulo prime p or not
def isQuadRes(n, p): if ModExpo(n, (p-1)//2, p) == 1: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_circular_prime(n):\r\n\r\n # pdb.set_trace()\r\n s = str(n)\r\n for i in xrange(len(s)):\r\n if not is_prime(n):\r\n return False\r\n s = s[1:] + s[0]\r\n n = int(s)\r\n\r\n return True", "def is_pentagonal_number(n):\n _, x = quadratic.solve(3, -1, -2 * n)\n...
[ "0.73027486", "0.72157884", "0.7104419", "0.70687497", "0.70469683", "0.70250696", "0.7001637", "0.7001637", "0.698179", "0.69503385", "0.6945682", "0.6938788", "0.69155365", "0.6899548", "0.68993956", "0.68970287", "0.6896934", "0.6884099", "0.6884094", "0.68836313", "0.6881...
0.774607
0
return the smaller square root of a modulo prime p
def ModSqrt(a, p): a = a % p for x in range(p // 2 + 1): if x * x % p == a: return x return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modular_sqrt(a, p):\n\tif legendre_symbol(a, p) != 1:\n\t\treturn 0\n\telif a == 0:\n\t\treturn 0\n\telif p == 2:\n\t\treturn p\n\telif p % 4 == 3:\n\t\treturn pow(a, (p + 1) // 4, p)\n\ts = p - 1\n\te = 0\n\twhile s % 2 == 0:\n\t\ts //= 2\n\t\te += 1\n\tn = 2\n\twhile legendre_symbol(n, p) != -1:\n\t\tn += 1\...
[ "0.73739314", "0.7368131", "0.7306269", "0.7259706", "0.72322303", "0.7186032", "0.686091", "0.6841745", "0.6790579", "0.6784048", "0.6754891", "0.6744396", "0.6726701", "0.6676071", "0.66648", "0.66332537", "0.66182226", "0.6617929", "0.6605412", "0.65917844", "0.6585745", ...
0.8091769
0
return the reverse of a modulo n
def ModRev(a, n): _n = n r = a % _n Q = [] while r: Q.append(a // _n) a = _n _n = r r = a % _n if _n != 1: return None x, y = 0, 1 while Q: t = x x = y y = t - Q.pop() * y return x % n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invmod(b,n):\r\n\treturn inverse_mod(b,n)", "def reverse_slice(n):\n return n[::-1]", "def invmod(b,n):\n\treturn inverse_mod(b,n)", "def mod_inverse(a, n):\n b = n\n if abs(b) == 0:\n return (1, 0, a)\n\n x1, x2, y1, y2 = 0, 1, 1, 0\n while abs(b) > 0:\n q, r = divmod(a, b)\...
[ "0.7425303", "0.7418317", "0.738211", "0.70105183", "0.6999461", "0.69878596", "0.6958133", "0.6955689", "0.6868598", "0.6706933", "0.6609888", "0.6527904", "0.65250224", "0.6491127", "0.6487782", "0.6414331", "0.6414331", "0.6400787", "0.63076913", "0.6305666", "0.6305666", ...
0.8121986
0
Returns rightjoin ratio IOU (not original IOU) Usually box1 would be bucket and box2 can be either Wear Area or MatInside
def bbox_iou_right_join(box1, box2): intersect_w = _interval_overlap([box1.xmin, box1.xmax], [box2.xmin, box2.xmax]) intersect_h = _interval_overlap([box1.ymin, box1.ymax], [box2.ymin, box2.ymax]) intersect = intersect_w * intersect_h w1, h1 = box1.xmax - box1.xmin, box1.ymax - box1.ymin w2, h2 = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wh_iou(box1, box2):\n box2 = box2.t()\n\n # w, h = box1\n w1, h1 = box1[0], box1[1]\n w2, h2 = box2[0], box2[1]\n\n # Intersection area\n inter_area = torch.min(w1, w2) * torch.min(h1, h2)\n\n # Union Area\n union_area = (w1 * h1 + 1e-16) + w2 * h2 - inter_area\n\n return inter_area ...
[ "0.69589484", "0.6741285", "0.6672911", "0.6650604", "0.6644824", "0.6644824", "0.6635925", "0.662128", "0.657864", "0.6395771", "0.6370578", "0.6360169", "0.6336198", "0.63202405", "0.62936884", "0.62620956", "0.62080824", "0.61978775", "0.61811954", "0.6167579", "0.6127999"...
0.75182194
0
Removes bboxes of wrong area or aspect ratio.
def filter_wrong_sizes(bboxes, image_size, min_area_thresholds, max_area_thresholds, min_aspect_ratios, max_aspect_ratios): image_w, image_h = image_size, image_size filtered_bboxes = [] for bbox in bboxes: class_ind = bbox.get_label() class_string = ind_to_label[class_ind] min_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _resize_bboxes(self, results):\n for key in results.get('bbox_fields', []):\n bboxes = results[key] * results['scale_factor']\n if self.bbox_clip_border:\n img_shape = results['img_shape']\n bboxes[:, 0::2] = np.clip(bboxes[:, 0::2], 0, img_shape[1])\n...
[ "0.68065894", "0.68065894", "0.6722607", "0.6614308", "0.6477159", "0.6414996", "0.638873", "0.6333079", "0.6279583", "0.61603", "0.6112518", "0.60392505", "0.59928364", "0.5968961", "0.5945603", "0.59403706", "0.59392303", "0.59348387", "0.59313625", "0.5927118", "0.59164476...
0.7133185
0
Selects margins in pixels to select for detections. Uses intertooth distances.
def get_patch_margins_intertooth(boxes, image_w=640, image_h=640, x_factor=1.3, y_bottom_factor=3.): boxes_in_pixels = [] for box in boxes: if box.get_label() == 0: xmin, xmax, ymin, ymax = convert_bbox_coords_to_pixels(box, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def margin(self) -> Tuple[int, int, int, int]:\n return (self.imargin[0].to_pixels(self.parent.width),\n self.imargin[1].to_pixels(self.parent.width),\n self.imargin[2].to_pixels(self.parent.height),\n self.imargin[3].to_pixels(self.parent.height))", "def margi...
[ "0.6110076", "0.5917967", "0.5810448", "0.57009494", "0.56659496", "0.5631988", "0.54503363", "0.5413209", "0.53923327", "0.522617", "0.52062994", "0.5177018", "0.5124165", "0.51230377", "0.5098288", "0.50958157", "0.50889736", "0.5087846", "0.50690097", "0.5063675", "0.50126...
0.5871274
2
Get patches of objects where each patch should include a tooth and corresponding WM landmarks below it.
def get_tooth_wm_patches(image, boxes, patch_h, patch_w, num_teeth, patch_selection_method="toothline"): image_h, image_w, _ = image.shape patches = [] patch_coords = [] coord_scales = [] tooth_tips_from_det = [] if patch_selection_method == "intertooth": x_margi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_patches(self):\n patches = []\n for x, counter in enumerate(self.counters):\n y1 = 1\n for c, n in counter.most_common():\n y0 = y1 - n / self.num_keys\n glyph_1 = Glyph(c[0], 2 * self.space_between_glyphs * x, y0, y1,\n ...
[ "0.62231636", "0.6170488", "0.6080191", "0.60318565", "0.587059", "0.5869357", "0.5863246", "0.5862629", "0.5826907", "0.58078605", "0.5785377", "0.57516426", "0.57330334", "0.56712705", "0.566753", "0.5640151", "0.5613234", "0.5548319", "0.5533929", "0.5522306", "0.5521519",...
0.63257545
0
Normalize all elements in a vector or matrix This operation is done by dividing each row vector of x by its norm, i.e., x / || x || After the operation each row of x should be a vector of unit length.
def normalize(data: np.ndarray, axis=0, order=2) -> tuple[np.ndarray, np.ndarray]: norms = np.linalg.norm(data, ord=order, axis=axis, keepdims=True) return ( data / norms, norms, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(x):\n\n x_norm = np.linalg.norm(x, axis=1, keepdims=True)\n print(x_norm)\n x = x / x_norm\n ### END\n\n return x", "def normalizerows(x):\n # Compute x_norm as the norm 2 of x. Use np.linalg.norm(..., ord=2, axis= ..., keepdims=True)\n x_norm = np.linalg.norm(x, ord=2, axis=1,...
[ "0.80641246", "0.79652774", "0.79223174", "0.79193467", "0.774033", "0.7732043", "0.768047", "0.7616763", "0.76163095", "0.7613469", "0.76076937", "0.7600002", "0.7574053", "0.75378436", "0.75070626", "0.7477457", "0.74730444", "0.74645746", "0.7448027", "0.74289113", "0.7365...
0.0
-1
Unit test app ``core`` model ``Location`` 2.1 Test that location is a location.
def test_location_is_location_instance(self): self.assertIsInstance(self.location, Location)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_location(self):\n location = self.location\n\n self.assertTrue(isinstance(location, Location))\n self.assertEqual(location.name, \"Test Location\")", "def test_training_location(self):\n self.assertIsInstance(self.one_off_training.location, Location)\n self.asse...
[ "0.85598594", "0.78179574", "0.7669402", "0.75165844", "0.7507073", "0.7471748", "0.7461896", "0.74058753", "0.7382494", "0.7347911", "0.7293281", "0.72910255", "0.7228694", "0.7217437", "0.7025329", "0.6971885", "0.6951858", "0.69301045", "0.68527937", "0.68214864", "0.67967...
0.8313768
1
Create and save a bar graph representing the count of police deaths for each year The xaxis is year, yaxis is count
def graph_year_count(df): # set the visual features of the graph sns.set(font_scale=1.5) sns.set_style("darkgrid") fig, ax = plt.subplots() fig.set_size_inches(15, 8) plt.xticks(rotation=45) ax.set_title("Yearly Police Deaths") # create the graph of the data plot = sns.barpl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graph_year_cause_count(df):\r\n # set the visual features of the graph\r\n sns.set(font_scale=1.5)\r\n sns.set_style(\"darkgrid\")\r\n fig, ax = plt.subplots()\r\n fig.set_size_inches(20, 12)\r\n plt.xticks(rotation=25)\r\n ax.set_title(\"2001 and 2007 Police Death Causes\")\r\n # creat...
[ "0.7450756", "0.72697115", "0.72362417", "0.7095809", "0.6813179", "0.6523942", "0.61249", "0.60766643", "0.60371226", "0.60217017", "0.59915453", "0.59783196", "0.5974714", "0.5969027", "0.59505653", "0.5931583", "0.59070116", "0.5892057", "0.5820099", "0.581506", "0.5804305...
0.78675544
0
Create and save a bar graph representing the count of police deaths of one cause for every year The xaxis is year, yaxis is count
def graph_cause_count_each(df, label): # set the visual features of the graph sns.set(font_scale=1.5) sns.set_style("darkgrid") fig, ax = plt.subplots() fig.set_size_inches(15, 8) plt.xticks(rotation=45) ax.set_title(label.capitalize() + " Police Death Causes") # create the graph...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graph_year_cause_count(df):\r\n # set the visual features of the graph\r\n sns.set(font_scale=1.5)\r\n sns.set_style(\"darkgrid\")\r\n fig, ax = plt.subplots()\r\n fig.set_size_inches(20, 12)\r\n plt.xticks(rotation=25)\r\n ax.set_title(\"2001 and 2007 Police Death Causes\")\r\n # creat...
[ "0.79792094", "0.77567977", "0.7751755", "0.72074294", "0.6822239", "0.6261886", "0.62320924", "0.6189878", "0.6135614", "0.6122631", "0.61114997", "0.5992379", "0.59722614", "0.5963579", "0.595483", "0.590753", "0.5904286", "0.5897413", "0.587199", "0.5866743", "0.5852234", ...
0.7605764
3
Calculate the occurance percentage for the highest counted cause for the row
def occurance(row): # divide the row's highest counted cause by the row's total number of deaths percentage = row['max_count'] / row['all_count'] percentage *= 100 # round the percentage up so it's two digits return round(percentage)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repetitive(df):\r\n total_rows = df.shape[0] \r\n for col in df.columns:\r\n count = df[col].value_counts(dropna=False)\r\n high_percent = (count/total_rows).iloc[0] \r\n if high_percent > 0.95:\r\n print('{0}: {1:.1f}%'.format(col, high_percent*100))\r\n ...
[ "0.634417", "0.60727507", "0.5786198", "0.57564735", "0.5738753", "0.5714478", "0.5663033", "0.5635289", "0.5610698", "0.5604262", "0.5602366", "0.55800503", "0.55777955", "0.55542934", "0.55493265", "0.55451536", "0.5515589", "0.55114174", "0.55077696", "0.5506781", "0.54793...
0.83149606
0
Get all monomers that are included in this package by their extended name.
def keys(self): return self.keys
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_registered_modules():\n yield from iterchain(modules.values() for modules in Registry.monomers.values())", "def all_registered_appnames():\n yield from sorted(Registry.monomers.keys())", "def _parts(self):\n return [part for part in Package.__walkparts(self.__relationships)]", "def __dir...
[ "0.5826023", "0.5759264", "0.5675053", "0.5372965", "0.5360488", "0.53524214", "0.5337553", "0.53013045", "0.52280784", "0.5214672", "0.5208173", "0.52072376", "0.52032745", "0.51820874", "0.5169305", "0.51689535", "0.5148772", "0.514187", "0.51102906", "0.51088756", "0.51047...
0.0
-1
Checks to see if the permutation contains only one number Therefore there is only one possible permutation of this set of numbers Examples ======== >>> from sympy.combinatorics import Permutation >>> Permutation([0]).is_Singleton True >>> Permutation([0, 1]).is_Singleton False See Also ======== is_Empty
def is_Singleton(self): return self.size == 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_trivial(p: List[int]) -> bool:\n validate_permutation(p)\n\n for i in range(len(p)):\n if p[i] != i:\n return False\n return True", "def is_singleton(self) -> bool:\n return len(self.elements) == 1", "def validate_permutation(p):\n if not isinstance(p, list):\n ...
[ "0.6626172", "0.6573984", "0.6466623", "0.6459016", "0.59154475", "0.584707", "0.5775967", "0.5728189", "0.56953317", "0.5654894", "0.56312656", "0.56158066", "0.55957276", "0.55319995", "0.5505085", "0.54915696", "0.5430177", "0.5418184", "0.5418093", "0.54101235", "0.540525...
0.6455453
4
Returns the positions of descents in a permutation, ie, the location where p[i] > p[i+1] Examples ======== >>> from sympy.combinatorics.permutations import Permutation >>> p = Permutation([4,0,1,3,2]) >>> p.descents() [0, 3] See Also ======== ascents, inversions, min, max
def descents(self): a = self.array_form pos = [i for i in xrange(len(a)-1) if a[i] > a[i+1]] return pos
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def descents(self, index_set=None, positive=False):\n if index_set==None:\n index_set=self.parent().index_set()\n return [ i for i in index_set if self.has_descent(i, positive) ]", "def all_descendents (self,ind,from_indexes=None,as_index=True):\r\n\r\n if not from_ind...
[ "0.5839029", "0.5558416", "0.53199047", "0.52244025", "0.500037", "0.4827326", "0.47661033", "0.47643653", "0.47404474", "0.47339895", "0.47143736", "0.46777955", "0.46759987", "0.466451", "0.46167475", "0.45975444", "0.45554113", "0.45547083", "0.45358992", "0.452451", "0.45...
0.6667033
0
The maximum element moved by the permutation. Examples ======== >>> from sympy.combinatorics.permutations import Permutation >>> p = Permutation([1,0,2,3,4]) >>> p.max() 1 See Also ======== min, descents, ascents, inversions
def max(self): max = 0 a = self.array_form for i in xrange(len(a)): if a[i] != i and a[i] > max: max = a[i] return max
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_max(self):\n return self.max[-1]", "def max(self):\n assert self.__stack\n return self.__max_values[-1]", "def max(self):\n return self.__max", "def maximum(self):\n return max(self.numbers)", "def get_max(self):\n\t\tif self.right:\n\t\t\treturn self.right.get_ma...
[ "0.7760708", "0.7593996", "0.7488064", "0.74361163", "0.74210334", "0.74044496", "0.74013025", "0.74013025", "0.7396774", "0.73869574", "0.7357279", "0.73493344", "0.7346123", "0.7346123", "0.732503", "0.73080623", "0.72943455", "0.72727686", "0.7120369", "0.7110294", "0.7087...
0.77361
1
The minimum element moved by the permutation. Examples ======== >>> from sympy.combinatorics.permutations import Permutation >>> p = Permutation([0,1,4,3,2]) >>> p.min() 2 See Also ======== max, descents, ascents, inversions
def min(self): a = self.array_form min = len(a) for i in xrange(len(a)): if a[i] != i and a[i] < min: min = a[i] return min
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimum(self):\n return min(self.numbers)", "def min(self):\n return self._reduce_for_stat_function(F.min, only_numeric=False)", "def smallest (self):\n return self.pointers[0].smallest()", "def min(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"min\")", "def min(se...
[ "0.750494", "0.73122925", "0.7308595", "0.72762966", "0.72762966", "0.72712666", "0.72495323", "0.72495323", "0.71233666", "0.70817524", "0.70769155", "0.7075571", "0.70591295", "0.70591295", "0.7054703", "0.6998952", "0.6998952", "0.6998473", "0.6971501", "0.6917875", "0.691...
0.74646544
1
Checks if the permutation is positive Examples ======== >>> from sympy.combinatorics import Permutation >>> Permutation([0, 1, 2]).is_Positive True See Also ======== is_Negative
def is_Positive(self): return self.signature() > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_positive(self, a):\n return a > 0", "def permutation_is_valid(permutation):\n pass", "def is_positive(self):\n return (self._num > 0)", "def positive_only(self):\n return True", "def positive_only(self):\n return True", "def positive_only(self):\n return True"...
[ "0.68091965", "0.67505175", "0.67112964", "0.65012336", "0.65012336", "0.65012336", "0.6346707", "0.61876976", "0.6155681", "0.6145052", "0.60864043", "0.5925359", "0.58670163", "0.5864776", "0.5808227", "0.57996666", "0.57859373", "0.56885123", "0.5678387", "0.56660897", "0....
0.65420955
3
Computes the precedence distance between two permutations. Suppose p and p' represent n jobs. The precedence metric counts the number of times a job j is prededed by job i in both p and p'. This metric is commutative. Examples ======== >>> from sympy.combinatorics.permutations import Permutation >>> p = Permutation([2,...
def get_precedence_distance(self, other): if self.size != other.size: raise ValueError("The permutations must be of the same size.") self_prec_mat = self.get_precedence_matrix() other_prec_mat = other.get_precedence_matrix() n_prec = 0 for i in xrange(self.size): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDistance(self,p1,p2):\n return sum([(p1[i]-p2[i])**2 for i in range(2)])", "def _compute_precedence(self):\n self._setup_precedence()\n if isinstance(self._current_node, KleeneStar):\n self._add_parenthesis_around_part_of_componants(\n 0, self._end_current_gr...
[ "0.56794924", "0.56321716", "0.56074905", "0.5540072", "0.5530909", "0.54615664", "0.5460272", "0.5458742", "0.5458742", "0.5428616", "0.5347637", "0.53364056", "0.5332343", "0.53320855", "0.53207064", "0.5309921", "0.52834636", "0.5273776", "0.5265109", "0.52485836", "0.5239...
0.79595035
0
Computes the positional distance between two permutations. Examples ======== >>> from sympy.combinatorics.permutations import Permutation >>> p = Permutation([0, 3, 1, 2, 4]) >>> q = Permutation.josephus(4, 5, 2) >>> r = Permutation([3, 1, 4, 0, 2]) >>> p.get_positional_distance(q) 12 >>> p.get_positional_distance(r) 1...
def get_positional_distance(self, other): a = self.array_form b = other.array_form if len(a) != len(b): raise ValueError("The permutations must be of the same size.") return sum([abs(a[i] - b[i]) for i in xrange(len(a))])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDistance(p1, p2):\n\tdist = la.norm(p2 - p1)\n\treturn dist", "def getDistance(self,p1,p2):\n return sum([(p1[i]-p2[i])**2 for i in range(2)])", "def _pos_distance(pos1, pos2):\n delta = np.array(pos1).astype(float).flatten(\n ) - np.array(pos2).astype(float).flatten()\n delta %= 1\n ...
[ "0.66067207", "0.66018456", "0.65544814", "0.65434986", "0.65347785", "0.6522854", "0.6522854", "0.65157455", "0.6498043", "0.6460406", "0.6436375", "0.642424", "0.6419791", "0.64104456", "0.63993", "0.6386926", "0.6373464", "0.6373163", "0.63726175", "0.6350069", "0.6346437"...
0.7850794
0
Returns a FileDescriptorSet proto to be used by tf.io.decode_proto.
def _get_descriptor_set(): proto = pb.FileDescriptorSet() # The FileDescriptor for tensorflow.ranking.internal.ExampleListWithContext. file_proto = proto.file.add( name=_FILE_NAME, package=_PACKAGE, syntax="proto3") message_proto = file_proto.message_type.add(name=_MESSAGE_NAME) message_proto.field.add...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_proto(self) -> FeatureSetProto:\n\n meta = FeatureSetMetaProto(\n created_timestamp=self.created_timestamp, status=self.status\n )\n\n spec = FeatureSetSpecProto(\n name=self.name,\n project=self.project,\n max_age=self.max_age,\n l...
[ "0.6655686", "0.64806414", "0.5870579", "0.55106497", "0.5424343", "0.5335488", "0.5291065", "0.52861184", "0.5221573", "0.52101123", "0.5198242", "0.5111702", "0.5082708", "0.5057119", "0.50536305", "0.50462496", "0.50195646", "0.5006837", "0.4996153", "0.49501193", "0.49459...
0.8356988
0
Parses SequenceExample to feature maps. The `FixedLenFeature` in `example_feature_spec` is converted to `FixedLenSequenceFeature` to parse `feature_list` in SequenceExample. We keep track of the nontrivial default_values (e.g., 1 for labels) for features in `example_feature_spec` and use them to replace the parsing def...
def parse_from_sequence_example(serialized, list_size=None, context_feature_spec=None, example_feature_spec=None, size_feature_name=None, mask_feature_name=None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_examples_to_features(\n examples: List[InputExample],\n label_list: List[str],\n max_length: int,\n tokenizer: PreTrainedTokenizer,\n pad_token_segment_id=0,\n pad_on_left=False,\n pad_token=0,\n mask_padding_with_zero=True,\n) -> List[InputFeatures]:\n\n label_map = {label: ...
[ "0.6380864", "0.6261056", "0.6210906", "0.61983395", "0.617306", "0.6169481", "0.6139974", "0.6139974", "0.61158013", "0.61137265", "0.6091876", "0.60900754", "0.60900515", "0.6084662", "0.60674435", "0.60544986", "0.60464865", "0.6025559", "0.6020386", "0.5998066", "0.599194...
0.6352493
1
Returns a `Dataset` of features from `SequenceExample`.
def read_batched_sequence_example_dataset(file_pattern, batch_size, list_size, context_feature_spec, example_feature_spec, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def features(self) -> datasets.Features:\n return datasets.Features(\n {\n \"sequence\": datasets.Value(\"string\"),\n \"description\": datasets.Value(\"string\"),\n \"id\": datasets.Value(\"string\"),\n }\n )", "def features_datase...
[ "0.65652615", "0.6440698", "0.61487615", "0.60766685", "0.60450655", "0.59644336", "0.5929399", "0.5922943", "0.59117806", "0.58371", "0.58305675", "0.5793195", "0.5760066", "0.5753719", "0.5740687", "0.5706553", "0.56776154", "0.5673357", "0.56687593", "0.5657515", "0.565682...
0.0
-1
Creates a serving_input_receiver_fn for `SequenceExample` inputs. A string placeholder is used for inputs. Note that the context_feature_spec and example_feature_spec shouldn't contain weights, labels or training only features in general.
def build_sequence_example_serving_input_receiver_fn(input_size, context_feature_spec, example_feature_spec, default_batch_size=None): return build_ranking_ser...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serving_input_receiver_fn():\n # Placeholder for the tf.example to be received\n serialized_tf_example = tf.placeholder(dtype=tf.string, shape=[None])\n # Dict to be passed to ServingInputReceiver -> input signature\n receiver_tensors = {'examples': serialized_tf_example}\n # Parse the example t...
[ "0.7693126", "0.7576035", "0.7458408", "0.74262977", "0.7421002", "0.7314076", "0.72384566", "0.7165283", "0.71635693", "0.71107525", "0.700704", "0.70048624", "0.70022017", "0.6806134", "0.6771842", "0.67557734", "0.67035764", "0.66910076", "0.6482212", "0.63701385", "0.6350...
0.7394039
5
Parse function to convert `tf.train.Example` to feature maps.
def parse_from_tf_example(serialized, context_feature_spec=None, example_feature_spec=None, size_feature_name=None, mask_feature_name=None): batch_size = tf.shape(serialized)[0] features = tf.io.parse_example( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_function(record):\n features = {\n \"terms\": tf.VarLenFeature(dtype=tf.string), # terms are strings of varying lengths\n \"labels\": tf.FixedLenFeature(shape=[1], dtype=tf.float32) # labels are 0 or 1\n }\n \n parsed_features = tf.parse_single_example(record, features)\n \n terms = parsed_f...
[ "0.7286557", "0.7192081", "0.71616954", "0.7040333", "0.70141315", "0.6961648", "0.6938032", "0.68541753", "0.68218017", "0.68170536", "0.6790918", "0.6768647", "0.67237645", "0.6707807", "0.668926", "0.6676268", "0.66687053", "0.66659963", "0.6665652", "0.66501856", "0.66208...
0.65566736
24
If `funcs` specified, apply them to each tile before merging.
def merge_tiles(tiles, funcs=None): return np.vstack([ np.hstack([ reduce(lambda acc, f: f(acc), funcs, x) if funcs else x for x in row ]) for row in tiles ])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multimap(funcs, iterable):\n\n for f in funcs:\n iterable = map(f, iterable)\n\n return iterable", "def compose(*funcs):\n if not funcs:\n return identity\n\n def wrapper(*args, **kwargs):\n fst, *rest = funcs\n ret = fst(*args, **kwargs)\n\n for f in rest:\n ...
[ "0.60011554", "0.5787575", "0.5696854", "0.568793", "0.5611172", "0.55531746", "0.5549072", "0.5522566", "0.55186737", "0.5507669", "0.5499317", "0.54753375", "0.5439334", "0.5384896", "0.53775895", "0.5347689", "0.5312817", "0.53123355", "0.5260666", "0.52296597", "0.5203757...
0.7618011
0
Fill each tile with another array created by `fill_func`.
def fill_tiles(tiles, fill_func): return np.array([[fill_func(x) for x in row] for row in tiles])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill(self, func=lambda: random().getdigits(1), diag=None):\n for y,x in self.coords(diag):\n self.store(y,x, func())", "def fill(self, filler):\n\n for x in range(self.__xmax):\n for y in range(self.__ymax):\n self.__data[(x,y)] = filler(x,y) % self.mod", ...
[ "0.6910671", "0.65624326", "0.6079739", "0.6048602", "0.60464525", "0.5909062", "0.58409363", "0.5798324", "0.57665217", "0.5718461", "0.5645002", "0.5631742", "0.5628187", "0.55924505", "0.55909234", "0.5547838", "0.5530588", "0.55177283", "0.5504256", "0.5483152", "0.547611...
0.8620867
0
Download a blob as bytes
def download_blob(url: str) -> io.BytesIO: storage_client = storage.Client() bucket_name = get_bucket_name(url) source_blob_name = get_blob_name(url) bucket = storage_client.bucket(bucket_name) blob = bucket.blob(source_blob_name) f = io.BytesIO(blob.download_as_bytes()) return f
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blob_download(blob_url):\n blob = storage.Object.from_url(blob_url)\n blobc = blob.download()\n return blobc", "def get_blob(self, download_meta):\n blob_id = download_meta['blob_id']\n if isinstance(blob_id, str):\n blob_id = uuid.UUID(blob_id)\n session = self.DBSes...
[ "0.77642393", "0.721828", "0.71933115", "0.70745903", "0.7056861", "0.69814175", "0.6867125", "0.6847257", "0.6825369", "0.6812353", "0.67706835", "0.6651771", "0.6594487", "0.6589651", "0.6537228", "0.6502545", "0.6466667", "0.64162225", "0.6412126", "0.6369801", "0.6357196"...
0.75308365
1
Returns a string representing the platform this build is targetted for.
def platform(): if 'OS' in gyp_defines(): if 'android' in gyp_defines()['OS']: return 'android' else: return gyp_defines()['OS'] elif IsWindows(): return 'win' elif IsLinux(): return 'linux' else: return 'mac'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def platform(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"platform\")", "def platform(self):\n # type: () -> string_types\n return self._platform", "def _get_build_os_name():\n system = platform.system()\n if 'Darwin' in system or 'Macintosh' in system:\n return 'd...
[ "0.8346893", "0.815772", "0.7967567", "0.792701", "0.79067993", "0.7898727", "0.78434443", "0.7751172", "0.7712779", "0.759612", "0.7587226", "0.7560863", "0.75583434", "0.75551844", "0.7545541", "0.751422", "0.7362841", "0.73149467", "0.72781867", "0.7273031", "0.7269034", ...
0.78414303
7
Returns the kind of the named identifier in the current scope. If the identifier is unknown in the current scope, returns None.
def kindOf(self, aName): if aName in self.subroutineTable: tup = self.subroutineTable[aName] elif aName in self.classTable: tup = self.classTable[aName] else: return None # DEBUG if self.DEBUG: print("DEBUG(SymbolTable): KIND OF '{...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kind(self) -> Optional[str]:\n return pulumi.get(self, \"kind\")", "def kind(self) -> Optional[str]:\n return pulumi.get(self, \"kind\")", "def kind(self) -> Optional[str]:\n return pulumi.get(self, \"kind\")", "def kind(self) -> Optional[str]:\n return pulumi.get(self, \"kind...
[ "0.64919865", "0.64919865", "0.64919865", "0.64919865", "0.6396671", "0.63650405", "0.62592405", "0.62409407", "0.6203032", "0.61427164", "0.61427164", "0.61427164", "0.6121663", "0.6121663", "0.6121663", "0.6121663", "0.6121663", "0.6121663", "0.6121663", "0.6121663", "0.612...
0.6364982
6
Use the management API to declare a queue.
def declare_queue(self, c, queue_name): return self._management_req( c, 'PUT', ['queues', urlquote(c.vhost, safe=''), queue_name], {"auto_delete": False, "durable": False, "arguments": {}})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def declare_queue(self):\n\n self._channel.queue_declare(queue=self._queue_name, durable=True)\n print(\"Queue declared....\")", "def setup_queue(self, channel, queue_name):\n logger.info('Declaring queue %s', queue_name)\n channel.queue_declare(queue = queue_name, \n durab...
[ "0.81214935", "0.7631336", "0.7544795", "0.7427591", "0.7355256", "0.72456235", "0.7244864", "0.6941235", "0.688709", "0.68756276", "0.68676907", "0.6821677", "0.6809824", "0.6805658", "0.663481", "0.65823704", "0.65740746", "0.6549895", "0.6549895", "0.6549895", "0.6543707",...
0.77669483
1
Return theta and J_history
def gradientDescent(self,X, y, theta): # number of instances m = len(y) J_history = np.zeros((self.NUM_ITERS,1)) for i in range(self.NUM_ITERS): h = self.sigmoid(X@theta) grad = 1 / m * X.T @ (h - y) theta = theta - self.ALPHA * grad J_h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def J(theta, x, y):\n m = len(y)\n z = theta.dot(x.T) #argument for hypothesis function\n return 1. / m * np.sum(-y * np.log(g(z)) - (1. - y) * np.log(1 - g(z)))", "def theta():\n pass", "def theta(self):\n tmp = [self._get_one_param_theta(p) for p in self._LIST_PARAMETERS]\n return n...
[ "0.6950735", "0.6649922", "0.6543228", "0.6485027", "0.6258811", "0.6219147", "0.6184788", "0.6184788", "0.6170629", "0.6163561", "0.6107435", "0.60741055", "0.6054163", "0.6038025", "0.6021765", "0.6021255", "0.601556", "0.59481984", "0.5943052", "0.59357226", "0.5897428", ...
0.6488257
3
Set is_space if current token is whitespace
def determine_if_whitespace(self): value = self.current.value if value == "\n": self.is_space = True else: self.is_space = False if value == "" or regexes["whitespace"].match(value): self.is_space = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_space(self):\n return self.pos == self.SPACE_POS", "def wrapspace(text, token):\n\n # Wildcards have no whitespace. Need special case since * is also multiply which does have whitespace.\n if token in [\"*\"] and (not text or text.endswith((\" \", \"(\"))):\n return token\n\n ...
[ "0.7020219", "0.6986494", "0.6700453", "0.6649125", "0.66462475", "0.65734935", "0.6543672", "0.6492766", "0.6431927", "0.6406948", "0.6397717", "0.6277612", "0.6238498", "0.6217519", "0.6142976", "0.60928607", "0.60779923", "0.6073988", "0.60397017", "0.59851426", "0.5915279...
0.802504
0
Verifies the behaviour of mute on an alert when the same alert is generated again
def verify_alert_unmute(node: CephAdmin, alert: str, **kwargs) -> bool: if alert == "OSDMAP_FLAGS": sticky = kwargs.get("sticky") if not verify_alert(node=node, alert=alert, flag="noscrub", sticky=sticky): log.error(f"Alert : {alert} is not Muted") return False # Add...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mute(self, msg, args):\n if self.mute:\n self.mute=False\n return \"Yay, I can make noise again!\"\n else:\n self.mute=True\n return \"OK, I'll shut up now!\"", "async def test_cache_miss_sent_mod_alert_voice(self):\n self.cog.previous_overwrit...
[ "0.70042527", "0.6958718", "0.69161993", "0.69100916", "0.65937746", "0.6590511", "0.6373651", "0.6186105", "0.6183723", "0.6132045", "0.612756", "0.6081112", "0.60577506", "0.6056941", "0.60190994", "0.601786", "0.5989709", "0.59725064", "0.5924046", "0.5922763", "0.58866143...
0.7354837
0
Remove stop words and lemmatize input.
def process_input( input_data: List[ArticleInfoStemmed] ) -> List[ArticleInfoStemmed]: stop_words = stopwords.words('russian') stop_words.extend(['что', 'это', 'так', 'вот', 'быть', 'как', 'в', 'к', 'на']) my_stemmer = Mystem() result = [] for elem in input_data: title_without_sw =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_stopwords_lemmatize(text):\n tokens = clean_stopwords(text)\n tokens = lemmatize_tokens(tokens)\n # count = Counter(tokens)\n # c = count.most_common(15)\n # b = [str(i[0]) for i in c]\n # keywords = [t for t in tokens if t in b]\n news = ['ESPN', 'espn', 'foxsports', 'fox', 'cnn', 'yaho...
[ "0.7799866", "0.7562857", "0.740089", "0.72312415", "0.72265565", "0.71447855", "0.6998881", "0.6850866", "0.6842619", "0.68289655", "0.6802723", "0.67786384", "0.6777514", "0.67430836", "0.67257583", "0.6722361", "0.6711797", "0.6710667", "0.67049855", "0.6704398", "0.670088...
0.6212129
96
Wildcard chars are everywhere, and there are multiple literals.
def test_wildcards_inside_outside_multiple_literals(self): qs = '"Fo?" s* "yes*" o?' qs_escaped, wildcard = wildcard_escape(qs) self.assertEqual( qs_escaped, r'"Fo\?" s* "yes\*" o?', "Wildcards in literal should be escaped", ) self.assertTrue(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_multiple_match_any_wildcard_in_literal(self):\n qs = '\"Fo*o t*\"'\n qs_escaped, wildcard = wildcard_escape(qs)\n\n self.assertEqual(\n qs_escaped, r'\"Fo\\*o t\\*\"', \"Both wildcards should be escaped\"\n )\n self.assertFalse(wildcard, \"Wildcard should not ...
[ "0.70266396", "0.70098746", "0.6959173", "0.694705", "0.6430979", "0.6355583", "0.63458925", "0.6161441", "0.59570634", "0.59240246", "0.58363456", "0.57723093", "0.5754214", "0.5735046", "0.5713353", "0.57045794", "0.5677222", "0.56439114", "0.5615413", "0.56148857", "0.5610...
0.68952394
4
Return whether there are changes staged in the index.
def has_staged_changes(repo): return subprocess.call(['git', 'diff-index', '--cached', '--quiet', 'HEAD'], cwd=repo) != 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_changes(self):\n if self.repo_is_empty:\n return True\n\n tree = self.repo.get(self.index.write_tree(self.repo))\n diff = tree.diff_to_tree(self.repo.get(self.repo.head.target).tree)\n return bool(diff)", "def index_is_dirty():\n result, output = popen('git diff ...
[ "0.78240436", "0.7427147", "0.7259371", "0.7247766", "0.7033398", "0.68701726", "0.6775976", "0.66627145", "0.66391957", "0.66156906", "0.6578035", "0.6491765", "0.6476037", "0.6469735", "0.6431343", "0.6426879", "0.6412966", "0.6394874", "0.63894445", "0.6388647", "0.6380831...
0.75188035
1
Return whether there are unstaged changes in the working tree.
def has_unstaged_changes(repo): subprocess.check_call(['git', 'update-index', '-q', '--ignore-submodules', '--refresh'], cwd=repo) return subprocess.call(['git', 'diff-index', '--quiet', 'HEAD'], cwd=repo) != 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_unstaged_changes(self):\n pass", "def has_staged_changes(repo):\n return subprocess.call(['git', 'diff-index', '--cached', '--quiet', 'HEAD'],\n cwd=repo) != 0", "def local_changes():\n result, output = popen('git status', False, False)\n try:\n return...
[ "0.8172257", "0.74224067", "0.7179171", "0.7160259", "0.7136172", "0.71034104", "0.7068434", "0.70023155", "0.70009446", "0.6953707", "0.69295585", "0.6915011", "0.6841017", "0.6674257", "0.6667745", "0.6646031", "0.6569326", "0.65209794", "0.6464198", "0.643293", "0.6412829"...
0.8190848
0
Return the ARN of the IAM Role on the provided account as a string. Returns an `IAMRole` object from boto3
def confirm_iam_role(self, account): try: iam = self.session.client('iam') rolearn = iam.get_role(RoleName=self.role_name)['Role']['Arn'] return rolearn except ClientError as e: if e.response['Error']['Code'] == 'NoSuchEntity': self.create...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_role_arn(self, role, partition='aws'):\n if not role or role.startswith(\"arn:aws\"):\n return role\n if not role.startswith(\"role/\"):\n role = \"role/\" + role\n return \"arn:{0}:iam::{1}:{2}\".format(partition, self.account_id, role)", "def get_redshift_...
[ "0.7615182", "0.68969595", "0.68490857", "0.67595655", "0.6699634", "0.66625166", "0.66314983", "0.6564157", "0.65151244", "0.65151244", "0.65151244", "0.65151244", "0.6453544", "0.6453544", "0.638315", "0.6204257", "0.6204257", "0.61953646", "0.61953646", "0.61840516", "0.60...
0.6416746
14
Returns an int64_list from a bool / enum / int / uint.
def _int64_feature(value): return tf.train.Feature(int64_list=tf.train.Int64List(value=[value]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _BoolsToInts(arg_list):\n result = []\n for arg in arg_list:\n if isinstance(arg, (list, tuple)):\n result.append(_BoolsToInts(arg))\n elif arg is True:\n result.append(1)\n elif arg is False:\n result.append(0)\n else:\n result.append(arg)\n\n return result", "def convertT...
[ "0.68819815", "0.659524", "0.6460672", "0.64474607", "0.6367618", "0.6291482", "0.6270116", "0.6216924", "0.6101936", "0.59520674", "0.59475744", "0.5902947", "0.5865389", "0.5865389", "0.5855006", "0.5845118", "0.58441347", "0.58316153", "0.5802565", "0.57950443", "0.5795044...
0.54260087
71
Clean all graphical objects, remove from sprite dictionary and remove the game reference
def clean_before_save(self, image_only=False): self.image = None self.animated = False if hasattr(self, "dict_image"): # self.dict_image = None delattr(self, "dict_image") if hasattr(self, "list_image"): self.list_image = None delattr(self,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_game_objects(self):\n self.game_objects = list() # [go for go in self.game_objects if go.dont_destroy]\n self.colliders = list()", "def unload(self):\n for obj in self.objects:\n self.scene.removeItem(obj)\n for plant in self.plants:\n self.scene.remove...
[ "0.7206723", "0.718348", "0.7134893", "0.7049908", "0.7022351", "0.7010834", "0.6991802", "0.6920527", "0.6840245", "0.6783653", "0.6733267", "0.6729808", "0.672947", "0.672154", "0.6717521", "0.66974646", "0.661839", "0.6588763", "0.6565614", "0.6559923", "0.65361184", "0....
0.0
-1
Calculate the Haversine distance in meters.
def distance(origin: Tuple[float, float], destination: Tuple[float, float]) -> float: radius = 6372797.560856 # Earth's quatratic mean radius for WGS-84 lat1, lon1, lat2, lon2 = map( math.radians, [origin[0], origin[1], destination[0], destination[1]] ) dlon = lon2 - lon1 dlat = lat2 - la...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def haversine(lon1, lat1, lon2, lat2): \r\n lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) \r\n #print 34\r\n dlon = lon2 - lon1 \r\n dlat = lat2 - lat1 \r\n a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2 \r\n c = 2 * atan(sqrt(a)/sqrt(1-a)) \r\n r = 637...
[ "0.717295", "0.71524125", "0.71517825", "0.7074592", "0.7012661", "0.70119554", "0.69689655", "0.69665873", "0.6943535", "0.6943336", "0.6930834", "0.69140434", "0.68999726", "0.68669325", "0.685067", "0.6838337", "0.6829331", "0.68217", "0.6817715", "0.679323", "0.6791806", ...
0.0
-1
This model implements a Kalman filter over a time series. The key method is `KalmanFilter.filter()`. It considers the provided time series as containing (possibly noisy) observations z obtained from a (possibly noisy) linear dynamical system with hidden state x. The function `filter(series)` returns a new `TimeSeries` ...
def __init__(self, dim_x: int = 1, kf: Optional[Kalman] = None): # TODO: Add support for x_init. Needs reimplementation of NFourSID. super().__init__() if kf is None: self.kf = None self.dim_x = dim_x self._kf_provided = False else: self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter(\n self,\n series: TimeSeries,\n covariates: Optional[TimeSeries] = None,\n num_samples: int = 1,\n ) -> TimeSeries:\n super().filter(series)\n\n raise_if(\n self.kf is None,\n \"The Kalman filter has not been fitted yet. Call `fit()` fi...
[ "0.7776398", "0.67010283", "0.6458076", "0.63149166", "0.6137373", "0.6130053", "0.60871553", "0.60769624", "0.5968232", "0.5745265", "0.563601", "0.5617688", "0.5577299", "0.5537823", "0.55330664", "0.5520145", "0.5485191", "0.54678595", "0.5464964", "0.54608214", "0.5459638...
0.0
-1
Sequentially applies the Kalman filter on the provided series of observations.
def filter( self, series: TimeSeries, covariates: Optional[TimeSeries] = None, num_samples: int = 1, ) -> TimeSeries: super().filter(series) raise_if( self.kf is None, "The Kalman filter has not been fitted yet. Call `fit()` first " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def KFilt(sample,fs=25):\n\t#kalman filter inputs\n \n # Dimensions of parameters:\n # 'transition_matrices': 2,\n # 'transition_offsets': 1,\n # 'observation_matrices': 2,\n # 'observation_offsets': 1,\n # 'transition_covariance': 2,\n # 'observation_covariance': 2,\n # 'initial_sta...
[ "0.6253877", "0.62128437", "0.6187326", "0.6127671", "0.6050993", "0.59781045", "0.5972726", "0.5739453", "0.56927985", "0.5654467", "0.56153286", "0.55797", "0.55774987", "0.5572194", "0.5557671", "0.55040103", "0.5416595", "0.54071057", "0.5348931", "0.5315805", "0.5303385"...
0.67902356
0
return tuple representing bounding box of reverse geocoder with form (left, bottom, right, top)
def bounds(self): return self.osmdb.bounds()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bounding_box(self):\n lon, lat = self.coordinates\n\n ll = (np.min(lon),np.min(lat))\n ul = (np.min(lon),np.max(lat))\n ur = (np.max(lon),np.max(lat))\n lr = (np.max(lon),np.min(lat))\n\n return (ll, ul, ur, lr)", "def bounding_box(self):\n latlon00 = self...
[ "0.781958", "0.7549841", "0.75235707", "0.7443732", "0.7404683", "0.72664326", "0.72664326", "0.71939343", "0.7106945", "0.7090425", "0.7067621", "0.70609933", "0.7057045", "0.7049618", "0.70485306", "0.70354766", "0.69361347", "0.69171494", "0.6901337", "0.6885634", "0.68573...
0.0
-1
Compare two index properties for equality.
def __eq__(self, other): if not isinstance(other, IndexProperty): return NotImplemented return self.name == other.name and self.direction == other.direction
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return (self.name == other.name and\n self.index_type == other.index_type and\n self.hash_key == other.hash_key and\n self.range_key == other.range_key and\n self.read_throughput == other.read_throughput and\n ...
[ "0.73820996", "0.7007457", "0.6649975", "0.65558517", "0.6508119", "0.64641464", "0.64640576", "0.62937516", "0.6244109", "0.6224224", "0.6140386", "0.6113254", "0.60249746", "0.59961665", "0.59827787", "0.59800756", "0.59538686", "0.5945407", "0.5930792", "0.59278286", "0.59...
0.7806691
0
Return the kind name for this class. This defaults to ``cls.__name__``; users may override this to give a class a different name when stored in Google Cloud Datastore than the name of the class.
def _get_kind(cls): return cls.__name__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(cls) -> str:\n return cls.__name__ # type: ignore[attr-defined]", "def kind(cls):\n return cls.__name__", "def name(cls) -> str:\n return cls.__name__", "def class_name(cls):\n return cls.__name__", "def class_name(cls):\n return cls.__name__", "def _get_classname(cls...
[ "0.7942168", "0.78967655", "0.7862698", "0.77933", "0.77933", "0.77606165", "0.7730739", "0.77014863", "0.7691594", "0.76342505", "0.759643", "0.7578216", "0.7471605", "0.74112463", "0.73953176", "0.73832285", "0.7232317", "0.7232317", "0.718681", "0.7183165", "0.71638846", ...
0.78269374
3
Only call this with the criticallydamped DSc model as argument. Defaults to black line plot.
def testDSc(DS, xtarget, col='k'): # protocol for critically damped model t1 = 5 s1c = args(pars={'S': 0, 'x0': 35}, tdur=t1) t2 = 100 s2c = args(pars={'S': 0, 'x0': xtarget}, tdur=t2) trajc, ptsc = pcw_protocol(DSc, [s1c,s2c]) do_plots(ptsc, col)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(self):\n\t\tself.plotOfSpect().plot()", "def plot(self):\n\t\tself.plotOfSpect()", "def plot_model(self):\n \n plt.figure(figsize=[10,5])\n \n plt.scatter(self.receivers['recxs'],self.receivers['reczs'],marker='v')\n if self.source['src_type']==4:\n from o...
[ "0.54804933", "0.54780096", "0.5397993", "0.53640574", "0.5335361", "0.53308004", "0.5259872", "0.5225873", "0.52149063", "0.51742977", "0.5129519", "0.512896", "0.51285034", "0.512037", "0.5098921", "0.508121", "0.5077731", "0.5073066", "0.50707966", "0.5065889", "0.5051925"...
0.55046964
0
Executes the setLoggingLevel operation on the server. setLoggingLevel(Arg1=enum, async_operation=bool)
def SetLoggingLevel(self, *args, **kwargs): # type: (*Any, **Any) -> None payload = {} for i in range(len(args)): payload["Arg%s" % (i + 1)] = args[i] for item in kwargs.items(): payload[item[0]] = item[1] return self._execute("setLoggingLevel", payload=pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def set_log_level(self, log_level: str) -> None:\n await self._send_message_get_response(OutgoingMessage(OutgoingMessageType.set_log_level, log_level=log_level))", "def set_logging_level(self, level):\n return self.sdk.set_logging_level(\n level,\n prefix=self.__class__....
[ "0.7192378", "0.70032954", "0.6776787", "0.6764134", "0.66718197", "0.6669104", "0.66436124", "0.6639818", "0.6595389", "0.65719914", "0.6512226", "0.6486954", "0.64375776", "0.64276475", "0.64275664", "0.6395008", "0.6384189", "0.63814825", "0.63629377", "0.6347836", "0.6310...
0.6866034
2
Return structure with defaulted metadata values required for a NWBFile. These standard defaults are metadata["NWBFile"]["session_description"] = "no description" metadata["NWBFile"]["identifier"] = str(uuid.uuid4()) Proper conversions should override these fields prior to calling NWBConverter.run_conversion()
def get_default_nwbfile_metadata() -> DeepDict: metadata = DeepDict() metadata["NWBFile"].deep_update( session_description="no description", identifier=str(uuid.uuid4()), ) return metadata
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_nwbfile_from_metadata(metadata: dict) -> NWBFile:\n\n # Validate metadata\n schema_path = Path(__file__).resolve().parent.parent / \"schemas/base_metadata_schema.json\"\n base_metadata_schema = load_dict_from_file(file_path=schema_path)\n validate_metadata(metadata=metadata, schema=base_metada...
[ "0.7001911", "0.68060946", "0.66537225", "0.64992124", "0.6379478", "0.62738776", "0.6186642", "0.6151457", "0.6092115", "0.59207845", "0.5897244", "0.58177525", "0.5812387", "0.57986695", "0.5797827", "0.57847816", "0.57538414", "0.5723986", "0.56995463", "0.56913435", "0.56...
0.8653975
0
Create and save an ordinary user with the given email, name and password.
def create_user(self, email, name, password, **extra_fields): extra_fields.setdefault('role', User.ROLE_USER) extra_fields.setdefault('is_superuser', False) return self._create_user(email, name, password, **extra_fields)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user(self, name, email, password):\n new_user = User(name=name, email=email, password=password)\n db.session.add(new_user)\n db.session.commit()", "def _create_user(self, username, name,\n email, password, **extra_fields):\n if not email:\n ra...
[ "0.83235365", "0.8266425", "0.82039505", "0.8174819", "0.8172768", "0.81646734", "0.8153281", "0.8148734", "0.8126452", "0.81213474", "0.8120301", "0.8108491", "0.81023", "0.8098179", "0.8075773", "0.80615765", "0.80573696", "0.8044561", "0.80385953", "0.80296576", "0.802952"...
0.78047603
91
Create and save a superuser with the given email, name and password.
def create_superuser(self, email, name, password, **extra_fields): extra_fields.setdefault('role', User.ROLE_ADMIN) extra_fields.setdefault('is_superuser', True) extra_fields.setdefault('is_staff', True) if extra_fields.get('is_superuser') is not True: raise ValueError('Supe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_superuser(self, email, name, password):\n\n user = self.create_user(email, name, password)\n\n # Make this user an admin.\n user.is_superuser = True\n user.is_staff = True\n user.save(using=self._db)\n\n return user", "def createsuperuser():\n\n email = prompt('User E-Mail')\n ...
[ "0.83064646", "0.82670945", "0.82389", "0.822481", "0.82135373", "0.8186731", "0.8184222", "0.81648266", "0.8155606", "0.81546015", "0.81458473", "0.81458473", "0.81307507", "0.81181186", "0.8099987", "0.8099177", "0.80884", "0.8088027", "0.80774003", "0.8067301", "0.8065221"...
0.81532604
10
Return the user's email
def get_short_name(self): # The user is identified by the email address return self.email
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_email(self):\n member = self.get_user()\n if member:\n return member.getProperty('email')", "def user_email(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"user_email\")", "def get_email(obj):\r\n return obj.user.email", "def email(self, instance):\r\n...
[ "0.89156574", "0.8576969", "0.8501789", "0.8455517", "0.8452494", "0.8345917", "0.81268835", "0.8081051", "0.80751437", "0.80625206", "0.80039424", "0.80039424", "0.80039424", "0.7972809", "0.79432976", "0.7919716", "0.7894168", "0.7886542", "0.78460133", "0.78448176", "0.784...
0.71760446
58
Takes a vector and returns it's unit vector
def normalize_vector (vector ): if (np.sum (vector ) == 0): #print ("In normalize_vector: Vector is 0. Returning input vector.") return vector return vector / np.linalg.norm(vector)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cal_unit_vec(vector):\n return vector / np.linalg.norm(vector)", "def unit_vector(vector):\r\n return vector / np.linalg.norm(vector)", "def unit_vector(vector):\r\n return vector / np.linalg.norm(vector)", "def unit_vector(vector):\r\n return vector / np.linalg.norm(vector)", "def unit_vec...
[ "0.8847675", "0.8827156", "0.8827156", "0.8827156", "0.8809197", "0.8809197", "0.8809197", "0.8809197", "0.8809197", "0.8809197", "0.8809197", "0.8809197", "0.8809197", "0.8809197", "0.8809197", "0.87835234", "0.8763117", "0.87047213", "0.8642639", "0.85598093", "0.8505708", ...
0.67854637
58
Normalizes Vectors of an numpy.ndarray of shape (1, n)
def normalize_vector_array (vector_array ): norms = np.linalg.norm (vector_array, axis=1 ) norms = np.where (norms == 0, 1, norms ) # these filtered values belong to arrays that already are normalized return vector_array / norms.reshape (-1, 1 )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(self):\n self.vector /= np.linalg.norm(self.vector)", "def vector_normalize(x):\n mag = math.sqrt(vector_dot(x, x))\n return [float(i) / mag for i in x]", "def normalize(v):\n\tdim = v.shape \n\tfor i in range(0, dim[0]-1):\n\t\tv[i,:,:] = (v[i,:,:].T/np.sum(v[i,:,:],1)).T\n\n\tretur...
[ "0.72583866", "0.72463936", "0.7211733", "0.72110134", "0.71922225", "0.7186948", "0.718182", "0.7180445", "0.71580994", "0.71496916", "0.713165", "0.71000606", "0.7058011", "0.70440507", "0.70421475", "0.70400274", "0.6962223", "0.6956507", "0.6936452", "0.69357705", "0.6925...
0.71217793
11
From the points of the given point cloud, this function derives a plane defined by a normal vector and the noise of the given point cloud in respect to this plane.
def PCA (numpy_cloud ): # abort, if there are no points if (numpy_cloud.shape[0] == 0): #print ("In normals.py, in PCA: The input array is empty. Returning a null vector and high sigma") return np.array ((0, 0, 0)), 1.0, np.array ((0, 0, 0)) # we only need three colums [X, Y, Z, I] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fit_plane_to_point_cloud(\n points_xyz: NDArrayFloat,\n) -> Tuple[float, float, float, float]:\n center_xyz: NDArrayFloat = np.mean(points_xyz, axis=0)\n out: Tuple[NDArrayFloat, NDArrayFloat, NDArrayFloat] = np.linalg.svd(\n points_xyz - center_xyz\n )\n vh = out[2]\n\n # Get the uni...
[ "0.6580144", "0.63780445", "0.63138264", "0.62746537", "0.6177512", "0.61291873", "0.6109093", "0.60267746", "0.59768504", "0.59131163", "0.5872911", "0.5853883", "0.5835957", "0.58269656", "0.58189553", "0.5813077", "0.57806265", "0.57600707", "0.5745201", "0.5717565", "0.57...
0.0
-1
Uses Ransac with the probability parameters w and z to estimate a valid plane in given cloud. Uses distance from plane compared to given threshold to determine the consensus set. Returns points and normal vector of the detected plane.
def ransac_plane_estimation (numpy_cloud, threshold, fixed_point=None, w = .9, z = 0.95 ): # variables current_consensus = 0 # keeps track of how many points match the current plane best_consensus = 0 # shows how many points matched the best plane yet consensus_point...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ransac_plane_segmentation(cloud: object, thresh: int, n_iter: int) -> Tuple[object, object]:\n plane_model, inliers = cloud.segment_plane(\n distance_threshold=thresh,\n ransac_n=3,\n num_iterations=n_iter)\n plane_cloud = cloud.select_by_index(inliers)\n obstacles_cloud = cloud.s...
[ "0.6371048", "0.62168926", "0.61706877", "0.60739213", "0.5938027", "0.5844546", "0.5790194", "0.57716024", "0.57679754", "0.57642746", "0.5713132", "0.569902", "0.56792825", "0.5623892", "0.5574627", "0.5574627", "0.55611265", "0.55504286", "0.5529408", "0.5528072", "0.55267...
0.81879735
0
return the unicode representation of obj
def safe_unicode(obj, *args): try: return unicode(obj, *args) except UnicodeDecodeError: # obj is byte string ascii_text = str(obj).encode('string_escape') return unicode(ascii_text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def u(obj):\n return obj if isinstance(obj, unicode) else unicode(obj) # noqa: F821 pylint: disable=undefined-variable", "def u(obj):\n return obj if isinstance(obj, str) else str(obj)", "def format_result(self,obj):\n return unicode(obj)", "def as_unicode(obj):\n if sys.version_...
[ "0.8203075", "0.7992205", "0.797343", "0.79137915", "0.7886161", "0.7804273", "0.769004", "0.7639067", "0.7570535", "0.75103855", "0.75103855", "0.7428463", "0.7394372", "0.7372737", "0.73335004", "0.7299523", "0.7290797", "0.72396266", "0.7239328", "0.7216154", "0.7149755", ...
0.74312717
15
reset weight and bias
def reset_parameters(self): model_utils.truncated_normal_(self.weight, mean=0.0, std=0.1) model_utils.truncated_normal_(self.bias, mean=0.0, std=0.1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_weights(self):\r\n self._weights = deepcopy(self._tmp_weights)\r\n self._tmp_weights = None", "def reset_weights(self):\n self.head.reset_weights()", "def reset(self):\n self._weights.clear()", "def reset(self):\n ih = (param for name, param in self.named_paramete...
[ "0.8267183", "0.8148116", "0.811264", "0.80035985", "0.78749144", "0.78714716", "0.7843639", "0.7657778", "0.7489607", "0.74009585", "0.74009585", "0.74009585", "0.73622704", "0.7284026", "0.7249447", "0.7239407", "0.7238883", "0.7238883", "0.72352153", "0.7204413", "0.719513...
0.77959615
7
Test that full s3 metadata is correctly stripped to essentials
def test_strip_s3_metadata(self): # Anonymised sample response from a head_object call with boto3 data = { 'ResponseMetadata': { 'RequestId': 'XXXXXXXXXXXXXXXX', 'HostId': 'hhhhhhhhhhhhhhhhhhhhhhhhhh', 'HTTPStatusCode': 200, 'H...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_s3_key_names_to_clean(self, test_case_data):\n s3_key_names = activity_module.s3_key_names_to_clean(\n \"outbox/\",\n test_case_data.get(\"prepared\"),\n test_case_data.get(\"xml_file_to_doi_map\"),\n test_case_data.get(\"do_not_remove\"),\n te...
[ "0.7071416", "0.69247544", "0.6711803", "0.65330374", "0.65180415", "0.64667034", "0.6360186", "0.63230467", "0.6281179", "0.6276321", "0.61171323", "0.60566837", "0.60145736", "0.600942", "0.6006092", "0.5978313", "0.5961877", "0.5945466", "0.5897789", "0.5867041", "0.584592...
0.8298188
0
Decide whether ``method`` is contained within the MRO of ``object``.
def is_method_of(method, object): if not callable(method) or not hasattr(method, "__name__"): return False if inspect.ismethod(method): return method.__self__ is object for cls in inspect.getmro(object.__class__): if cls.__dict__.get(method.__name__, None) is method: retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ismethod(object):\r\n return isinstance(object, types.MethodType)", "def is_method(obj: Any) -> bool:\n return inspect.ismethod(obj) or \"Boost.Python.function\" in str(type(obj))", "def _has_method(arg, method):\n return hasattr(arg, method) and callable(getattr(arg, method))", "def hasmethod(o...
[ "0.68832517", "0.67464465", "0.67349166", "0.65703607", "0.6432216", "0.6161321", "0.60411626", "0.6025945", "0.59048045", "0.57359904", "0.5734392", "0.5706894", "0.5676422", "0.5661669", "0.56310344", "0.56203425", "0.56199515", "0.55781573", "0.5548041", "0.55368125", "0.5...
0.76714796
0
Apply function for `vectorbt.indicators.basic.MA`.
def ma_apply_nb(ts, window, ewm, adjust, cache_dict): h = hash((window, ewm)) return cache_dict[h]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arma2ma(ar, ma, lags=100):\n return arma_impulse_response(ar, ma, leads=lags)", "def compute_MA(self, series, long_term=True):\n temp = series.copy().reset_index(drop=True) # DO NOT MODIFY THE ORIGINAL DATAFRAME!\n if long_term:\n lag = 200\n else:\n lag = 50\n ...
[ "0.6564936", "0.61908185", "0.6128455", "0.5984452", "0.59652424", "0.59645486", "0.59355915", "0.5856882", "0.57462", "0.571832", "0.5692187", "0.5664699", "0.566012", "0.5619815", "0.5594224", "0.55898577", "0.5577156", "0.5549418", "0.5521161", "0.55150145", "0.54783326", ...
0.0
-1
Caching function for `vectorbt.indicators.basic.MSTD`.
def mstd_cache_nb(ts, windows, ewms, adjust, ddof): cache_dict = dict() for i in range(len(windows)): h = hash((windows[i], ewms[i])) if h not in cache_dict: cache_dict[h] = mstd_nb(ts, windows[i], ewms[i], adjust=adjust, ddof=ddof) return cache_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_mstd(cls, data, column, windows):\n\t\twindow = cls.get_only_one_positive_int(windows)\n\t\tcolumn_name = '{}_{}_m_std'.format(column, window)\n\t\tdata[column_name] = data[column].rolling(min_periods=1, window=window,\n\t\t\t\t\t\t center=False).std()\n\t\treturn data", "def mean_STD(self,counter):...
[ "0.5957932", "0.59184873", "0.5699049", "0.56460124", "0.56098276", "0.553611", "0.5479815", "0.5406559", "0.5401095", "0.53737235", "0.53051645", "0.52908", "0.5272881", "0.5271256", "0.52460134", "0.5221955", "0.52169913", "0.5199122", "0.51928514", "0.5187776", "0.5165291"...
0.53501356
10
Apply function for `vectorbt.indicators.basic.RSI`.
def rsi_apply_nb(ts, window, ewm, adjust, cache_dict): h = hash((window, ewm)) roll_up, roll_down = cache_dict[h] rs = roll_up / roll_down return 100 - 100 / (1 + rs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ift_rsi(data):\n if data is None:\n raise EmptyDataError('[!] Invalid data value')\n\n result = TA.IFT_RSI(data)\n if result is None:\n raise IndicatorException\n return result", "def __calculate_rsi(self,df):\n df['RSI']=round(ta.rsi(df[Config.PRI...
[ "0.6286931", "0.6077023", "0.60016006", "0.59995", "0.59768754", "0.5929737", "0.59177923", "0.5912615", "0.59061193", "0.57669103", "0.5764891", "0.57538414", "0.5708065", "0.550596", "0.54577136", "0.5426175", "0.5380706", "0.53164965", "0.5305945", "0.52951753", "0.5262326...
0.46255586
59
r"""Test LPyModelDriver error when LPy not installed.
def test_LPyModelDriver_nolpy(): # pragma: no lpy assert_raises(RuntimeError, LPyModelDriver.LPyModelDriver, 'test', scripts['lpy'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_validate_nagl_model_path_failed():\n with pytest.raises(FileNotFoundError):\n validate_nagl_model_path(\"does-not-exist.pt\")", "def test_failure():\n with pytest.raises(ModuleNotFoundError):\n import torch # noqa: F401\n\n with pytest.raises(ModuleNotFoundError):\n import...
[ "0.6338071", "0.6316618", "0.616884", "0.59346616", "0.5849294", "0.5826512", "0.58031327", "0.57380205", "0.5728839", "0.572462", "0.5715396", "0.5711509", "0.56888545", "0.56804115", "0.56726086", "0.56611365", "0.56555086", "0.5634733", "0.56115484", "0.5584204", "0.558103...
0.85099113
0
Add Experiance to Replay Buffer.
def Step(self, state, action, reward, next_state, done, limit=-1): self.Memory.addMulti(state, action, reward, next_state, done, limit)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append(self, experience: Experience) -> None:\n self.buffer.append(experience)", "def add_experience(self, action, state, reward, terminal):\n self.replay_buffer.add_experience(action, state, reward, terminal)", "def add(self, experience):\n self.buffer.append(experience)", "def appe...
[ "0.6126036", "0.60967386", "0.6094653", "0.5946677", "0.5672599", "0.55147403", "0.54663604", "0.5273294", "0.5226438", "0.5153992", "0.51377285", "0.5045141", "0.5034448", "0.49872455", "0.4966085", "0.4960083", "0.49395856", "0.48919225", "0.4891089", "0.4861434", "0.479920...
0.0
-1
Returns a tuples (variable index, column index in that variable). The function has two different behaviours, one when i (column index) is an integer, another one when i is a string (column name). If i is a string, the function looks for input name with this name and returns `(index, 0)`. If i is an integer, let's assum...
def get_column_index(i, inputs): if isinstance(i, int): if i == 0: # Useful shortcut, skips the case when end is None # (unknown dimension) return 0, 0 vi = 0 pos = 0 end = inputs[0][1].shape[1] if end is None: raise RuntimeErro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indices_of_var(v):\n name = v.varName\n indices = name[2:].split(',')\n i, j = int(indices[0]), int(indices[1])\n return i, j", "def location_of(self, c: str) -> tuple:\n\n c = c.upper()\n if c == 'J': c = 'I'\n\n row = 0\n while row < 5:\n c...
[ "0.6323326", "0.58435106", "0.58264816", "0.5805598", "0.5801189", "0.57787395", "0.5754739", "0.57472175", "0.57394", "0.5714151", "0.56712127", "0.5657222", "0.56557673", "0.5651027", "0.56094927", "0.5593126", "0.55774975", "0.55662507", "0.5542124", "0.5514759", "0.550829...
0.7673106
0
This view is to redirect user to checkout from the my bookings page This can happen if the user have not finished the checkout after the booking was made
def CheckoutThisBooking(request, pk): try: booking = Booking.objects.get(pk=pk) motorhome = get_object_or_404(Motorhome, pk=booking.booked_vehicle.id) user = request.user request.session['user.pk'] = user.pk # get the dates from the form booked_from = booking.booked_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reader_checkout(request):\n bookcopy = None\n if request.method == 'POST':\n\n # A 'POST' request is for form submission.\n form = BookCopyCheckoutForm(None, None, request.POST)\n if form.is_valid():\n id = form.cleaned_data['id']\n action = form.cleaned_data['a...
[ "0.694296", "0.6487638", "0.64557004", "0.64254504", "0.6327567", "0.6299454", "0.62208414", "0.62182593", "0.61870754", "0.6173737", "0.61491144", "0.6130322", "0.6123574", "0.61085457", "0.6107655", "0.6100576", "0.6060958", "0.6017189", "0.5997124", "0.5986465", "0.5984689...
0.7800301
0
Loads an object saved with `torch.save()` or `crypten.save()`.
def load(f, encrypted=False, dummy_model=None, src=0, **kwargs): if encrypted: raise NotImplementedError("Loading encrypted tensors is not yet supported") else: assert isinstance(src, int), "Load failed: src argument must be an integer" assert ( src >= 0 and src < comm.get()....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_obj(saved_name):\n with open( saved_name + '.pkl', 'rb') as f:\n return pickle.load(f)", "def load(model, name=\"store/base\"):\n if torch.cuda.is_available():\n pretrained_dict = torch.load(name + \".pt\")\n else:\n pretrained_dict = torch.load(name + \".pt\", map_location...
[ "0.67293406", "0.624632", "0.6225806", "0.62197393", "0.6218711", "0.6209016", "0.620334", "0.620334", "0.61686987", "0.61686987", "0.6157381", "0.6125955", "0.6125955", "0.6077802", "0.6066805", "0.6058042", "0.6044678", "0.60228366", "0.60091394", "0.5953639", "0.59524447",...
0.5793288
37
Returns the gpustat of this host. See `excludeself` option of `gpuview run`.
def report_gpustat(): def _date_handler(obj): if hasattr(obj, 'isoformat'): return obj.isoformat() else: raise TypeError(type(obj)) response.content_type = 'application/json' if EXCLUDE_SELF: resp = {'error': 'Excluded self!'} else: resp = core.m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gpus(self):\n return self.__gpus", "def GetGPU():\n return option['device_id']", "def get_free_gpus(gpu_num = None, bool=False, verbose=False):\n if gpu_num != None:\n check_num(gpu_num)\n return (get_gpu_utilization(gpu_num, verbose)<(1,1)).min()\n res = (get_gpu_utilization(gpu_...
[ "0.6925846", "0.6432396", "0.60408264", "0.5735819", "0.57051605", "0.57051605", "0.5696185", "0.56935096", "0.56897956", "0.5675194", "0.5662505", "0.5611714", "0.56056756", "0.55672836", "0.5566159", "0.5523766", "0.5503897", "0.54938495", "0.546913", "0.5446613", "0.541045...
0.0
-1
This field specifies the maximum number of SIDs in the top MSD in an MSD stack that the router can apply PSP or USP flavors to. If the value of this field is zero, then the router cannot apply PSP or USP flavors.
def MaxEndPopMsd(self): return self._get_attribute('maxEndPopMsd')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MaxLSPsOrMGroupPDUsPerBurst(self):\r\n\t\treturn self._get_attribute('maxLSPsOrMGroupPDUsPerBurst')", "def max_shares(self) -> Optional[int]:\n return pulumi.get(self, \"max_shares\")", "def getMaxMancount(self):\n return self.__size * 20", "def minsize(self):# -> int:\r\n return 0",...
[ "0.57622594", "0.5617422", "0.555893", "0.55575377", "0.5553475", "0.55190516", "0.5470241", "0.5453663", "0.5443849", "0.5418935", "0.5400843", "0.537705", "0.53716993", "0.5367154", "0.53652966", "0.53561544", "0.5355868", "0.53483653", "0.53373563", "0.5329634", "0.5325107...
0.5467811
7
Computes the closest pair of indices between two sets of indices. Each index pair corresponds to the start and end of a subsequence (i.e. phrases in a sentence). Currently finds the closest pair just by checking the absolute distance between the start of each subsequence.
def get_closest_match(indices1, indices2): if len(indices1) == 1 and len(indices2) == 1: return indices1[0], indices2[0] closest_match = (indices1[0], indices2[0]) min_dist = np.abs(closest_match[0][0] - closest_match[1][0]) for pair in itertools.product(indices1, indices2): di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_closest_atom(coords1, coords2):\n\n coords1 = np.array(coords1)\n coords2 = np.array(coords2)\n diff = coords2[:, np.newaxis] - coords1[np.newaxis, :]\n dist = np.einsum('ijk->ij', diff**2)**0.5\n index = np.argmin(dist)\n return index", "def find_indices(li, first_elt, second_elt):\r\...
[ "0.63234985", "0.6176782", "0.6110066", "0.60815537", "0.6058005", "0.59816456", "0.5973025", "0.59400487", "0.59123135", "0.5912085", "0.58572686", "0.5849757", "0.5837614", "0.5810739", "0.5795735", "0.57617736", "0.575801", "0.5754841", "0.5753995", "0.5749336", "0.5748059...
0.73385775
0
Check if password is a valid password.
def is_valid_password(variable): if re.match(r'[A-Za-z0-9@#$%^&+=]{8,}', variable): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_password(self, password):\n rule = re.compile(constant.password_regex)\n if not rule.match(password):\n return False\n # disallow password from azure guide, yes, it's hard code.\n disallowed = constant.password_disallowed\n return password not in disallowed"...
[ "0.8618973", "0.84867865", "0.8463078", "0.8462248", "0.84620655", "0.8333932", "0.83183765", "0.8301522", "0.83003336", "0.82944286", "0.82355964", "0.8194231", "0.81928074", "0.8173996", "0.8173349", "0.81718874", "0.8164174", "0.8164174", "0.81612766", "0.8147886", "0.8131...
0.77712625
46
Converts time strings to hour lists.
def convert_time(time): s = time.split()[0] s_h = int(s.split(':')[0]) am_pm = s.split(':')[1][-2:] if s_h == 12: s_h = s_h - 12 if am_pm == 'PM': s_h = s_h + 12 s_h = s_h + 1 e = time.split()[2] e_h = int(e.split(':')[0]) am_pm = e.split(':')[1][-2:] if e_h =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_times(time_str):\n warnings = []\n days, interval = time_str.split(',')\n assert int(days) == float(days)\n days = int(days)\n assert int(interval) == float(interval)\n interval = int(interval)\n if interval < 3:\n warnings.append('Minimum interval is 3 hours')\n if days > ...
[ "0.7458262", "0.65959746", "0.6189524", "0.61875147", "0.6165391", "0.6014263", "0.5844406", "0.5827681", "0.58153456", "0.5808027", "0.5797886", "0.574867", "0.5677828", "0.56731707", "0.56696624", "0.56445616", "0.55809003", "0.55760634", "0.55455714", "0.55455714", "0.5545...
0.7849633
0
Return the Plant of the Day for a given day and partner site.
def for_day(self, day_date, partner_name): plant_for_day = None taxon = None while not taxon: candidate_plant = self._pick_candidate_plant( day_date, partner_name) if candidate_plant: # Make sure this plant still exists in the main databa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pick_candidate_plant(self, day_date, partner_name):\n candidate_plant = None\n # First check to see if there is already a plant for this day.\n plants = self.filter(last_seen=day_date,\n partner_short_name=partner_name,\n include=Tru...
[ "0.6798648", "0.5399709", "0.5290895", "0.5190091", "0.5084283", "0.50734746", "0.5037955", "0.49555525", "0.49534097", "0.4880959", "0.48276672", "0.48193213", "0.48121452", "0.47832596", "0.47429958", "0.47129145", "0.46985742", "0.468627", "0.46656072", "0.46105653", "0.45...
0.7144241
0
test retrieving a list of recipes
def test_retrieve_recipe(self): sample_recipe(user=self.user) sample_recipe(user=self.user) res = self.client.get(RECIPE_URL) recipes = Recipe.objects.all().order_by('id') serializer = RecipeSerializer(recipes,many=True) print(json.dumps(serializer.data, indent=1)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_recipe_information_bulk(self):\n pass", "def test_get_random_recipes(self):\n pass", "def test_get_recipe_information(self):\n pass", "def test_retrieve_recipes(self):\n sample_recipe(name=\"Avocado toast\")\n sample_recipe(name='Baklava')\n\n res = self...
[ "0.81717724", "0.80490136", "0.804446", "0.79468447", "0.78477895", "0.7847377", "0.779245", "0.77565753", "0.77107847", "0.7424308", "0.73802507", "0.7204181", "0.71637887", "0.7118915", "0.70756555", "0.6992412", "0.69724214", "0.6953806", "0.6858405", "0.6855138", "0.68451...
0.73041534
11
retrieve recipes limited to the authenticated user
def test_recipe_limited_to_user(self): user2 = get_user_model().objects.create_user('test@test.com','passpass') sample_recipe(user2) sample_recipe(self.user) res = self.client.get(RECIPE_URL) recipe = Recipe.objects.filter(user=self.user) serializer = RecipeSerializer(rec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n user = self.request.user\n return Recipe.objects.filter(created_by=user)", "def test_recipes_limited_to_user(self):\n user2 = get_user_model().objects.create_user(\n email = 'test2@gmail.com',\n password = '123465',\n )\n sample_r...
[ "0.73592275", "0.6845996", "0.6829094", "0.68058443", "0.6736745", "0.6716937", "0.6629862", "0.66132605", "0.6605455", "0.660369", "0.6595812", "0.6576698", "0.63961625", "0.6380524", "0.63551784", "0.6239085", "0.6230718", "0.6220945", "0.61829185", "0.61822295", "0.6172210...
0.6300848
15
test updating a recipe with PUT method
def test_full_update_recipe(self): recipe = sample_recipe(user=self.user) recipe.tag.add(sample_tag(user=self.user)) payload = { 'title':'chicken noodles', 'time_minutes':50, 'price':12.67, } url = detail_url(recipe.id) self.client.put(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_full_update_recipe(self):\n recipe = sample_recipe()\n recipe.ingredients.create(name='Eggs')\n original_description = recipe.description\n\n payload = {\n 'name': 'Vegan gnocchi',\n 'ingredients': [{'name': 'Vegegg'}]\n }\n url = recipe_deta...
[ "0.8260011", "0.81543297", "0.8100989", "0.8089497", "0.80221903", "0.79731107", "0.7930643", "0.7832129", "0.7828336", "0.7796912", "0.778766", "0.7704531", "0.76727724", "0.7531208", "0.7522847", "0.75153404", "0.74857104", "0.7459878", "0.742174", "0.7314077", "0.73059416"...
0.8220734
1
test returning recipe's with specific ingredients
def test_filter_recipe_by_ingredients(self): recipe1 = sample_recipe(user=self.user, title='chicken curry') recipe2 = sample_recipe(user=self.user, title='mutton curry') recipe3 = sample_recipe(user=self.user, title='milk dish') ing1 = sample_ingredient(user=self.user,name='chicken') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search_recipes_by_ingredients(self):\n pass", "def test_get_recipe_ingredients_by_id(self):\n pass", "def test_creating_recipe_with_ingredients(self):\n ingredient1 = sample_ingredients(user=self.user, name='Prawns')\n ingredient2 = sample_ingredients(user=self.user, name='...
[ "0.83429855", "0.79539394", "0.7854156", "0.7639293", "0.7604956", "0.7593395", "0.7559094", "0.751062", "0.74519587", "0.73807645", "0.7373793", "0.7361029", "0.73334414", "0.7307807", "0.7303709", "0.73035383", "0.71983427", "0.71857625", "0.7153656", "0.71254", "0.71071285...
0.7528916
7
Get the leaves of the decision tree >>> d = DecisionTreeClassifier() >>> d.fit([[1,2,3],[4,5,6],[7,8,9]], [1,2,3]) >>> get_n_leaves(clf) 4
def get_n_leaves(clf): leaves = clf.tree_.children_left == -1 leaves = np.arange(0,clf.tree_.node_count)[leaves] return len(leaves)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_leaves(tree):\n return ((tree.n_node_samples > 0) & (tree.feature == INVALID_VALUE)).sum()", "def leaves(tree):\n if is_leaf(tree):\n return [label(tree)]\n else:\n return sum([leaves(b) for b in branches(tree)], [])", "def count_leaves(self) -> int:\n # binary search ...
[ "0.74670506", "0.68974525", "0.678377", "0.6779171", "0.6719672", "0.6653477", "0.65831137", "0.6513492", "0.64592224", "0.64412075", "0.64057827", "0.6375553", "0.63726157", "0.6322535", "0.6303533", "0.62496805", "0.62414163", "0.6231768", "0.61973846", "0.61602074", "0.614...
0.8843361
0
Generate n colors with equally spaced hues.
def _color_brew(n): color_list = [] # Initialize saturation & value; calculate chroma & value shift s, v = 0.75, 0.9 c = s * v m = v - c for h in np.arange(25, 385, 360. / n).astype(int): # Calculate some intermediate values h_bar = h / 60. x = c * (1 - abs((h_bar % 2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniquecolors(n):\n hues = [360.0 / n * i for i in range(n)]\n hs = [math.floor(hue / 60) % 6 for hue in hues]\n fs = [hue / 60 - math.floor(hue / 60) for hue in hues]\n return [('rgb({}%, {}%, {}%)'.format(*tuple(a * 100 for a in rgbcolor(h, f)))) for h, f in zip(hs, fs)]", "def unique_colors_rgb...
[ "0.8027365", "0.78960544", "0.75964296", "0.73884255", "0.7378317", "0.7127401", "0.70659304", "0.70644534", "0.7033906", "0.6942788", "0.6885502", "0.6885502", "0.6885502", "0.68266106", "0.68192196", "0.67784595", "0.67692924", "0.67639786", "0.6758458", "0.6753326", "0.670...
0.74503654
3
Plot confusion matrix using heatmap.
def plot_confusion_matrix_normal(data, labels): seaborn.set(color_codes=True) plt.figure(1, figsize=(9, 6)) plt.title("Normal Equations Method Confusion Matrix") seaborn.set(font_scale=1.4) ax = seaborn.heatmap(data, annot=True, cmap="YlGnBu", cbar_kws={'label': 'Scale'}) ax.set_xticklabel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=None, title='Confusion matrix'):\n if classes is not None:\n sns.heatmap(cm, xticklabels=classes, yticklabels=classes, vmin=0., vmax=1., annot=True)\n else:\n sns.heatmap(cm, vmin=0., vmax=1.)\n plt.title(title)\n plt.ylabel('True label')\n plt.xla...
[ "0.830233", "0.82818854", "0.824255", "0.82181364", "0.8200182", "0.81982034", "0.8061991", "0.7947487", "0.79189795", "0.7879949", "0.78654116", "0.7864955", "0.781701", "0.781386", "0.7800045", "0.7795842", "0.7794019", "0.7789363", "0.77865803", "0.77813697", "0.7779168", ...
0.7825948
12
Return the name of the sensor.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._sensor.name", "def get_sensor_name(self):\n return self.data[1]", "def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'", "def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso...
[ "0.91896784", "0.9168378", "0.890185", "0.8770976", "0.8511273", "0.8479953", "0.844435", "0.8299758", "0.8186503", "0.8105667", "0.8079737", "0.8066149", "0.8049647", "0.7700968", "0.7612295", "0.7611456", "0.7600605", "0.7600605", "0.7600605", "0.75392073", "0.75166553", ...
0.0
-1