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
Zero parameter automatic Canny edge detection courtesy of
def auto_canny(image, sigma=0.4): v = np.median(image) lower = int(max(0, (1.0 - sigma) * v)) upper = int(min(255, (1.0 + sigma) * v)) edged = Canny(image, lower, upper) return edged
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def canny_edge(self):\n self.frame = cv.Canny(self.frame, 100, 200)", "def run_canny_edge_detection(image, min_threshold=100, max_threshold=150):\n return cv2.Canny(image, min_threshold, max_threshold)", "def edgeDetection():\n image1 = cv2.imread(\"images\\OC14.tiff\")\n edges = cv2.Canny(imag...
[ "0.76493996", "0.72182775", "0.7216294", "0.72023165", "0.72023165", "0.72023165", "0.72023165", "0.72023165", "0.72023165", "0.72023165", "0.72023165", "0.72023165", "0.72023165", "0.72023165", "0.72023165", "0.72023165", "0.72023165", "0.72023165", "0.71943456", "0.7187973", ...
0.64813304
34
Judge whether the VectorSet contains a given vector.
def __contains__(self, vector: Vector) -> bool: for vec in self.__elements: if vec == vector: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains_vect(self, v: Tuple[float, float]) -> bool:\n assert len(v) == 2\n return bool(lib.cpBBContainsVect(self, v))", "def __contains__(self, v):\n for i in self:\n if v in i:\n return True\n False", "def has(self, *args):\n return _ida_hexray...
[ "0.710292", "0.6935895", "0.6644651", "0.65584636", "0.6549296", "0.64888877", "0.64488", "0.6423306", "0.6423306", "0.6422749", "0.6325735", "0.63245225", "0.63245225", "0.6309977", "0.62081075", "0.6133481", "0.6102702", "0.61008435", "0.6097306", "0.60970557", "0.6063051",...
0.83577657
0
Judge whether this VectorSet is equal to a given VectorSet.
def __eq__(self, vs) -> bool: return {*map(tuple, self.__elements)} == {*map(tuple, vs)}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, anotherset):\r\n if not isinstance(anotherset, LR0ItemSet):\r\n raise TypeError\r\n if len(self.itemlist) != len(anotherset.itemlist):\r\n return False\r\n for element in self.itemlist:\r\n if element not in anotherset.itemlist:\r\n ...
[ "0.7329616", "0.72963536", "0.7153364", "0.7101648", "0.70883745", "0.70731133", "0.69106615", "0.6772446", "0.6772446", "0.6728485", "0.6657832", "0.6651126", "0.66088957", "0.6591927", "0.65618545", "0.65610933", "0.6553453", "0.6489576", "0.6486279", "0.6461076", "0.643107...
0.67989606
7
Performs the forward pass of the L1 loss function.
def forward(self,y_out, y_truth): result = None ######################################################################### # TODO: # # Implement the forward pass and return the output of the L1 loss. # ##########...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def L_model_forward(X, parameters):\n pass", "def l1_loss(inputs, reduction='mean', **kwargs):\n args = ArgHelper.parse(locals())\n args['reduction'] = reduction.upper()\n op_lib = loss_ops_lib.L1Loss\n if context.executing_eagerly():\n return op_lib \\\n .instantiate(reduction=a...
[ "0.6900068", "0.68213624", "0.67145723", "0.6687107", "0.66505486", "0.6643757", "0.66029626", "0.65981174", "0.65748453", "0.6572366", "0.6550759", "0.652202", "0.6506907", "0.65013653", "0.6500998", "0.64785224", "0.64723045", "0.64703393", "0.6449808", "0.6448741", "0.6446...
0.6485144
15
Performs the backward pass of the L1 loss function.
def backward(self,y_out, y_truth): gradient = None ########################################################################### # TODO: # # Implement the backward pass. Return the gradient wrt y_out # #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backward_pass(self, loss):\n\n self.optimizer.zero_grad()\n self.optimizer.backward(loss)\n self.optimizer.step()", "def _backward(loss):\n\n loss.backward()", "def backward_and_step(self, loss):\n self.opt.zero_grad()\n loss.backward()\n self.opt.step()", ...
[ "0.7829394", "0.7614116", "0.7377019", "0.7323652", "0.730343", "0.7257266", "0.7231584", "0.72029597", "0.71579987", "0.710414", "0.70944566", "0.7085781", "0.70661736", "0.6946666", "0.6946666", "0.69433695", "0.6833876", "0.6812968", "0.67766273", "0.6764659", "0.674349", ...
0.62443656
84
Performs the backward pass of the loss function.
def backward(self,y_out, y_truth): gradient = None ########################################################################### # TODO: # # Implement the backward pass. Return the gradient wrt y_out # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backward_pass(self, loss):\n\n self.optimizer.zero_grad()\n self.optimizer.backward(loss)\n self.optimizer.step()", "def _backward(loss):\n\n loss.backward()", "def backward_and_step(self, loss):\n self.opt.zero_grad()\n loss.backward()\n self.opt.step()", ...
[ "0.85558826", "0.8452244", "0.80646175", "0.80081743", "0.79074144", "0.782004", "0.7805677", "0.7795026", "0.7746016", "0.768947", "0.7677231", "0.7633204", "0.7633204", "0.7600017", "0.7560247", "0.7532067", "0.7532067", "0.74631304", "0.74398345", "0.74051845", "0.7382091"...
0.69497526
50
Validate characters for the provided alias.
def clean_alias(self): alias = self.cleaned_data.get('alias') if not bool(re.compile(r'^[a-zA-Z0-9-]+$').match(alias)): raise forms.ValidationError("Alias contains invalid characters") return alias
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_character(char, name, parameters):\r\n if char in name:\r\n raise NameError('Invalid character in the variable name: ' + name)\r\n\r\n # Make sure people don't include # within the name of parameters\r\n for item in parameters.keys():\r\n if char in item:\r\n raise NameE...
[ "0.66764194", "0.662183", "0.6502785", "0.64648443", "0.6438361", "0.6437747", "0.6382608", "0.6377143", "0.6376573", "0.6256093", "0.6225624", "0.6191249", "0.61696607", "0.6159029", "0.61316186", "0.61009514", "0.6095541", "0.6092223", "0.60531527", "0.6037803", "0.6018155"...
0.78793395
0
Test that a user can add a bucket
def test_creating_a_bucket(self): with self.client: self.create_bucket(self.get_user_token())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_buckets(self):\n objectstore.bucket.Bucket.create('new_bucket', self.context)\n bucket = objectstore.bucket.Bucket('new_bucket')\n\n # creator is authorized to use bucket\n self.assert_(bucket.is_authorized(self.context))\n\n # another user is not authorized\n con...
[ "0.7763606", "0.77099466", "0.7086688", "0.7003638", "0.6886021", "0.6864985", "0.68597794", "0.68041325", "0.6786825", "0.6734436", "0.66748255", "0.66228974", "0.65437603", "0.6510135", "0.65068775", "0.6502714", "0.6474747", "0.6473299", "0.6466394", "0.6443089", "0.642757...
0.80832076
0
Test there is no bucket/no bucket returned with given Id
def test_no_bucket_returned_by_given_id(self): with self.client: token = self.get_user_token() response = self.client.get( '/bucketlists/1', headers=dict(Authorization='Bearer ' + token) ) data = json.loads(response.data.decode()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_get_bucketlist_by_id_not_exist(self):\n res = self.client().get(f\"/bucketlist/99\")\n self.assertEqual(res.status_code, 404)", "def test_get_bucket(self):\n pass", "def test_deletion_handles_no_bucket_found_by_id(self):\n with self.client:\n response = self....
[ "0.7713271", "0.71432155", "0.7107075", "0.70750123", "0.6986567", "0.6849585", "0.6821341", "0.6737777", "0.6546235", "0.6531086", "0.65217876", "0.65036184", "0.6452373", "0.64255", "0.64049375", "0.63744843", "0.63696444", "0.63232464", "0.6296747", "0.62818104", "0.625737...
0.77902484
0
Show tha a 404 response is returned when an un existing bucket is being deleted.
def test_deletion_handles_no_bucket_found_by_id(self): with self.client: response = self.client.delete( '/bucketlists/1', headers=dict(Authorization='Bearer ' + self.get_user_token()) ) data = json.loads(response.data.decode()) self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raise_not_found(*_, **__):\n e = boto.exception.S3ResponseError(400, 'missing')\n e.error_code = 'NoSuchBucket'\n raise e", "def test_delete(self):\n responses.add(\n responses.Response(\n method='DELETE',\n url='https://connect...
[ "0.684705", "0.67667437", "0.6481858", "0.64196914", "0.64190435", "0.63951874", "0.62681764", "0.6158347", "0.61309874", "0.6055331", "0.6046032", "0.6043882", "0.60398084", "0.599907", "0.5997249", "0.59945416", "0.5963344", "0.59540546", "0.59325296", "0.5919325", "0.59189...
0.7230822
0
Test that the Bucket details(name) is updated
def test_bucket_is_updated(self): with self.client: # Get an auth token token = self.get_user_token() # Create a Bucket response = self.client.post( '/bucketlists', data=json.dumps(dict(name='Travel')), headers=dict(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_bucket(self):\n pass", "def test_patch_bucket(self):\n pass", "def test_id_of_bucket_to_be_edited_is_invalid(self):\n with self.client:\n # Get an auth token\n token = self.get_user_token()\n # Update the bucket name\n res = self....
[ "0.8708406", "0.79123294", "0.76828593", "0.76591843", "0.7471502", "0.742757", "0.7048196", "0.6995496", "0.6977668", "0.68588907", "0.68556577", "0.682883", "0.6799105", "0.678763", "0.67652243", "0.675332", "0.67003673", "0.66971505", "0.66387427", "0.6615255", "0.65860766...
0.87999487
0
Test the bucket to be updated does not exist.
def test_id_of_bucket_to_be_edited_does_not_exist(self): with self.client: # Get an auth token token = self.get_user_token() # Update the bucket name res = self.client.put( '/bucketlists/1', headers=dict(Authorization='Bearer ' + to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_item_with_non_existing_bucket(self):\n self.client.post('/buckets',\n content_type='application/json',\n data=self.bucket, headers=self.header)\n self.client.post('/buckets/1/items',\n conten...
[ "0.71295375", "0.6940976", "0.6899412", "0.6776305", "0.677003", "0.67556757", "0.6668342", "0.66050065", "0.6603274", "0.6497684", "0.6497437", "0.64860666", "0.64646524", "0.6431992", "0.64307004", "0.64276284", "0.6400218", "0.63427407", "0.6283145", "0.6276225", "0.627147...
0.7745154
0
Test that the content type used for the request is application/json
def test_content_type_for_editing_bucket_is_json(self): with self.client: token = self.get_user_token() res = self.client.put( '/bucketlists/1', headers=dict(Authorization='Bearer ' + token), data=json.dumps(dict(name='Adventure')) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_content_type():\n return request.content_type == \"application/json\"", "def is_json(request: HttpRequest):\n ct = request.content_type\n return (\n ct == 'application/json'\n or (ct.startswith('application/')) and ct.endswith('+json')\n )", "def is_json(self):\n mt = sel...
[ "0.8551049", "0.8006421", "0.7867867", "0.76065797", "0.75816983", "0.7569212", "0.7562776", "0.74854827", "0.7244852", "0.7199992", "0.71933126", "0.7142546", "0.7047551", "0.69829714", "0.6978315", "0.69091946", "0.6815024", "0.6762803", "0.6756431", "0.6753268", "0.6690397...
0.7023403
13
Test that a Bucket is deleted successfully
def test_bucket_is_deleted(self): with self.client: # Get an auth token token = self.get_user_token() response = self.client.post( '/bucketlists', data=json.dumps(dict(name='Travel')), headers=dict(Authorization='Bearer ' + toke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_bucket(self):\n pass", "def test_delete(self):\n responses.add(\n responses.Response(\n method='DELETE',\n url='https://connection.keboola.com/v2/storage/buckets/1?force=False&async=False',\n json={}\n )\n )\n...
[ "0.8918379", "0.8679143", "0.81490856", "0.80459154", "0.79044837", "0.7776505", "0.77320004", "0.763795", "0.7605917", "0.75812054", "0.75642914", "0.7472303", "0.73590463", "0.7358934", "0.733549", "0.72955567", "0.72792494", "0.72073174", "0.7198382", "0.7176627", "0.71275...
0.8728136
1
Create a new application object. The database and CLI are automatically wired up. If ``config_filename`` or ``config_object`` are not ``None`` they
def create_app(config_filename=None, config_object=None): app = Flask(__name__) app.config.from_object('psephology.config.default') if config_filename is not None: app.config.from_pyfile(config_filename) if config_object is not None: app.config.from_object(config_object) db.init_ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app(configobj=ProdConfig):\n\n app = Flask(__name__)\n app.config.from_object(configobj)\n configure_blueprints(app)\n configure_extensions(app)\n configure_callbacks(app)\n configure_filters(app)\n configure_error_handlers(app)\n return app", "def create_app(config_object=Conf...
[ "0.7304309", "0.724927", "0.7132455", "0.7007617", "0.69696975", "0.68736166", "0.68637097", "0.6826989", "0.67556334", "0.674993", "0.6724784", "0.6704176", "0.66930896", "0.6637348", "0.6634328", "0.6627209", "0.6620914", "0.6619785", "0.6618544", "0.6595053", "0.65865695",...
0.78656185
0
Assume embeddiing has nbatch x max_atom x n_dims mask has nbatch x max_atom
def attn(self, embed, mask, name=""): with tf.variable_scope("attn_"+name): K = self.get_trans_param("K") Q = self.get_trans_param("Q") V = self.get_trans_param("V") kdata = tf.einsum("nml,lk->nmk", embed, K) qdata = tf.einsum("nml,lk->nmk", embed, Q) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pool(embed, seq_len):\n attention_w = ops.last_dim_weighted_sum(embed, \"w\")\n attention_w = ops.mask_logits(attention_w, seq_len)\n attention_w = tf.expand_dims(tf.nn.softmax(attention_w), 1)\n\n # [batch, 1, len] * [batch, len, dim] -> [batch, 1, dim]\n return tf.squeeze(tf.matmul(attention_w, embed), ...
[ "0.6692591", "0.6459019", "0.6335892", "0.6118211", "0.60688734", "0.60625243", "0.60481936", "0.59835744", "0.5980937", "0.5863645", "0.58461136", "0.5833285", "0.5815252", "0.5805961", "0.57885605", "0.5788423", "0.577147", "0.57709837", "0.5766963", "0.5750837", "0.5749588...
0.5996511
7
Creates the classification visualizer.
def __init__(self, top_n: int = 5, *args, **kwargs): super().__init__('Real time classification visualizer', *args, **kwargs) class_input_spec = self.inputs_specs['classification_data'] self.class_names = class_input_spec['class_names'] self.top_n = top_n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classify(self):\r\n Classify(os.path.join(self.__path,'test.csv'),self.__rang,self.__numeric,self.__statistics,self.__k,self.__classes,self.__abs_n,self)\r\n self.view.Build_Button.configure(state=\"active\")", "def visualise_dataset_classifier_results(dataset_results):\n current_time = date...
[ "0.6425579", "0.61953336", "0.61389655", "0.6129537", "0.59203684", "0.5904309", "0.58877313", "0.5859866", "0.5830613", "0.5827389", "0.5809543", "0.5774925", "0.5754018", "0.56999975", "0.56976795", "0.5654992", "0.5654484", "0.5652847", "0.56334454", "0.56249714", "0.56149...
0.60467935
4
Helper function to append composite tensors to each other in the 0 axis. In order to support batching within a fit/evaluate/predict call, we need to be able to aggregate within a CompositeTensor. Unfortunately, the CT API currently does not make this easy especially in V1 mode, where we're working with CompositeTensor ...
def _append_composite_tensor(target, to_append): if type(target) is not type(to_append): raise RuntimeError('Unable to concatenate %s and %s' % (type(target), type(to_append))) # Perform type-specific concatenation. # TODO(b/125094323): This should be replaced by a simple call to # t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concatenate(tensors, axis=0):\n raise NotImplementedError", "def concat_model():\n x = tf.keras.Input(shape=[10, 10, 3, ])\n x1 = tf.keras.layers.Conv2D(5, (2, 2))(x)\n x2 = tf.keras.layers.Conv2D(6, (2, 2))(x)\n x3 = tf.keras.layers.Conv2D(7, (2, 2))(x)\n z = tf.keras.layers.concatenat...
[ "0.6782832", "0.6158586", "0.6154764", "0.6153678", "0.61383915", "0.6124244", "0.60853636", "0.5964189", "0.5964189", "0.5943198", "0.58413076", "0.5831469", "0.5757137", "0.5747809", "0.5743722", "0.5737976", "0.57355106", "0.5723419", "0.5676435", "0.5659987", "0.5649936",...
0.6515346
1
Legacy utility method to slice input arrays.
def _slice_assign(self, batch_element, batch_start, batch_end, is_finished): try: self.results[batch_start:batch_end] = batch_element except Exception as e: # pylint: disable=broad-except # `_slice_assign` should only be called in threads and exceptions raised # in threads do not carry over ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_slice(items, a1, a2 = None):\n if (a2 is None):\n return items[a1:]\n else:\n return items[a1:a2]", "def _fix_slice(self, inputs, new_attr):\n begin = new_attr.get('begin')\n end = new_attr.get('end')\n axes = new_attr.get('axis', tuple(range(len(begin))))\n slice_op...
[ "0.72107875", "0.6629543", "0.6146551", "0.6092164", "0.60912913", "0.6087721", "0.60780793", "0.60098535", "0.5985206", "0.5980164", "0.59576505", "0.59540904", "0.5948342", "0.5926323", "0.5893846", "0.58470637", "0.58464056", "0.5782253", "0.5768264", "0.57507706", "0.5708...
0.0
-1
Returns the metric function corresponding to the given metric input.
def get_metric_function(metric, output_shape=None, loss_fn=None): if metric not in ['accuracy', 'acc', 'crossentropy', 'ce']: return metrics_module.get(metric) is_sparse_categorical_crossentropy = ( isinstance(loss_fn, losses.SparseCategoricalCrossentropy) or (isinstance(loss_fn, losses.LossFunctio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_metric_fn(metric):\n metrics = {'accuracy': accuracy, 'acc': accuracy, 'mean_squared_error': mean_squared_error, 'mse': mean_squared_error, 'sum_squared_error': sum_squared_error, 'sse': sum_squared_error, 'mean_absolute_error': mean_absolute_error, 'mae': mean_absolute_error, 'r_squared': r_squared, 'r...
[ "0.79478264", "0.773909", "0.7693249", "0.7484452", "0.74728703", "0.7415086", "0.67947537", "0.65703934", "0.65485346", "0.6375187", "0.6344244", "0.6344244", "0.6344244", "0.6344244", "0.6344244", "0.6344244", "0.6344244", "0.6344244", "0.6344244", "0.63227123", "0.63181776...
0.707597
6
Validates `steps` argument based on input data's type. The cases when `steps` value must be provided are when 1. input data passed is an iterator. 2. model was built on top of symbolic tensors, input data is not required and is `None`. 3. input data passed is a symbolic tensor.
def check_steps_argument(input_data, steps, steps_name): is_x_iterator = isinstance( input_data, (iterator_ops.Iterator, iterator_ops.IteratorBase)) if (input_data is None or is_x_iterator or has_symbolic_tensors(input_data) or (isinstance(input_data, list) and not input_data)): if steps is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infer_steps_for_dataset(model,\n dataset,\n steps,\n epochs=1,\n steps_name='steps'):\n assert isinstance(dataset, data_types.DatasetV2)\n if (model._in_multi_worker_mode() and\n (dataset.options(...
[ "0.59339863", "0.58530223", "0.5575207", "0.55042255", "0.54675263", "0.543106", "0.5414612", "0.5392719", "0.5344477", "0.5334092", "0.53208137", "0.5320611", "0.5308681", "0.5301851", "0.5241938", "0.52040267", "0.5100234", "0.50522053", "0.50399315", "0.50380796", "0.50061...
0.79893106
0
Prepares sample weight modes for the model.
def prepare_sample_weight_modes(training_endpoints, sample_weight_mode): if isinstance(sample_weight_mode, collections.abc.Mapping): generic_utils.check_for_unexpected_keys( 'sample_weight_mode', sample_weight_mode, [e.output_name for e in training_endpoints]) for end_point in training_endpo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _weight_initializer(self):\n for m in self.modules():\n if isinstance(m, nn.ConvTranspose2d):\n nn.init.kaiming_normal_(m.weight)\n elif isinstance(m, nn.BatchNorm2d):\n nn.init.constant_(m.weight, 1.0)\n nn.init.constant_(m.bias, 0.0)",...
[ "0.6787136", "0.67559147", "0.673324", "0.6547644", "0.63690925", "0.63519377", "0.6348145", "0.63220274", "0.63203686", "0.62991184", "0.6271092", "0.6253546", "0.6243629", "0.6194683", "0.61855793", "0.61775434", "0.6174475", "0.6174475", "0.6174475", "0.6166436", "0.614962...
0.74049
0
Unpack validation data based input type. The validation data is not touched if its dataset or dataset iterator. For other type of input (Numpy or tensor), it will be unpacked into tuple of 3 which is x, y and sample weights.
def unpack_validation_data(validation_data, raise_if_ambiguous=True): if (isinstance(validation_data, (iterator_ops.Iterator, iterator_ops.IteratorBase, data_types.DatasetV2, data_utils.Sequence)) or not has...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unpack_iterator_input(iterator):\n try:\n next_element = iterator.get_next()\n except errors.OutOfRangeError:\n raise RuntimeError('Your dataset iterator ran out of data; '\n 'Make sure that your dataset can generate '\n 'required number of samples.')\n\n if...
[ "0.68664455", "0.6166854", "0.60683525", "0.59711117", "0.59358513", "0.5912676", "0.57879007", "0.57307273", "0.5716732", "0.56955814", "0.5685819", "0.5651088", "0.56367314", "0.5515616", "0.5505022", "0.5504365", "0.5449258", "0.5449258", "0.54394317", "0.54169995", "0.541...
0.7501216
0
Returns the loss value & metrics values for the model in test mode.
def evaluate(self, model, x=None, y=None, batch_size=None, verbose=1, sample_weight=None, steps=None, callbacks=None, **kwargs): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_model(self, test_data, test_labels,verbose=2):\n test_loss, test_acc = self.model.evaluate(test_data, test_labels, verbose=verbose)\n return test_loss, test_acc", "def test(self):\n self.eval()\n test_mask = self.data.test_mask\n labels = self.data.y\n outpu...
[ "0.70213044", "0.67979884", "0.6788402", "0.67791986", "0.6728958", "0.6678472", "0.66340625", "0.66176784", "0.6560534", "0.65578383", "0.65578353", "0.65380776", "0.65049046", "0.6456377", "0.6447112", "0.6443894", "0.64180607", "0.64137375", "0.6403959", "0.6340312", "0.63...
0.0
-1
Check if a given string contains whitespaces.
def has_whitespaces(string): if not isinstance(string, STRTYPE): print(str(string) + " (" + str(type(string)) + ") is not a string!") return False has_ws = False for char in string: has_ws |= char.isspace() return has_ws
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_whitespace(string):\n temp = string.split()\n return len(temp) > 1", "def has_whitespace(s):\n for c in string.whitespace:\n if c in s:\n return True\n return False", "def _is_whitespace(char):\n if char == ' ' or char == '\\t' or char == '\\n' or char == '\\r':\n ...
[ "0.8325304", "0.83044946", "0.7461919", "0.7412087", "0.7411359", "0.7358462", "0.72656137", "0.726428", "0.72127455", "0.71294475", "0.69387496", "0.69273835", "0.6861504", "0.67393714", "0.66792136", "0.6621741", "0.66149664", "0.6581993", "0.6578152", "0.6538422", "0.65273...
0.8583922
0
Check if a given surface dictonary is valid. In the sence, that the contained data is consistent. Checks for correct polyline, surface and volume definitions Point duplicates are not checked.
def check_surface(srf, ply_names, verbose=True): if verbose: print(" checking surface for validity") print(" -----------------------------") # check if dict if not isinstance(srf, dict): if verbose: print(" srf is not of type dict") return False # check for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_polyline(ply, point_cnt, verbose=True):\n if verbose:\n print(\" checking polyline for validity\")\n print(\" ------------------------------\")\n # check if dict\n if not isinstance(ply, dict):\n if verbose:\n print(\" ply is not of type dict\")\n return...
[ "0.61833507", "0.61710864", "0.59076947", "0.5878474", "0.58475614", "0.5732541", "0.5693828", "0.5688629", "0.5670729", "0.56633466", "0.5647805", "0.5646256", "0.5634864", "0.5624424", "0.5621362", "0.5607812", "0.5600887", "0.5567264", "0.5545857", "0.55367696", "0.55341",...
0.72668934
0
Get the decoder model.
def build_decoder_for(self, name, incoming, tie_weights=False, nonlinearity=None, W=None, b=None, **kwargs): # collect the weight and bias initializers. if tie_weights: W = self.transpose_initializers(self.layer_weights) else: W = self.transpose_initializers(W or self.W) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_decoder(self):\n raise NotImplementedError()", "def get_model(trained_model: Model, num_decoder_tokens: int) -> Model:\n dim = 256\n\n decoder_lstm = lstm(dim, return_sequences=True, return_state=True)\n decoder_dense = Dense(num_decoder_tokens, activation='softmax')\n\n encoder_inputs...
[ "0.73370683", "0.67943585", "0.67807484", "0.6561833", "0.6492715", "0.6368078", "0.6362944", "0.6335992", "0.6335992", "0.63025224", "0.6300246", "0.62971294", "0.628067", "0.6262798", "0.6215624", "0.6190132", "0.6188353", "0.61860156", "0.6185913", "0.6185913", "0.6185913"...
0.0
-1
Return a list of the local policies
def list_policies(self): return self.con.list_policies( Scope='Local' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_policies():\r\n policy = policies.values()\r\n return policy", "def list_policies(self):\n client = self.connect(VAULT_TOKEN)\n return client.list_policies()", "def policies(self):\n return self._data.get('policies')", "def policies(self):\n return self._policies", ...
[ "0.74049133", "0.7387466", "0.6957433", "0.69073826", "0.6891879", "0.6777323", "0.6552722", "0.6544682", "0.6470436", "0.6445166", "0.641071", "0.63633364", "0.63262874", "0.62828547", "0.6272366", "0.61944973", "0.6175624", "0.6136246", "0.6113518", "0.6105507", "0.6082833"...
0.8060352
0
Serialize a dict to JSON.
def process_bind_param(self, value: Optional[dict], dialect: str) \ -> Optional[str]: if value is not None: obj: Optional[str] = serializer.dumps(value) else: obj = value return obj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_to_json(dic):\n return json.dumps(dic)", "def dict_to_json(in_dict: dict):\n\n return json.dumps(r)", "def serialize_dict(d):\n txt = '{'\n for k in d:\n txt += f'\"{k}\":'\n if isinstance(d[k], dict):\n txt += serialize_dict(d[k])\n if isinstance(d[k], str)...
[ "0.80408686", "0.7433592", "0.7214761", "0.71581805", "0.70764846", "0.6927942", "0.6894137", "0.6888428", "0.6849501", "0.68391097", "0.6801657", "0.66795933", "0.66752046", "0.66752046", "0.66499937", "0.66101366", "0.6604802", "0.6604802", "0.6588156", "0.65229344", "0.651...
0.0
-1
Given new batch x and kl divergence for previous minibatch l_old compute l_new and perform statistical test Returns l_new and indicator of significance (0 or 1)
def detect_boundary(self, x, l_old): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kl(self, old_dist_info, new_dist_info):\n old_prob = old_dist_info[\"prob\"]\n new_prob = new_dist_info[\"prob\"]\n return np.sum(\n old_prob * (np.log(old_prob + TINY) - np.log(new_prob + TINY)),\n axis=2\n )", "def kl_divergence(y_true, y_pred):\n y_pred =...
[ "0.6649235", "0.66004366", "0.6290447", "0.6256187", "0.6230011", "0.6192192", "0.6158242", "0.6120937", "0.6067348", "0.6055149", "0.6041087", "0.6019769", "0.6001965", "0.5993864", "0.5960585", "0.59601283", "0.5935002", "0.59210587", "0.58922064", "0.5889051", "0.5880926",...
0.0
-1
Creates the list of environments to read
def _get_env_list(obj, env): # add the [default] env env_list = [obj.get("DEFAULT_ENV_FOR_DYNACONF")] # compatibility with older versions that still uses [dynaconf] as # [default] env global_env = obj.get("ENVVAR_PREFIX_FOR_DYNACONF") or "DYNACONF" if global_env not in env_list: env_list...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_environments() -> List[EnvironmentRecord]:\n env_path = Path(__file__).parent.resolve().parents[1] / Path(ENV_FILE)\n\n if not env_path.exists():\n raise FileNotFoundError(f\"Program requires the environments file to function. Expect \"\n f\"file in\\n{env_path....
[ "0.7622789", "0.750219", "0.7284712", "0.71755797", "0.7108447", "0.66121197", "0.6584707", "0.65297395", "0.64933014", "0.6480451", "0.6373208", "0.6339303", "0.632256", "0.6308522", "0.6295996", "0.6282537", "0.62542", "0.62076545", "0.60843724", "0.60797125", "0.60684603",...
0.57863575
49
Parse a JSON literal.
def str2literal(value_str: str) -> Union[bool, None]: lookup = { "true": True, "false": False, "null": None, } if value_str in lookup: return lookup[value_str] else: raise ValueError(f"Unknown JSON literal: {value_str}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_json(json_string):\n\n return _convert_to_jsonc(simplejson.loads(json_string))", "def parse(json_string: str) -> object:\n tokens = tokenize(json_string)\n\n value = _parse(tokens)\n if len(tokens) != 0:\n raise ParseError(\n f\"Invalid JSON at {tokens[0].value} \"\n ...
[ "0.6902593", "0.6771398", "0.6647518", "0.66263795", "0.6503923", "0.64619076", "0.6460247", "0.64163506", "0.6382355", "0.633544", "0.633544", "0.633544", "0.6329697", "0.6329697", "0.6329697", "0.63275075", "0.6314731", "0.63070565", "0.6297665", "0.6296732", "0.6247262", ...
0.0
-1
Get a specific comment to be updated, the primary key and the title will be taken off the Url.
def get_success_url(self): return reverse('post-detail', kwargs={'pk': self.get_object().question.pk, 'title': self.get_object().question.title})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_comment(self, comment_id, **args):\n return self.fetch(\"/comment/\" + comment_id, **args)", "def edit_comment():\n # Implement me!\n\n logger.info(\"vars: %r\" % request.vars)\n logger.info(\"vars_comment_text: %r\" % request.vars.comment_text)\n logger.info(\"vars id: %r\" % reques...
[ "0.6965776", "0.6900841", "0.6809709", "0.6746965", "0.6733224", "0.67144364", "0.66943145", "0.66239774", "0.64527833", "0.6398007", "0.63505644", "0.63204175", "0.62310016", "0.6200477", "0.6180449", "0.6180449", "0.61686206", "0.6146795", "0.61176103", "0.6110255", "0.6093...
0.0
-1
Returns an int64_list from a bool / enum / int / uint.
def _int64_feature(value): feature = tf.train.Feature( int64_list=tf.train.Int64List(value=value) ) return feature
{ "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.6880445", "0.6595397", "0.64601403", "0.6447067", "0.63662434", "0.62912166", "0.62706554", "0.62156785", "0.6104905", "0.5951909", "0.5947005", "0.590078", "0.58633447", "0.58633447", "0.5856222", "0.58450794", "0.58430177", "0.5829417", "0.580021", "0.57930773", "0.57930...
0.5438856
70
Initialize weights for the network
def init_weights_gaussian(self, m): classname = m.__class__.__name__ if hasattr(m, 'weight') and (classname.find('Conv') == 0 or classname.find('Linear') == 0): nn.init.normal_(m.weight.data, mean = 0.0, std = 0.02) if hasattr(m, 'bias') and m.bias is not None: nn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_weights(self):\n pass", "def initialize_weights(self):\n weights_initializer.WeightsInitializer.initialize_layer_or_model(\n self._batch)", "def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)", "def init_weights(self):\n # Ini...
[ "0.8968514", "0.8656998", "0.8628366", "0.86096615", "0.8597106", "0.840778", "0.83443516", "0.82856405", "0.82795066", "0.8276653", "0.826437", "0.8250069", "0.82463634", "0.82372063", "0.82357705", "0.8221339", "0.8187596", "0.8108354", "0.807981", "0.8069943", "0.80248153"...
0.0
-1
Initialize weights for the network
def init_weights_kaiming(self, m): classname = m.__class__.__name__ if hasattr(m, 'weight') and (classname.find('Conv') == 0 or classname.find('Linear') == 0): nn.init.kaiming_normal_(m.weight.data, a = 0, mode = 'fan_in') if hasattr(m, 'bias') and m.bias is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_weights(self):\n pass", "def initialize_weights(self):\n weights_initializer.WeightsInitializer.initialize_layer_or_model(\n self._batch)", "def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)", "def init_weights(self):\n # Ini...
[ "0.8968514", "0.8656998", "0.8628366", "0.86096615", "0.8597106", "0.840778", "0.83443516", "0.82856405", "0.82795066", "0.8276653", "0.826437", "0.8250069", "0.82463634", "0.82372063", "0.82357705", "0.8221339", "0.8187596", "0.8108354", "0.807981", "0.8069943", "0.80248153"...
0.0
-1
`x` is tensor (numpy or tensorflow). All indices are batchindices except the last one which is the index of the variable. E.g. `x` of shape [10, 30, 2] means 10 x 30 batch of twodimensional vectors [x0, x1]. If in addition `degs` = [3, 5], then the resulting shape is [10, 30, 3, 5].
def get_monomials(x, degs): def monomials_1var(x, deg): return x[..., None] ** np.arange(deg) assert x.shape[-1] == len(degs) # sometimes degs are tf.Dimension. Convert to ints: degs = [int(d) for d in degs] ret = 1 for i in range(x.shape[-1]): xi = x[..., i] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def idn(x):\n\n def grad(dy):\n return dy\n\n return tf.ones_like(x), grad", "def with_batch_dim(x: torch.Tensor) -> torch.Tensor:\n if x.dim() == 1:\n return x.unsqueeze(0)\n else:\n return x", "def add_dummy_batch_dim(x):\n return x.view(1, x.size()[0], x.s...
[ "0.59445673", "0.58664787", "0.5821761", "0.57950664", "0.5706409", "0.56556743", "0.562092", "0.5593077", "0.556896", "0.5540579", "0.553841", "0.5519701", "0.5499014", "0.5471686", "0.54087466", "0.5402171", "0.5400286", "0.5385653", "0.5383942", "0.53508496", "0.53472656",...
0.49555814
91
Return a polynomial representing 1 with the same batch_ndim and degrees as `p`.
def unit_like(p): shape = nptf.shape(p.coef) batch_ndim = p.batch_ndim batch_shape = shape[ : batch_ndim] dtype = nptf.np_dtype(p.coef) ## first construct the coefficients for one-element batch ## (i.e. batch_ndim = 0) one = np.zeros(np.prod(p.degs), dty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_poly(self, p):\n A = self\n m, n = A.shape\n\n if m != n:\n raise DMNonSquareMatrixError(\"Matrix must be square\")\n\n if not p:\n return self.zeros(self.shape, self.domain)\n elif len(p) == 1:\n return p[0] * self.eye(self.shape, self.d...
[ "0.59998965", "0.59041935", "0.58631235", "0.58592504", "0.57598746", "0.5698995", "0.5633111", "0.55932", "0.5588688", "0.55770296", "0.5563133", "0.5554835", "0.54827064", "0.5444806", "0.5442225", "0.5420345", "0.53798246", "0.5343605", "0.5343305", "0.5262891", "0.5259685...
0.7240781
0
This will plot accuracies and lossesfor both training and validation sessions for given history objects. If no history object is given, values will be fetched from Tensorboard logs.
def plot_accuracy_and_loss(histories=None): fig = subplots.make_subplots(rows=2, cols=2, subplot_titles=('Training accuracy', 'Validation accuracy', 'Training loss ', 'Validation loss')) def append_trace(model_name, acc, val_acc, loss, val_loss, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plots(self, history):\n print(history.history.keys())\n plt.plot(history.history['acc'])\n plt.plot(history.history['val_acc'])\n plt.title('model accuracy')\n plt.ylabel('accuracy')\n plt.xlabel('epoch')\n plt.legend(['train','test'], loc='upper left')\n ...
[ "0.790461", "0.76937914", "0.7595231", "0.75737894", "0.7488978", "0.7449181", "0.74018705", "0.73820513", "0.736483", "0.72692233", "0.7268121", "0.72586584", "0.7253943", "0.7237364", "0.72056174", "0.720518", "0.7198059", "0.717756", "0.71769917", "0.71229887", "0.7097975"...
0.72701424
9
Escape all special characters.
def glob_escape(pathname): # Escaping is done by wrapping any of "*?[" between square brackets. # Metacharacters do not work in the drive part and shouldn't be escaped. drive, pathname = os.path.splitdrive(pathname) if isinstance(pathname, bytes): pathname = _magic_check_byte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _escapeSpecialCharacters(text):\n text.replace('\\\\', '\\\\\\\\')\n escape = ['~', '#', '&', '%', '_']\n for c in escape:\n text = text.replace(c, '\\\\' + c )\n return text", "def _escape(self,text):\n\t\tif not text: return \"_\" # escape empty string\n\t\ttext = text.replace(\"_\...
[ "0.8386262", "0.78267103", "0.7764801", "0.74527055", "0.7433216", "0.72004306", "0.7125831", "0.7110628", "0.7108127", "0.71056813", "0.7041395", "0.6976508", "0.6954215", "0.6944749", "0.6915148", "0.6856603", "0.6835639", "0.68339455", "0.6803731", "0.6748764", "0.6731587"...
0.0
-1
Whether the camera has hit an edge by moving in its present direction.
def has_hit_edge(self): return self.will_hit_edge(self._direction)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def will_hit_edge(self, direction):\n return ((self.position <= 0 and direction.is_left()) or \n (self.position >= self.scene.step_count - 1 and \n direction.is_right()))", "def check_edges(self):\n screen_rect = self.screen.get_rect()\n if self.rect....
[ "0.8193928", "0.7175331", "0.71696216", "0.71264863", "0.70965314", "0.70731205", "0.68800735", "0.6857221", "0.6844524", "0.6709939", "0.6637558", "0.66200465", "0.6596718", "0.65851676", "0.6534672", "0.64095145", "0.633984", "0.63365954", "0.6258987", "0.6246556", "0.62464...
0.7520673
1
Whether the camera will hit an edge by moving in the specified direction.
def will_hit_edge(self, direction): return ((self.position <= 0 and direction.is_left()) or (self.position >= self.scene.step_count - 1 and direction.is_right()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_hit_edge(self):\n return self.will_hit_edge(self._direction)", "def can_move(self, direction):\n assert direction\n return self._walls & direction == 0", "def hitDetect(self, direction, solid):\n # Hit edge code not finished - A-Small-Being\n modX = self.x\n mo...
[ "0.68149406", "0.6714008", "0.6636918", "0.65822124", "0.6548928", "0.6546583", "0.6526378", "0.65106666", "0.6504178", "0.6465445", "0.6436435", "0.63311815", "0.62684625", "0.62330055", "0.6230071", "0.62063885", "0.61752844", "0.61351204", "0.6127719", "0.6120612", "0.6075...
0.8607627
0
This function returns a new list where all elements are the items from the given list that have the given value
def occurrences(lstObjects, objVal): lstNew = [] for itm in lstObjects: if itm == objVal: lstNew.append(itm) return lstNew;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_filter(function,lst):\n return list(x for x in lst if function(x))", "def _filter_search_values(key: str, values: list, collection: list):\n return_data = []\n for item in collection:\n if any(val in values for val in item[key]):\n return_data.append(item)\n return return_dat...
[ "0.7010567", "0.6448184", "0.64334023", "0.64259267", "0.6417931", "0.6359927", "0.6348337", "0.6283698", "0.62663895", "0.6260493", "0.6209742", "0.6151634", "0.6140078", "0.61143804", "0.61000973", "0.6064853", "0.6023389", "0.5999483", "0.5986986", "0.5921217", "0.59184676...
0.5897425
21
This function determines what is the index of the second smallest item in the list or, if the list contains more than one of the smallest item, the second index of that item
def secondSmallest(lstItems): if len(lstItems) == 0: return -1; index = 0#current index in the list returnNext = False;#return the next occurence of a value equal to valSmallest valSmallest = lstItems[0]#just declaring and initializing valSmallest for val in lstItems: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_two_smallest(L):\n\n # Get a sorted copy of the list so that the two smallest items are at the\n # front\n temp_list = sorted(L)\n smallest = temp_list[0]\n next_smallest = temp_list[1]\n\n # Find the indices in the original list L\n min1 = L.index(smallest)\n min2 = L.index(next_s...
[ "0.78681004", "0.7591011", "0.73733485", "0.73343384", "0.72756165", "0.71797305", "0.69286144", "0.6924723", "0.6912953", "0.6903721", "0.68822765", "0.6843311", "0.68114185", "0.67890126", "0.6787188", "0.6779859", "0.6768543", "0.67614603", "0.67528063", "0.67402005", "0.6...
0.8168971
0
This function generates a random letter out of four gene letters
def getGeneLetter(): iRand = random.randint(0, 3) if iRand == 0: return 'A' elif iRand == 1: return 'C' elif iRand == 2: return 'G' elif iRand == 3: return 'T' return '';
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createGene(self):\n # Beginning and end of the alphabet for random gene generation\n Astart = 97\n Zend = 122\n return \"\".join(map(lambda i: chr(random.randint(Astart, Zend)), range(random.randint(4, 8)))).upper()", "def genrate_letters():\n lt = []\n letter = \"abcdefghij...
[ "0.79278743", "0.78764945", "0.75701547", "0.74830693", "0.7445514", "0.7310548", "0.72965133", "0.72545236", "0.7231837", "0.71715516", "0.7141235", "0.7065663", "0.70482403", "0.7029514", "0.70033383", "0.69822323", "0.69698006", "0.6930069", "0.6852957", "0.68225116", "0.6...
0.8103309
0
Adds the cog, a bot, and a message to the instance for usage in tests.
def setUp(self): self.bot = MockBot() self.cog = TokenRemover(bot=self.bot) self.msg = MockMessage(id=555, content="hello world") self.msg.channel.mention = "#lemonade-stand" self.msg.author.__str__ = MagicMock(return_value=self.msg.author.name) self.msg.author.avatar_ur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(bot: util.CustomBot):\r\n bot.add_cog(Info(bot))", "def __init__(self, bot):\n self.bot = bot", "def __init__(self, bot):\n self.bot = bot", "def setup(bot):\n bot.add_cog(DBCog(bot))", "def setup(bot):\n bot.add_cog(Info(bot))", "def __init__(self, message=None):\n ...
[ "0.64705855", "0.6182543", "0.6182543", "0.61740786", "0.61396563", "0.6089406", "0.6089406", "0.60554856", "0.60535806", "0.60535806", "0.60535806", "0.60293895", "0.59951943", "0.59951943", "0.598639", "0.598639", "0.598639", "0.5914436", "0.591286", "0.5909725", "0.5909725...
0.5561635
60
Should consider timestamps valid if they're greater than the Discord epoch.
def test_is_valid_timestamp_valid(self): timestamps = ( "XsyRkw", "Xrim9Q", "XsyR-w", "XsySD_", "Dn9r_A", ) for timestamp in timestamps: with self.subTest(timestamp=timestamp): result = TokenRemover.is_valid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_timestamp(self, timestamp):\n if timestamp is None:\n return True\n if not isinstance(timestamp, float):\n return False\n\n # is it sufficiently in the future to be unreasonable?\n if timestamp > ntplib.system_to_ntp_time(time.time() + (86400 * 365)):\n ...
[ "0.7199118", "0.71054965", "0.689157", "0.68540245", "0.6769624", "0.67334926", "0.66043407", "0.6305988", "0.62948304", "0.6260071", "0.6246471", "0.6226302", "0.620991", "0.61817294", "0.6162438", "0.61170405", "0.60911506", "0.6076477", "0.60401005", "0.6036342", "0.603166...
0.6996692
2
None should be returned if no matches have valid user IDs or timestamps.
def test_find_token_invalid_matches(self, token_re, token_cls, is_valid_id, is_valid_timestamp): token_re.finditer.return_value = [mock.create_autospec(Match, spec_set=True, instance=True)] token_cls.return_value = mock.create_autospec(Token, spec_set=True, instance=True) is_valid_id.return_valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match(request, user_id):\n current_user = CustomUser.objects.get(id=request.user.id)\n liked_user = CustomUser.objects.get(id=user_id)\n\n if not Matches.objects.filter(first_user=current_user, second_user=liked_user):\n Matches.objects.create(first_user=current_user, second_user=liked_user)\n\...
[ "0.55831546", "0.5540892", "0.54392993", "0.5371876", "0.53610516", "0.5323951", "0.5273652", "0.5219466", "0.51108557", "0.5107562", "0.50823647", "0.5074098", "0.50719935", "0.50039816", "0.50008196", "0.4978977", "0.49758294", "0.4974587", "0.496083", "0.4959822", "0.49501...
0.46495456
68
Shouldn't send any messages if the token message can't be deleted.
async def test_take_action_delete_failure(self, mod_log_property): cog = TokenRemover(self.bot) mod_log_property.return_value = mock.create_autospec(ModLog, spec_set=True, instance=True) self.msg.delete.side_effect = NotFound(MagicMock(), MagicMock()) token = mock.create_autospec(Token,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _should_delete(self, msg, ctx):\n # Do not remove the user's call\n if msg.id == ctx.message.id:\n return False\n # Remove command calls\n if msg.content.startswith(ctx.prefix):\n return True\n # Remove our bot's messages\n if msg.author == self.b...
[ "0.6513734", "0.6468861", "0.6425789", "0.6348263", "0.6347383", "0.6327653", "0.63240975", "0.63198626", "0.63058007", "0.6284851", "0.627325", "0.62696606", "0.6266855", "0.62583494", "0.6257216", "0.6255099", "0.62217915", "0.6186382", "0.61690444", "0.6142666", "0.614046"...
0.6340498
5
Gets product with given code
def get_product(self, code): candidates = list(filter(lambda c: c.code == code, self.list_products())) if not len(candidates): return None return candidates[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_product(self, identifier):\n # try to find an id corresponding to the code\n for p in self['products']:\n if identifier in p.get('ids', []):\n return p\n # if no product associated with the code found, return None\n return None", "def getitem(self, co...
[ "0.78304857", "0.7034293", "0.69267976", "0.6862473", "0.66131866", "0.6580624", "0.63800466", "0.6379591", "0.63251394", "0.6314203", "0.62995523", "0.62912405", "0.62605095", "0.6222106", "0.6214287", "0.6142249", "0.6118086", "0.6115655", "0.60886323", "0.60845894", "0.605...
0.85042363
0
Tell the log watcher to cease watching for new logs. This method merely signals to the thread that it should stop, so you must call the thread's join() method afterwards to wait for the thread to exit. It is an error to call stop() on a thread which isn't alive (running).
def stop(self) -> None: assert self.is_alive(), "Thread not alive" self.stopped.set()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill_log(self): \n # set the thread termination event\n self.kill_event.set()", "def stop_logging(self):\n\n self._log_queue.put_nowait(None)\n self._log_subprocess.join()", "def stop(self) -> None:\n # set the stop event, then cancel the timer\n self._stop_ev...
[ "0.73727757", "0.70296603", "0.6596195", "0.65642303", "0.6478179", "0.64583683", "0.6441928", "0.6416651", "0.6384832", "0.62932366", "0.6259451", "0.6259144", "0.6232398", "0.619668", "0.6174086", "0.615723", "0.61523664", "0.6141746", "0.61232233", "0.6118948", "0.6115477"...
0.6616209
2
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
def type(self) -> str: return pulumi.get(self, "type")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")", "def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")", "def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource_type\")", "def ...
[ "0.7918516", "0.7918516", "0.7866337", "0.7866337", "0.7866337", "0.7866337", "0.7866337", "0.7708053", "0.75534964", "0.7282099", "0.70591027", "0.6979169", "0.69202054", "0.6868452", "0.67303157", "0.67049116", "0.6654272", "0.6646357", "0.65510035", "0.65426683", "0.654266...
0.66396123
58
setup environment for test
def setup_method(self, method): sys.argv.clear() sys.argv.append("") sys.argv.append("spam")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n test_env_setup()", "def SetupEnvironment(self):\n pass", "def setUpModule():\n # pull in test environment as dict\n global TestEnv\n get_test_env(TestEnv)", "def setUpModule():\n # pull in test environment as dict\n global TestEnv\n get_test_env(TestEnv)", "de...
[ "0.86360085", "0.8105623", "0.76520115", "0.76520115", "0.75336707", "0.7496305", "0.7444822", "0.7433704", "0.74211895", "0.7348237", "0.7348237", "0.7330926", "0.7294719", "0.72612566", "0.7256958", "0.7233404", "0.7226662", "0.7215199", "0.7186369", "0.7153597", "0.7121118...
0.0
-1
Constructs an MTLabel with a max_width. If needed label text is trimmed and '...' is added for the user to known that more text exists.
def get_trimmed_label_widget(text, position, font_size, max_width): text_changed = False label_obj = MTLabel(label = text, pos = position, font_size = font_size, autowidth = True) while label_obj.width > max_width: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_word_wrap_label_width(self):\n original_max = self.form.max_label_width\n original_setting = self.form.adjust_label_width\n self.form.adjust_label_width = True\n allowed_fields = self.get_allowed_width_fields()\n labels = [field.label or pretty_name(name) for name, field...
[ "0.62319475", "0.6069337", "0.6040795", "0.59638476", "0.5784685", "0.5692705", "0.5612587", "0.55609554", "0.5560724", "0.5560151", "0.54527587", "0.54442596", "0.5441481", "0.5439613", "0.54230607", "0.5348873", "0.5347342", "0.5288962", "0.5285591", "0.5252384", "0.5248244...
0.770177
0
Get the current state to allow pickling.
def __getstate__(self) -> Dict[str, Any]: s = self.__dict__.copy() # Kill the parent ref. It won't pickle well. s["_parent"] = None return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_state(self):\n return self.__state", "def _get_state(self):\n return self.__state", "def _get_state(self):\n return self.__state", "def _get_state(self):\n return self.__state", "def _get_state(self):\n return self.__state", "def _get_state(self):\n return self.__state", "def...
[ "0.8335613", "0.8335613", "0.8335613", "0.8335613", "0.8335613", "0.8335613", "0.8335613", "0.8335613", "0.8335613", "0.8335613", "0.8335613", "0.8335613", "0.8335613", "0.8335613", "0.8335613", "0.8335613", "0.8335613", "0.8335613", "0.8335613", "0.8335613", "0.8335613", "...
0.0
-1
Return True if this is entirely made of comments.
def is_comment(self) -> bool: # pragma: no cover TODO? return all(seg.is_comment for seg in self.segments)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_comment(self):\n return (self.__type & NODE_COMMENT) == NODE_COMMENT", "def is_comment_hook(self) -> bool:\n query = (where('message_cid') == self.channel_id) & \\\n (where('message_mid') == self.message_id) & \\\n (where('altype') == int(AlternateType.COMM...
[ "0.739846", "0.6917695", "0.68073714", "0.6661247", "0.66303885", "0.6581225", "0.6422114", "0.6416056", "0.63950133", "0.6346781", "0.62816787", "0.6268705", "0.6184703", "0.6115147", "0.60998917", "0.6093087", "0.60793895", "0.60661095", "0.60586643", "0.6040571", "0.600023...
0.8195251
0
The set of types for this segment.
def class_types(self) -> Set[str]: # NOTE: This version is simple, but some dependent classes # (notably RawSegment) override this with something more # custom. return self._class_types
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_set(self) -> Set[str]:\n typs = {self.type}\n for s in self.segments:\n typs |= s.type_set()\n return typs", "def get_types(self):\n return self.types", "def get_set_types(self):\n if not self._refreshed:\n self.refresh()\n return self._s...
[ "0.854263", "0.76198685", "0.75361145", "0.7497864", "0.7319929", "0.7302782", "0.7300577", "0.7243883", "0.70606035", "0.6997625", "0.6806734", "0.6737915", "0.6649156", "0.6611323", "0.66104186", "0.66036224", "0.65993774", "0.65686166", "0.64918643", "0.64121085", "0.64064...
0.69683105
10
Make an uppercase string from the segments of this segment.
def raw_upper(self) -> str: return self.raw.upper()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_upper(self, text):\n\t\treturn text.upper()", "def upper(self):\n if not self._upper_string:\n self._upper_string = \"\".join(self.upper_word_list)\n return self._upper_string", "def convert_to_uppercase(text):\n return text.upper()", "def upper(self, value):\n retur...
[ "0.6990272", "0.681089", "0.6764799", "0.67455757", "0.66785884", "0.660239", "0.6521966", "0.65207255", "0.64983475", "0.64810383", "0.6463355", "0.64238447", "0.64022404", "0.6397483", "0.6379049", "0.6364804", "0.6311865", "0.6301639", "0.6247128", "0.62433237", "0.6239316...
0.6506304
8
Returns a list of raw segments in this segment.
def raw_segments(self) -> List["RawSegment"]: return self.get_raw_segments()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_raw_segments(self) -> List[\"RawSegment\"]:\n return [item for s in self.segments for item in s.raw_segments]", "def get_all(self):\n return self._segments", "def segments(self):\n return self._segments", "def getSegments(self) -> List[int]:\n ...", "def segments(self):\...
[ "0.89217323", "0.7611614", "0.75400317", "0.71691585", "0.70996237", "0.70900214", "0.7032567", "0.6854717", "0.66147834", "0.6408108", "0.62217736", "0.6150271", "0.6144512", "0.6143868", "0.61018723", "0.60947424", "0.5964384", "0.59556687", "0.59516644", "0.5932096", "0.59...
0.9032639
0
Returns the type of this segment as a string.
def get_type(self) -> str: return self.type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type(self) -> str:\n return self.type_", "def type_as_string(self):\n return self.properties.get('TypeAsString', None)", "def typestr(self) -> str:\n return self.type if not self.subtype else f\"{self.type}:{self.subtype}\"", "def type(self) -> str:\n return self._type", "de...
[ "0.76600385", "0.7646128", "0.76402175", "0.7615016", "0.7615016", "0.7615016", "0.75902027", "0.7568275", "0.74221957", "0.7410149", "0.7410149", "0.7410149", "0.7410149", "0.7410149", "0.7410149", "0.7410149", "0.7410149", "0.7410149", "0.7410149", "0.7410149", "0.7410149",...
0.75980914
6
Returns the number of segments in this segment.
def count_segments(self, raw_only: bool = False) -> int: if self.segments: self_count = 0 if raw_only else 1 return self_count + sum( seg.count_segments(raw_only=raw_only) for seg in self.segments ) else: return 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segment_n(self):\n return len(self.segment_lengths)", "def getSegmentCount(self) -> int:\n ...", "def numSegments(self):\n\n return self.getHierView().numSegments()", "def calculate_number_of_segments(self):\n return sum(len(eg.transcript_file.segments) for eg in self.exemplar...
[ "0.8736593", "0.86064184", "0.8550998", "0.8135904", "0.80854666", "0.8023354", "0.76189035", "0.76010066", "0.7477544", "0.7139224", "0.69297445", "0.69123036", "0.6826159", "0.67922395", "0.67548394", "0.67472404", "0.67464334", "0.674568", "0.6697717", "0.66120046", "0.659...
0.7428703
9
Get a point marker at the end of this segment.
def get_end_point_marker(self) -> PositionMarker: assert self.pos_marker return self.pos_marker.end_point_marker()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def markerPoint():\n\n circleB = mpath.Path.unit_circle()\n circleS = mpath.Path.unit_circle()\n # concatenate the circle with an internal cutout of the star\n verts = np.concatenate([circleB.vertices, 0.5 * circleS.vertices])\n codes = np.concatenate([circleB.codes, circleS.code...
[ "0.6776815", "0.6464169", "0.6409012", "0.63753617", "0.6248417", "0.6149185", "0.6043708", "0.6018482", "0.6018482", "0.5940929", "0.5890808", "0.58825964", "0.58809257", "0.58085954", "0.5804449", "0.57882285", "0.5785911", "0.5782149", "0.57790124", "0.5746689", "0.5735670...
0.80931246
0
Get a location tuple at the end of this segment.
def get_end_loc(self) -> Tuple[int, int]: assert self.pos_marker return self.pos_marker.working_loc_after( self.raw, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_location(self) -> tuple:\n return self.__location", "def last_pos(self):\n return self.locs[self.indices[-1], 2:4]", "def end(self):\n return tuple(self._lo_atom + self._n_atoms)", "def get_end_point_marker(self) -> PositionMarker:\n assert self.pos_marker\n return ...
[ "0.725516", "0.7186247", "0.676839", "0.64660573", "0.6440116", "0.6429935", "0.6425954", "0.6370832", "0.6349226", "0.62889653", "0.6275488", "0.6273651", "0.6222283", "0.6192089", "0.6180465", "0.6176467", "0.61470884", "0.610674", "0.6077248", "0.60709953", "0.6063837", ...
0.78040665
0
If segment's first/last child is noncode, return index.
def _find_start_or_end_non_code( cls, segments: Sequence[BaseSegment] ) -> Optional[int]: if segments: for idx in [0, -1]: if not cls._is_code_or_meta(segments[idx]): return idx return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_index(self, child):\n for _index, item in enumerate(self.children):\n if item == child:\n return _index\n\n return -1", "def indexOfChild(self, child):\n self.__initChild()\n return self.__child.index(child)", "def getIndex(self, child):\n \n...
[ "0.6962888", "0.67124027", "0.66232204", "0.66118443", "0.65579426", "0.6513389", "0.6436912", "0.6412968", "0.629415", "0.628788", "0.62688285", "0.62464863", "0.62307394", "0.62279636", "0.62221324", "0.62015045", "0.6198111", "0.6157464", "0.61390793", "0.60355496", "0.602...
0.69708115
0
set visual line mode
def vim_set_visual_line_mode(): v = VimMode() v.set_visual_line_mode()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_mode_line():\n global DRAW_MODE, CURRENT_LABEL, SHAPE_SIZE\n global mouse_pos, line_start_pos\n\n if DRAW_MODE==\"line\":\n # draw the line on the mask\n cv.line(source_msk, line_start_pos, mouse_pos, CURRENT_LABEL, thickness=SHAPE_SIZE)\n\n line_start_pos = mouse_pos\n DRAW_MODE=\...
[ "0.77540654", "0.6578946", "0.65723634", "0.64950174", "0.64909756", "0.6314431", "0.61965615", "0.6056458", "0.6017599", "0.59943366", "0.59737146", "0.59569526", "0.59237283", "0.5893564", "0.58656424", "0.58580154", "0.5857274", "0.58324796", "0.5822347", "0.58171254", "0....
0.7912044
0
Read a json file from disk
def json_data_loader(path): res = open(path, 'r').read() logging.info("Loading file using a pyspark.read.json") data_rdd = Spark.instance.sc().parallelize([res]) return Spark.instance.spark().read.json(data_rdd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_file(path):\n with open(path) as json_file:\n data = json.load(json_file)\n return data", "def read_json(path):\n with open(path, 'r') as f:\n return json.load(f)", "def read_json(filepath):\n return json.loads(open(filepath).read())", "def readjson(path):\n\twith open(path...
[ "0.82362807", "0.8048279", "0.7991998", "0.7940178", "0.7895708", "0.78932476", "0.7859092", "0.7827093", "0.78208643", "0.78180754", "0.7811745", "0.7799813", "0.779392", "0.77658135", "0.77469414", "0.7729011", "0.77231073", "0.7694719", "0.7689512", "0.7680625", "0.7679204...
0.0
-1
Returns Context Variable Containing Datetime format currently used
def datetime_format(context): return {'DATETIME_FORMAT': settings.DATETIME_FORMAT.replace('%', '')}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_datetime_string():\n return datetime.now().strftime(DATETIME_FORMAT)", "def get_current_datetime_string ( ) :\n return get_current_datetime( ).strftime( \"%Y%m%d-%H%M%S\" )", "def get_current_date(fmt=\"%Y-%m-%d\"):\n return datetime.datetime.now().strftime(fmt)", "def _getCurrentDateString(s...
[ "0.6721154", "0.6569885", "0.65225536", "0.6467806", "0.6395182", "0.6353798", "0.6301972", "0.62919945", "0.62804306", "0.6274833", "0.6271068", "0.62617344", "0.62222946", "0.6212745", "0.6208396", "0.6187156", "0.61462224", "0.6104347", "0.60950416", "0.60893005", "0.60630...
0.6463138
4
Determine if we currently running on stage production
def stage_variable(context): return {'STAGE': settings.STAGE_KEYWORD}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prod(environment):\n return environment == 'live' or environment == 'debug' or environment == 'prod'", "def is_production_environment(self):\n return self.get_current_environment() == Environment.PRODUCTION", "def on_production(self):\n\n if not self.is_valid_platform() and not self.in_bui...
[ "0.8059704", "0.8003619", "0.79296434", "0.78778523", "0.7639554", "0.7552264", "0.7349679", "0.726895", "0.7240907", "0.7211174", "0.70496035", "0.6964209", "0.6913246", "0.6748909", "0.67400396", "0.6736634", "0.671447", "0.6659144", "0.65128654", "0.6434043", "0.6423795", ...
0.0
-1
Implement the == operator for schema nodes.
def __eq__(self, other): try: other_dict = other.to_dict() except AttributeError: return False return self.to_dict() == other_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def equals(self, *args):\n return _libsbml.XMLNode_equals(self, *args)", "def __eq__(self, other):\n return type(self) == type(other) and self.node is other.node", "def __eq__(self, node):\n if node == None or self.element != node.element:\n return False\n return self...
[ "0.74729407", "0.72615176", "0.72106946", "0.7158029", "0.7158029", "0.7158029", "0.7158029", "0.7158029", "0.71447957", "0.7132398", "0.7111416", "0.7091245", "0.7091245", "0.70528233", "0.70517385", "0.7048379", "0.68620634", "0.67977536", "0.6773673", "0.67592543", "0.6746...
0.0
-1
Create a new instance from a dict representation.
def from_dict(cls, node_dict): if node_dict['node_type'] != cls.__name__: raise ValueError('Invalid node type in dict.') return cls(**node_dict['config'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n ...
[ "0.8501901", "0.8501901", "0.8501901", "0.8501901", "0.8501901", "0.8501901", "0.8501901", "0.8501901", "0.8501901", "0.8501901", "0.8501901", "0.8501901", "0.8501901", "0.8501901", "0.8501901", "0.8501901", "0.8501901", "0.8501901", "0.8501901", "0.8501901", "0.8501901", "...
0.0
-1
Return the node representation as a dict. The representation dict includes a field ``node_type`` with the node class name and a field ``config`` with a dict of the configuration options.
def to_dict(self): raise NotImplementedError('To be implemented in subclass.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n config = {'min_length': self.min_length, 'max_length': self.max_length}\n return {'node_type': 'String', 'config': config}", "def to_dict(self):\n node_dict = {'node_type': 'List', 'config': {\n 'subnode': self.subnode.to_dict(),\n 'max_length': sel...
[ "0.7439757", "0.72291726", "0.7189523", "0.7125301", "0.71190107", "0.66892266", "0.6674597", "0.663788", "0.6624867", "0.6596693", "0.64881855", "0.647873", "0.64703506", "0.64636385", "0.62812376", "0.6258251", "0.61272234", "0.610568", "0.6085757", "0.6078085", "0.60757333...
0.0
-1
Return the node representation as a dict. The representation dict includes a field ``node_type`` with the node class name and a field ``config`` with a dict of the configuration options.
def to_dict(self): config = { 'dtype': self.dtype, 'unit': self.unit, 'max_shape': self.max_shape, 'min_shape': self.min_shape, 'ndim': self.ndim, 'max_value': self.max_value, 'min_value': self.min_value, 'depends_on...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n config = {'min_length': self.min_length, 'max_length': self.max_length}\n return {'node_type': 'String', 'config': config}", "def to_dict(self):\n node_dict = {'node_type': 'List', 'config': {\n 'subnode': self.subnode.to_dict(),\n 'max_length': sel...
[ "0.74416345", "0.72305924", "0.71915764", "0.71269107", "0.7120841", "0.6689397", "0.6675947", "0.6640161", "0.6622743", "0.65991944", "0.64861286", "0.6481253", "0.6471709", "0.6466092", "0.62808806", "0.61303455", "0.61083245", "0.608912", "0.6081169", "0.6077734", "0.60446...
0.62605065
15
Return the node representation as a dict. The representation dict includes a field ``node_type`` with the node class name and a field ``config`` with a dict of the configuration options.
def to_dict(self): config = {'min_length': self.min_length, 'max_length': self.max_length} return {'node_type': 'Bytes', 'config': config}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n config = {'min_length': self.min_length, 'max_length': self.max_length}\n return {'node_type': 'String', 'config': config}", "def to_dict(self):\n node_dict = {'node_type': 'List', 'config': {\n 'subnode': self.subnode.to_dict(),\n 'max_length': sel...
[ "0.7442022", "0.7231194", "0.71909934", "0.7127399", "0.6690997", "0.6674581", "0.6639316", "0.6626117", "0.65985435", "0.6489566", "0.64804006", "0.64713436", "0.6465782", "0.62811035", "0.62604296", "0.61286867", "0.61084473", "0.60882753", "0.6079824", "0.60770315", "0.604...
0.71207815
4
Return the node representation as a dict. The representation dict includes a field ``node_type`` with the node class name and a field ``config`` with a dict of the configuration options.
def to_dict(self): return {'node_type': 'Bool', 'config': {}}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n config = {'min_length': self.min_length, 'max_length': self.max_length}\n return {'node_type': 'String', 'config': config}", "def to_dict(self):\n node_dict = {'node_type': 'List', 'config': {\n 'subnode': self.subnode.to_dict(),\n 'max_length': sel...
[ "0.7439757", "0.72291726", "0.7189523", "0.71190107", "0.66892266", "0.6674597", "0.663788", "0.6624867", "0.6596693", "0.64881855", "0.647873", "0.64703506", "0.64636385", "0.62812376", "0.6258251", "0.61272234", "0.610568", "0.6085757", "0.6078085", "0.60757333", "0.6041382...
0.7125301
3
Create a new instance from a dict representation.
def from_dict(cls, node_dict): if node_dict['node_type'] != 'Compilation': raise ValueError('Invalid node type in dict.') subnodes = {name: node_from_dict(node_config) for name, node_config in node_dict['config']['subnodes'].items()} config = {k: v for k, v in no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n ...
[ "0.85012746", "0.85012746", "0.85012746", "0.85012746", "0.85012746", "0.85012746", "0.85012746", "0.85012746", "0.85012746", "0.85012746", "0.85012746", "0.85012746", "0.85012746", "0.85012746", "0.85012746", "0.85012746", "0.85012746", "0.85012746", "0.85012746", "0.85012746"...
0.0
-1
Return the node representation as a dict. The representation dict includes a field ``node_type`` with the node class name and a field ``config`` with a dict of the configuration options.
def to_dict(self): subnode_dict = {name: node.to_dict() for name, node in self.subnodes.items()} return {'node_type': 'Compilation', 'config': { 'subnodes': subnode_dict, 'optionals': self.optionals, }}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n config = {'min_length': self.min_length, 'max_length': self.max_length}\n return {'node_type': 'String', 'config': config}", "def to_dict(self):\n node_dict = {'node_type': 'List', 'config': {\n 'subnode': self.subnode.to_dict(),\n 'max_length': sel...
[ "0.7439757", "0.72291726", "0.7125301", "0.71190107", "0.66892266", "0.6674597", "0.663788", "0.6624867", "0.6596693", "0.64881855", "0.647873", "0.64703506", "0.64636385", "0.62812376", "0.6258251", "0.61272234", "0.610568", "0.6085757", "0.6078085", "0.60757333", "0.6041382...
0.7189523
2
Return the node representation as a dict. The representation dict includes a field ``node_type`` with the node class name and a field ``config`` with a dict of the configuration options.
def to_dict(self): config = {'set_on_create': self.set_on_create} return {'node_type': 'Date', 'config': config}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n config = {'min_length': self.min_length, 'max_length': self.max_length}\n return {'node_type': 'String', 'config': config}", "def to_dict(self):\n node_dict = {'node_type': 'List', 'config': {\n 'subnode': self.subnode.to_dict(),\n 'max_length': sel...
[ "0.7442022", "0.7231194", "0.71909934", "0.7127399", "0.71207815", "0.6690997", "0.6674581", "0.6626117", "0.65985435", "0.6489566", "0.64804006", "0.64713436", "0.6465782", "0.62811035", "0.62604296", "0.61286867", "0.61084473", "0.60882753", "0.6079824", "0.60770315", "0.60...
0.6639316
7
Return the node representation as a dict. The representation dict includes a field ``node_type`` with the node class name and a field ``config`` with a dict of the configuration options.
def to_dict(self): config = {'set_on_create': self.set_on_create} return {'node_type': 'DateTime', 'config': config}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n config = {'min_length': self.min_length, 'max_length': self.max_length}\n return {'node_type': 'String', 'config': config}", "def to_dict(self):\n node_dict = {'node_type': 'List', 'config': {\n 'subnode': self.subnode.to_dict(),\n 'max_length': sel...
[ "0.74422324", "0.72310513", "0.7191288", "0.71277833", "0.7121494", "0.6689465", "0.6676102", "0.66403353", "0.6624315", "0.6599147", "0.64876497", "0.64708906", "0.64651513", "0.628331", "0.6260746", "0.6129604", "0.61087316", "0.60883707", "0.6080056", "0.6078302", "0.60436...
0.64814466
11
Initialize a List schema node.
def __init__(self, subnode, max_length=None, min_length=None): self.subnode = subnode self.max_length = max_length self.min_length = min_length
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, node, declare):\n symbol.__init__(self, node, declare, \"listDefine\", \"List Define\")\n self.entries = []\n self.lookup = {}\n value = 0\n start = None\n\n members = getNode( node, \"members\" )\n\n for entry in filter(lambda n: n.nodeType == n...
[ "0.6160854", "0.6115168", "0.6073686", "0.60375786", "0.6020626", "0.60057247", "0.5933338", "0.59222776", "0.5869465", "0.58475715", "0.58248115", "0.5792297", "0.5774524", "0.57720494", "0.5767941", "0.5752878", "0.5749302", "0.5738745", "0.5711914", "0.57090586", "0.567531...
0.0
-1
Create a new instance from a dict representation.
def from_dict(cls, node_dict): if node_dict['node_type'] != 'List': raise ValueError('Invalid node type in dict.') subnode = node_from_dict(node_dict['config']['subnode']) config = {k: v for k, v in node_dict['config'].items() if k != 'subnode'} return cls(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n ...
[ "0.8499637", "0.8499637", "0.8499637", "0.8499637", "0.8499637", "0.8499637", "0.8499637", "0.8499637", "0.8499637", "0.8499637", "0.8499637", "0.8499637", "0.8499637", "0.8499637", "0.8499637", "0.8499637", "0.8499637", "0.8499637", "0.8499637", "0.8499637", "0.8499637", "...
0.0
-1
Return the node representation as a dict. The representation dict includes a field ``node_type`` with the node class name and a field ``config`` with a dict of the configuration options.
def to_dict(self): node_dict = {'node_type': 'List', 'config': { 'subnode': self.subnode.to_dict(), 'max_length': self.max_length, 'min_length': self.min_length, }} return node_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n config = {'min_length': self.min_length, 'max_length': self.max_length}\n return {'node_type': 'String', 'config': config}", "def to_dict(self):\n subnode_dict = {name: node.to_dict() for name, node in\n self.subnodes.items()}\n return {'nod...
[ "0.74422324", "0.7191288", "0.71277833", "0.7121494", "0.6689465", "0.6676102", "0.66403353", "0.6624315", "0.6599147", "0.64876497", "0.64814466", "0.64708906", "0.64651513", "0.628331", "0.6260746", "0.6129604", "0.61087316", "0.60883707", "0.6080056", "0.6078302", "0.60436...
0.72310513
1
Return the node representation as a dict. The representation dict includes a field ``node_type`` with the node class name and a field ``config`` with a dict of the configuration options.
def to_dict(self): config = { 'dtype': self.dtype, 'unit': self.unit, 'max_value': self.max_value, 'min_value': self.min_value, } return {'node_type': 'Scalar', 'config': config}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n config = {'min_length': self.min_length, 'max_length': self.max_length}\n return {'node_type': 'String', 'config': config}", "def to_dict(self):\n node_dict = {'node_type': 'List', 'config': {\n 'subnode': self.subnode.to_dict(),\n 'max_length': sel...
[ "0.7439757", "0.72291726", "0.7189523", "0.7125301", "0.71190107", "0.66892266", "0.6674597", "0.663788", "0.6624867", "0.6596693", "0.64881855", "0.647873", "0.64703506", "0.62812376", "0.6258251", "0.61272234", "0.610568", "0.6085757", "0.6078085", "0.60757333", "0.6041382"...
0.64636385
13
Return the node representation as a dict. The representation dict includes a field ``node_type`` with the node class name and a field ``config`` with a dict of the configuration options.
def to_dict(self): config = {'min_length': self.min_length, 'max_length': self.max_length} return {'node_type': 'String', 'config': config}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n node_dict = {'node_type': 'List', 'config': {\n 'subnode': self.subnode.to_dict(),\n 'max_length': self.max_length,\n 'min_length': self.min_length,\n }}\n return node_dict", "def to_dict(self):\n subnode_dict = {name: node.to_dict...
[ "0.72305924", "0.71915764", "0.71269107", "0.7120841", "0.6689397", "0.6675947", "0.6640161", "0.6622743", "0.65991944", "0.64861286", "0.6481253", "0.6471709", "0.6466092", "0.62808806", "0.62605065", "0.61303455", "0.61083245", "0.608912", "0.6081169", "0.6077734", "0.60446...
0.74416345
0
Return the node representation as a dict. The representation dict includes a field ``node_type`` with the node class name and a field ``config`` with a dict of the configuration options.
def to_dict(self): config = {'set_on_create': self.set_on_create} return {'node_type': 'Time', 'config': config}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n config = {'min_length': self.min_length, 'max_length': self.max_length}\n return {'node_type': 'String', 'config': config}", "def to_dict(self):\n node_dict = {'node_type': 'List', 'config': {\n 'subnode': self.subnode.to_dict(),\n 'max_length': sel...
[ "0.7442022", "0.7231194", "0.71909934", "0.7127399", "0.71207815", "0.6690997", "0.6674581", "0.6639316", "0.6626117", "0.6489566", "0.64804006", "0.64713436", "0.6465782", "0.62811035", "0.62604296", "0.61286867", "0.61084473", "0.60882753", "0.6079824", "0.60770315", "0.604...
0.65985435
9
Create a new node from its ``node_dict``. This is effectively a shorthand for choosing the correct node class and then calling its ``from_dict`` method.
def node_from_dict(node_dict): node_types = {name: cls for name, cls in globals().items() if inspect.isclass(cls) and issubclass(cls, SchemaNode)} if node_dict['node_type'] not in node_types: raise ValueError('Invalid node type specified.') node_type = node_types[node_dict['node_ty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, node_dict):\n if node_dict['node_type'] != cls.__name__:\n raise ValueError('Invalid node type in dict.')\n return cls(**node_dict['config'])", "def from_dict(cls, d):\n clsname = d['type']\n\n if clsname == cls.__name__:\n raise Exception('Can...
[ "0.8566032", "0.7684564", "0.75125474", "0.72912705", "0.6761311", "0.66024286", "0.6496452", "0.64643914", "0.6423483", "0.62548316", "0.62548316", "0.62548316", "0.62548316", "0.62548316", "0.62548316", "0.62548316", "0.62548316", "0.62548316", "0.62548316", "0.62548316", "...
0.74205935
3
Create a new node from its JSON representation.
def node_from_json(json_str): return node_from_dict(json.loads(json_str))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromJson(json):\r\n raise NotImplementedError(\"Returns instance\")", "def from_json(cls, b):\n return cls.from_dict(json.loads(b))", "def from_json(cls, tag_json):\n return cls.from_dict(json.loads(tag_json))", "def from_json(cls, node):\n\n story = Story()\n story.sto...
[ "0.6749755", "0.6290951", "0.628192", "0.6257354", "0.60901785", "0.608538", "0.6084188", "0.60559815", "0.6036828", "0.60300213", "0.5965382", "0.5965382", "0.5965382", "0.5907138", "0.5907138", "0.59011143", "0.5884044", "0.58633643", "0.5856813", "0.585468", "0.5818817", ...
0.75141054
0
Returns True if the passed user has passed permission for this instance. Otherwise False.
def has_permission(self, user, permission, roles=None): if roles is None: roles = [] return permissions.utils.has_permission(self, user, permission, roles)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_perm(self, user):\n return True", "def has_permission(cls, perm, user):\n return perm in cls.get_permissions(user)", "def _has_permission(self, user, user_is_mod, command, db_session):\n\n if command[1] == 'for_all':\n return True\n if command[1] == 'for_mods' and...
[ "0.8283404", "0.7908732", "0.7861734", "0.78259146", "0.78118193", "0.7801385", "0.76495403", "0.76378196", "0.76199204", "0.75947", "0.75038147", "0.75000054", "0.7480346", "0.7479189", "0.7473837", "0.744742", "0.7434219", "0.73997945", "0.7391658", "0.7349404", "0.73440117...
0.7171924
42
Convert a Ditz timestamp to a BE timestamp.
def __format_time(in_time): logging.debug("in_time = %s", in_time) out = in_time.strftime("%a, %d %b %Y %H:%M:%S %z+0000") logging.debug("out = %s, out") return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_timestamp(self, timestamp):\n return int(timestamp * 1e6)", "def to_hfs_be(self):\n try:\n dt_obj = duparser.parse(timestamp)\n conv = int((dt_obj - self.epoch_1904).total_seconds())\n self.out_hfs_be = '{0:08x}'.format(conv)\n except Exception as e:...
[ "0.6227305", "0.61929035", "0.61863", "0.61290854", "0.6086191", "0.6040755", "0.5997102", "0.5989433", "0.5986509", "0.5965704", "0.5926505", "0.5904821", "0.5891226", "0.58841735", "0.58613324", "0.5850126", "0.5844812", "0.58103627", "0.579728", "0.5790927", "0.5775074", ...
0.0
-1
Correct problems with Ditz YAML. Ditz doesn't put double quotes around titles starting with the "`" character, and encodes nonASCII characters in a nonstandard way. This function rewrites a Ditz quasiYAML into a wellformed YAML string which can be read by yaml.load without problems.
def fix_ditz_yaml(ditz_string): # Put " characters around titles beginning with ` result = re.sub("title: (`.*)\n", r'title: "\1"\n', ditz_string) # Ditz represents 16-bit Unicode characters as three consecutive # \x.. escapes representing the bytes of a UTF-8 encoding, # rather than (as YAML spec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_snapcraft_yaml(snapcraft_yaml):\n for key in snapcraft_yaml:\n stream = StringIO()\n data = {}\n data[key] = snapcraft_yaml[key]\n helpers.dump_yaml(data, stream, typ=\"rt\")\n stream = stream.getvalue()\n\n # Assuming content starts with yaml key name, wr...
[ "0.5691163", "0.5608269", "0.5356055", "0.52969724", "0.5272399", "0.5244335", "0.5191273", "0.50636977", "0.50494516", "0.49811327", "0.4936989", "0.4883389", "0.4865876", "0.4854402", "0.4847249", "0.4826937", "0.48266217", "0.48062685", "0.47994736", "0.4782841", "0.477632...
0.72684824
0
Sets the flux for the LightCurve.
def set_flux(self, **kwargs): from .utils import read_lc_file input_done = False usecols = None if 'usecols' in kwargs: usecols = kwargs['usecols'] skiprows = 0 if 'skiprows' in kwargs: skiprows = int(kwargs['skiprows']) if 'file' in kwarg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_flux(self):\n try:\n self.flux = self.flux_obs\n except:\n raise ValueError('Reset is only possible when a LightCurve is instantiated with time and flux.')\n return", "def set_flux(self, flux, var):\n self._properties[\"flux\"] = np.float(flux)\n ...
[ "0.753703", "0.73755616", "0.6691866", "0.6272665", "0.6103615", "0.59867424", "0.5962357", "0.5954845", "0.58685625", "0.58322674", "0.58055216", "0.57954043", "0.57822", "0.5765943", "0.57379305", "0.57374907", "0.5722315", "0.5676114", "0.5656412", "0.5628673", "0.555676",...
0.5908917
8
Sets the object distance.
def set_dist(self, dist): dist = u.Quantity(dist, unit=u.AU) if dist.value < 0: warnings.warn("distance cannot be negative. Using absolute value.") self.dist = np.absolute(dist.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(self, distance):\n\n self._distance = distance", "def distance(self, distance):\n\n self._distance = distance", "def distance(self, distance):\n\n self._distance = distance", "def set_distance(self):\n distance = self.gui.doubleSpinBox_distance.value()\n unit =...
[ "0.741672", "0.741672", "0.741672", "0.7346829", "0.6572938", "0.6328819", "0.61095697", "0.60270905", "0.60199684", "0.5885509", "0.5881777", "0.5839233", "0.58255285", "0.5806414", "0.5771256", "0.572016", "0.56607294", "0.5653694", "0.56498516", "0.5642306", "0.55980253", ...
0.67865855
4
Determines the magnitude drop of the occultation.
def calc_magnitude_drop(self, mag_star, mag_obj): from .utils import calc_magnitude_drop mag_drop, bottom_flux = calc_magnitude_drop(mag_star, mag_obj) self.mag_drop = mag_drop self.bottom_flux = bottom_flux
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def absolute_magnitude(self):\n return self._absolute_magnitude", "def magnitude(self):\n return self.real ** 2 + numpy.inner(self.pure, self.pure)", "def __abs__(self):\n return self.magnitude()", "def displacement_mag(self):\n print(3284 * math.pow(self.concentration, -0.158))\n...
[ "0.6362259", "0.6342887", "0.63426393", "0.63260937", "0.630266", "0.6274245", "0.6228945", "0.6201521", "0.6198432", "0.6165679", "0.61574244", "0.61482805", "0.6145389", "0.6103653", "0.6062506", "0.60443956", "0.6019284", "0.60037607", "0.60013896", "0.60013896", "0.596915...
0.688157
0
Looks for all the blobs in the bucket that begin with the prefix and returns the available folder. This can be used to list all blobs in a "folder", e.g. "public/". The delimiter argument can be used to restrict the results to only the "files" in the given "folder". Without the delimiter, the entire tree under
def get_available_folder(foldername: str, bucket_name: str, delimiter=None) -> str: bucket = connect_to_bucket(bucket_name) # define prefix (bucket folder name) which is used by notifier prefix = "model_output/" + foldername available_folder = None # this function checks if the last part of the n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filenames(self, bucket, directory, delimiter=''):\n b = self.conn.get_bucket(bucket)\n rs = b.list(directory, delimiter)\n return [key.name for key in rs if '$folder$' not in key.name]", "def get_list_of_blobs(bucket_name, prefix=None, delimiter=None):\r\n\r\n # initialize client\r\n stora...
[ "0.70891166", "0.68545735", "0.66423535", "0.65049565", "0.63648283", "0.6339433", "0.63098526", "0.6251281", "0.6191405", "0.60998994", "0.6023948", "0.6012974", "0.59783745", "0.5893421", "0.583977", "0.5740943", "0.5739943", "0.5735244", "0.56723374", "0.56504613", "0.5648...
0.59004825
13
Finds the first match that has a Compound as a value.
def _FindFirstCompoundMatch(matches): for m in matches: if isinstance(m.value, models.Compound): return m return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_first(self, ast, label):\n res = self._find_all(ast, label, max_results=1)\n if len(res):\n return res[0]\n return None", "def find_match(potential_category: str, categories: List[str]):\n return process.extractOne(potential_category, categories)[0]", "def get_compo...
[ "0.6016543", "0.5834336", "0.5678704", "0.5657585", "0.5643023", "0.5508956", "0.54367584", "0.53814363", "0.53302", "0.53271663", "0.53266215", "0.52743524", "0.5270677", "0.52337503", "0.5143348", "0.5133931", "0.51282066", "0.5121478", "0.51175827", "0.51169", "0.50980425"...
0.8777652
0
Calculates a learning rate of the initial LR decayed by 10 every 30 epochs
def adjust_learning_rate(lr, optimizer, epoch): lr = lr_init * (0.1 ** (epoch // 10)) for param_group in optimizer.param_groups: param_group['lr'] = lr return lr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def learning_rate(epoch):\n self.lr = self.lr / 1.00000001\n return self.lr", "def __learning_rate(self, lr0, epoch):\n \n \"\"\"\n Dan's Methos\n \"\"\"\n lrs = lr0 * 0.001\n c = np.power((lrs/lr0), 1.0/self.__maxEpoch)\n \n return lr...
[ "0.82223254", "0.8086511", "0.803759", "0.803759", "0.7834619", "0.78295976", "0.78064525", "0.7795517", "0.778973", "0.778973", "0.778973", "0.778973", "0.77371264", "0.77239877", "0.7662104", "0.7593775", "0.75899374", "0.75884485", "0.757662", "0.75717473", "0.75522095", ...
0.744859
24
Computes the precision for the specified values of k
def accuracy(output, target, topk=(1,)): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expand_as(pred)) res = [] for k in topk: correct_k = correct[:k].view(-1).float().sum(0, keepdim=Tru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den", "def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\...
[ "0.7643094", "0.7419047", "0.74181783", "0.7270927", "0.7245956", "0.7244712", "0.72375613", "0.722149", "0.72102135", "0.7058916", "0.6851902", "0.6786465", "0.67835456", "0.67682284", "0.67274547", "0.6717998", "0.6717998", "0.6717998", "0.6717998", "0.6717998", "0.6717998"...
0.0
-1
Return an initialized dict so empty rows or columns in the Sudoku are correctly handled.
def initialize_d(d, square_sides, offset=0): return {key:[] for key in range(offset, square_sides ** 2 + offset)}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_grid_dict(height, width):\n board = {}\n for i in range(height):\n for j in range(width):\n position = (i, j)\n board[position] = 0\n return board", "def _init_squares() -> Dict[Pos2D, Square]:\r\n squares: Dict[Pos2D, Square] = {}...
[ "0.691303", "0.6503695", "0.642644", "0.61995727", "0.6198556", "0.61782855", "0.6109561", "0.60498834", "0.6048783", "0.6027217", "0.60227877", "0.6010691", "0.6005722", "0.59985423", "0.5913935", "0.5909166", "0.58611274", "0.58490217", "0.58396024", "0.58266664", "0.582605...
0.5262787
90
Return dicts with updated digit removed from missing digits.
def remove_updated_from_dicts(fit, dicts, squares_coords): row, col, n = fit rm, cm, sm = dicts sq = squares_coords rm[row].remove(n) cm[col].remove(n) sm[squares_coords[row, col]].remove(n) del sq[(row, col)] return dicts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_digit(self, values, box, digit):\n values[box] = values[box].replace(digit, '')\n return values", "def eliminate(values):\n solved_values = [box for box in values.keys() if len(values[box]) == 1]\n for box in solved_values:\n digit = values[box]\n for peer in peers[bo...
[ "0.61933106", "0.61880916", "0.6021302", "0.6021302", "0.5980913", "0.5635354", "0.5601633", "0.54836386", "0.54461795", "0.5436395", "0.5378042", "0.5349286", "0.53485453", "0.5339401", "0.53085923", "0.5305944", "0.5299588", "0.5290143", "0.52666515", "0.52202797", "0.51958...
0.0
-1
Reduces the size of the matrix, erasing the zero values.
def reduce_size(data): data_ = pd.DataFrame(data) nonzero_idxs = np.flatnonzero(np.diag(data_)) cov_reduced = data_.iloc[nonzero_idxs, nonzero_idxs] return nonzero_idxs, cov_reduced
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self):\n for y in range(len(self.matrix)):\n for x in range(len(self.matrix[0])):\n self.matrix[y-1][x-1] = (0,0,0)", "def clear(self):\n self._length = 0 # \"Erase\" values by ignoring them\n self._resize_arr(1) # Shrink array to original size", "def ...
[ "0.7029638", "0.66807014", "0.6656752", "0.65129143", "0.64787734", "0.6444722", "0.63964504", "0.62870175", "0.62544125", "0.621797", "0.6210601", "0.61580896", "0.6134495", "0.6127081", "0.6102331", "0.6094252", "0.6091178", "0.6091023", "0.6057329", "0.6043073", "0.6041758...
0.0
-1
Get ELBO for this layer
def get_ELBO(self, length): # KL divergence between posterior and N(0,1) prior KL_div = (0.5 * (tf.reduce_sum(tf.sqrt(tf.reduce_sum(self.batch_mu**2, axis=1))) + tf.reduce_sum(self.batch_Tr_C) - tf.reduce_sum(self.batch_ld_C) - length)) weight_reg = ((0.5 / ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ELBO(self, nbatches):\n self.coord_update()\n # Log Density\n ELBO = (tf.reduce_sum(-0.5 * (self.mu**2 + self.sigma**2) *\n (self.alpha / self.beta) + 0.5 * (tf.digamma(self.alpha) -\n tf.log(self.beta)) - 0.5 * tf.log(2 * np.pi)))\n ELBO += (tf.red...
[ "0.68285304", "0.659543", "0.60152537", "0.58310217", "0.5678733", "0.550667", "0.54124963", "0.537104", "0.53311837", "0.5244197", "0.52229315", "0.5187892", "0.5183694", "0.5146262", "0.5131166", "0.51201504", "0.51093227", "0.50982654", "0.50919646", "0.508655", "0.5080843...
0.5614302
5