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
Sets default values for the object.
def set_defaults(self, all_defaults): if all_defaults: # Set every value from the defaults. self.letters = probabilities.LETTERS self.word_constructions = probabilities.WORD_CONSTRUCTIONS self.word_sizes = probabilities.WORD_SIZES self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_defaults(self):\n\n for k, v in self.DEFAULTS.items():\n if not getattr(self, k, None):\n setattr(self, k, v)", "def setdefaults(self): # 3\n res = self.__obj.setdefaults()\n if res != 0:\n result,msg = self.__getlasterror(res)\n raise Error(rescod...
[ "0.79113126", "0.776834", "0.7531978", "0.73837537", "0.7346018", "0.7205495", "0.7124789", "0.7029042", "0.6950056", "0.6884912", "0.6884912", "0.6884912", "0.6821938", "0.6803345", "0.676307", "0.6750649", "0.6750649", "0.673596", "0.67225254", "0.66957563", "0.66957563", ...
0.6298108
55
Take a character and add it to the relevant ProbabilitySet.
def parse_character(self, character): if character in letters: self.letters.add(character) elif character in self.MATCHED_PUNCTUATION: index = self.MATCHED_PUNCTUATION.find(character) if index % 2 != 0: # Ignore odd indices, as they're ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addChar(self, char):\n self.guessedChars.append(char)", "async def character(self, ctx, character=None):\n\n if character.lower() in [c.lower() for c in self.characters]:\n return await ctx.send(f\"`ERROR: Duplicate Character` {character} is already added.\")\n\n created_char ...
[ "0.6437056", "0.59943604", "0.58539104", "0.5816475", "0.5519025", "0.5466264", "0.5197941", "0.5180241", "0.5177656", "0.5129904", "0.5105205", "0.50422406", "0.50342023", "0.50062567", "0.50062567", "0.49946484", "0.49736342", "0.49531725", "0.49469993", "0.4945008", "0.488...
0.49474654
18
Gets the device data.
def data(self): return self.content
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_device_data(self):\n pass", "def get_data(self):\n self._send_command(self._adapter.get_data())", "def get_data(self):\n return read_sensor(bus=self.bus,\n address=self.address)", "def get_dev(self, data_file):\r\n return self.read_data(data...
[ "0.85546774", "0.74737453", "0.7421417", "0.72829604", "0.72538984", "0.7214651", "0.721224", "0.7165726", "0.7165726", "0.7162357", "0.7146811", "0.7146811", "0.71413344", "0.712045", "0.7034801", "0.7034801", "0.7034801", "0.7016369", "0.7016369", "0.7016369", "0.7016369", ...
0.0
-1
Customizable logic to determine whether the data should be refreshed. By default, this returns False. Consumers can set `refresh_always` to True or assign their own function that takes a singleargument (the last reponse) and returns a boolean.
def should_refresh_client(self): return self.refresh_always or FindFriendsService.should_refresh_client_fnc( self.response )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should_refresh_client_fnc(response):\n return not response", "def should_reset(self):\n # type: () -> bool\n if not self._is_cache_enabled():\n return False\n elapsed = time.time() - self._last_ts\n return elapsed > self._refresh_interval_sec", "def auto_refres...
[ "0.7081736", "0.64856315", "0.64296556", "0.6410178", "0.6032431", "0.6032431", "0.60149574", "0.58555883", "0.5756816", "0.57453173", "0.57453173", "0.57453173", "0.57453173", "0.57453173", "0.5710015", "0.57030165", "0.567462", "0.56660634", "0.56660634", "0.56232643", "0.5...
0.73922545
0
Transform a word to camelCase.
def underscore_to_camelcase(word, initial_capital=False): words = [x.capitalize() or "_" for x in word.split("_")] if not initial_capital: words[0] = words[0].lower() return "".join(words)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snake_to_camel(word):\n return ''.join(x.capitalize() or '_' for x in word.split('_'))", "def snake_to_camel(word):\n return ''.join(x.capitalize() or '_' for x in word.split('_'))", "def _camelify(words):\n newText = ''\n for word in words:\n if newText == '':\n newText = wor...
[ "0.79109997", "0.79109997", "0.7795171", "0.7714735", "0.7683873", "0.7656575", "0.7654179", "0.7488696", "0.7386074", "0.73723394", "0.7336169", "0.7286182", "0.7227418", "0.72009003", "0.71525687", "0.7149686", "0.71401083", "0.71379423", "0.7099917", "0.7099433", "0.708348...
0.709428
20
Returns the time to wait before running this job. The returned value can be negative, indicating that the run should have already been started. If a run is very late, the returned negative value may not accurately represent how long ago the run should have started.
def seconds_before_next_run(self): period, last_start_time = self.period, self.last_start_time now = utcnow() if isinstance(period, Weekly): then = now.replace(hour=period.hour, minute=10, second=0, microsecond=0) days = (period.weekday - now.isoweekday()) % 7 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_wait_time(self) -> int:\n next_ts = self.get_next_timestamp()\n if next_ts is None:\n return max(0, self.min_wait)\n return min((next_ts - parser.parse(self.event['timestamp'])).seconds, self.max_wait)", "def execution_time_sec(self):\n if self.job_started_at is not...
[ "0.77566355", "0.7449364", "0.72762674", "0.719089", "0.7132132", "0.7118637", "0.70672184", "0.6920451", "0.69094855", "0.68709403", "0.6808784", "0.678187", "0.6755234", "0.6697267", "0.6665306", "0.6609517", "0.6555602", "0.6546795", "0.65352637", "0.64738184", "0.6473074"...
0.7100557
6
Function to remove punctuations, stem words and finally convert the text into lower case
def clean_document(cls, text: str) -> str: # stop words will be removed while computing the vectorizer text_processed = text.translate( str.maketrans('', '', string.punctuation)).lower() # removing punctuations and converting to lower case # tokenization token_words = word_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_text(text):\n return normalize_case(normalize_punctuation(text))", "def normalize(text):\n removePunctuation = dict((ord(char), None) for char in string.punctuation)\n return stem_tokens(nltk.word_tokenize(text.lower().translate(removePunctuation)))", "def preprocess_text(s: str) -> str:...
[ "0.8196806", "0.78944397", "0.7856684", "0.78247017", "0.7714756", "0.76489437", "0.76489437", "0.7587302", "0.7584339", "0.75777483", "0.75670075", "0.7516437", "0.75076956", "0.7506685", "0.7483201", "0.74531823", "0.7430232", "0.7362402", "0.73271775", "0.73247397", "0.730...
0.7090709
35
Returns true if file is a known media extension. This list is selfmaintained.
def is_media_file(file): return file.lower().endswith(MEDIA_EXTENSIONS)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_known_media(extension: str) -> bool:\n return get_analyze_tool(extension) is not None", "def _valid_extension(self, filename):\n return any(filename.endswith(ext)\n for ext in self.config['document-extensions'])", "def have_mpeg_extension(l):\r\n if \".mpeg\" in str(l)...
[ "0.7715759", "0.7290552", "0.7252331", "0.7247137", "0.7134413", "0.70900923", "0.703342", "0.7006105", "0.7005341", "0.6998105", "0.6968491", "0.69278425", "0.6858323", "0.6823715", "0.68025523", "0.6800015", "0.6790841", "0.67759055", "0.67607844", "0.6729701", "0.6699359",...
0.8435781
0
Returns true if file is a known subtitle extension. This list is selfmaintained.
def is_subtitle(file): return file.lower().endswith(SUBTITLE_EXTENSIONS)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_extension(self, filename):\n if filename is None:\n return False\n return filename.split(\".\")[-1].lower() in self.extensions", "def _valid_extension(self, filename):\n return any(filename.endswith(ext)\n for ext in self.config['document-extensions'])", ...
[ "0.725117", "0.71732587", "0.69373", "0.69332296", "0.6831451", "0.67917275", "0.67758065", "0.6760962", "0.6631628", "0.663049", "0.6602128", "0.6560397", "0.6558565", "0.65360624", "0.6481933", "0.6469865", "0.6469865", "0.64661765", "0.64196044", "0.64022356", "0.63865197"...
0.84408325
0
Returns true if file is a known manga file extension. This list is selfmaintained.
def is_manga(file): return file.lower().endswith(MANGA_EXTENSIONS)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supportsFile(self, filename):\n extension = filename.rsplit(\".\", 1)[1]\n return extension in AcronymDisambiguator.supported_extensions", "def has_extension(self, filename):\n if filename is None:\n return False\n return filename.split(\".\")[-1].lower() in self.extens...
[ "0.7768693", "0.75858337", "0.74395084", "0.7438519", "0.74237555", "0.73428005", "0.7329734", "0.7262043", "0.71752834", "0.7127566", "0.7086381", "0.7047793", "0.70406044", "0.70379883", "0.7032205", "0.7007886", "0.70009905", "0.6985098", "0.6908625", "0.6896287", "0.68942...
0.8054451
0
Find the documents whose attribute values have the closest date to the query date. The date field field is indexed as 'keyword' to enable use of this similarity metric.
def ClosestDate(caseAttrib, queryValue, weight, scale, decay): # format 'dd-MM-yyyy' e.g. '01-02-2020' # format = "%d-%m-%Y"'T'"%H:%M:%SZ" # qd = dateutil.parser.isoparse(queryValue) # queryValue = qd.strftime(format) # enforce query conversion to a known date format # build query string queryFnc = { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_similar(self, doc, *args, **kwargs):\n n = kwargs.get('n', 5)\n distance_threshold = kwargs.get('distance_threshold', 0.4)\n\n # for each doc, find the most similar one...\n distances = []\n doc_vector = self.vectorizer.transform([doc])\n for i in range(self.vecto...
[ "0.55266094", "0.55023867", "0.53997016", "0.5353275", "0.5253669", "0.5195839", "0.5052103", "0.5045156", "0.50290847", "0.49706817", "0.4961016", "0.49455598", "0.4920742", "0.48854512", "0.48792627", "0.4833882", "0.4785057", "0.47798833", "0.47738934", "0.47621465", "0.47...
0.6085392
0
Vertices are equivalent if they are sufficiently close. Use the "is" operator to test if they are identical.
def __eq__(self, other): return abs(self.x - other.x) + abs(self.y - other.y) < Vertex.epsilon
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verticesEqual(self, v1, v2, eps=1e-8):\n if abs(v1[0] - v2[0]) > eps:\n return False\n if abs(v1[1] - v2[1]) > eps:\n return False\n if abs(v1[2] - v2[2]) > eps:\n return False\n return True", "def _vertices_are_equal(\n vertices1: List[np.ndarr...
[ "0.7453717", "0.72692144", "0.7005311", "0.6835252", "0.6734327", "0.6692228", "0.6658585", "0.6639025", "0.6619329", "0.661404", "0.65609276", "0.6522427", "0.65069145", "0.6498356", "0.6480899", "0.6462569", "0.6453289", "0.6429027", "0.64131904", "0.64131904", "0.6385622",...
0.74623466
0
Returns the hidden units of this LSTM.
def hidden(self): return self._hidden
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_hidden_units():\n hidden_units = list(map(int, parameters.HYPER_PARAMS.hidden_units.split(',')))\n\n if parameters.HYPER_PARAMS.layer_sizes_scale_factor > 0:\n first_layer_size = hidden_units[0]\n scale_factor = parameters.HYPER_PARAMS.layer_sizes_scale_factor\n num_layers ...
[ "0.7207112", "0.6767588", "0.6767588", "0.6764774", "0.673488", "0.67207533", "0.66979086", "0.66979086", "0.66210943", "0.65917397", "0.64599586", "0.634236", "0.6336924", "0.6326442", "0.627039", "0.6241771", "0.62320715", "0.61960256", "0.6159398", "0.6156961", "0.6156961"...
0.5680201
56
Assigns to the hidden units of this LSTM.
def hidden(self, value): if value is not None: value.get_shape().assert_is_compatible_with(self._output_shape) self._hidden = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Dense(self, units):\n self.hidden_units.append(units)", "def init_hidden(self, batch_size, device):\n if self.mode == 'LSTM':\n return (torch.ones((1+self.bidirectional , batch_size, self.hidden_dim), device=device),\n torch.ones((1+self.bidirectional, batch_size, ...
[ "0.70018655", "0.65942407", "0.65757746", "0.65757746", "0.6498418", "0.6498418", "0.64616543", "0.6407301", "0.6398214", "0.6325727", "0.6319952", "0.6297466", "0.6297466", "0.62516034", "0.62516034", "0.62516034", "0.62516034", "0.62516034", "0.62516034", "0.62516034", "0.6...
0.58051866
48
Returns the cell units of this LSTM.
def cell(self): return self._cell
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_units(self):\n return str(self._modeler.GetModelUnits())", "def units(self):\n return self._units", "def units(self):\n return self._units", "def getUnits(self):\n return _libsbml.Compartment_getUnits(self)", "def units(self):\n pass", "def unit_of_measurement(s...
[ "0.7405619", "0.7378982", "0.7378982", "0.7116993", "0.70852137", "0.70472515", "0.6907479", "0.6865392", "0.68638694", "0.68318707", "0.6808857", "0.67885274", "0.67645055", "0.67587507", "0.67471164", "0.6735788", "0.6690739", "0.6654465", "0.6653194", "0.6643801", "0.66433...
0.0
-1
This is home page
def home(request): # Big Sale! big_sale = BuyProduct.objects.first() for _ in BuyProduct.objects.all(): if _.customer_price > big_sale.customer_price: big_sale = _ return render(request, "core/index.html", { "products": Product.objects.all(), "latest": Product.obje...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(request):\n\treturn render(request, \"compta/home.html\")", "def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)", "def home():\n\n return render_template('home_page.html')", "def home():\n return render_template(\n 'home.ht...
[ "0.86175734", "0.8544187", "0.85058725", "0.84684956", "0.84201914", "0.83735985", "0.8364351", "0.83584195", "0.83513796", "0.83238906", "0.8323269", "0.83168477", "0.83031785", "0.83031785", "0.83031785", "0.83031785", "0.83031785", "0.83031785", "0.83031785", "0.83031785", ...
0.0
-1
This is to check if the email entered on the form is already existing
def check_email_exist(request): email = request.POST.get("email") user_obj = User.objects.filter(email=email).exists() if user_obj: return HttpResponse(True) else: return HttpResponse(False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_exists(form, field):\n if User.select().where(User.email == field.data).exists():\n raise ValidationError('A user with that E-mail already exists.')", "def validate_email(form, field):\n if User.query.filter_by(email=form.email.data).first():\n form.email.errors.append(\n ...
[ "0.76347697", "0.7629023", "0.7594589", "0.7559888", "0.7533228", "0.752166", "0.7465833", "0.7465089", "0.73603636", "0.73602974", "0.73001945", "0.72843295", "0.7282299", "0.7262615", "0.7246313", "0.72427374", "0.72328043", "0.7227731", "0.72234446", "0.7185513", "0.717102...
0.6613285
57
Construct a full path to a TFRecord file to be stored in the data_directory. Will also ensure the data directory exists
def _data_path(data_directory: str, name: str) -> str: if not os.path.isdir(data_directory): os.makedirs(data_directory) return os.path.join(data_directory, '{}.tfrecords'.format(name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_record_fullpath(\n kapture_dirpath: str = '',\n record_filename: Optional[str] = None) -> str:\n feature_filename = record_filename or ''\n return path_secure(path.join(kapture_dirpath, RECORD_DATA_DIRNAME, feature_filename))", "def _get_output_filename(dataset_dir):\n return os.pa...
[ "0.70185626", "0.6525818", "0.65037584", "0.64261127", "0.64106345", "0.6286697", "0.62441295", "0.6237005", "0.6170105", "0.61235625", "0.61235625", "0.61235625", "0.6091769", "0.60649973", "0.60647696", "0.6057862", "0.6057388", "0.60410446", "0.599134", "0.5973309", "0.596...
0.7803677
0
Create a Int64List Feature
def _int64_feature(value: int) -> tf.train.Features.FeatureEntry: return tf.train.Feature(int64_list=tf.train.Int64List(value=[value]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _int64_feature(value):\n value = _ensure_list(value)\n return tf.train.Feature(int64_list=tf.train.Int64List(value=value))", "def _int64_feature(value):\n return tf.train.Feature(\n int64_list=tf.train.Int64List(value=[int(v) for v in value]))", "def _int64_feature(value):\n return tf.train.Fe...
[ "0.83878964", "0.8369726", "0.836711", "0.8360846", "0.8324094", "0.83171684", "0.83171684", "0.8310096", "0.8310096", "0.8310096", "0.8297459", "0.8297459", "0.8283516", "0.8283516", "0.8283516", "0.8283516", "0.827969", "0.827969", "0.827969", "0.827969", "0.827969", "0.8...
0.7979693
44
Returns a float representing the crawl delay specified for this user agent, or None if the crawl delay was unspecified or not a float.
def get_crawl_delay(self, user_agent): # See is_allowed() comment about the explicit unicode conversion. if (PY_MAJOR_VERSION < 3) and (not isinstance(user_agent, unicode)): user_agent = user_agent.decode() for ruleset in self.__rulesets: if ruleset.does_user_agent_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_crawl_delay(self, useragent=\"*\"):\n crawl_delay = None\n try:\n crawl_delay = self.rp.crawl_delay(useragent=useragent)\n logger.info(\"Crawl delay is %s\" % crawl_delay)\n except Exception as e:\n logger.error(\"get_crawl_delay:\\n%s\" % e)\n\n ...
[ "0.77960306", "0.63386637", "0.62997276", "0.6232375", "0.61948", "0.6143157", "0.6143157", "0.60890985", "0.6088594", "0.6088594", "0.60790205", "0.595705", "0.59461033", "0.5936903", "0.58981216", "0.5835806", "0.5829424", "0.5766042", "0.5766042", "0.5766042", "0.5766042",...
0.7142257
1
Determine if the named feature is enabled for the current request. If the feature has no override in the database, it will default to False. Features must be documented, and an UnknownFeatureError will be thrown if an undocumented feature is interrogated. When the internal cache is empty, it will automatically load the...
def enabled(self, name): if name not in FEATURES: raise UnknownFeatureError( '{0} is not a valid feature name'.format(name)) if not self._cache: self.load() return self._cache[name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_enabled(self, feature):\n if feature in self._disabled:\n return False\n if feature in self._enabled:\n return True\n return self.default_enabled is True", "def __call__(self, feature):\n return self.is_enabled(feature)", "def has_feature(self, feature):...
[ "0.6690882", "0.6646818", "0.61427927", "0.6095452", "0.6087122", "0.5996685", "0.59492666", "0.58852005", "0.5782755", "0.5782755", "0.5782394", "0.5782394", "0.5782394", "0.5782394", "0.5718162", "0.5718162", "0.5718162", "0.5718162", "0.5701245", "0.56945777", "0.56353956"...
0.7392259
0
Remove old feature flags from the database on startup.
def remove_old_flags_on_boot(event): # Skip this if we're in a script, not actual app startup. See the comment # in h.script:main for an explanation. if 'H_SCRIPT' in os.environ: return remove_old_flags() transaction.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_old_flags():\n # N.B. We remove only those features we know absolutely nothing about,\n # which means that FEATURES_PENDING_REMOVAL are left alone.\n known = set(FEATURES) | set(FEATURES_PENDING_REMOVAL)\n unknown_flags = Feature.query.filter(sa.not_(Feature.name.in_(known)))\n count = un...
[ "0.7830818", "0.60210323", "0.59815943", "0.593286", "0.5920289", "0.58938146", "0.5876648", "0.5871416", "0.5839587", "0.58393186", "0.57996804", "0.579703", "0.5795434", "0.57841665", "0.5746831", "0.5744737", "0.5671682", "0.56663114", "0.5662509", "0.5660765", "0.56586766...
0.7267699
1
x y = 2 x (y/2), if y is even x y = x + 2 x (y/2), if y is odd
def multiply(x, y): if y == 1: return x t = multiply(x, y >> 1) t *= 2 if y & 1: t += x return t
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def odds(x,y):\r\n payout = (x+y)/y\r\n return payout", "def div2(x):\n if odd(x):\n x += n\n return x // 2 % n", "def is_odd(self, x):\n return x%2", "def is_odd(x):\n return x % 2 != 0", "def is_even(x):\n return x % 2 == 0", "def is_odd(x):\n if (x%2==1):\n ...
[ "0.7994391", "0.7377836", "0.7197594", "0.7083101", "0.69985926", "0.6888534", "0.6752689", "0.67415154", "0.67125684", "0.67055327", "0.6698801", "0.6681415", "0.6652178", "0.66503036", "0.6628694", "0.6623073", "0.65621513", "0.6560653", "0.653861", "0.64981854", "0.6484753...
0.0
-1
Checks whether or not the given context is from an admin.
def is_admin(ctx) -> bool: return db.user(ctx.author).is_admin
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_admin_context(context):\n if not context:\n warnings.warn(_('Use of empty request context is deprecated'),\n DeprecationWarning)\n raise Exception('die')\n return context.is_admin", "def is_admin_context(context):\n if not context:\n warnings.warn(_('Use ...
[ "0.86990875", "0.86990875", "0.86990875", "0.85682356", "0.84782094", "0.8324588", "0.82164264", "0.7774166", "0.76384264", "0.76384264", "0.7605712", "0.75500697", "0.74654675", "0.74615836", "0.74223846", "0.73787975", "0.73736405", "0.73587173", "0.73031425", "0.72948384", ...
0.8055054
7
Determines if given datetime object is set to midnight.
def is_midnight(dt): return dt.hour == 0 and dt.minute == 0 and dt.second == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_starttrimester(today):\n if isinstance(today, datetime):\n if today.day == 1 and today.month == 1:\n return True\n elif today.day == 1 and today.month == 4:\n return True\n elif today.day == 1 and today.month == 7:\n return True\n elif today.da...
[ "0.6316294", "0.6185327", "0.6185327", "0.60319597", "0.5906638", "0.59025776", "0.5823405", "0.5798733", "0.57395375", "0.5674077", "0.56247437", "0.5597596", "0.5577019", "0.5562061", "0.5554642", "0.5542466", "0.5540736", "0.552818", "0.5467706", "0.54512024", "0.5443104",...
0.8336064
0
Inicializa y carga lista de stopwords desde el path recibido
def __init__(self,dir_stopwords): arc = open(dir_stopwords, "r", encoding='utf-8') self.stp_wrds = [line.strip() for line in arc] arc.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_stop_words():\n with open('../data/stop_words.txt', 'r') as stop_words_file:\n return stop_words_file.read().split()", "def _stopwords():\n global _stopword_set\n if _stopword_set:\n return _stopword_set\n f_name = \"stopword.list\"\n if os.path.isfile(f_name):\n res ...
[ "0.70847505", "0.7051989", "0.69990194", "0.699775", "0.6894505", "0.6890229", "0.68880403", "0.6702198", "0.6643121", "0.661804", "0.6568817", "0.6564261", "0.63946927", "0.63723576", "0.63657683", "0.6362664", "0.6362664", "0.62694436", "0.62655616", "0.6248142", "0.6236767...
0.7769529
0
Remueve las stopwords dentro de un cuerpo de texto.
def remocion_de_stopwords(self,texto): tok = nltk.tokenize palabras = tok.word_tokenize(texto) palabras_salida = [] for palabra in palabras: if palabra not in self.stp_wrds: palabras_salida.append(palabra) salida = "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_stopwords(text):\n text = \" \"+text\n text = text.upper()\n for word in STOP_WORDS:\n text = text.replace(word.upper(),\" \")\n return text", "def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n ...
[ "0.8186614", "0.8167427", "0.80849475", "0.80665344", "0.80609053", "0.7961596", "0.7913977", "0.7758668", "0.77576387", "0.77263385", "0.7659319", "0.76445484", "0.7564671", "0.7508944", "0.74831736", "0.74475497", "0.7446147", "0.7437394", "0.7379602", "0.736228", "0.728529...
0.72882515
20
Function to create a linked list
def create_linked_list(input_list): if len(input_list) == 0: return None head = create_node(input_list[0]) currNode = head previousNode = None for i in range(1, len(input_list)): if currNode.value is not None: previousNode = currNode currNode = create_node(inp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_linked_list(input_list):\n head=None\n for value in input_list:\n if head is None:\n head=Node(value)\n else:\n current_node=head\n while current_node.next:\n current_node=current_node.next\n current_node.next=Node(value)\n# ...
[ "0.77214336", "0.75695115", "0.73824114", "0.7363659", "0.7302192", "0.73002917", "0.7205697", "0.7196152", "0.7162771", "0.71372133", "0.705602", "0.7041141", "0.7028409", "0.6987021", "0.6983965", "0.69128084", "0.6884512", "0.6869112", "0.67818743", "0.6706874", "0.6663436...
0.7513225
2
Returns a string containing the name of the Pepper C type for |type_|. If array is True, returns the name of an array of |type_|. If optional is True, returns the name of an optional |type_|. If both array and optional are True, returns the name of an optional array of |type_|.
def ToPpapiType(self, type_, array=False, optional=False): if isinstance(type_, model.Function) or type_.property_type in ( model.PropertyType.OBJECT, model.PropertyType.ENUM): return self._FormatPpapiTypeName( array, optional, '_'.join( cpp_util.Classname(s) for s in self._Nam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_type_string(attr_type):\n if isinstance(attr_type, (list, tuple)):\n if len(attr_type) > 1:\n return (\n \", \".join([x.__name__ for x in attr_type[:-1]])\n + \" or \"\n + attr_type[-1].__name__\n )\n return attr_type[0]._...
[ "0.6798284", "0.6208575", "0.61560285", "0.6118705", "0.603263", "0.6015443", "0.59415644", "0.5903752", "0.5857458", "0.5834035", "0.5829078", "0.58240837", "0.57987493", "0.57529175", "0.5741216", "0.56974566", "0.56773055", "0.5657199", "0.5656581", "0.56545234", "0.563576...
0.64665055
1
Returns True if an optional |type_| is required.
def NeedsOptional(self, type_): return self._NameComponents(type_) in self._optional_types
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_valid_optional(content_type: str) -> bool:\n content_type = content_type.strip()\n\n if not content_type.startswith(\"pt:optional\"):\n return False\n\n if not _has_matched_brackets(content_type):\n return False\n\n if not _has_brackets(content_type):\n return False\n\n ...
[ "0.723862", "0.6928058", "0.6731056", "0.6610195", "0.64665216", "0.6466331", "0.63721937", "0.63449675", "0.6337248", "0.6314173", "0.6304244", "0.6241088", "0.6241088", "0.62294996", "0.6092895", "0.608791", "0.60751784", "0.6070337", "0.605822", "0.6050811", "0.6048762", ...
0.85003793
0
Builds user object from json dictionary.
def from_dict(user_json): user = User() user.id = user_json['id'] user.first_name = user_json['first_name'] user.surname = user_json['surname'] user.full_name = "{} {}".format(user.first_name, user.surname) user.email = user_json['email'] user.organisation = user_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, json, user=None):\n if user is None:\n user = cls()\n\n user.username = json['username']\n user.first_name = json['first_name']\n user.last_name = json['last_name']\n\n user.password = json['password']\n\n return user", "def build_user(data:...
[ "0.788263", "0.77517813", "0.6843238", "0.6741426", "0.6678272", "0.66541845", "0.6630228", "0.65087795", "0.6477479", "0.6359624", "0.63080406", "0.6287949", "0.6206536", "0.62037516", "0.61982036", "0.6137657", "0.61068296", "0.6100292", "0.60984886", "0.6090608", "0.608252...
0.7691353
2
Logically compare two Firefox version strings. Split the string into pieces, and compare each piece numerically. Returns 1, 0, or 1 depending on whether a is less than, equal to, or greater than b.
def compare_ver(a, b): if a == b: return 0 ap = [int(p) for p in a.split(".")] bp = [int(p) for p in b.split(".")] lap = len(ap) lbp = len(bp) # min # of pieces mp = lap if lbp < mp: mp = lbp for i in range(mp): if ap[i] < bp[i]: return -1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def semver_greater_or_equal_then(self, a, b):\n regex_pattern = r\"^[0-9]+\\.[0-9]+\\.[0-9]+$\"\n if not re.search(regex_pattern, a) or not re.search(regex_pattern, b):\n raise ValueError(\n \"input semver_greater_than not conforming to semver string with three components\"\...
[ "0.6895598", "0.6743786", "0.6740128", "0.66319966", "0.65628123", "0.65443957", "0.64480853", "0.6446703", "0.6441994", "0.64305896", "0.6421748", "0.6416959", "0.6401585", "0.63995934", "0.63389623", "0.62862116", "0.6275784", "0.62654954", "0.6259658", "0.6259658", "0.6194...
0.7151355
0
Get the predicted taxid of a cluster
def predict_tax_id_of(self, cluster, lowest_predicted_novelty=None): assert isinstance(cluster, list) assert isinstance(lowest_predicted_novelty, dict) list_of_valid_iid, set_of_ncbi_taxid = self.load_lineages(cluster) root = {"count": 0, "c": {}, 'p': None} # Build tree based from lineage of known referenc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, test_vector):\n return self.find_closest(test_vector)[1].class_id", "def predict(toPredict=None):\n\tif not toPredict:\n\t\ttoPredict = gc.generate_test_cases(1)[0]\n\ttoPredict = np.asarray(toPredict)\n\ttoPredict = toPredict.reshape(1, -1)\t\n\tclusterer = joblib.load(\"training_data.p...
[ "0.61873776", "0.59227043", "0.5879525", "0.58381927", "0.5827772", "0.58084744", "0.579759", "0.579388", "0.5715172", "0.5692964", "0.5692964", "0.5692964", "0.5692964", "0.56203836", "0.56029224", "0.5600961", "0.55800897", "0.557896", "0.5554138", "0.5523848", "0.55089825"...
0.6975198
0
Converts a date/time to an ISO8601 date string
def datetime_to_iso8601(date_time): assert not date_time.utcoffset() return date_time.strftime('%Y-%m-%dT%H:%M:%S.%f') + 'Z'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_to_iso8601(date):\n dateTimeStr = date.strftime('%Y-%m-%dT%H:%M:%S')\n timeZone_Sign = date.strftime('%z')[0:1]\n timeZone_Str = '%s:%s' % (\n date.strftime('%z')[1:3], date.strftime('%z')[3:5]\n )\n return '{dateTimeStr}{tzsign}{timezone}'.format(\n dateTimeStr=dateTimeStr,\n...
[ "0.74979764", "0.74902165", "0.7431974", "0.7419218", "0.7412657", "0.7403743", "0.7371318", "0.7325647", "0.7270622", "0.7265942", "0.71070457", "0.7059399", "0.70436025", "0.70258117", "0.7015273", "0.6989766", "0.6948633", "0.69454974", "0.6882652", "0.68742526", "0.682166...
0.7737572
0
This function computes the Hamming distance between the two input strings.
def hamming_dist(s1, s2): if s1 is None or s2 is None: return np.NaN if pd.isnull(s1) or pd.isnull(s2): return np.NaN # Create the similarity measure object measure = sm.HammingDistance() s1 = gh.convert_to_str_unicode(s1) s2 = gh.convert_to_str_unicode(s2) # Call the fu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_hamming_distance(str1, str2):\n\n mismatches = 0\n len_strs = len(str1)\n for i in range(len_strs):\n if str1[i] != str2[i]:\n mismatches = mismatches + 1\n return mismatches", "def HammingDist(str1, str2):\n\tHdist = 0\n\tfor i, base in enumerate(str1):\n\t\tif base != ...
[ "0.87342846", "0.86569554", "0.864575", "0.8600363", "0.858226", "0.84849864", "0.84785", "0.8473925", "0.83067364", "0.8301702", "0.82530946", "0.82253784", "0.82091683", "0.81999475", "0.80688906", "0.79166293", "0.78850746", "0.78613204", "0.77716285", "0.7766682", "0.7750...
0.81839216
14
This function computes the relative difference between two numbers
def rel_diff(d1, d2): if d1 is None or d2 is None: return np.NaN if pd.isnull(d1) or pd.isnull(d2): return np.NaN try: d1 = float(d1) d2 = float(d2) except ValueError: return np.NaN if d1 == 0.0 and d2 == 0.0: return 0 else: # Compute the ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def difference(num1, num2):\n\n # Return the calculated value\n return abs(num1 - num2)", "def relative_change(nr1, nr2):\n\n return float(((nr2 - nr1) / nr1) * 100)", "def rel_diff (x, y, ord=2):\n return np.linalg.norm (x - y, ord=ord) / np.linalg.norm (y, ord=ord)", "def subtract(value1, value...
[ "0.78438365", "0.7366058", "0.71686053", "0.715922", "0.6943712", "0.68633705", "0.68463707", "0.6832445", "0.68225986", "0.68112576", "0.67888916", "0.6780808", "0.6780808", "0.67792785", "0.6770976", "0.6770976", "0.6768049", "0.67509234", "0.67287207", "0.6695316", "0.6695...
0.78984976
0
Basic dynamics of xdot = u + w X = [x, y, theta, v] U = [a, thetadot]
def xdot(self, t, x, u, w): a= u[0] thetadot = u[1] theta = x[2] v = x[3] w = w * self.w_scale return np.array([v*np.cos(theta), v*np.sin(theta), thetadot, a]) + np.array([np.cos(theta) * w[0] - np.sin(theta) * w[1], np.sin(theta) * w[0] + np.cos(theta) * w[1], v * w[2], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _x_dot(self, x, t, u):\r\n # freeze system if state is irrecoverable\r\n if self.is_irrecoverable(ignore_force_check=True):\r\n return np.concatenate([x[3:], -100 * x[3:]])\r\n\r\n omega_dot = self._compute_omega_dot(x, u)\r\n return np.concatenate([x[3:], omega_dot])", ...
[ "0.7095485", "0.67280114", "0.6631565", "0.6583655", "0.6473879", "0.64622515", "0.6437646", "0.6346359", "0.6318589", "0.6317359", "0.6280072", "0.62792444", "0.6275815", "0.62749016", "0.6229366", "0.6229271", "0.6220608", "0.6207483", "0.6186498", "0.616053", "0.61565715",...
0.8511646
0
Load the data in the file as YAML, then deserialize into the model with the schema
def load_yaml_file(self, path): with path.open('r') as handle: data = load_yaml(handle) self.set_all(**self.SCHEMA.load(data).data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yaml(fname, schema=None):\n with open(fname) as fh:\n data = yaml.safe_load(fh.read())\n if schema:\n import jsonschema\n jsonschema.validate(data, schema=schema)\n return data", "def load_yaml():\n yamlfullpath = os.path.join(THISDIR, 'ff_data.yaml')\n\n with open(ya...
[ "0.7052859", "0.6938935", "0.6663248", "0.66504115", "0.6547714", "0.65372574", "0.6492213", "0.6489156", "0.6478954", "0.6426492", "0.642378", "0.6408891", "0.63940364", "0.63902265", "0.63423324", "0.6328812", "0.6247367", "0.6204342", "0.61898434", "0.6164526", "0.6142374"...
0.70614487
0
Starts the webdriver (dls if needed) and returns it.
def start_driver(headless = False) -> webdriver.Chrome: # if chromedriver doesn't exist, dl it, then set path to it # chromedriver = os.path.join(current_folder,"chromedriver.exe") cda.install() # setup webdriver settings options = webdriver.ChromeOptions() # add ublock origin to reduce impact, block stuff # o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _instantiate_driver(self) -> webdriver:\n\n if self.driver is None: return Browser.run_chromedriver()\n\n return self.driver", "def get_driver():\n # user_agent = user_agent_rotator.get_random_user_agent()\n try:\n if len(sys.argv) > 1:\n if Driver._drive...
[ "0.7084599", "0.6941087", "0.6816508", "0.67303175", "0.658199", "0.65801823", "0.65406185", "0.6523861", "0.65219396", "0.65053314", "0.65053314", "0.64913964", "0.6454579", "0.6397404", "0.6382118", "0.6368231", "0.6346839", "0.6334337", "0.6273411", "0.6243833", "0.6226587...
0.6257622
19
Return datetime with necessary twint formatting
def get_formatted_time() -> datetime.strftime: now = datetime.now() # time now half_hour = (now - timedelta(minutes = 30)) # time 30 min ago # returns half hour ago to accommodate for failed checks # (bc twint behaves as if none found if check failed) current_time = half_hour.strftime("%Y-%m-%d %H:%M:%S") ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_datetime(self, data):\r\n data = make_naive(data)\r\n if self.datetime_formatting == 'rfc-2822':\r\n return format_datetime(data)\r\n\r\n return data.isoformat()", "def formatted_time() -> datetime.datetime:\r\n return datetime.datetime.now()", "def format_datetime...
[ "0.7101346", "0.709166", "0.70681345", "0.69130504", "0.68483335", "0.6827547", "0.68235683", "0.68001056", "0.67996854", "0.67662156", "0.67649925", "0.6669421", "0.66533226", "0.662465", "0.66046804", "0.656051", "0.65203434", "0.65191424", "0.6514996", "0.64962417", "0.647...
0.61613846
71
Returns average of all stored heart rates for user since some time if given
def average_hr(self, since_time=None): try: import numpy as np except ImportError as e: print("Necessary import failed: {}".format(e)) return None hr = np.array(self.heart_rate) if since_time is not None: hr_adjusted = np.array([]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interval_average():\r\n import statistics as st\r\n from tach_detect import tach_detect\r\n r = request.get_json()\r\n try:\r\n email = r[\"user_email\"]\r\n except KeyError:\r\n return jsonify(\"no email input\"), 400\r\n raise LookupError(\"no email input\")\r\n check_e...
[ "0.7452025", "0.72157973", "0.71164423", "0.68806595", "0.6503524", "0.648473", "0.63955784", "0.6392288", "0.63793623", "0.63394165", "0.622651", "0.62148166", "0.6195902", "0.614133", "0.61285305", "0.60863906", "0.60718745", "0.60439956", "0.59818286", "0.59671843", "0.594...
0.75091505
0
Compares given heart rate to calculated tachycardia range based on age of user
def is_tachycardic(self, hr): lower_bound = self.tachycardic_range() return hr > lower_bound
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_tachycardia(heart_rate_avg, age):\n if age <= 2/365:\n if heart_rate_avg > 159:\n tachycardia = True\n else:\n tachycardia = False\n elif age <= 6/365:\n if heart_rate_avg > 166:\n tachycardia = True\n else:\n tachycardia = Fal...
[ "0.7398071", "0.72204703", "0.69691634", "0.66293794", "0.59498596", "0.56704354", "0.5597344", "0.5525531", "0.5506919", "0.54604435", "0.54198134", "0.5403759", "0.53974295", "0.5394925", "0.5381238", "0.53441626", "0.5324112", "0.52596605", "0.5242152", "0.5221587", "0.515...
0.5055697
35
Determines lower bound for tachycardia given age of User
def tachycardic_range(self): self.adjust_age() if self.age_units == "day": if self.age <= 2: return 159 elif self.age <= 6: return 166 elif self.age_units == "week": return 182 elif self.age_units == "month": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_age_range(self):\n\n # Checks if user is in the age range of 1 to 3\n if self.age < 0 & self.age >= 3:\n self.age_range = \"1-3\"\n \n # Checks if user is in the age range of 4 to 8\n if self.age >= 4 & self.age <= 8:\n self.age_range = \"4-8\"\n...
[ "0.662293", "0.63977665", "0.637395", "0.61643904", "0.61416554", "0.61267847", "0.61246365", "0.607577", "0.60466456", "0.60255307", "0.59957397", "0.59957397", "0.59515685", "0.595111", "0.59409004", "0.5940497", "0.59309125", "0.5921905", "0.5916597", "0.59147346", "0.5910...
0.6890343
0
Check is current user is post's author
def has_object_permission(self, request, view, obj): if request.method in SAFE_METHODS: return True return obj.author == request.user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_func(self):\r\n post = self.get_object()\r\n if self.request.user == post.author:\r\n return True\r\n return False", "def test_func(self):\r\n post = self.get_object()\r\n if self.request.user == post.author:\r\n return True\r\n return Fals...
[ "0.80038464", "0.80038464", "0.80038464", "0.796662", "0.7854536", "0.7854536", "0.78025186", "0.72946584", "0.71438634", "0.709326", "0.6963413", "0.6963413", "0.6937156", "0.6879236", "0.68672705", "0.6850146", "0.68334633", "0.6752733", "0.66836405", "0.6623497", "0.662070...
0.65593725
22
Check is current user not a post author
def has_object_permission(self, request, view, obj): if request.user.is_authenticated: return obj.author != request.user return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_func(self):\r\n post = self.get_object()\r\n if self.request.user == post.author:\r\n return True\r\n return False", "def test_func(self):\r\n post = self.get_object()\r\n if self.request.user == post.author:\r\n return True\r\n return Fals...
[ "0.74935424", "0.74935424", "0.74935424", "0.74569714", "0.72762245", "0.72762245", "0.70809954", "0.7062695", "0.679221", "0.6767452", "0.66439694", "0.6595933", "0.65019596", "0.6484669", "0.64813435", "0.64813435", "0.64530545", "0.6415335", "0.64117104", "0.62986076", "0....
0.6459719
16
Return a list of comments relaited to post
def comments(self, request, pk=None): post = self.get_object() comments = Comment.objects.filter(post=post).order_by('created_at') serializer = PostCommentsSerializer(comments, many=True) return Response(serializer.data, status.HTTP_200_OK)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commentList(post):\n comments = Comment.objects.all().filter(post=post).order_by('-published')\n remote_comments = RemoteComment.objects.all().filter(post=post).order_by('published')\n comment_list = list()\n\n if comments:\n for comment in comments:\n comment_dict = dict()\n ...
[ "0.7933662", "0.7580084", "0.72869974", "0.7130854", "0.71116847", "0.7075892", "0.7057774", "0.701222", "0.6956028", "0.6911711", "0.6910088", "0.69061166", "0.69061166", "0.68957275", "0.6878161", "0.6851139", "0.6831488", "0.68124086", "0.68124086", "0.68124086", "0.677959...
0.70599663
6
Calculate rolling average from a column. We apply mean for each values of a specific column within the range of last week date and date itself
def get_rolling_average(date, df, column): lowestDate = datetime.strftime( datetime.strptime(date, "%Y-%m-%d") - timedelta(days=6), "%Y-%m-%d" ) return df[ (df['date'] >= lowestDate) & (df['date'] <= date) ].mean()[column].mean().round(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_rolling_average(df, level, code_level, trendType, column):\n df = df.sort_values(by=['date'])\n df = df.reset_index(drop=True)\n\n df['date_7days_ago'] = df['date'].apply(lambda x: datetime.strftime(\n datetime.strptime(x, \"%Y-%m-%d\") - timedelta(days=7), \"%Y-%m-%d\"\n ))\n df[...
[ "0.7191205", "0.7113405", "0.7069829", "0.69824106", "0.6897152", "0.67890257", "0.6559756", "0.64659315", "0.6439951", "0.64124846", "0.64092994", "0.6393626", "0.6359574", "0.61933124", "0.61762893", "0.6158098", "0.6112367", "0.6096859", "0.6073577", "0.5938104", "0.586631...
0.79241586
0
getter for size Returns thee width of Rectangle setter validates same as Rectangle's attributes setter sets width and height
def size(self): return self.width
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sizegetter(self):\n Rectangle.reset_objects()\n r1 = Square(1, 2, 2, 3)\n self.assertEqual(r1.size, 1)", "def test_sizesetter(self):\n Rectangle.reset_objects()\n r1 = Square(1, 2, 2, 3)\n self.assertEqual(r1.size, 1)\n r1.size = 100\n self.assertE...
[ "0.734276", "0.7205998", "0.7125906", "0.7124103", "0.7121435", "0.7013606", "0.70032203", "0.69812363", "0.69812363", "0.69812363", "0.69812363", "0.69812363", "0.69812363", "0.69812363", "0.6974362", "0.6974362", "0.6881332", "0.6848292", "0.68293625", "0.67739934", "0.6738...
0.6829797
18
Initial w & b will be set to be randomized, (mean, sd) = (0, 1). In the future maybe need to be enable to set user's initial w & b.
def set_initial_wb(self): self.w = np.append(self.iniW, self.iniB)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _random_weight_initialization(self, mean=0, stddev=1):\n self.slp_weights = np.random.normal(mean, stddev, size=(self.n_rbfs, self.n_targets))", "def randomize_values():\n Output.set_states({'v_th' : np.random.normal(V_TH0, V_TH0*DEV, M)})\n\n S.set_states({\n 'w' : np.random.normal(W0,W0*DEV,N*M...
[ "0.6921931", "0.66863215", "0.66731817", "0.6559594", "0.6518764", "0.6325679", "0.6285662", "0.62785685", "0.6272078", "0.624063", "0.61963147", "0.61382467", "0.6137038", "0.6127892", "0.6124035", "0.6104662", "0.6078483", "0.60777825", "0.6056588", "0.6050402", "0.6047216"...
0.0
-1
Filter this queryset to select status objects as of status_date.
def filter_status_as_of(self, status_date: datetime.date) -> QuerySet: return self.model._filter_queryset_status_as_of(self, status_date)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _filter_queryset_status_as_of(cls, queryset: QuerySet, status_date: datetime.date, \n status_model_path: str = '', return_type: Literal(['queryset', 'q_obj']) = 'queryset') -> QuerySet:\n if status_model_path != '':\n status_model_path += '__' # append thi...
[ "0.664834", "0.6547365", "0.63360095", "0.6248208", "0.584044", "0.57783943", "0.57516164", "0.566526", "0.55965686", "0.55448085", "0.55358857", "0.5526163", "0.54578", "0.5449902", "0.5433801", "0.5403676", "0.53997964", "0.5394545", "0.5364103", "0.5323609", "0.5303084", ...
0.8398093
0
Filter queryset to select status objects as of status_date. Can be used on querysets where the base object is not a subclass of StatusModel, in which case the django model path to the relevant StatusModel subclass should be provided in 'status_model_path'. e.g. StatusModel._filter_queryset_status_as_of(queryset = Invoi...
def _filter_queryset_status_as_of(cls, queryset: QuerySet, status_date: datetime.date, status_model_path: str = '', return_type: Literal(['queryset', 'q_obj']) = 'queryset') -> QuerySet: if status_model_path != '': status_model_path += '__' # append this to get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_status_as_of(self, status_date: datetime.date) -> QuerySet:\n return self.model._filter_queryset_status_as_of(self, status_date)", "def filter_status(self, queryset, name, value):\n\n return queryset.filter(status=value)", "def get_queryset(self):\n kwargs = {}\n if self....
[ "0.74970436", "0.6207123", "0.60850483", "0.5749448", "0.5747517", "0.5700742", "0.563528", "0.55883414", "0.5555127", "0.5464583", "0.54423386", "0.5425324", "0.5415296", "0.5364315", "0.53392094", "0.5288445", "0.52402896", "0.5209048", "0.51790655", "0.5161116", "0.5143606...
0.87326074
0
Add a new StatusModel record for an observed object. Any previously 'current' status (if one exists) is marked as ending the day prior to the new status, and the new status is added with no end date. If the prior status starts on the same day as the new status, the prior status is removed completely.
def add_status(cls, new_status: StatusModel): # start or ensure we're in a transaction transaction_context = db_transaction.atomic if not in_db_transaction() else nullcontext with transaction_context(): if new_status.applies_to is not None: raise StatusCreati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_timeline(new_status):\n timeline = CacheManager.get_timeline()\n index = [timeline.index(status) for status in timeline \\\n if parse(status['pubdate']) < parse(new_status['pubdate'])]\n if len(index) == 0:\n timeline.insert(0, new_status)\n else:\n ...
[ "0.58432233", "0.53649807", "0.52297235", "0.5140238", "0.50651693", "0.50297964", "0.50025034", "0.49827248", "0.49414158", "0.49335182", "0.49262938", "0.49026427", "0.4882126", "0.48527563", "0.48283255", "0.48227394", "0.47830966", "0.4775569", "0.4770164", "0.47696376", ...
0.76023984
0
an activation function which outputs the value between (0,1)
def sigmoid(X,prime=False): if prime: return sigmoid(X) * (1.0 - sigmoid(X)) else: return 1.0/(1.0+np.exp(-X))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activation(x):\n # return np.tanh(x)\n return np.maximum(0,x)", "def activation(x):\n return 1 / (1 + torch.exp(-x))", "def activation_func(x):\r\n a = -1\r\n return 1/(1+np.exp(-a*x))", "def activation(z):\n # formula for sigmoid\n return 1 / (1 + np.exp(-z))", "def activation(h):\n\n...
[ "0.81871647", "0.81268454", "0.80985284", "0.8092218", "0.7895913", "0.7782559", "0.7763995", "0.7745626", "0.76560044", "0.76304865", "0.7563744", "0.7448612", "0.74253803", "0.73874706", "0.73762214", "0.73255867", "0.73056066", "0.7304794", "0.72955924", "0.7286714", "0.72...
0.0
-1
an activation function which outputs the value between (1,1)
def tanh(X): if isinstance(X,np.ndarray): return (2.0/(1.0+np.exp(-(2*X))))-1 else: X=np.array(X) return tanh(X)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activation(x):\n # return np.tanh(x)\n return np.maximum(0,x)", "def activation(x):\n return 1 / (1 + torch.exp(-x))", "def activation_func(x):\r\n a = -1\r\n return 1/(1+np.exp(-a*x))", "def activation(z):\n # formula for sigmoid\n return 1 / (1 + np.exp(-z))", "def activation_functio...
[ "0.81185746", "0.8103764", "0.8068882", "0.7992871", "0.77595955", "0.7734101", "0.771974", "0.76860505", "0.76188684", "0.7604401", "0.75070393", "0.74875855", "0.74425083", "0.7411527", "0.74002546", "0.73841685", "0.73841685", "0.7334966", "0.73050106", "0.72710514", "0.72...
0.0
-1
Reads source and target sequences from txt files.
def __init__(self, src_seq, trg_seq, index_seq, src_word2id, trg_word2id, max_len, conv_seq, ent, ID,ans_seq,ir_seq,max_r_ans,entity_cal,entity_nav,entity_wet): self.src_seqs = src_seq self.trg_seqs = trg_seq self.index_seqs = index_seq self.num_total_seqs = len(self.src_seqs) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_examples(source_file, target_file):\n sources = []\n targets = []\n\n with gfile.GFile(source_file, \"r\") as txt_file:\n for line in txt_file:\n sources.append(line.rstrip(\"\\n\"))\n\n with gfile.GFile(target_file, \"r\") as txt_file:\n for line in txt_file:\n targets.append(line.rst...
[ "0.7004346", "0.6208018", "0.61497456", "0.6132846", "0.6076196", "0.60475314", "0.6025892", "0.5775756", "0.56896174", "0.5674089", "0.5657116", "0.56105125", "0.5501782", "0.5494425", "0.5476749", "0.5456228", "0.54284465", "0.54284143", "0.5420703", "0.5415088", "0.5394724...
0.0
-1
Returns a list of sentences from a paragraph This is a rather naive implementation; there are probably better ones out there Assumes that the paragraph has proper punctuation.
def get_sentences(paragraph): punctuation = re.compile(r'[\.!?]') sentences = [sentence.strip() for sentence in punctuation.split(paragraph)] sentences = filter(lambda x: x, sentences) return sentences
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sentences(self) -> List[str]:\n\t\treturn [sentence for sentence in re.split('(?<=[.!?])', self.text)]", "def get_sentences(text):\n \n return text.split('.')", "def split(text):\n doc = nlp(text)\n sentences = [x.text_with_ws for x in doc.sents]\n return sentences", "def sente...
[ "0.76229024", "0.74522465", "0.73308635", "0.72472256", "0.72472256", "0.71657723", "0.7106902", "0.70726115", "0.70445025", "0.70266235", "0.69980454", "0.6881847", "0.68521893", "0.6851337", "0.6841656", "0.6837825", "0.67499644", "0.67206156", "0.6693907", "0.66668844", "0...
0.88997257
0
return True if this is an UPDATE operation.
def is_update(self) -> bool: return self.statement.is_dml and self.statement.is_update
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_update(self):\n return self.action in [\"update\", \"partial_update\"]", "def is_update_active(self):\n return self._update_action", "def _is_valid_update_operation(session, row):\n # Check if there are older updates in the queue\n if db.check_for_older_ops(session, row):\n re...
[ "0.80514944", "0.68959904", "0.68557453", "0.6854025", "0.68472934", "0.6791104", "0.6708837", "0.6699989", "0.65150803", "0.6434282", "0.63465744", "0.6344334", "0.6336636", "0.632303", "0.6250073", "0.6207", "0.62066543", "0.6184201", "0.613155", "0.6125278", "0.6116963", ...
0.8240323
0
Return True if the operation is refreshing columnoriented attributes on an existing ORM object.
def is_column_load(self) -> bool: opts = self._orm_compile_options() return opts is not None and opts._for_refresh_state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_update(self) -> bool:\n return self.statement.is_dml and self.statement.is_update", "def is_modified(\n self, instance: object, include_collections: bool = True\n ) -> bool:\n state = object_state(instance)\n\n if not state.modified:\n return False\n\n dict...
[ "0.6629238", "0.62679005", "0.62371886", "0.60928726", "0.6065252", "0.5895536", "0.5853559", "0.5758199", "0.5731893", "0.5689342", "0.5689342", "0.56879103", "0.56879103", "0.56705713", "0.56613517", "0.5660778", "0.5656837", "0.5642546", "0.5632726", "0.562552", "0.5582123...
0.72165644
0
Return True if this load is loading objects on behalf of a relationship. This means, the loader in effect is either a LazyLoader, SelectInLoader, SubqueryLoader, or similar, and the entire SELECT statement being emitted is on behalf of a relationship load. Handlers will very likely not want to add any options to querie...
def is_relationship_load(self) -> bool: opts = self._orm_compile_options() if opts is None: return False path = self.loader_strategy_path return path is not None and not path.is_root
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def canLoad(self):\n #xxx should be corrected to work on all subclass hierarchy\n return 'load' in self.__class__.__dict__", "def requires_model_loading(self):\n return self.requires_loaded_models", "def is_loaded(self):\n return (\n self._momentary_follow_sense_prop.is_l...
[ "0.61518866", "0.6142196", "0.5921451", "0.59201634", "0.58543783", "0.58315754", "0.581896", "0.5817962", "0.57505995", "0.57488155", "0.574867", "0.57023674", "0.567425", "0.5661016", "0.5628691", "0.5619242", "0.5564777", "0.55491865", "0.55205286", "0.5505779", "0.5499632...
0.80417824
0
Close out the transactional resources and ORM objects used by this
def close(self) -> None: self._close_impl(invalidate=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _close(self):\n if self.__session is not None:\n self._rollback()\n self.__session.close()", "def _cleanup(self):\n\n self._orm_session.close()\n self._db_transaction.rollback()\n self._db_connection.close()\n\n self._db_engine = None\n self._db...
[ "0.7748021", "0.76051176", "0.74547166", "0.7376286", "0.7350675", "0.72431904", "0.71759796", "0.7152448", "0.71482897", "0.70926946", "0.70919955", "0.7059159", "0.7049967", "0.7033401", "0.70193446", "0.69770193", "0.69692546", "0.691628", "0.6904176", "0.68347526", "0.683...
0.0
-1
Close this Session, using connection invalidation.
def invalidate(self) -> None: self._close_impl(invalidate=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n self.session.close()\n self.session = None", "def close(self):\n self.__session.close()", "def close(self):\n self.__session.close()", "def close(self):\n self.__session.close()", "def close(self):\n self.__session.close()", "def close(self):\n...
[ "0.80742514", "0.80438524", "0.80438524", "0.80438524", "0.80438524", "0.80438524", "0.80438524", "0.7951826", "0.7924638", "0.7924638", "0.7924638", "0.7921705", "0.78882855", "0.7862392", "0.7854252", "0.7811027", "0.77958727", "0.7767702", "0.7764065", "0.7617149", "0.7600...
0.0
-1
Flush all the object changes to the database. Writes out all pending object creations, deletions and modifications to the database as INSERTs, DELETEs, UPDATEs, etc. Operations are automatically ordered by the Session's unit of work dependency solver. Database operations will be issued in the current transactional cont...
def flush(self, objects: Optional[Sequence[Any]] = None) -> None: if self._flushing: raise sa_exc.InvalidRequestError("Session is already flushing") if self._is_clean(): return try: self._flushing = True self._flush(objects) finally: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flush(self):\n if not self.is_active:\n return\n\n # XXX: investigate if there is db transaction flush\n self._orm_session.flush()", "def flush(self, obj=None):\n if self.impl.db is None: return\n if obj is None:\n self.uow.flush()\n else:\n ...
[ "0.7843716", "0.78038573", "0.7351902", "0.7191872", "0.7152729", "0.6979132", "0.6927588", "0.68423975", "0.6799363", "0.67682743", "0.6751423", "0.6713329", "0.6673304", "0.65490985", "0.65426314", "0.6481903", "0.64765257", "0.6473595", "0.64652073", "0.6461828", "0.645061...
0.6564672
13
The set of all persistent states considered dirty. This method returns all states that were modified including those that were possibly deleted.
def _dirty_states(self) -> Iterable[InstanceState[Any]]: return self.identity_map._dirty_states()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dirty(self) -> IdentitySet:\n return IdentitySet(\n [\n state.obj()\n for state in self._dirty_states\n if state not in self._deleted\n ]\n )", "def states(self):\n from copy import copy\n return copy(self._states_...
[ "0.81482345", "0.70150477", "0.6917673", "0.68806714", "0.68650913", "0.6763983", "0.648369", "0.6442556", "0.6442415", "0.6415415", "0.6394742", "0.6382415", "0.6304089", "0.62843317", "0.6263013", "0.6244383", "0.6112895", "0.60938674", "0.6065263", "0.60623515", "0.6061572...
0.8290956
0
The set of all persistent instances considered dirty.
def dirty(self) -> IdentitySet: return IdentitySet( [ state.obj() for state in self._dirty_states if state not in self._deleted ] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dirty_states(self) -> Iterable[InstanceState[Any]]:\n return self.identity_map._dirty_states()", "def objects_in_use(self):\n return set()", "def is_dirty(self):\n return True in [n.is_dirty for n in self.nodes]", "def persisted_values(self):\n return []", "def get_dirty_proper...
[ "0.7383943", "0.642375", "0.6398122", "0.63735354", "0.6362377", "0.61284876", "0.60679007", "0.60633314", "0.60006493", "0.5981661", "0.59665096", "0.5963429", "0.5932468", "0.5932468", "0.5932468", "0.5932468", "0.5932468", "0.5932468", "0.59288013", "0.591709", "0.5893051"...
0.7940066
0
Tests initialisation of Aquarius objects.
def test_init(): aqua = Aquarius("http://something/api/v1/aquarius/assets") assert ( aqua.url == "http://something/api/v1/aquarius/assets/ddo" ), "Different URL from the specified one." assert ( aqua.root_url == "http://something" ), "Different root URL from the specified one."
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test___init__(self):\n copula = GammaUnivariate()\n assert copula.a is None\n assert copula.loc is None\n assert copula.scale is None", "def test_init(self):\n self.assertIsNotNone(DatabaseIntermediary(), self.ec.db)", "def test_init(self):\n rachio = Rachio(AUTHTO...
[ "0.70525175", "0.69626737", "0.68798745", "0.68673795", "0.6812885", "0.6807057", "0.6797245", "0.67916226", "0.6714089", "0.6689329", "0.6682552", "0.66112345", "0.6610447", "0.65597427", "0.65076184", "0.649798", "0.6455297", "0.64524794", "0.6437213", "0.6428168", "0.63993...
0.76929474
0
Tests query search with an invalid query.
def test_invalid_search_query(aquarius_instance): search_query = dict() search_query["sort"] = "foo_sort" with pytest.raises(ValueError): aquarius_instance.query_search(search_query=search_query, sort="foo_sort")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_query_search_wrongfield(self):\r\n # Test first a non-existant field for all end-points\r\n for endpoint in self.endpoints:\r\n res = self.app.get(\"/api/%s?wrongfield=value\" % endpoint)\r\n err = json.loads(res.data)\r\n assert res.status_code == 415, err\r...
[ "0.7463945", "0.73862934", "0.7294621", "0.7236369", "0.72287714", "0.71919495", "0.7167107", "0.7147223", "0.7132126", "0.70846224", "0.7081743", "0.7079348", "0.70627487", "0.7033699", "0.702306", "0.69042057", "0.68690693", "0.6863569", "0.6847299", "0.6805821", "0.6796804...
0.8103058
0
Pulls the value for the given key from the object, applies the field's formatting and returns the result.
def serialize( self, attr: str, obj: typing.Any, accessor: typing.Callable[[typing.Any, str, typing.Any], typing.Any] | None = None, **kwargs, ): if self._CHECK_ATTRIBUTE: value = self.get_value(obj, attr, accessor=accessor) if value is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_formatted(self, key):\n val = self[key]\n\n if isinstance(val, str):\n try:\n return self.get_processed_string(val)\n except KeyError as err:\n # Wrapping the KeyError into a less cryptic error for end-user\n # friendliness\n ...
[ "0.6378401", "0.61252886", "0.6114411", "0.5919362", "0.5901136", "0.5885049", "0.5812164", "0.5710396", "0.56931174", "0.5648728", "0.5634506", "0.5630991", "0.5610064", "0.55813605", "0.55700916", "0.55591625", "0.5540824", "0.55239403", "0.55100405", "0.5497037", "0.549266...
0.0
-1
Creates a JSONoriented Flask app. All error responses that you don't specifically manage yourself will have applications/json content type, and will contain JSON like this (just an example)
def make_json_app(import_name, **kwargs): def make_json_error(ex): response = jsonify(message=str(ex), code=(ex.code if isinstance(ex, HTTPException) else 500)) response.status_code = (ex.code if isinstance(ex, HTTPException) else 500) return response app = Flask(import_name, **kwargs) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_json_app(import_name, **kwargs):\n def make_json_error(ex):\n pprint.pprint(ex)\n # pprint.pprint(ex.code)\n response = jsonify(message=str(ex))\n #response = jsonify(ex)\n response.status_code = (ex.code\n if isinstance(ex, HTTPExceptio...
[ "0.81635195", "0.8133192", "0.79274666", "0.79274666", "0.6972535", "0.6880173", "0.6824953", "0.6748881", "0.6580665", "0.6562327", "0.65008616", "0.6497854", "0.6444903", "0.64056337", "0.6374306", "0.63120764", "0.6223792", "0.6220883", "0.6203432", "0.6147896", "0.6102387...
0.7894046
4
Returns the transaction id for an iTunes transaction. The returned id is usable as a range key for Subscription.Query.
def GetITunesTransactionId(cls, verify_response): return kITunesPrefix + verify_response.GetRenewalTransactionId()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_payu_transaction_id():\n hash_object = sha256(str(int(time.time() * 1000)).encode('utf-8'))\n txnid = hash_object.hexdigest().lower()[0:32]\n return txnid", "def get_transactionId(self, data):\n transactionId = data['transactionId']\n return transactionId", "def compute_transacti...
[ "0.6896837", "0.6791971", "0.6683428", "0.63106054", "0.6138712", "0.59663343", "0.58990246", "0.5886493", "0.5816034", "0.56646365", "0.56619567", "0.55866027", "0.5493326", "0.5445639", "0.54284066", "0.5374061", "0.5373262", "0.53542167", "0.53393805", "0.53177744", "0.529...
0.61795217
4
Returns the subscription id for an iTunes transaction. THe returned id will be the same for all transactions in a series of renewals.
def GetITunesSubscriptionId(cls, verify_response): return kITunesPrefix + verify_response.GetOriginalTransactionId()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscription_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"subscription_id\")", "def get_subscription_id(self):\n subscription_id = self.get_intermediate(\"subscription_id\", None)\n if not subscription_id:\n subscription_id = self.cmd.cli_ctx.data.get('subscripti...
[ "0.6922909", "0.66919905", "0.6434174", "0.6358435", "0.6095308", "0.5967596", "0.59468853", "0.59185296", "0.57001954", "0.5659351", "0.5659351", "0.5658425", "0.56308174", "0.5568889", "0.5521859", "0.5473928", "0.5415231", "0.5415182", "0.52769345", "0.52344084", "0.520371...
0.7144965
0
Creates a subscription object for an iTunes transaction. The verify_response argument is a response from viewfinder.backend.services.itunes_store.ITunesStoreClient.VerifyReceipt. The new object is returned but not saved to the database.
def CreateFromITunes(cls, user_id, verify_response): assert verify_response.IsValid() sub_dict = dict( user_id=user_id, transaction_id=Subscription.GetITunesTransactionId(verify_response), subscription_id=Subscription.GetITunesSubscriptionId(verify_response), timestamp=verify_response.Ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RecordITunesTransaction(cls, client, callback, user_id, verify_response):\n sub = Subscription.CreateFromITunes(user_id, verify_response)\n sub.Update(client, callback)", "def post_create_subscription(\n self, response: pubsub.Subscription\n ) -> pubsub.Subscription:\n return response"...
[ "0.7048045", "0.61676496", "0.5990635", "0.59361476", "0.5884864", "0.55695355", "0.5556764", "0.541712", "0.5386612", "0.53512514", "0.5335941", "0.5322247", "0.5300988", "0.5213497", "0.52041996", "0.5198155", "0.51571894", "0.50963527", "0.499864", "0.49974996", "0.4977607...
0.6756502
1
Creates a subscription record for an iTunes transaction and saves it to the database. The verify_response argument is a response from viewfinder.backend.services.itunes_store.ITunesStoreClient.VerifyReceipt.
def RecordITunesTransaction(cls, client, callback, user_id, verify_response): sub = Subscription.CreateFromITunes(user_id, verify_response) sub.Update(client, callback)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_create_subscription(\n self, response: pubsub.Subscription\n ) -> pubsub.Subscription:\n return response", "def CreateFromITunes(cls, user_id, verify_response):\n assert verify_response.IsValid()\n sub_dict = dict(\n user_id=user_id,\n transaction_id=Subscription.GetITun...
[ "0.60433036", "0.5971549", "0.57673633", "0.57216924", "0.5666896", "0.56634444", "0.5558759", "0.5525311", "0.55051625", "0.53845364", "0.53136545", "0.53124315", "0.5200569", "0.5187778", "0.5142988", "0.5119962", "0.51056916", "0.50879365", "0.5056159", "0.50197226", "0.50...
0.75471354
0
Returns a list of Subscription objects for the given user. By default only includes currentlyactive subscriptions, and only one transaction per subscription. To return expired subscriptions, pass include_expired=True. To return all transactions (even those superceded by a renewal transaction for the same subscription),...
def QueryByUser(cls, client, callback, user_id, include_expired=False, include_history=False): history_results = [] latest = {} def _VisitSub(sub, callback): if include_history: history_results.append(sub) else: if sub.expiration_ts < time.time() and not include...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_subsciptions_by_user(user_id):\n user = get_user_by_id(user_id)\n subscriptions = user.subscriptions\n return subscriptions", "def GetSubscriptionsForUser(self, userName):\n\n return self.__GetJson(\"/users/\"+userName+\"/subscriptions\", True)", "def GetSubscriptionsFromUser(self, user...
[ "0.72044915", "0.71607876", "0.7076956", "0.6945214", "0.6808065", "0.66882795", "0.66704553", "0.6560594", "0.65368223", "0.65074223", "0.64766574", "0.64761186", "0.6420109", "0.62767226", "0.62731695", "0.62687385", "0.61983347", "0.61374867", "0.60987484", "0.608197", "0....
0.7135429
2
Converts KTensor to a dense ndarray.
def full(self): # Compute tensor unfolding along first mode unf = self.factors[0] @ khatri_rao(self.factors[1:]).T # Inverse unfolding along first mode return np.reshape(unf, self.shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_ndarray(self):\n invalidInputError(self.indices is None, \"sparseTensor to ndarray is not supported\")\n return np.array(self.storage, dtype=get_dtype(self.bigdl_type)).reshape(self.shape) # noqa", "def sparse_to_dense(self, tensor: tf.Tensor, output_shape: tf.TensorShape) -> tf.Tensor:\n ...
[ "0.6649719", "0.65330756", "0.6274775", "0.62331015", "0.61421955", "0.60363954", "0.60149133", "0.5951555", "0.5858377", "0.5730846", "0.57231045", "0.5667669", "0.5553754", "0.5500901", "0.54917526", "0.5465225", "0.54026896", "0.5399308", "0.53902495", "0.53844714", "0.536...
0.0
-1
Returns all the proxies registered in the server
def proxies(self): proxies = APIConsumer.get("/proxies").json() proxies_dict = {} for name, values in viewitems(proxies): # Lets create a Proxy object to hold all its data proxy = Proxy(**values) # Add the new proxy to the toxiproxy proxies collection ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all(self):\n return self.proxies", "def get_proxies():\n scrapper = Scrapper(category='ALL', print_err_trace=False)\n data = scrapper.getProxies()\n\n proxies = []\n for item in data.proxies:\n proxies.append('{}:{}'.format(item.ip, item.port))\n return proxies", "def proxi...
[ "0.82872874", "0.82591", "0.7790209", "0.77358323", "0.7701172", "0.75207084", "0.7369183", "0.7362553", "0.725647", "0.7144428", "0.6910044", "0.6874921", "0.68709165", "0.6850851", "0.68429357", "0.6809145", "0.674759", "0.6735651", "0.66016173", "0.6597222", "0.65918005", ...
0.7611807
5
Returns all the words of a string.
def words(s): return (normalize(w) for w in _words_re.findall(s))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allWordsFromString(str):\n return set(re.findall(\"\\w+\", str.lower()))", "def words(self, text):\n return re.findall(r'\\w+', text)", "def extract_words(string):\n l = []\n word = ''\n for c in string+' ':\n if c.isalpha():\n word += c\n else:\n ...
[ "0.7867398", "0.7798272", "0.7793118", "0.7711489", "0.7556821", "0.7495844", "0.7442168", "0.7396945", "0.7370289", "0.7360776", "0.73555183", "0.7345942", "0.73215896", "0.72583306", "0.72428656", "0.72195673", "0.71984345", "0.71700275", "0.7147852", "0.71264493", "0.71194...
0.81549746
0
Tests that the function raises an error for treatments and probs of different sizes
def test_stochatreat_input_more_treats_than_probs(correct_params): treat_too_large = 3 with pytest.raises(Exception): stochatreat( data=correct_params["data"], block_cols=["block"], treats=treat_too_large, idx_col=correct_params["idx_col"], pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_error_when_length_mismatch(self):\n self._assert_raise_error(\n probabilities=[0.5, 0.5],\n random_nums=[0],\n error=LengthMismatchError,\n code=1\n )", "def test_wrong_length(self):\n with self.assertRaises(ValueError):\n calc_...
[ "0.68574584", "0.6850788", "0.6673953", "0.66249496", "0.6617276", "0.65843415", "0.6540696", "0.65219265", "0.64802504", "0.64198655", "0.63976234", "0.6339576", "0.63279814", "0.62746906", "0.62368834", "0.6234616", "0.6228064", "0.62276286", "0.6216054", "0.6172493", "0.61...
0.655758
6
Tests that the function's output contains the `block_id`'
def test_stochatreat_output_block_id_col(treatments_dict): treatments_df = treatments_dict["treatments"] assert "block_id" in treatments_df.columns, "Block_id column is missing"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__blkid_output(self):\n blkid_export = textwrap.dedent(\n \"\"\"\n DEVNAME=/dev/sda1\n UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n TYPE=xfs\n PARTUUID=YYYYYYYY-YY\n\n DEVNAME=/dev/sdb1\n PARTUUID=ZZZZZZZZ-ZZZZ-ZZZZ-ZZZZ-ZZZ...
[ "0.6573601", "0.64442587", "0.63301694", "0.62979084", "0.6242147", "0.62361515", "0.620644", "0.61887836", "0.61803836", "0.6176128", "0.61706054", "0.6140707", "0.6127305", "0.61247945", "0.6113252", "0.60858834", "0.6081884", "0.6074062", "0.60737556", "0.6070936", "0.6053...
0.60131603
23
Converts pandas TimeSta,mp into a date str
def convert_timestamp(val, split="-"): res = "" if isinstance(val, pd.Timestamp): dt2 = val.date() elif isinstance(val, str): dt2 = "" if val.find(split) == 4: dt2 = dt.datetime.strptime(val, split.join(["%Y", "%m", "%d"])) elif val.find("/") == 4: dt2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_form(gdf):\n gdf['time'] = gdf['time'].dt.strftime(\"%Y-%m-%dT%H:%M:%S\")\n \n return gdf", "def ts2str(self,ts):\n dttime = datetime.datetime.fromtimestamp(ts)\n return self.format_datetime(dttime)", "def _time_str(self):\n try:\n if not self._time:\n ...
[ "0.6096868", "0.59809893", "0.5731243", "0.57030106", "0.56523174", "0.56303304", "0.55953336", "0.5541693", "0.5524897", "0.5504463", "0.54928905", "0.548618", "0.5470752", "0.5464102", "0.5448914", "0.5424861", "0.54167324", "0.54162085", "0.5408807", "0.53879124", "0.53837...
0.0
-1
Function that saves the created dataframe as a csv.
def save(df, save_preprocessed_dataframe_path, name): df.to_csv(save_preprocessed_dataframe_path + name + '.csv', index=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_df(data_frame, file_path):\r\n data_frame.to_csv(file_path)\r\n return None", "def save_dataframe(dataframe, filename):\n with open(filename, \"w\", encoding=\"utf8\") as outfile: \n dataframe.to_csv(outfile, sep=\",\")", "def write_csv(self):\n self.tableView.df.to_csv('Data ex...
[ "0.808599", "0.8040939", "0.78697246", "0.7795784", "0.77626383", "0.7737777", "0.76815236", "0.7584483", "0.75417167", "0.7527897", "0.7408575", "0.73884004", "0.737903", "0.7372637", "0.73557115", "0.73516923", "0.7351631", "0.73451465", "0.7331499", "0.7320402", "0.7298884...
0.7638196
7
A function that preprocesses the data (so that it is displayed per sentence), and saves is as a .csv file for later use.
def preprocess_to_csv(data_path, save_to): # Split on dialogue conversations = split_on_dialogue(data_path) # Split on sentence sentences = split_on_sentences(conversations) # Make dataframe and drop dubplicates df_sent = pd.DataFrame(np.array(sentences), columns=['sentences']) df_sent.dr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_in_sentence_form(self, dataset):\n big_dict = []\n\n # iterating through directories\n for file_path in self.list_news_path:\n with open(file_path, 'r') as f:\n # loading news content into labelled sections\n doc = json.load(f)\n ...
[ "0.6811158", "0.6722584", "0.6567336", "0.6514871", "0.64818025", "0.6445955", "0.6345094", "0.6313514", "0.6310771", "0.6289682", "0.6245924", "0.6188296", "0.61736614", "0.61571324", "0.6153687", "0.61359787", "0.6103529", "0.6078087", "0.607136", "0.60638565", "0.6058391",...
0.75479275
0
Takes standard tail file and returns a pandas dataframe
def pdTailMaker(inLoc): tails = tailParser(inLoc) pdTails = [] for tail in tails: type = tail[2][tail[2].find("|")+1:] name = tail[2][:tail[2].find("|")] repeater([name,tail[3],tail[4],tail[5],type],pdTails,int(tail[1])) df = pd.DataFrame(pdTails,columns=['Gene','3Loc','TailLengt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(self):\n if self.filename.endswith('.gz'):\n compression = 'gzip'\n elif self.filename.endswith('.bz2'):\n compression = 'bz2'\n else:\n compression = None\n df = pd.read_table(self.filename, compression=compression)\n\n # drop empty col...
[ "0.6500923", "0.646392", "0.6263773", "0.62481827", "0.6194304", "0.6129559", "0.6078942", "0.6003204", "0.5984774", "0.5977539", "0.5956512", "0.5915594", "0.5912465", "0.59102386", "0.5903589", "0.5870863", "0.58514863", "0.58370113", "0.58322597", "0.58320403", "0.5828572"...
0.57136476
30
Reads in a translation file in json format.
def read_json(self, inputfile): transtransfile = json.load(inputfile) self.language = transfile['lang'] self.translations = transfile['strings']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_translation_dict_from_file(path, lang, app):\n\tjson_content = {}\n\tif os.path.exists(path):\n\t\twith open(path, 'r') as f:\n\t\t\tjson_content = json.loads(f.read())\n\n\treturn json_content", "def _read_translation_file(language_code: str, filename: str):\n twlight_home = settings.TWLIGHT_HOME\n ...
[ "0.76486564", "0.7577767", "0.7166459", "0.71568304", "0.71235466", "0.71235466", "0.7073017", "0.70480293", "0.70153415", "0.70153415", "0.7010124", "0.6991458", "0.69871974", "0.6984109", "0.6969324", "0.6948705", "0.69473696", "0.6935583", "0.69271183", "0.6904846", "0.688...
0.8315508
0
Writes a translation file in json format.
def write_json(self, outputfile): outputfile.write(json.dumps(self.translations, sort_keys=True, indent=4))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, _filepath=None):\n _json_txt = json.dumps(self.json_dict, indent=2)\n self._write_json_text(_json_txt, _filepath)", "def write_json_file(self, file, content):\n with open(file, \"w\", encoding=\"utf-8\") as f:\n json.dump(content, f, indent=2)", "def _write_json(...
[ "0.7375926", "0.73411995", "0.72907406", "0.71562773", "0.7133225", "0.70734954", "0.70544845", "0.70544845", "0.7030629", "0.7023544", "0.6961805", "0.6953743", "0.67956346", "0.6769627", "0.6737666", "0.6707589", "0.66768265", "0.6640878", "0.6636975", "0.66189843", "0.6613...
0.80532444
0
The L{pyxb.binding.basis.complexTypeDefinition} instance to which the content would belong, if available.
def container (self): return self.__container
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complex_type_factory(name, definition, schema):\n d = dict()\n basecls = None\n basedef = definition.basedef\n if basedef and basedef != ITSELF:\n basecls = complex_type_factory(basedef.name, basedef, schema)\n if definition.content_type.is_element_only():\n model = definition.cont...
[ "0.662026", "0.6006497", "0.5994679", "0.5994679", "0.58757013", "0.5805625", "0.5772228", "0.56741375", "0.56511194", "0.5400544", "0.5376184", "0.5365635", "0.53551865", "0.53486794", "0.5348674", "0.531267", "0.52907616", "0.5270401", "0.52625525", "0.5256683", "0.52520835...
0.0
-1
Returns absolute seq start and end indices for a given target frame.
def get_seq_start_end(target_index, seq_length, sample_every=1): half_offset = int((seq_length - 1) / 2) * sample_every end_index = target_index + half_offset start_index = end_index - (seq_length - 1) * sample_every return start_index, end_index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frames_to_indices(self, start_frame: Union[int, None] = None, end_frame: Union[int, None] = None):\n # must be implemented in subclass\n if start_frame is None:\n init = 0\n else:\n init = np.searchsorted(self._spikestimes, start_frame, side=\"left\")\n if end_...
[ "0.6715035", "0.65553015", "0.65001374", "0.61677617", "0.6032674", "0.5994794", "0.5814949", "0.5793697", "0.5750009", "0.5744181", "0.57312435", "0.57003564", "0.5687238", "0.5666919", "0.5661147", "0.56553286", "0.56158334", "0.5595851", "0.5521909", "0.5520214", "0.54729"...
0.6275845
3
Returns true if obj is a numpy array.
def is_a_numpy_array(obj): return type(obj).__module__ == np.__name__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_array(self, arr):\n return isinstance(arr, np.ndarray)", "def is_numpy(obj):\n return 'numpy' in str(type(obj))", "def is_arraylike(obj):\n if isinstance(obj, list):\n return True\n elif isinstance(obj, np.ndarray):\n return True\n elif isinstance(obj, pd.Series):\n ...
[ "0.84035677", "0.8076048", "0.77647555", "0.7741642", "0.7736499", "0.76953906", "0.73582894", "0.7268553", "0.7229395", "0.7178989", "0.70816004", "0.6987525", "0.694164", "0.6726651", "0.6638855", "0.6638471", "0.6598614", "0.65872633", "0.63607806", "0.63399965", "0.630668...
0.8832039
0
Returns list of variables that should be saved/restored.
def get_vars_to_save_and_restore(ckpt=None): model_vars = tf.trainable_variables() # Add batchnorm variables. bn_vars = [v for v in tf.global_variables() if 'moving_mean' in v.op.name or 'moving_variance' in v.op.name or 'mu' in v.op.name or 'sigma' in v.op.name or ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variables(self):\n if save_context.in_save_context():\n return [self._vars[0]]\n return self._vars", "def get_variables_to_restore():\n# checkpoint_exclude_scopes=[\"distance-module\", \"InceptionV4/Logits\"]\n checkpoint_exclude_scopes=[\"DeInceptionV4\"]\n exclusions = [scope.strip() f...
[ "0.80383086", "0.7528085", "0.7279273", "0.7255528", "0.71498054", "0.70009124", "0.6987614", "0.6874694", "0.68420756", "0.6826596", "0.6821036", "0.67975426", "0.6795456", "0.6788206", "0.67689455", "0.674274", "0.66833127", "0.6675252", "0.6659809", "0.66465116", "0.664018...
0.66378254
21
Compute the distance between 2 points in a globe. The points are represented as a tuple
def haversine(p1=None, p2=None): lat1, lon1 = p1 lat2, lon2 = p2 p = pi/180 a = 0.5 - cos((lat2-lat1)*p)/2 + cos(lat1*p) * cos(lat2*p) * (1-cos((lon2-lon1)*p))/2 return 12742 * asin(sqrt(a)) #2*R*asin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculateDistanceBetweenPoints(lat1,lon1,lat2,lon2):\n\treturn Geodesic.WGS84.Inverse(lat1,lon1, lat2, lon2)['s12']", "def distance_between(pt1: tuple, pt2: tuple) -> float:\r\n\r\n return ((pt2[1] - pt1[1])**2 + (pt2[0] - pt1[0])**2)**0.5", "def distance(a: Point, b: Point) -> float:\n return math.s...
[ "0.73098433", "0.7125958", "0.707803", "0.70702195", "0.7053283", "0.70495915", "0.70466983", "0.7016189", "0.7011612", "0.7010642", "0.6999341", "0.6999278", "0.69990706", "0.6995437", "0.69907564", "0.6977105", "0.6975708", "0.69574225", "0.69553965", "0.6937835", "0.693607...
0.0
-1
Return a printable representation of the Courier model.
def __repr__(self): return f'<Courier id: {self.id}>'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return self.printable()", "def __str__(self):\n raise NotImplementedError('Subclasses must define how to layout Character printing')", "def __str__(self):\n astr = '{\\n'\n for (name, _) in self.contracts.iteritems():\n astr += ' ' + name + ',\\n'\n ...
[ "0.69444114", "0.6600302", "0.6576843", "0.65622246", "0.65294516", "0.6454514", "0.6442508", "0.64392525", "0.6436804", "0.6405665", "0.6395191", "0.63725376", "0.6365719", "0.6334325", "0.63229877", "0.63111085", "0.6304928", "0.62987095", "0.6296187", "0.6281976", "0.62819...
0.69949245
0
Printable representation of RestaurantCourier model.
def __repr__(self): return f'<RestaurantCourier restaurant: {self.restaurant_id} courier: {self.courier_id}>'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return f'<Restaurant id: {self.id}>'", "def __repr__(self):\n return f'<RestaurantProduct restaurant: {self.restaurant_id} product: {self.product_id}>'", "def __repr__(self):\n return f'<Courier id: {self.id}>'", "def __repr__(self):\n\n return \"<Truck truck...
[ "0.71120787", "0.70763516", "0.6993424", "0.66813153", "0.6545185", "0.65208304", "0.648358", "0.64835733", "0.6406419", "0.6375339", "0.63424045", "0.63126546", "0.63126546", "0.63126546", "0.63126546", "0.63126546", "0.6304636", "0.6280823", "0.627803", "0.62755007", "0.624...
0.8167621
0
Printable representation of RestaurantProduct model.
def __repr__(self): return f'<RestaurantProduct restaurant: {self.restaurant_id} product: {self.product_id}>'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n\n return \"<Product: {}>\".format(self.name)", "def __repr__(self):\n return f'<Restaurant id: {self.id}>'", "def __repr__(self):\n return f'<RestaurantCourier restaurant: {self.restaurant_id} courier: {self.courier_id}>'", "def __str__(self):\n return f\"Ord...
[ "0.7284317", "0.7115957", "0.6930726", "0.65813386", "0.65726453", "0.65726453", "0.6404084", "0.63658136", "0.63448894", "0.63268375", "0.6320364", "0.62845737", "0.62160903", "0.619781", "0.61736524", "0.61555886", "0.6143565", "0.6117131", "0.60542434", "0.60510373", "0.60...
0.84345436
0
Input > Model path for the object detection model Model type> Foot or Hand Output > Inference model for getting the predictions on test images
def get_joint_detection_model(model_path, model_type): # config_file_path = '/usr/local/bin/config' if model_type == 'Foot_detection': # with open('/usr/local/bin/src/config.ini','w') as f: # f.write('[anchor_parameters]\nsizes = 32 64 128 256 512 1024\nstrides = 8 16 32 64 128 256\nratios...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prediction_on_a_image(self, input, output,model_saved_path):\n\n # load the saved model\n if os.path.isfile(model_saved_path) is False:\n raise IOError('trained model: %s not exist' % model_saved_path)\n\n clf = joblib.load(model_saved_path)\n\n # split a large image to m...
[ "0.709018", "0.70268166", "0.69897854", "0.684806", "0.68473697", "0.68058217", "0.68043005", "0.67794544", "0.67151695", "0.6711857", "0.66996366", "0.6670149", "0.6654578", "0.6625851", "0.6591974", "0.65632236", "0.6540678", "0.6506307", "0.65026563", "0.6493569", "0.64884...
0.6911334
3
Probability density function of custom sympy.stats models
def pdf(self, grid, dataSegment): return self.density(dataSegment[0], *grid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probability_density(self, X):\n raise NotImplementedError", "def pdf(s, x):\r\n x = Basic.sympify(x)\r\n return 1/(s.sigma*sqrt(2*pi)) * exp(-(x-s.mu)**2 / (2*s.sigma**2))", "def density(self, arg):\n mean = - self.sigma**2 * self.data['maturity']\n std = self.sigma * sel...
[ "0.69486904", "0.6839655", "0.66942906", "0.66268593", "0.64896435", "0.6424063", "0.63419783", "0.63395894", "0.6316561", "0.6316308", "0.6266159", "0.62060744", "0.6195742", "0.61901736", "0.61862254", "0.6165573", "0.61443615", "0.6138411", "0.61313474", "0.6098505", "0.60...
0.57563996
49
Probability density function of the Bernoulli model
def pdf(self, grid, dataSegment): temp = grid[0][:] # make copy of parameter grid temp[temp > 1.] = 0. # p < 1 temp[temp < 0.] = 0. # p > 0 if dataSegment[0]: pass # pdf = p else: temp = 1. - temp # pdf = 1 - p return temp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probability_density(self, X):\n raise NotImplementedError", "def prob_distr(self, x):\n return 1.0/x", "def density(self, x):\n\t\tN = len(self.train_data)\n\t\tpoints = list(self.train_data)\n\t\tdists = [np.linalg.norm(x-point)**2 for point in points]\n\t\texps = [np.exp(-dist / (2 * (self....
[ "0.7435315", "0.71138096", "0.71096843", "0.7105216", "0.7027108", "0.70075536", "0.6847766", "0.68142974", "0.67728186", "0.67084306", "0.6619479", "0.65256804", "0.652328", "0.6516417", "0.64901376", "0.64700055", "0.6467701", "0.646181", "0.64494973", "0.6434902", "0.64326...
0.0
-1
Probability density function of the Gaussian model.
def pdf(self, grid, dataSegment): return np.exp( -((dataSegment[0] - grid[0]) ** 2.) / (2. * grid[1] ** 2.) - .5 * np.log(2. * np.pi * grid[1] ** 2.))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probability_density(self, X):\n raise NotImplementedError", "def pdf(x):\n return - np.exp(self.ks_gaussian.score_samples(x.reshape(1, -1)))", "def test_probability_density(self):\n # Setup\n copula = GaussianMultivariate(GaussianUnivariate)\n copula.fit(self.data)\n ...
[ "0.7947804", "0.7553608", "0.7516566", "0.74003404", "0.72932565", "0.7274971", "0.7039543", "0.70161957", "0.7002861", "0.69926655", "0.6945719", "0.6930526", "0.69161403", "0.6892972", "0.68551993", "0.68442243", "0.6843304", "0.6830255", "0.68098533", "0.6800575", "0.67849...
0.0
-1
Probability density function of the Autoregressive process of first order
def pdf(self, grid, dataSegment): return np.exp(-((dataSegment[1] - grid[0] * dataSegment[0]) ** 2.) / (2. * grid[1] ** 2.) - .5 * np.log( 2. * np.pi * grid[1] ** 2.))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probability_density(self, X):\n raise NotImplementedError", "def density(self, x):\n\t\tN = len(self.train_data)\n\t\tpoints = list(self.train_data)\n\t\tdists = [np.linalg.norm(x-point)**2 for point in points]\n\t\texps = [np.exp(-dist / (2 * (self.bandwidth ** 2))) for dist in dists]\n\t\tunnormaliz...
[ "0.7367533", "0.70152324", "0.6963267", "0.6902381", "0.68423057", "0.67976856", "0.6771773", "0.6758305", "0.6725957", "0.6685036", "0.6590607", "0.6552273", "0.64996487", "0.6477976", "0.6434538", "0.6408131", "0.6395663", "0.6391381", "0.6362059", "0.63470787", "0.63468486...
0.0
-1
Probability density function of the Autoregressive process of first order
def pdf(self, grid, dataSegment): r = grid[0] s = grid[1] sScaled = s*np.sqrt(1 - r**2.) return np.exp(-((dataSegment[1] - r * dataSegment[0]) ** 2.) / (2. * sScaled ** 2.) - .5 * np.log( 2. * np.pi * sScaled ** 2.))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probability_density(self, X):\n raise NotImplementedError", "def density(self, x):\n\t\tN = len(self.train_data)\n\t\tpoints = list(self.train_data)\n\t\tdists = [np.linalg.norm(x-point)**2 for point in points]\n\t\texps = [np.exp(-dist / (2 * (self.bandwidth ** 2))) for dist in dists]\n\t\tunnormaliz...
[ "0.7368097", "0.70158595", "0.6962699", "0.69000155", "0.68427974", "0.67974037", "0.67711955", "0.6757439", "0.6728212", "0.66863847", "0.6589417", "0.6550291", "0.6497331", "0.6476294", "0.6435491", "0.64073396", "0.6393094", "0.6389788", "0.6361023", "0.6348426", "0.634430...
0.0
-1
Consider x, y are vectors. Take L2 of the difference of the them after being normalized by their length
def NCC_loss(x, y): len_x = torch.sqrt(torch.sum(x ** 2)) len_y = torch.sqrt(torch.sum(y ** 2)) return torch.sqrt(torch.sum((x / len_x - y / len_y) ** 2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def l2(x, y):\n return np.sum(((x - y) ** 2))", "def l2(x1, x2):\n return np.sqrt((x1 - x2)**2)", "def l2(u: np.ndarray, v: np.ndarray) -> np.ndarray:\n\n return (u - v) ** 2", "def normalize_l2(x):\n return x / (npla.norm(x))", "def l2(vec):\n return np.linalg.norm(vec)", "def l1(x1, x2):\n...
[ "0.7676341", "0.7434906", "0.72900474", "0.714216", "0.7127061", "0.69866174", "0.69731694", "0.69207644", "0.6865735", "0.6836043", "0.683185", "0.6808437", "0.680253", "0.6744852", "0.6740793", "0.673373", "0.6713935", "0.670696", "0.66888577", "0.6678042", "0.66719097", ...
0.0
-1
Visualize an image once. Used to visualize generator before training.
def visualize_digits(tensor_to_visualize): with tf.Session() as sess: sess.run(tf.global_variables_initializer()) with tf.contrib.slim.queues.QueueRunners(sess): images_np = sess.run(tensor_to_visualize) plt.axis('off') plt.imshow(np.squeeze(images_np), cmap='gray')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualizeImg(img):\n plt.figure(figsize=(10,4))\n plt.imshow(img)\n plt.show()", "def show_image(self):\n cv2.imshow(self.config.DISPLAY_NAME, self.image)", "def plot_single_image(image):\n image = image.cpu()\n \n assert type(image) is torch.Tensor, 'Image to plot is not torch.Tensor'\n...
[ "0.7095515", "0.7071908", "0.7070959", "0.7046643", "0.7039195", "0.7019985", "0.7013595", "0.6947819", "0.6936294", "0.69345164", "0.69298977", "0.69109917", "0.6891952", "0.6877533", "0.6846699", "0.6822457", "0.6799582", "0.67991686", "0.67932516", "0.67726105", "0.6700117...
0.6129074
82