query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Map a list in which element turns scalar element
def scalar_mult(scalar, lista): return [scalar * element for element in lista]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simple_map(f, l):\n # Again, my first take is a list comprehension.\n return [ f(item) for item in l ]", "def maplist(f, xs):\n return list(map(f, xs))", "def simple_map_2(f, l):\n # Same as above without comprehension:\n mapped_l = []\n for item in l:\n mapped_l.append( f(item) ) ...
[ "0.73322433", "0.72311175", "0.7190859", "0.67876816", "0.6712773", "0.6535357", "0.64992934", "0.64565027", "0.64177424", "0.64035016", "0.6357955", "0.63018423", "0.6299705", "0.62501806", "0.6207463", "0.6158768", "0.6149128", "0.6136963", "0.6033882", "0.60334474", "0.596...
0.578542
31
This function transforms the text corpus with a TfidfVectorizer and trains a Naive Bayes model. Parameter
def train_mnb(X, y, **kwargs): tf = TfidfVectorizer() m = MultinomialNB(**kwargs) pipeline = make_pipeline(tf, m) pipeline.fit(X, y) print(f"\ntraining accuracy: {round(pipeline.score(X, y),3)}") cross_val = cross_val_score(pipeline, X, y, cv=5) print(f'\ncross-validation accuracy: {cross_va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, trainfile):\r\n\r\n # We load the data and lower the text\r\n data_train = pd.read_csv(trainfile, sep = \"\\t\", names = [\"polarity\", \"category\", \"word\", \"offsets\", \"sentence\"])\r\n data_train['sentence_l'] = data_train['sentence'].apply(str.lower)\r\n data_tra...
[ "0.7041745", "0.6892703", "0.68457866", "0.67108583", "0.66450006", "0.66246396", "0.6598008", "0.6502297", "0.6480821", "0.6453072", "0.6444225", "0.6428157", "0.6400798", "0.6360958", "0.63345605", "0.63037866", "0.6293806", "0.6275498", "0.6251998", "0.6239459", "0.6236153...
0.0
-1
Replace characters that are ok for the filesystem but have special meaning in the shell. It is assumed file_path is already passed in double quotes.
def sanitize_file_path_for_shell(file_path): file_path_sanitized = file_path.replace('\\', '\\\\') file_path_sanitized = file_path_sanitized.replace('$', '\\$') file_path_sanitized = file_path_sanitized.replace('"', '\\"') file_path_sanitized = file_path_sanitized.replace('`', '\\`') return file_pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _escape_path(path):\n path = path.strip()\n return '\"{0}\"'.format(path) if _platform_windows else path.replace(\" \", \"\\ \")", "def sanitize_file_path(file_path, replacement_text=\"\"):\n\n return __RE_INVALID_PATH.sub(replacement_text, file_path.strip())", "def _escape_filename(self, filename...
[ "0.71783984", "0.71233505", "0.7065954", "0.70276165", "0.6792996", "0.667642", "0.6659069", "0.65962875", "0.6565966", "0.65407276", "0.6515731", "0.649737", "0.647577", "0.64607286", "0.6425371", "0.6413269", "0.6343448", "0.62579924", "0.6134818", "0.61246663", "0.61156386...
0.7965993
0
create session before each request
def set_db_session(): g.s = database.db_session()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_session(self):\n self.session = requests.Session() # pragma: no cover\n self.session.headers[\"Accept\"] = \"application/json\" # pragma: no cover\n if self.user: # pragma: no cover\n self.session.auth = (self.user, self.cred) # pragma: no cover", "def before_reque...
[ "0.7623372", "0.7430753", "0.73650914", "0.7351063", "0.7351063", "0.7216878", "0.7167172", "0.71506554", "0.71009123", "0.704625", "0.70091945", "0.7002909", "0.70023346", "0.70022875", "0.69955266", "0.68908185", "0.68709975", "0.68529636", "0.68171114", "0.68158793", "0.67...
0.0
-1
Returns the corresponding Recent Location.
def get_location(self) -> models.Location: return models.Location.get(region=self, name=self.name, deleted=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_current_location(self):\n return self.get_queryset().filter(status=self.model.CURRENT).first()", "def most_recent_coordinates(self):\n location = Location.objects.get(id=self.most_recent_location_id)\n\n return location.position['coordinates']", "def getMostRecent(self):\n ...
[ "0.6604315", "0.6441396", "0.6436993", "0.6409579", "0.6325625", "0.62447786", "0.62360996", "0.61787456", "0.6150267", "0.61499745", "0.61066777", "0.6100615", "0.6090599", "0.6090599", "0.6046029", "0.6039892", "0.5983601", "0.5983601", "0.5960603", "0.5948464", "0.5934924"...
0.6258611
5
Returns all parent regions of this region.
def all_parents(self) -> Iterable[Region]: if self.parent is not None: yield self.parent yield from self.parent.all_parents()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def children(self) -> List[Region]:\n return []", "def getParents(self):\n return self.parents[:]", "def parent_ids(self):\n return self._parent_ids", "def region(self):\n return [node.region for node in self]", "def children(self) -> List[Region]:\n return self._children...
[ "0.7434008", "0.7339606", "0.7157085", "0.7153343", "0.7056081", "0.6984813", "0.6946143", "0.6928434", "0.6888119", "0.6858729", "0.6857094", "0.6851539", "0.68390924", "0.6822237", "0.682013", "0.67900497", "0.676651", "0.6735071", "0.6715634", "0.6683919", "0.668044", "0...
0.8541655
0
Initialize attributes to describe a car
def __init__(self, make, model, year): self.make = make self.model = model self.year = year # default value for a data attribute not matched by a parameter self.odometer_reading = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, car):\n super(self.__class__, self).__init__(car)\n self.coordinator_name = car.get_faulty_coordinator_name()\n self.second_at_charge_name = car.get_second_at_charge_name()\n self.coordinated_car_name = car.get_corrected_coordinated_car_name()\n self.following_...
[ "0.7682444", "0.7564797", "0.7197258", "0.7195483", "0.7105557", "0.694793", "0.694793", "0.694793", "0.68839586", "0.6785889", "0.6748675", "0.67431015", "0.67331845", "0.66451067", "0.6464271", "0.64505064", "0.643961", "0.6439453", "0.64178514", "0.6395654", "0.63946205", ...
0.6249929
29
Return a neatly formatted descriptive name
def get_descriptive_name(self): return f"{self.year} {self.make} {self.model}".title()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_descriptive_name(self):\n long_name = f\"{self.make} {self.model} {self.year}\"\n \n return long_name.title()", "def get_descriptive_name(self):\n long_name = f\"{self.year} {self.make} {self.model}\"\n return long_name.title()", "def get_descriptive_name(self):\r\n ...
[ "0.82712626", "0.8233793", "0.81636363", "0.8123895", "0.8123895", "0.8123895", "0.8123895", "0.8123895", "0.8123895", "0.8123895", "0.8123895", "0.81226194", "0.8022516", "0.79681844", "0.79071957", "0.78473455", "0.77523863", "0.77043635", "0.76816696", "0.7679536", "0.7660...
0.8013531
13
A method that is going to be overridden
def fill_gas_tank(self): print("Filling the tank for", self.get_descriptive_name())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self):\r\n raise NotImplementedError('override me')", "def __call__(self):\n raise NotImplementedError", "def __call__(self):\n raise NotImplementedError()", "def override(self):\n return None", "def __call__( self ):\n pass", "def __call__(self):\n\t\tretu...
[ "0.8271088", "0.7843803", "0.7668648", "0.7631912", "0.75162923", "0.75038874", "0.74938595", "0.74938595", "0.7470797", "0.7404255", "0.7288453", "0.72610587", "0.72610587", "0.72610587", "0.7230123", "0.7177749", "0.71770835", "0.71770835", "0.71261805", "0.7083847", "0.705...
0.0
-1
Initialize the battery's attributes.
def __init__(self, battery_size=40): self.battery_size = battery_size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, battery_size=70):\r\n\t\tself.battery_size = battery_size", "def __init__(self, battery_size=70):\n self.battery_size = battery_size", "def __init__(self, battery_size=70):\n self.battery_size = battery_size", "def __init__(self, battery_size=70):\n self.battery_size =...
[ "0.7373256", "0.73601586", "0.73601586", "0.73601586", "0.734221", "0.734221", "0.7319005", "0.7316006", "0.72850525", "0.7227408", "0.72071785", "0.7196292", "0.6998248", "0.696277", "0.69499767", "0.6907041", "0.6907041", "0.6907041", "0.6907041", "0.6907041", "0.6907041", ...
0.7383211
0
Print a statement describing the battery size.
def describe_battery(self): print(f"This car has a {self.battery_size}-kWh battery.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe_battery(self):\r\n\t\tprint(\"This car has a \" + str(self.battery_size) + \"-kWh battery.\")", "def describe_battery(self):\r\n print(\"This car has a \" + str(self.battery_size) + \"-kWh battery.\")", "def describe_battery(self):\n print(\"This car has a \"+str(self.battery_size)+\...
[ "0.8077025", "0.80585897", "0.80483544", "0.7991147", "0.7991147", "0.7991147", "0.7991147", "0.7991147", "0.7991147", "0.7977282", "0.7844624", "0.7842952", "0.781898", "0.76121926", "0.6630486", "0.64125836", "0.62330794", "0.6192078", "0.61695147", "0.6145232", "0.61055034...
0.7825442
14
Print a statement about the range this battery provides.
def get_range(self): if self.battery_size == 40: range = 150 elif self.battery_size == 65: range = 225 print(f"This car can go about {range} miles on a full charge.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_range(self):\r\n\t\tif self.battery_size == 70:\r\n\t\t\trange = 240\r\n\t\telif self.battery_size == 85:\r\n\t\t\trange = 270\r\n\t\t\t\r\n\t\tmessage = \"This car can go approx. \" + str(range)\r\n\t\tmessage += \" miles on a full charge.\"\r\n\t\tprint(message)", "def get_range(self):\n if self...
[ "0.7663095", "0.76585656", "0.76337993", "0.7627849", "0.7579565", "0.75276333", "0.7510972", "0.7475078", "0.74686944", "0.7214683", "0.6869354", "0.6118391", "0.5908394", "0.5883784", "0.5820139", "0.5802177", "0.5795216", "0.5795216", "0.5795216", "0.5763995", "0.5734394",...
0.7608142
4
Initialize attributes of the parent class Call the constructor of the base class Then define the data member for the current class
def __init__(self, make, model, year): super().__init__(make, model, year) self.battery = Battery()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, parent=None, **kwargs):\n self.__dict__.update(_dict=dict(), parent=parent)\n self.declare(**kwargs)", "def __init__(self, name, age, billing):\n super().__init__(name, age)\n \"\"\"Define own properties in children class\"\"\"\n self.billing = billing", "d...
[ "0.7136743", "0.70918214", "0.7000738", "0.6974844", "0.6974844", "0.6889836", "0.6814976", "0.67724675", "0.6718611", "0.67166483", "0.66260177", "0.66138333", "0.6600251", "0.658364", "0.6583424", "0.6581016", "0.65571094", "0.65444577", "0.65402037", "0.6535905", "0.653228...
0.0
-1
Print a statement describing the battery size. Extends the base interface adding a new method specific for this class
def describe_battery(self): self.battery.describe_battery()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe_battery(self):\r\n print(\"This car has a \" + str(self.battery_size) + \"-kWh battery.\")", "def describe_battery(self):\n print(\"This car has a \"+str(self.battery_size)+\"-KWh battery.\")", "def describe_battery(self):\r\n\t\tprint(\"This car has a \" + str(self.battery_size) + \...
[ "0.8252661", "0.8244354", "0.823131", "0.8196981", "0.8138175", "0.8138175", "0.8138175", "0.8138175", "0.8138175", "0.8138175", "0.8101542", "0.8101542", "0.8101542", "0.80835646", "0.8036482", "0.7874975", "0.7828315", "0.6725298", "0.67208236", "0.67208236", "0.67208236", ...
0.6976863
17
Implicit method override Electric cars don't have gas tanks
def fill_gas_tank(self): print("This car doesn't have a gas tank!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_gas_tank(self):\r\n\t\tprint(\"This car doesn't need a gas tank.\")", "def fill_gas_tank(self):\n print(\"This car doesn't need a gas tank!\")", "def fill_gas_tank(self):\n print(\"This car doesn't need a gas tank!\")", "def fill_gas_tank(self):\n print(\"\\nThis car doesn't...
[ "0.69217145", "0.6831921", "0.6831921", "0.6540081", "0.61860675", "0.6126857", "0.6059359", "0.5955987", "0.5778402", "0.57008517", "0.56938565", "0.56021523", "0.5577644", "0.54664433", "0.5426959", "0.54259795", "0.54092133", "0.5356318", "0.5295983", "0.5295983", "0.52959...
0.68206114
3
Function to generate ground truth labels as specified by int_limit.
def generate_true_labels(int_limit, n_obs): if int_limit > 0: if int_limit > n_obs: raise ValueError(f"""Invalid value of int_limit {int_limit}: greater than the number of sequences""") else: true_labels = [1 if idx <= i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_cut_labels(var, bin_edges, bottom_inclusive=True):\n incl = '=' if bottom_inclusive else ''\n return ['{low:g} <{incl} {var} < {high:g}'.format(var=var, low=bin_low,\n high=bin_high, incl=incl)\n for (bin_low, bin_high) in bin_edges...
[ "0.58891654", "0.58660847", "0.58303446", "0.5694453", "0.5692392", "0.5666728", "0.56513286", "0.5643508", "0.5582945", "0.54308045", "0.5425018", "0.5418894", "0.5386328", "0.5373158", "0.5323061", "0.53213376", "0.53181946", "0.53151214", "0.5308631", "0.52794737", "0.5237...
0.75520366
0
Return a new minio client based on given endpoints and credentials
def connect(**kwargs) -> Minio: global client client = Minio( SETTINGS.s3.endpoint, access_key=SETTINGS.s3.access_key, secret_key=SETTINGS.s3.secret_key, secure=SETTINGS.s3.secure, **kwargs, ) logger.debug( f"Successfully connected to S3 server on endpoint...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_minio_client(\n host=\"minio\", \n port=\"9000\", \n access_key=\"minio\", \n secret_key=\"minio123\", \n secure=False\n ):\n return Minio(\n endpoint=f\"{host}:{port}\",\n access_key=access_key,\n secret_key=secret_key,\n secure=secure\n )", "def g...
[ "0.731455", "0.723306", "0.69170517", "0.6855766", "0.67673016", "0.67613757", "0.6466971", "0.61935866", "0.61898446", "0.61510766", "0.61457545", "0.6138061", "0.6063103", "0.59764355", "0.59592575", "0.59241456", "0.58898264", "0.5886738", "0.5864017", "0.5790241", "0.5770...
0.59089184
16
Create the bucket where all datasets will be stored
def create_bucket() -> None: try: client.make_bucket(DATASETS_BUCKET) except BucketAlreadyOwnedByYou: logger.debug(f"Not creating bucket {DATASETS_BUCKET}: Bucket already exists") pass else: logger.debug(f"Successfully created bucket {DATASETS_BUCKET}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_buckets():\n s3 = boto.connect_s3()\n s3.create_bucket('mls_data.mls.angerilli.ca')", "def create_and_fill_bucket(self):\n EmrProcessing.bucket = \\\n self.s3_handle.create_bucket(EmrProcessing.bucket_name)\n key = EmrProcessing.bucket.new_key('input/test.csv')\n i...
[ "0.71161413", "0.6791009", "0.67162263", "0.6680957", "0.6674802", "0.6673578", "0.64413446", "0.63897455", "0.63669753", "0.63237906", "0.631078", "0.6286531", "0.62792015", "0.6254688", "0.62064546", "0.62060267", "0.61797833", "0.61677337", "0.61318856", "0.61285365", "0.6...
0.692468
1
Retrieve an object from datasets bucket
def get_file(object_name: str, **kwargs) -> HTTPResponse: data = client.get_object(DATASETS_BUCKET, object_name, **kwargs) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, bucket: str, object_name: str) -> bytes:\n raise NotImplementedError()", "def get_object(self, bucket_name, key, stream=False, extra_get_args={}):\n url = self.__key_url(bucket_name, key)\n res = self.infinispan_client.get(url, headers=self.headers, auth=self.basicAuth)\n ...
[ "0.6928165", "0.67026985", "0.6629515", "0.6608332", "0.6491294", "0.6458658", "0.6420723", "0.6378986", "0.6354143", "0.6300951", "0.61703414", "0.6160772", "0.6131997", "0.60850906", "0.6043375", "0.59998703", "0.5998574", "0.5989563", "0.59847516", "0.59839803", "0.597959"...
0.66965616
2
Put an object into datasets bucket
async def put_file(object_name: str, file: File, **kwargs) -> str: # TODO: Do not read file but rather stream content as it comes await file.read() # Get the synchronous file interface from the asynchronous file file_obj = file.file # Store position of cursor (number of bytes read) file_size = f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_object(self, key, data):\n self.s3client.put_object(Bucket=self.s3_bucket, Key=key, Body=data)", "def put_object(self, bucket_name, key, data):\n url = self.__key_url(bucket_name, key)\n resp = self.infinispan_client.put(url, data=data,\n auth...
[ "0.73082185", "0.7173861", "0.69983566", "0.6985764", "0.6830087", "0.6717999", "0.66830075", "0.6659365", "0.64738876", "0.64718133", "0.63807553", "0.6379868", "0.6363792", "0.63152105", "0.6307537", "0.62962", "0.6230256", "0.6186309", "0.61797756", "0.61682147", "0.615810...
0.0
-1
Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the between the two objects is more than the given delta. Note that decimal places (from zero) are usually not the same as significant digits (measu...
def almost_equal(first, second, places=None, delta=0.1): if first == second: # shortcut return True if delta is not None and places is not None: raise TypeError("specify delta or places not both") if delta is not None: if abs(first - second) <= del...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def almost_equals(self, other, decimal=...): # -> bool:\n ...", "def assert_almost_equal(self, val1, val2, delta):\n return self.assertTrue(\n 0 <= abs(val1 - val2) <= delta,\n \"Absolute difference of {} and {} ({}) is not within {}\".format(\n val1,\n ...
[ "0.68236005", "0.6749057", "0.6739666", "0.670881", "0.6466249", "0.6378507", "0.6307229", "0.62476826", "0.62318397", "0.62042546", "0.6183346", "0.6175197", "0.61698675", "0.6129581", "0.61233366", "0.61050105", "0.60785776", "0.6067823", "0.60575235", "0.6055449", "0.60546...
0.67849344
1
Rude check if uuid is in correct uuid1 format.
def validate_uuid(self, uuid): match = re.match( r'([a-z0-9]+)-([a-z0-9]+)-([a-z0-9]+)-([a-z0-9]+)-([a-z0-9]+)', uuid ) if match: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_uuid(uuid):\n try:\n converted = UUID(uuid, version=4)\n except ValueError:\n return False\n\n return str(converted) == uuid", "def validate_uuid(uuid_string):\n try:\n UUID(uuid_string, version=4)\n return True\n except:\n return False", "def is_vali...
[ "0.7841857", "0.756394", "0.7472721", "0.739947", "0.73708713", "0.73455393", "0.7301181", "0.71633416", "0.71633416", "0.7073445", "0.7024794", "0.6966057", "0.69361615", "0.69247895", "0.6830562", "0.67718047", "0.6766432", "0.67584354", "0.65963656", "0.65020233", "0.64920...
0.75939476
1
Checks if the CSV file contains all required columns.
def validate_column_names(self, cols): self.stdout.write('Verifying CSV header') csv_cols = set(cols) if self.required_csv_columns <= csv_cols: return True else: missing_cols = set(self.required_csv_columns).difference(csv_cols) raise ValidationError( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_csv(filename, header, cols, rows):\n\n # open file\n data = pd.read_csv(filename, delimiter='|')\n\n # validate header\n assert header == '|'.join(list(data.columns.values))\n\n # validate column count\n assert data.shape[1] == cols\n\n # validate row count\n assert data.shape[...
[ "0.74219674", "0.71559626", "0.7064051", "0.7044676", "0.6933204", "0.6880624", "0.6842778", "0.67009544", "0.6593976", "0.6554927", "0.65337193", "0.64992315", "0.6493306", "0.64672685", "0.6462007", "0.64533734", "0.64333785", "0.6407367", "0.63730824", "0.63719225", "0.636...
0.77545106
0
Concatenate observation data into one string.
def concatenate_observation_data( self, compartment, date, measurementmethod, orig_srid, origx, origy, parameter, property, quality, sampledevice, samplemethod, unit, value, ): # Convert to string before joining data = map(str, [ compartment, date, measurementmethod, orig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concatenate_data():", "def __str__(self):\n return ', '.join(str(item) for item in self._data)", "def obs_to_string(observations):\n str_obs = []\n for obs in observations:\n str_obs.append(obs.reshape(-1).tostring())\n return str_obs", "def __str__(self):\n lst = [str(i) fo...
[ "0.724462", "0.6176857", "0.6093485", "0.60458475", "0.5983507", "0.59311306", "0.59206545", "0.58791316", "0.5874102", "0.5709245", "0.57053846", "0.5704484", "0.5695554", "0.5685938", "0.5673281", "0.565494", "0.56044185", "0.55893093", "0.5557514", "0.55474746", "0.5525495...
0.78445834
0
Parses chunk and puts it in a dict, which is used to insert data in DB.
def chunk_to_dict(chunk): csv_cols = chunk.keys() return [dict(zip(csv_cols, v)) for v in chunk.values]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readchunk(self):\n chunksize = self.readdword()\n chunktype = ChunkType(self.readword())\n chunkdata = self.readbytearr(chunksize - 6)\n return {\n \"type\": chunktype,\n \"data\": _ParseChunk(chunktype, chunkdata, self.PIXELSIZE),\n }", "async def par...
[ "0.6791292", "0.62264615", "0.59367365", "0.57398707", "0.57072264", "0.5562959", "0.5515545", "0.54788476", "0.5358384", "0.53143746", "0.53005743", "0.5295604", "0.5294302", "0.52832663", "0.52484864", "0.52410567", "0.5231699", "0.52220035", "0.52200276", "0.5217106", "0.5...
0.5903628
3
Removes Observations or removes related Environments.
def remove_or_deref_observations(self, processing_job): cursor = connection.cursor() env_hash = self.make_env_hash(processing_job) # Update observations which have the same environment setup. # Removes these items from the array. self.stdout.write('Dereference environment {0} in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def env_remove(args):\n read_envs = []\n for env_name in args.rm_env:\n env = ev.read(env_name)\n read_envs.append(env)\n\n if not args.yes_to_all:\n answer = tty.get_yes_or_no(\n \"Really remove %s %s?\"\n % (\n string.plural(len(args.rm_env), \"e...
[ "0.62257844", "0.6080496", "0.5872701", "0.58601445", "0.5766776", "0.57624966", "0.5742403", "0.5738756", "0.56853753", "0.5683202", "0.5669383", "0.56654215", "0.5665408", "0.5649904", "0.5649904", "0.5643665", "0.56427264", "0.5626603", "0.5625567", "0.55980545", "0.559113...
0.7031861
0
Check if concatenated_observation_data is in self.observations
def observation_exists_locally(self, concatenated_observation_data): local_observation = self.observations.get( concatenated_observation_data, None ) if local_observation: return local_observation['observation']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def observation_exists(self, concatenated_observation_data):\n local_observation = self.observation_exists_locally(\n concatenated_observation_data\n )\n if local_observation:\n return local_observation\n\n try:\n return Observation.objects.get(\n ...
[ "0.65428954", "0.626618", "0.5845177", "0.5799288", "0.57642674", "0.5685769", "0.55044246", "0.5491718", "0.54879206", "0.5462496", "0.5368831", "0.5367507", "0.5330643", "0.5304856", "0.530262", "0.5287393", "0.52781326", "0.52779424", "0.52746606", "0.5272336", "0.52582705...
0.70318484
0
Checks if an observation with the same data already exists.
def observation_exists(self, concatenated_observation_data): local_observation = self.observation_exists_locally( concatenated_observation_data ) if local_observation: return local_observation try: return Observation.objects.get( conca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_already_present(self, new_da):\n for da in self:\n self._id_of_DataArrays_equal(da, new_da)", "def check_if_duplicate(self, data):\n\n query = \"SELECT * FROM {} WHERE topic = '{}' AND location = '{}'\\\n \".format(self.table, data['topic'], data['location'])\n\n ...
[ "0.71108025", "0.702407", "0.66583943", "0.65662485", "0.6549493", "0.6468821", "0.6406193", "0.64007765", "0.6364914", "0.6243635", "0.6242653", "0.621726", "0.62128055", "0.6174885", "0.6150819", "0.6140846", "0.6126474", "0.59956187", "0.5966047", "0.5962848", "0.5959198",...
0.6416996
6
Returns False if point does not exist, else return locationpoint id
def point_exists(self, point): qs = LocationPoint.objects.raw(""" SELECT * FROM script_execution_manager_locationpoint WHERE st_dwithin( thegeometry, st_transform( st_setsrid( st_point({point.x}, {point.y}), {point.sri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isSetId(self):\n return _libsbml.Point_isSetId(self)", "def check_point(point,points):\n if point in points:\n return True\n else:\n return False", "def find_point(self, point: Point):\n for internal_point in self.points:\n if internal_point == point:\n ...
[ "0.65851754", "0.60588527", "0.59962666", "0.5944725", "0.58938813", "0.5892437", "0.58379346", "0.5795499", "0.57793", "0.576884", "0.5735127", "0.57340264", "0.5658171", "0.56532735", "0.5652695", "0.56121695", "0.5558224", "0.5546083", "0.5536352", "0.5525766", "0.5519552"...
0.73598516
0
Create observation related to existing or new LP.
def create_observation( self, location_point, dictified_chunk, published, processing_job ): errors = [] def get_relations(model, field): """ Gets relation or adds error message to errors list. Errors should be descriptive to user. (Standard DoesNotExist e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_observation(self):", "def create_observation(self):", "def create_observation(self):\n return self._user_state.create_observation()", "def new_observation(self, mode=NEW, obsId=\"\"):\n # check if current observation must be closed to create a new one\n if mode == NEW and self.obs...
[ "0.5966779", "0.5966779", "0.56633604", "0.56257737", "0.5275226", "0.52512157", "0.5241649", "0.5192232", "0.5145275", "0.5077749", "0.5063368", "0.5051711", "0.5014516", "0.4991801", "0.4839248", "0.4837828", "0.48263907", "0.48166376", "0.4793916", "0.4787702", "0.47759995...
0.46837047
32
Gets relation or adds error message to errors list. Errors should be descriptive to user. (Standard DoesNotExist errors are not.) If a value is NaN, None is returned.
def get_relations(model, field): field_iexact = '{0}__exact'.format(field) value = dictified_chunk[model.__name__.lower()] if type(value) == float and math.isnan(value): return None try: return model.objects.get(**{ fie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error(self):\n errors = self._info.get('error', {}).get('errors')\n if not errors:\n return None\n return ' '.join(err.get('message', 'unknown') for err in errors)", "def get_error(self):\n p = self._get_sub_text('error')\n if not p:\n return None\n else:\n ...
[ "0.60867625", "0.566688", "0.5566653", "0.5510137", "0.5510137", "0.5510137", "0.5510137", "0.5510137", "0.5510137", "0.5510137", "0.5442257", "0.5405362", "0.5397558", "0.536908", "0.5291303", "0.5285853", "0.5274996", "0.52188915", "0.517312", "0.517312", "0.5161423", "0....
0.47182307
79
Adds LocationPoint if it does not exists. Relates observation to point.
def chunk_to_db(self, dictified_chunks, published, processing_job): self.observations = {} new_location_points = [] existing_location_points = [] for dc in dictified_chunks: point = Point(dc['origx'], dc['origy'], srid=dc['orig_srid']) lp = self.point_exists(point...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_point(self, point):\n self._points.append(point)", "def add_point(self, point: Point, interesting=False) -> Point:\n if point not in self.points:\n if not point.name:\n point.name = alphabet(len(self.points))\n self.points.add(point)\n if i...
[ "0.6725591", "0.67133373", "0.6681482", "0.66755474", "0.66706175", "0.6607873", "0.6607873", "0.6607873", "0.6607873", "0.6607873", "0.6607873", "0.6607873", "0.6529323", "0.64986783", "0.64739203", "0.6390155", "0.6384036", "0.634297", "0.63195705", "0.62687486", "0.6237278...
0.0
-1
Saves all observations from the observation 'registry'.
def save_observations(self, observations): Observation.objects.bulk_create( [v['observation'] for v in observations.itervalues() if v['created']] ) for v in observations.itervalues(): if not v['created']: v['observation'].save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self):\r\n for obs_name in self.__dict__.keys():\r\n if obs_name is not \"_ObjetSimu__obs\":\r\n if not obs_name in self.__sous_objets:\r\n if obs_name in self.__obs.keys():\r\n if \"copy\" in dir(self.__dict__[obs_name]):\r\n ...
[ "0.73052555", "0.6733764", "0.6608693", "0.6594945", "0.657012", "0.64871424", "0.64703155", "0.6384951", "0.62907267", "0.6276889", "0.62471867", "0.62202305", "0.6190579", "0.61807287", "0.6172243", "0.610022", "0.6061101", "0.60320276", "0.60176027", "0.60088223", "0.59973...
0.6606781
3
we include a valid route and controllers
def test_response_without_method(app_client, path): app_iter, status, headers = app_client.get(path) assert status.upper() == '404 NOT FOUND', "A status 404 is necesary, but a status {} was got from the request".format( status)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def includeme(config):\n config.add_route('home', '/')\n config.add_route('detail', '/detail/{id:\\d+}')\n config.add_route('update', '/edit/{id:\\d+}')\n config.add_route('create', '/create')", "def add_routes(self):\n pass", "def route(self):\n pass", "def route( request, c ):...
[ "0.62387675", "0.622436", "0.6139062", "0.61008644", "0.6092722", "0.5983449", "0.5922116", "0.5919165", "0.5895856", "0.58876914", "0.587018", "0.58597404", "0.5856948", "0.58300674", "0.58160836", "0.57912624", "0.57350916", "0.57123536", "0.57119346", "0.5641473", "0.56345...
0.0
-1
we include a valid route and controllers
def test_response_without_method_routes(app_routes, path): app_iter, status, headers = app_routes.get(path) assert status.upper() == '200 OK', "A status 200 is necesary, but a status {} was got from the request".format( status) assert get_body_request( app_iter) == '200 OK', "The default fro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def includeme(config):\n config.add_route('home', '/')\n config.add_route('detail', '/detail/{id:\\d+}')\n config.add_route('update', '/edit/{id:\\d+}')\n config.add_route('create', '/create')", "def add_routes(self):\n pass", "def route(self):\n pass", "def route( request, c ):...
[ "0.62387526", "0.6224374", "0.61399716", "0.6102114", "0.609112", "0.59813225", "0.59221673", "0.59184855", "0.58958554", "0.5886427", "0.58700645", "0.5857996", "0.5854663", "0.58290184", "0.58146137", "0.5788888", "0.57340324", "0.5710644", "0.5709957", "0.56408924", "0.563...
0.0
-1
Make a CarlaSettings object with the settings we need.
def make_carla_settings(args): settings = CarlaSettings() settings.set( SynchronousMode=True, SendNonPlayerAgentsInfo=True, NumberOfVehicles=0, NumberOfPedestrians=0, SeedVehicles = '00000', WeatherId=1, QualityLevel=args.quality_level) settings.random...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_carla_settings(args):\n settings = CarlaSettings()\n settings.set(\n SynchronousMode=False,\n SendNonPlayerAgentsInfo=True,\n NumberOfVehicles=NUM_VEHICLES,\n NumberOfPedestrians=NUM_PEDESTRIANS,\n WeatherId=random.choice([1, 3, 7, 8, 14]),\n QualityLevel=ar...
[ "0.7046542", "0.64021003", "0.6321816", "0.59555054", "0.58940154", "0.5859983", "0.58227974", "0.5814349", "0.5743213", "0.5712618", "0.56494814", "0.563011", "0.56196254", "0.56128407", "0.55752116", "0.5572938", "0.5552482", "0.5540732", "0.55223477", "0.5518125", "0.54987...
0.8063497
0
INTERNAL USE ONLY Get the fact in the KB that is the same as the fact argument
def _get_fact(self, fact): for kbfact in self.facts: if fact == kbfact: return kbfact
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFact(self, fact):\n for kbfact in self.kb.facts:\n if fact == kbfact:\n return True\n return False", "def fact(self, name):\n facts = self.facts(name=name)\n return next(fact for fact in facts)", "def get_furniture():", "def parse_fact(self, factel...
[ "0.64909446", "0.55313945", "0.55220604", "0.545844", "0.54017186", "0.5279208", "0.526946", "0.524799", "0.5233914", "0.5233914", "0.5068595", "0.50262606", "0.4968205", "0.4955512", "0.49484053", "0.4944101", "0.49107435", "0.48900303", "0.4867359", "0.4864705", "0.4863232"...
0.70821464
2
INTERNAL USE ONLY Get the rule in the KB that is the same as the rule argument
def _get_rule(self, rule): for kbrule in self.rules: if rule == kbrule: return kbrule
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRule(self, *args):\n return _libsbml.Model_getRule(self, *args)", "def get_rule(self):\n\n return self.__rule_", "def rule(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"rule\")", "def rule(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"rule\")", "def ru...
[ "0.72598034", "0.69801867", "0.69057363", "0.69057363", "0.69057363", "0.676362", "0.67517036", "0.6723854", "0.6723854", "0.6723854", "0.6723854", "0.6723854", "0.6723854", "0.6723854", "0.6402129", "0.63560486", "0.63248295", "0.628659", "0.6276691", "0.61988664", "0.616951...
0.79268336
2
Add a fact or rule to the KB
def kb_add(self, fact_rule): printv("Adding {!r}", 1, verbose, [fact_rule]) if isinstance(fact_rule, Fact): if fact_rule not in self.facts: self.facts.append(fact_rule) for rule in self.rules: self.ie.fc_infer(fact_rule, rule, self) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kb_add(self, fact_rule):\n printv(\"Adding {!r}\", 1, verbose, [fact_rule])\n if isinstance(fact_rule, Fact):\n if fact_rule not in self.facts:\n self.facts.append(fact_rule)\n for rule in self.rules:\n self.ie.fc_infer(fact_rule, rule, ...
[ "0.75052065", "0.67358214", "0.66465557", "0.6613316", "0.6535551", "0.64647514", "0.64200574", "0.6356476", "0.63013196", "0.61622655", "0.6102377", "0.60814255", "0.60814255", "0.60814255", "0.60700375", "0.5975886", "0.5965079", "0.5875529", "0.5841823", "0.58227754", "0.5...
0.75037193
2
Assert a fact or rule into the KB
def kb_assert(self, fact_rule): printv("Asserting {!r}", 0, verbose, [fact_rule]) self.kb_add(fact_rule)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kb_assert(self, fact):\n if isinstance(fact, Fact): #check if it's an instance of fact\n if (fact.name is \"fact\"): #checking if it is a fact/ double check\n for x in self.facts:\n if (x == fact): #if the fact is already in the kb\n ...
[ "0.7594763", "0.62535036", "0.6135857", "0.6124177", "0.5977059", "0.5977059", "0.5968787", "0.5905811", "0.58380437", "0.57631975", "0.576085", "0.5709365", "0.56988823", "0.56957656", "0.56953454", "0.5676461", "0.5652195", "0.5644657", "0.56348133", "0.5627622", "0.5623301...
0.78474134
2
Ask if a fact is in the KB
def kb_ask(self, fact): print("Asking {!r}".format(fact)) if factq(fact): f = Fact(fact.statement) bindings_lst = ListOfBindings() # ask matched facts for fact in self.facts: binding = match(f.statement, fact.statement) if b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_kb_status():\n result = minisat(agent.kb.clauses)\n if result:\n print \"Agent KB is satisfiable\"\n else:\n print \"Agent KB is NOT satisfiable!! There is contradiction that needs fixing!\"", "def getFact(self, fact):\n for kbfact in self.kb.facts:\n ...
[ "0.67102563", "0.64609563", "0.55531037", "0.5546491", "0.5480997", "0.5480862", "0.546851", "0.5426157", "0.53731054", "0.5303705", "0.5283261", "0.5274328", "0.5240789", "0.5233031", "0.5215956", "0.5210727", "0.52056134", "0.52027833", "0.51916176", "0.518918", "0.5165558"...
0.0
-1
Retract a fact from the KB
def kb_retract(self, fact_or_rule): printv("Retracting {!r}", 0, verbose, [fact_or_rule]) #################################################### # Student code goes here if fact_or_rule in self.facts: ind = self.facts.index(fact_or_rule) f_r = self.facts[ind] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_retract_fact(self):\n fact = self.env.assert_string('(implied-fact)')\n\n self.assertTrue(fact in list(self.env.facts()))\n\n fact.retract()\n\n self.assertFalse(fact in list(self.env.facts()))", "def kb_retract(self, fact_or_rule):\n printv(\"Retracting {!r}\", 0, ver...
[ "0.72810733", "0.68295395", "0.6592928", "0.5983057", "0.5843659", "0.5822878", "0.56172395", "0.5609192", "0.5586348", "0.55481756", "0.5539644", "0.55248684", "0.55074006", "0.5498454", "0.54947954", "0.5473625", "0.54666054", "0.5443795", "0.5413491", "0.5398232", "0.53903...
0.66837656
2
Forwardchaining to infer new facts and rules
def fc_infer(self, fact, rule, kb): printv('Attempting to infer from {!r} and {!r} => {!r}', 1, verbose, [fact.statement, rule.lhs, rule.rhs]) #################################################### # Student code goes here # binding = match(fact.statement, rule.lhs[0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fc_infer(self, fact, rule, kb):\n printv('Attempting to infer from {!r} and {!r} => {!r}', 1, verbose,\n [fact.statement, rule.lhs, rule.rhs])\n ####################################################\n # //--\n bindings = match(rule.lhs[0],fact.statement)\n if bindin...
[ "0.70777905", "0.69960123", "0.61015964", "0.55858845", "0.55777586", "0.55288315", "0.54299307", "0.5380897", "0.5336765", "0.52970016", "0.52801335", "0.518475", "0.5183168", "0.5181316", "0.51246744", "0.509721", "0.5092668", "0.50754994", "0.50486445", "0.5037382", "0.503...
0.6988643
2
Main function for running the application.
def test_lk(): # get current directory to work relative to current file path curdir = os.path.dirname(__file__) # Load configuration for system yaml_file = os.path.join(curdir, 'config.yaml') with open(yaml_file, "r") as f: config = yaml.load(f) # extract list of videos from data dir ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(args=None):\n app()\n return 0", "def main():\n print(\"def main\")\n return APP.run()", "def main():\n return", "def main():\n app = App()\n app.run()", "def main():\n CLI_APP.run()", "def main(self) -> None:\n pass", "def main():\n print(\"Call your main applica...
[ "0.8267055", "0.82121", "0.81232756", "0.8114297", "0.81044734", "0.8067274", "0.80287755", "0.80287755", "0.80287755", "0.80164164", "0.78847355", "0.78267777", "0.78267777", "0.78267777", "0.78267777", "0.78124523", "0.78004485", "0.77828294", "0.77566296", "0.77566296", "0...
0.0
-1
parse command line input generate options including input proguardgenerated mappings and predict mappings
def parse_args(): parser = argparse.ArgumentParser(description="evaluate the recovered derg by comparing with ground truth mapping file") parser.add_argument("-mapping", action="store", dest="mapping_file", required=True, help="path to proguard-generated mapping.txt") parser.add_argu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_args():\n\tparser = argparse.ArgumentParser(description=\"comparing proguard-generated and predict mappings\")\n\tparser.add_argument(\"--proguard\", action=\"store\", dest=\"proguard_mappings_dir\",\n\t\t\t\t\t\trequired=True, help=\"directory of proguard-generated mappings file\")\n\tparser.add_argumen...
[ "0.758029", "0.6911417", "0.66426575", "0.6602202", "0.6586641", "0.6517531", "0.64053476", "0.6373626", "0.6314406", "0.631191", "0.6287974", "0.6280361", "0.6261687", "0.62313056", "0.62139565", "0.6213808", "0.6197871", "0.6196983", "0.61876106", "0.6174314", "0.616388", ...
0.66534996
2
Convert a hex color to rgb integer tuple.
def hex_to_rgb(color): if color.startswith('#'): color = color[1:] if len(color) == 3: color = ''.join([c * 2 for c in color]) if len(color) != 6: return False try: r = int(color[:2], 16) g = int(color[2:4], 16) b = int(color[4:], 16) except ValueError...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hex_to_rgb(hex):\n hex = hex.lstrip('#')\n hlen = len(hex)\n return tuple(int(hex[i:i + hlen // 3], 16) for i in range(0, hlen, hlen // 3))", "def hex_to_rgb(self,value):\n value = value.lstrip('#')\n lv = len(value)\n return tuple(int(value[i:i + lv // 3], 16) for i in range(0,...
[ "0.8451613", "0.839427", "0.83495486", "0.8305007", "0.82783866", "0.8268142", "0.8268142", "0.8268142", "0.8268142", "0.82359517", "0.82191676", "0.8202206", "0.8152297", "0.79935545", "0.7940223", "0.78840506", "0.7768129", "0.77437425", "0.7743241", "0.7723033", "0.7719117...
0.7372798
31
Check whether a color is 'dark'. Currently, this is simply whether the luminance is <50%
def dark_color(color): rgb = hex_to_rgb(color) if rgb: return rgb_to_hls(*rgb)[1] < 128 else: # default to False return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dark(self):\n\n return self.red() < 125 and self.green() < 125 and self.blue() < 125", "def dark(r, d):\n return d * 1.0 / (r + d) + d * r * 1.0 / ((r + d) ** 2)", "def is_monochromatic(self):\n return equal(s.color for s in self.iter_states())", "def ensureBrightOrDark( nColor, bBrig...
[ "0.8725131", "0.65368", "0.65338826", "0.6522034", "0.6357333", "0.63260835", "0.62616885", "0.62494576", "0.62354577", "0.6234573", "0.6193287", "0.6178857", "0.6167206", "0.6154868", "0.6118449", "0.6047277", "0.6014609", "0.59861344", "0.5977451", "0.59697956", "0.5940999"...
0.81742746
1
Guess whether the background of the style with name 'stylename' counts as 'dark'.
def dark_style(stylename): return dark_color(get_style_by_name(stylename).background_color)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_color(style):\n for kw in list(cc.keys()):\n m = re.search(kw, style)\n if m:\n return m.group()\n\n # Return 'b' if nothing has found\n return 'b'", "def is_dark(self):\n\n return self.red() < 125 and self.green() < 125 and self.blue() < 125", "def check_them...
[ "0.66091275", "0.63446206", "0.6265952", "0.561835", "0.5487273", "0.5460873", "0.54280055", "0.5422753", "0.5419636", "0.53896165", "0.5383962", "0.5319423", "0.5317914", "0.5317887", "0.53108865", "0.52508605", "0.5241777", "0.5228757", "0.5217556", "0.52019304", "0.5188046...
0.69731295
0
Construct the keys to be used building the base stylesheet from a templatee.
def get_colors(stylename): style = get_style_by_name(stylename) fgcolor = style.style_for_token(Token.Text)['color'] or '' if len(fgcolor) in (3, 6): # could be 'abcdef' or 'ace' hex, which needs '#' prefix try: int(fgcolor, 16) except TypeError: pass ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stylesheet():\n\n #ss_dict\n ss_dict = {'header_image' : HEADER_IMAGE,\n 'icon_true' : ICON_TRUE,\n 'icon_false' : ICON_FALSE,\n 'futura_lt_light' : FUTURA_LT_LIGHT,\n 'bright_orange' : BRIGHT_ORANGE.name(),\n 'bright_orange_t...
[ "0.60495263", "0.5874462", "0.5874462", "0.5804995", "0.5754522", "0.5742323", "0.57396144", "0.55724186", "0.5565366", "0.54510945", "0.5429787", "0.5330616", "0.52988195", "0.5295383", "0.5225139", "0.5201271", "0.5179384", "0.5159989", "0.5142463", "0.5080673", "0.5075791"...
0.0
-1
Use one of the base templates, and set bg/fg/select colors.
def sheet_from_template(name, colors='lightbg'): colors = colors.lower() if colors == 'lightbg': return default_light_style_template % get_colors(name) elif colors == 'linux': return default_dark_style_template % get_colors(name) elif colors == 'nocolor': return default_bw_style_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, red=Black.red, green=Black.green, blue=Black.blue):\n self.color = Color(red, green, blue)\n\n self.template = '\\ttextcolor = {textcolor};\\n'", "def _style_colours(self):\n\n pass", "def setMyBackground(self):\n base.setBackgroundColor(globals.colors['guiblue4']...
[ "0.63418514", "0.6126202", "0.6101432", "0.60870427", "0.6030478", "0.59174025", "0.5908568", "0.58894444", "0.5875755", "0.58252996", "0.5767308", "0.57080126", "0.5699954", "0.566833", "0.56431055", "0.5625276", "0.5576492", "0.5572506", "0.55247325", "0.55214554", "0.55201...
0.0
-1
r""" Computes the gradient of conv2d with respect to the input of the convolution. This is same as the 2D transposed convolution operator under the hood but requires the shape of the gradient w.r.t. input to be specified explicitly.
def conv2d_input(input_size, weight, grad_output, stride=1, padding=0, dilation=1, groups=1): stride = _pair(stride) padding = _pair(padding) dilation = _pair(dilation) kernel_size = (weight.shape[2], weight.shape[3]) if input_size is None: raise ValueError("grad.conv2d_input requires speci...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient(self, node, output_grad):\r\n return [conv2d_grad_op1(node.inputs[0], node.inputs[1], node.const_attr , output_grad),conv2d_grad_op2(node.inputs[0], node.inputs[1], node.const_attr , output_grad)]", "def _Conv2DGrad(op, grad):\n strides = op.get_attr('strides')\n padding = op.ge...
[ "0.7136372", "0.7087412", "0.6661306", "0.6652858", "0.65240824", "0.6440572", "0.6431438", "0.64151895", "0.63838226", "0.638127", "0.63581175", "0.6345818", "0.6308881", "0.62837183", "0.62459445", "0.6236354", "0.62340426", "0.6232537", "0.62316734", "0.6220648", "0.621702...
0.63617384
10
r""" Computes the gradient of conv2d with respect to the weight of the convolution.
def conv2d_weight(input, weight_size, grad_output, stride=1, padding=0, dilation=1, groups=1): stride = _pair(stride) padding = _pair(padding) dilation = _pair(dilation) in_channels = input.shape[1] out_channels = grad_output.shape[1] min_batch = input.shape[0] grad_output = grad_output.con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_gradient (w, x, y):\n (n,d) = x.shape\n g = np.zeros(d)\n for i in range(0,d):\n g[i] = (w*x-y)*np.transpose(x[i])\n g += 0.5*w\n return g", "def gradient(self, node, output_grad):\r\n return [conv2d_grad_op1(node.inputs[0], node.inputs[1], node.co...
[ "0.7060526", "0.69919515", "0.68430454", "0.66755736", "0.66457593", "0.66347766", "0.6634614", "0.6628003", "0.6615836", "0.6599485", "0.65958774", "0.6593012", "0.6530576", "0.6513897", "0.6493217", "0.6491872", "0.6491026", "0.64871246", "0.6460029", "0.6453161", "0.645178...
0.61689085
50
4th Order RungeKutta method (RK4) RK4 that solves a system of three coupled differential equations. Additional parameters not explained below, are described in the main.py program located in the same folder as this file.
def RK4(a_in, b, c, x0, y0, z0, N, T, n, fx, fy, fz=None, Basic=False, Vital=False, Season=False, Vaccine=False, CombinedModel=False): # Setting up arrays x = np.zeros(n) y = np.zeros(n) z = np.zeros(n) t = np.zeros(n) # Size of time step dt = T/n # Initialize x[0] = x0 y[0] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rk4(x,t,tau,derivsRK,param): #couldn't get it to import right so I just copy pasted.\r\n \r\n half_tau = 0.5*tau\r\n F1 = derivsRK(x,t,param) \r\n t_half = t + half_tau\r\n xtemp = x + half_tau*F1\r\n F2 = derivsRK(xtemp,t_half,param) \r\n xtemp = x + half_tau*F2\r\n F3 = derivsRK(xte...
[ "0.7954573", "0.77571136", "0.74954444", "0.71658003", "0.70909965", "0.7012071", "0.69917583", "0.6986058", "0.6910422", "0.68250304", "0.6824724", "0.6814575", "0.68134725", "0.6803948", "0.6789339", "0.6765618", "0.67407966", "0.6738729", "0.6710684", "0.66979975", "0.6687...
0.6626081
22
Right hand side of S' = dS/dt For basic SIRS, vital dynamics, seasonal variation, vaccine and a combined model
def fS(a, b, c, N, S, I, R=None, vital=False, vaccine=False, combined=False): if vital: temp = c*R - a*S*I/N - d*S + e*N elif vaccine: R = N - S - I temp = c*R - a*S*I/N - f*S elif combined: temp = c*R - a*S*I/N - d*S + e*N - f*S else: temp = c*(N-S-I) - a*S*I/N ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dydt(t,S):\n Scl = S[0]\n Swb = S[1]\n \n Seff_cl = (Scl - Sclmin)/(Sclmax - Sclmin)\n Lcl = acl * Seff_cl**bcl\n \n Seff_wb = (Swb - Swbmin)/(Swbmax - Swbmin)\n Lwb = awb * Seff_wb**bwb\n \n E = pE * Cf *fred\n Beta = Beta0 * Seff_cl\n \n # Equations\n dScldt = Jrf - Lcl - E\n ...
[ "0.6709277", "0.65212226", "0.6506355", "0.6376106", "0.6086967", "0.6046832", "0.60436714", "0.5999482", "0.59557784", "0.5927742", "0.5925995", "0.59152555", "0.5876051", "0.58732706", "0.5844832", "0.5819526", "0.5817883", "0.5792154", "0.57908195", "0.5771786", "0.5769986...
0.5705355
24
Right hand side of I' = dI/dt For basic SIRS, with vital dynamics, seasonal variation, vaccine and a combined model
def fI(a, b, c, N, S, I, R=None, vital=False, vaccine=False, combined=False): if vital: temp = a*S*I/N - b*I - d*I - dI*I elif vaccine: temp = a*S*I/N - b*I elif combined: temp = a*S*I/N - b*I - d*I - dI*I else: temp = a*S*I/N - b*I return temp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dSIR(s, i, r, beta, gamma, dt):\n \n N = s + i + r\n return np.array([-beta / N * i * s,\n beta / N * i * s - gamma * i,\n gamma * i]) * dt", "def dSIRD(s, i, r, d, beta, gamma, mu, dt):\n \n N = s + i + r + d\n return np.array([-beta / N * i * s,\n ...
[ "0.65454096", "0.6504648", "0.63993156", "0.62488604", "0.6208171", "0.6152282", "0.6077421", "0.606764", "0.6063668", "0.6053156", "0.6007391", "0.59563476", "0.5868086", "0.5859338", "0.5774364", "0.57708526", "0.5752", "0.5680514", "0.5661055", "0.56446713", "0.56088495", ...
0.54601496
32
Right hand side of R' = dR/dt For basic SIRS, with vital dynamics, seasonal variation, vaccine and a combined model
def fR(a, b, c, N, S, I, R, vital=False, vaccine=False, combined=False): if vital: temp = b*I - c*R - d*R elif vaccine: R = N - S - I temp = b*I - c*R + f*S elif combined: temp = b*I - c*R - d*R + f*S else: temp = 0 return temp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dSIR(s, i, r, beta, gamma, dt):\n \n N = s + i + r\n return np.array([-beta / N * i * s,\n beta / N * i * s - gamma * i,\n gamma * i]) * dt", "def dSIRD(s, i, r, d, beta, gamma, mu, dt):\n \n N = s + i + r + d\n return np.array([-beta / N * i * s,\n ...
[ "0.6417594", "0.62465185", "0.61990243", "0.6146874", "0.6019759", "0.59690404", "0.5936613", "0.59302646", "0.58936304", "0.58754086", "0.5860053", "0.5856836", "0.5746976", "0.57035094", "0.5688082", "0.56799275", "0.56329614", "0.5620549", "0.5616551", "0.5611345", "0.5608...
0.53041786
44
Disease modelling using MonteCarlo. This function uses randomness and transition probabilities as a basis for the disease modelling. Additional parameters not explained below, are described in the main.py program located in the same folder as this file.
def MC(a_in, b, c, S_0, I_0, R_0, N, T, vitality=False, seasonal=False, vaccine=False): if seasonal: a0 = a_in #average transmission rate A = 4 #max.deviation from a0 omega = 0.5 #frequency of oscillation a = A*np.cos(omega*0) + a0 else: a =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_scenario_1(seed=1996, permanent_save=True, sigma_process=0.01, sigma_meas_radar=3, sigma_meas_ais=1):\n # specify seed to be able repeat example\n start_time = datetime.now()\n\n np.random.seed(seed)\n\n # combine two 1-D CV models to create a 2-D CV model\n transition_model = CombinedL...
[ "0.63426965", "0.61112314", "0.6076911", "0.6061208", "0.60226256", "0.5981131", "0.59642947", "0.5918322", "0.5863828", "0.5817048", "0.5789747", "0.5731177", "0.57195646", "0.5717003", "0.56996053", "0.5694678", "0.56899124", "0.56714576", "0.5669338", "0.5646432", "0.56285...
0.0
-1
Constructor for smach Concurrent Split.
def __init__(self, outcomes, default_outcome, input_keys = [], output_keys = [], outcome_map = {}, outcome_cb = None, child_termination_cb = None ): smach.container.Container.__init__(self, outcomes, input_keys, outp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_split(self) -> NoReturn:\n raise NotImplementedError", "def __init__(self, comm, data, num_epochs, train_list, val_list, num_masters=1,\n synchronous=False, callbacks=[]):\n self.data = data\n self.num_masters = num_masters\n self.num_workers = comm.Get_size() - ...
[ "0.6501006", "0.60381305", "0.59367543", "0.59327763", "0.5870752", "0.5870021", "0.5826461", "0.5807034", "0.57936984", "0.5790517", "0.5718749", "0.56733483", "0.5666154", "0.56660837", "0.5630289", "0.5607317", "0.55971277", "0.55574745", "0.55560327", "0.55555826", "0.552...
0.0
-1
Add state to the opened concurrence. This state will need to terminate before the concurrence terminates.
def add(label, state, remapping={}): # Get currently opened container self = Concurrence._currently_opened_container() # Store state self._states[label] = state self._remappings[label] = remapping return state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_io_state(self, state):\n if self._state != state:\n state = self._state = self._state | state\n self._update_handler(self._state)", "def add_state(self, state):\n self.states.add(state)", "def add_state(self, state):\n self._validate_state(state)\n self._s...
[ "0.66800797", "0.6445865", "0.64207387", "0.6252283", "0.6251686", "0.62296855", "0.61850387", "0.61375093", "0.60501254", "0.5971698", "0.5954651", "0.5868956", "0.5826321", "0.57091546", "0.57091546", "0.56562334", "0.5651364", "0.5650971", "0.56308216", "0.55859417", "0.55...
0.64219916
2
Overridden execute method. This starts all the threads.
def execute(self, parent_ud = None): # Clear the ready event self._ready_event.clear() # Reset child outcomes self._child_outcomes = {} # Copy input keys self._copy_input_keys(parent_ud, self.userdata) # Spew some info smach.loginfo("Concurrence...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_workers(self):\n\n for thread in self.threads:\n thread.start()", "def start_threads(self):\r\n assert len(self.all_threads) > 0\r\n for thread in self.all_threads:\r\n thread.start()", "def create_and_start_threads(self):\r\n self.create_threads()\r\...
[ "0.72440064", "0.71170753", "0.6793708", "0.67579764", "0.6752653", "0.6662899", "0.65031946", "0.64659274", "0.6461829", "0.64602405", "0.6420833", "0.63945025", "0.6368528", "0.6360315", "0.63563305", "0.6355684", "0.63202614", "0.62761915", "0.62727165", "0.62565506", "0.6...
0.0
-1
Preempt all contained states.
def request_preempt(self): # Set preempt flag smach.State.request_preempt(self) # Notify concurrence that it should preempt running states and terminate with self._done_cond: self._done_cond.notify_all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preempt(self):\n rospy.logwarn(\"Preempting scan...\")\n self.preempted = True", "def skip_all_animations(self):\n for child in self.children:\n child.skip_all_animations()\n \n # remove unskippable animations from queue\n unskippables = [anim for anim...
[ "0.554885", "0.5414512", "0.5326902", "0.529442", "0.5274952", "0.5222493", "0.5195873", "0.51523536", "0.51299024", "0.50996476", "0.5081874", "0.5050064", "0.50393015", "0.50298834", "0.5028418", "0.50032896", "0.49937183", "0.49687582", "0.49533314", "0.49426508", "0.49423...
0.7223714
0
Runs the states in parallel threads.
def _state_runner(self,label): # Wait until all threads are ready to start before beginnging self._ready_event.wait() self.call_transition_cbs() # Execute child state try: self._child_outcomes[label] = self._states[label].execute(smach.Remapper( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_in_parallel(self):\n\t\tfor p in self.parallel_threads:\n\t\t\tp.start()\n\t\tfor p in self.parallel_threads:\n\t\t\tp.join()", "def test_setting_state_parallel(self):\n no_replicates = 25\n\n replicate(experiment, no_replicates, parallel=True, no_processes=2)\n for i in range(no_rep...
[ "0.669734", "0.64710146", "0.62994856", "0.61933833", "0.60969037", "0.6092645", "0.6050855", "0.6029131", "0.6006256", "0.5982374", "0.5978855", "0.5941273", "0.59398925", "0.59389126", "0.58783174", "0.5869711", "0.58460647", "0.578596", "0.5767861", "0.57622504", "0.571896...
0.5938656
14
Need a global enumerated list, not a local one, or there will be errors if one .gnt file skips a character
def saveImages(saveImagePath,dataForSaving,enumeratedList): for i in range(len(dataForSaving[0])): singleChar = dataForSaving[0][i] singleImage = dataForSaving[1][i] if singleChar not in enumeratedList: enumeratedList.append(singleChar) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_genuine(path):\n out = []\n with open(path, 'r') as fp:\n for line in fp:\n fields = line.rstrip().split()\n ii, tt = fields[:2]\n if tt == 'genuine':\n out.append(ii[2:-4]) # remove 'D_' and '.wav'\n\n return...
[ "0.51875985", "0.51774746", "0.5140021", "0.51013625", "0.50543755", "0.50452536", "0.49202475", "0.49026576", "0.48826155", "0.4863277", "0.484987", "0.4848835", "0.48407993", "0.4830614", "0.4829038", "0.48158124", "0.48138157", "0.48046628", "0.478652", "0.47688955", "0.47...
0.0
-1
Processes training and test files into one tfrecord rather than saving images/labels separately
def processGNTasImageGeneric(saveImagePath,gntPath,imageSize,trainGNT,testGNT): totalFiles = 0 for subdir, dirs, filenames in os.walk(gntPath): totalFiles += len(filenames) print("{} .gnt files".format(totalFiles)) #create train and test folders if not os.pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_all_image_files_into_tf_records(image_dir, tf_records_dir):\n files = os.listdir(image_dir)\n\n training_files = []\n test_files = []\n for file in files:\n if os.path.isdir(image_dir + file):\n image_files = os.listdir(image_dir + file)\n length = len(image_files)...
[ "0.75491244", "0.74270195", "0.7271221", "0.70785785", "0.70030403", "0.699899", "0.69399333", "0.69106877", "0.6883742", "0.6876416", "0.68456495", "0.6837926", "0.68090194", "0.6796269", "0.679149", "0.678764", "0.67850995", "0.67207783", "0.6716689", "0.67131555", "0.67065...
0.0
-1
We are going to generate 10 unique characters in the addrs and labels
def generateUniqueAddrs(saveImagePath,numUnique,trainType,addrs_labels): print("Saving only {} unique characters for {}".format(numUnique,trainType)) train_addrs = addrs_labels[0] train_labels = addrs_labels[1] test_addrs = addrs_labels[2] test_labels = addrs_labels[3] ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_id() -> str:\n return \"\".join(sample(\"abcdefghjkmopqrstuvqxyz\", 16))", "def generate_uuids():\n uuid_start = str(uuid())\n while uuid_start.startswith(\"zzzzzzzz\"):\n uuid_start = str(uuid())\n uuid_end = list(deepcopy(uuid_start))\n \n char_pool = list(string.digits) ...
[ "0.640046", "0.6369727", "0.63013107", "0.6263165", "0.62521905", "0.6217594", "0.62151855", "0.6057115", "0.6023755", "0.6016253", "0.59843117", "0.59843117", "0.5947065", "0.5907196", "0.5886632", "0.5849489", "0.58435", "0.58254504", "0.5823662", "0.58192736", "0.5805219",...
0.7429078
0
Processes training and test files into one tfrecord rather than saving images/labels separately
def generateGenericTFRecord(addrs,labels,numOutputs): print("Generating TFRecord containing training and test files for {} outputs...".format(numOutputs)) filename = 'generic'+str(numOutputs)+'.tfrecords' writer = tf.python_io.TFRecordWriter(filename) labels = [i-171 for i in labels] #to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_all_image_files_into_tf_records(image_dir, tf_records_dir):\n files = os.listdir(image_dir)\n\n training_files = []\n test_files = []\n for file in files:\n if os.path.isdir(image_dir + file):\n image_files = os.listdir(image_dir + file)\n length = len(image_files)...
[ "0.75485015", "0.74270594", "0.72712696", "0.7077852", "0.70025826", "0.6998779", "0.6940493", "0.6910123", "0.6883235", "0.68759894", "0.6845586", "0.6837063", "0.68087155", "0.6795098", "0.67914337", "0.6787535", "0.67847365", "0.6720754", "0.67159617", "0.6711898", "0.6706...
0.6654385
23
Render a template with a RequestContext.
def render(request, template, data=None, mimetype=None, status=200): t = get_template(template) c = RequestContext(request, data) return HttpResponse(t.render(c), mimetype=mimetype, status=status)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render(self, _template, context=None):\n variables = {}\n if context:\n variables.update(context)\n rv = self.jinja2.render_template(_template, **variables)\n self.response.write(rv)", "def render(self, _template, **context):\n context['_request'] = self.request\...
[ "0.78249687", "0.77378184", "0.7640356", "0.752489", "0.7478129", "0.74194103", "0.7324433", "0.718892", "0.7165826", "0.7165826", "0.7163388", "0.714797", "0.714797", "0.7139211", "0.7137041", "0.71318865", "0.7094226", "0.7079073", "0.7059118", "0.7053729", "0.702802", "0...
0.75907755
3
Check if have an modal in the page and close it
def check_modal(client): modal_close_btn_xpath = "/html/body/div[9]/div[3]/div/button[1]" try: modal_close_btn = wait(client, 20).until( EC.visibility_of_element_located((By.XPATH, modal_close_btn_xpath)) ).click() except TimeoutException: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_until_modal_is_closed(self):\n self.selenium.wait_until_page_does_not_contain_element(\n lex_locators[\"modal\"][\"is_open\"], timeout=15\n )", "def close_modal(self):\n locator = lex_locators[\"modal\"][\"close\"]\n self._jsclick(locator)", "def isModal(self) ->...
[ "0.7223902", "0.6937706", "0.6832686", "0.6832686", "0.6832686", "0.6832686", "0.6668967", "0.6477973", "0.6467144", "0.64522135", "0.6235597", "0.6161681", "0.609987", "0.6045032", "0.60414016", "0.6033631", "0.5973035", "0.5968023", "0.5936488", "0.5881599", "0.5880967", ...
0.6974228
1
Takes in a list of column headers and the Data object and returns a list of 2element lists with the minimum and maximum values for each column. The function is required to work only on numeric data types.
def range_(headers, data): column_matrix=data.get_data(headers).getT() # get columns as rows, as this makes analysis much easier by just perfoming operations on column list directly if column_matrix==[]: print "wrong headers, not present in data Object" return [] column_max=column_matrix.max(1) column_min=colum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_min_max(data):\n v = [i[1] for i in data]\n extremes = [min(v), max(v)]\n logging.info('Calculated extremes: %s', extremes)\n return extremes", "def get_features_min_max(self):\n min_max_list = []\n\n # Get each feature's min and max values.\n for feature_name in self.fe...
[ "0.7179984", "0.67622894", "0.66347414", "0.65967995", "0.6559086", "0.6524025", "0.6347338", "0.6229328", "0.6198685", "0.6165774", "0.6158391", "0.61267865", "0.6091353", "0.60664314", "0.6055036", "0.6013343", "0.60074276", "0.5973478", "0.5945628", "0.59140044", "0.585765...
0.67075384
2
Takes in a list of column headers and the Data object and returns a list of the mean values for each column. Use the builtin numpy functions to execute this calculation.
def mean(headers, data): column_matrix=data.get_data(headers) mean_values=column_matrix.mean(0) return mean_values
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_list(data):\n return sum(data) / len(data)", "def calculate_mean(data_dir):\n data = ([each for each in os.listdir(data_dir)\n if each.endswith('.h5')])\n all_data = []\n for num_data in data:\n processed_data = os.path.join(data_dir, num_data)\n file = h5py.File(pr...
[ "0.688118", "0.6788073", "0.67306453", "0.6660681", "0.65742046", "0.6569169", "0.6488681", "0.64012986", "0.6394433", "0.6307643", "0.6307385", "0.6297519", "0.6297519", "0.6287866", "0.6264603", "0.6255944", "0.62483", "0.6204587", "0.6190885", "0.61622494", "0.6139135", ...
0.81816053
0
stdev Takes in a list of column headers and the Data object and returns a list of the standard deviation for each specified column. Use the builtin numpy functions to execute this calculation.
def stdev(headers, data): column_matrix=data.get_data(headers) mean_values=column_matrix.std(0) std_values=mean_values.tolist() return std_values
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_std_dev(self, data):\n mean = 0\n data_arr = []\n for i in data:\n data_arr.append(i[1])\n return statistics.stdev(data_arr)", "def column_stdev(column_values, mean):\n\n try:\n stdev = math.sqrt(\n sum([(mean-x)**2 for x in column_values]) / le...
[ "0.762345", "0.76011705", "0.7323709", "0.71934015", "0.715191", "0.7065229", "0.70174754", "0.69014233", "0.6891203", "0.67621124", "0.67020977", "0.6664076", "0.6664076", "0.6625717", "0.65968806", "0.65932107", "0.6561748", "0.65059817", "0.6488277", "0.6485756", "0.648408...
0.855148
0
Takes in a list of column headers and the Data object and returns a matrix with each column normalized so its minimum value is mapped to zero and its maximum value is mapped to 1.
def normalize_columns_separately(headers, data): column_matrix=data.get_data(headers) column_max=column_matrix.max(1) column_min=column_matrix.min(1) range=column_max-column_min nomalized=(column_matrix-column_min)/range return nomalized
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_columns_together(headers, data):\n\tcolumn_matrix=data.get_data(headers)\n\tmax=column_matrix.max()\n\tprint \"The maximum:\t \", max\n\tmin=column_matrix.min()\n\tprint \"The minimum:\t \", min\n\trange=max-min\n\tprint \"range: \", range\n\tcolumn_matrix=column_matrix-min\n\tnormalized=column_matri...
[ "0.7496443", "0.66081625", "0.65859145", "0.6499091", "0.6407396", "0.6192507", "0.6134639", "0.60927606", "0.6090253", "0.60883844", "0.6063456", "0.60361797", "0.59998703", "0.59998703", "0.59897834", "0.5978918", "0.5962571", "0.5955856", "0.5939429", "0.59259486", "0.5905...
0.708409
1
Takes in a list of column headers and the Data object and returns a matrix with each entry normalized so that the minimum value (of all the data in this set of columns) is mapped to zero and its maximum value is mapped to 1.
def normalize_columns_together(headers, data): column_matrix=data.get_data(headers) max=column_matrix.max() print "The maximum: ", max min=column_matrix.min() print "The minimum: ", min range=max-min print "range: ", range column_matrix=column_matrix-min normalized=column_matrix/range return normalized
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_columns_separately(headers, data):\n\tcolumn_matrix=data.get_data(headers)\n\tcolumn_max=column_matrix.max(1)\n\tcolumn_min=column_matrix.min(1)\n\trange=column_max-column_min\n\tnomalized=(column_matrix-column_min)/range\n\treturn nomalized", "def normalize(data):\n # normalize data and return\...
[ "0.6924816", "0.6368028", "0.634722", "0.6282522", "0.62384415", "0.6170771", "0.5904337", "0.5867747", "0.58657235", "0.585182", "0.5851378", "0.58379954", "0.5837087", "0.5817979", "0.57913613", "0.5751155", "0.5751155", "0.5748093", "0.57406265", "0.5719488", "0.5708877", ...
0.73747426
0
Return the numeric matrices with sorted columns
def sort(headers, data): # extension column_matrix=data.get_data(headers) # get raw matrix data for numeric values print "\n before sorting \n " print column_matrix column_matrix=column_matrix.tolist() column_array=np.asarray(column_matrix) column_array.sort(axis=0) print "\n \n done sorting here is your m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_for_sorting():\n return RaggedArray([[1, 0], [2, 0], [0, 0]])", "def _sort_rows(matrix, num_rows):\n tmatrix = array_ops.transpose(matrix, [1, 0])\n sorted_tmatrix = nn_ops.top_k(tmatrix, num_rows)[0]\n return array_ops.transpose(sorted_tmatrix, [1, 0])", "def Msort(index, arr1, arr2, matrix):\n...
[ "0.6472477", "0.6157688", "0.60989267", "0.6080551", "0.5776652", "0.5737888", "0.56588423", "0.56309026", "0.556288", "0.5534623", "0.551707", "0.5514763", "0.55020404", "0.5490696", "0.5472799", "0.54618865", "0.5438563", "0.5436786", "0.53938407", "0.53862166", "0.53718483...
0.71695834
0
takes in data object and then creates a linear regression using the dependant variable
def linear_regression(d, ind, dep): y=d.get_data([dep]) print "y :",y A=d.get_data(ind) print "A :",A ones = np.asmatrix(np.ones( (A.shape[0]) )).transpose() A=np.concatenate((A, ones), axis=1) print "concatenated A :",A AAinv=np.linalg.inv( np.dot(A.transpose(), A)) print "AAinv: \n",AAinv """ print "A...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nnRegression(data):", "def linear_regression_sklearn(data):\n# Split the data into training/testing sets\n dataset = np.array(data)\n\n X_train = dataset[:,0].reshape(-1,1)\n y_train = dataset[:,1]\n\n# Create linear regression object\n regr = linear_model.LinearRegression()\n\n# Train the model ...
[ "0.75647044", "0.74391013", "0.7289286", "0.7030522", "0.6867436", "0.6795315", "0.66433483", "0.6637564", "0.6582622", "0.6578247", "0.65309256", "0.65170056", "0.6510575", "0.6499299", "0.64719", "0.64666194", "0.6466013", "0.64587486", "0.6433807", "0.6419431", "0.63958323...
0.63677645
21
Calculate GAN loss for the discriminator
def backward_D(self): self.loss_D_frame, self.loss_D_frame_real, self.loss_D_frame_fake = self.get_GAN_loss_D_sequential( discriminator=self.discriminator, real_images=self.real_target, fake_images=self.fake_target, conditioned_on=self.real_source, ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _define_discriminator_loss(self):\n real_d_loss = tf.reduce_mean(self._real_discriminator_out)\n real_d_loss = tf.negative(real_d_loss, name='real_discriminator_loss')\n gen_d_loss = tf.reduce_mean(self._gen_discriminator_out,\n name='gen_discriminator_loss')\n return...
[ "0.77901465", "0.73512495", "0.72766215", "0.7197856", "0.71317965", "0.70893556", "0.6996443", "0.69658417", "0.6945136", "0.6936123", "0.6872704", "0.68453836", "0.6738948", "0.67176574", "0.6678768", "0.6669968", "0.6669444", "0.66358835", "0.6635603", "0.66341007", "0.662...
0.0
-1
register_attr(attr, editor, clazz = None) Registers EDITOR as the editor for atrribute ATTR of class CLAZZ, or for any class if CLAZZ is None. EDITOR can be either a Tk widget subclass of editobj.editor.Editor, or None to hide the attribute. MRO is used in order to allow subclasses to use the editor registered for thei...
def register_attr(attr, editor, clazz = None): for_attr = _attr_editors.get(attr) if for_attr: for_attr[clazz] = editor else: _attr_editors[attr] = { clazz : editor }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_children_attr(attr, insert = \"insert\", del_ = \"__delitem__\", clazz = None):\n \n if clazz: _children_attrs[clazz] = (attr, insert, del_)\n else: _children_attrs[None].append((attr, insert, del_))", "def register_on_edit(func, clazz):\n \n _on_edit[clazz] = func", "def addEditor(self, ...
[ "0.569334", "0.52287275", "0.4944205", "0.4870793", "0.477365", "0.46567985", "0.46526116", "0.46501258", "0.4630243", "0.4627526", "0.45808572", "0.45672143", "0.4548827", "0.45476916", "0.45291042", "0.4518718", "0.44888854", "0.4439509", "0.4431176", "0.4427259", "0.442450...
0.837206
0
register_children_attr(attr, insert = "insert", del_ = "__delitem__", clazz = None) Registers ATTR as an attribute that can act as the "content" or the "children" of an object of class CLAZZ (or any class if None). If ATTR is None, the object is used as its own list of children (automatically done for list / dict subcl...
def register_children_attr(attr, insert = "insert", del_ = "__delitem__", clazz = None): if clazz: _children_attrs[clazz] = (attr, insert, del_) else: _children_attrs[None].append((attr, insert, del_))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_children(self, children: dict) -> None:\n for child in children:\n self.children[child.move] = child", "def register_attr(attr, editor, clazz = None):\n \n for_attr = _attr_editors.get(attr)\n if for_attr: for_attr[clazz] = editor\n else: _attr_editors[attr] = { clazz : edito...
[ "0.5429349", "0.54085225", "0.53786886", "0.53273", "0.51638204", "0.5120558", "0.5015715", "0.50146097", "0.50063944", "0.49629942", "0.48599657", "0.48443073", "0.48174873", "0.47865376", "0.47392642", "0.47035292", "0.47018874", "0.46887925", "0.46817335", "0.4680879", "0....
0.8719397
0
register_method(method, clazz, args_editor) Registers METHOD as a method that must be displayed in EditObj for instance of CLAZZ. METHOD can be either a method name (a string), or a function (in this case, it is not a method, strictly speaking). ARGS_EDITOR are the editors used for entering the argument, e.g. use edito...
def register_method(method, clazz, *args_editor): methods = _methods.get(clazz) if methods: methods.append((method, args_editor)) else: _methods[clazz] = [(method, args_editor)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_method(cls: type) -> Callable:\n\n def decorator(func):\n func.enable = lambda: _method_enable(\n cls, [_plugin_funcname(func)], func\n )\n func.disable = lambda: _method_disable(\n cls, [_plugin_funcname(func)], func\n )\n return func\n\n ret...
[ "0.5905217", "0.58517236", "0.5786096", "0.5741496", "0.57013345", "0.561656", "0.5559318", "0.55209756", "0.5503904", "0.54889995", "0.53730494", "0.5337263", "0.5303383", "0.5225363", "0.5225363", "0.52207655", "0.5208166", "0.51892644", "0.5186976", "0.5176117", "0.5170982...
0.78775865
0
register_available_children(children_codes, clazz) Register the CHILDREN_CODES that are proposed for addition in an instance of CLAZZ. If CHILDREN_CODES is a list of strings (Python code), EditObj will display a dialog box. If CHILDREN_CODES is a single string, no dialog box will be displayed, and this code will automa...
def register_available_children(children_codes, clazz): if isinstance(children_codes, list): try: _available_children[clazz].extend(children_codes) except: _available_children[clazz] = children_codes else: _available_children[clazz] = children_codes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_children(self, *args):\r\n self.children.extend(args)\r\n return self", "def add_children(self, *args):\r\n self._children.extend(args)\r\n return self", "def addChildren(self, values):\r\n for i, value in enumerate(values):\r\n newScope = copy(self.scope)\...
[ "0.5452896", "0.53605896", "0.5334651", "0.5284387", "0.52782434", "0.5211498", "0.5191764", "0.5082743", "0.50570357", "0.5024224", "0.49518868", "0.49307147", "0.49156395", "0.4906171", "0.48993438", "0.48965266", "0.4896071", "0.48945415", "0.48457983", "0.4797419", "0.479...
0.79036367
0
register_values(attr, code_expressions) Registers CODE_EXPRESSIONS as a proposed value for ATTR.
def register_values(attr, code_expressions): code_expressions = map(unicodify, code_expressions) try: _values[attr].extend(code_expressions) except KeyError: _values[attr] = list(code_expressions)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_reg_expressions(self, expressions_update: Dict[str, Any]) -> None:\n expressions = self.base_expressions.copy()\n expressions.update(expressions_update)\n self.reg_expressions = expressions", "def RegisterValues():\n return get_float64_array(lib.Generators_Get_RegisterValues)",...
[ "0.48745957", "0.4734857", "0.46250662", "0.46225697", "0.4597566", "0.45449904", "0.45448384", "0.4482638", "0.44240987", "0.44201872", "0.4374772", "0.4365421", "0.43483615", "0.43303338", "0.43257523", "0.43160722", "0.42835793", "0.42812833", "0.427737", "0.42618823", "0....
0.85605466
0
register_on_edit(func, clazz) Register FUNC as an "on_edit" event for CLAZZ. When an instance of CLAZZ is edited, FUNC is called with the instance and the editor Tkinter window as arguments.
def register_on_edit(func, clazz): _on_edit[clazz] = func
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addEdit( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight,\n cText=None,\n textListenerProc=None,\n cReadOnly=None,\n cMultiline=None,\n cAutoVScroll=None):\n self.addControl( \"com...
[ "0.5836717", "0.57678133", "0.5657995", "0.5506038", "0.5439217", "0.5395581", "0.53424084", "0.53140134", "0.51880944", "0.51332206", "0.5114195", "0.51119095", "0.509349", "0.50865626", "0.5086496", "0.50285983", "0.50238705", "0.5020771", "0.49626553", "0.4934645", "0.4925...
0.8712736
0
register_on_children_visible(func, clazz) Register FUNC as an "on_children_visible" event for CLAZZ. When the children of an instance of CLAZZ are shown or hidden, FUNC is called with the instance and the new visibility status (0 or 1) as arguments.
def register_on_children_visible(func, clazz): _on_children_visible[clazz] = func
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visible(self, show):", "def register_available_children(children_codes, clazz):\n \n if isinstance(children_codes, list):\n try: _available_children[clazz].extend(children_codes)\n except: _available_children[clazz] = children_codes\n else:\n _available_children[clazz] = children_codes", "de...
[ "0.5089612", "0.50880736", "0.5036541", "0.5036325", "0.4887222", "0.4887222", "0.4887222", "0.4887222", "0.4887222", "0.4887222", "0.4887222", "0.4887222", "0.4887222", "0.4887222", "0.4887222", "0.48733646", "0.48165864", "0.47937766", "0.47393054", "0.47151053", "0.4670040...
0.8832136
0
This method uses to check if the food name in our database or not. name It is the name of the food from the users. true if food in databases, false othewise
def findFood(self,name): name = name.lower() return dictfood.has_key(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __contains__(self, user_name):\n tuples = self._execute(\n \"SELECT name FROM users WHERE name == ?\",\n (user_name,)\n )\n return len(tuples) == 1", "def player_exists_in_db(name: str):\n with open('db.json') as fo:\n data = loads(fo.read())\n return n...
[ "0.65653473", "0.63060015", "0.6292949", "0.62000495", "0.6126626", "0.6053125", "0.6008738", "0.5959989", "0.59151655", "0.5908109", "0.58882326", "0.58628136", "0.58392847", "0.5811589", "0.58058965", "0.5798567", "0.57955873", "0.57936364", "0.5790114", "0.5773204", "0.577...
0.73230463
0
This method uses to check if the food name in our database or not. string It is the string name of food from the users. total calories
def calculateCal(self,string): global total total = 0 string = string.upper() lis = tokenize.sent_tokenize(string) for string1 in lis: food, qual = string1.split() food = food.lower() qual = float(qual[:-1]) if (dictfood.has_key(food)): cal = dictfood[food] else: cal = 0 total = tota...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findFood(self,name):\n\t\tname = name.lower()\n\t\treturn dictfood.has_key(name)", "def checkFood(self, food):\n pass", "def FoodCheckIn(sc, event):\n channel = sc.api_call('channels.info', channel=event['channel'])\n food = event['text'][9:]\n if food:\n if 'pizza' in food:\n sc.api_call...
[ "0.6849376", "0.6569406", "0.5917411", "0.5899268", "0.56720513", "0.5544741", "0.5530943", "0.55145216", "0.55123574", "0.5480699", "0.54642636", "0.54486895", "0.5419985", "0.53458047", "0.53259957", "0.5320329", "0.53049254", "0.52984124", "0.52976334", "0.52566516", "0.52...
0.56761986
4
A subscriber to the ``pyramid.events.BeforeRender`` events. Updates
def add_renderer_globals(event): request = event.get('request') if request is None: request = get_current_request() globs = { 'url': route_url, 'h': None, 'a_url': request.application_url, 'user': authenticated_userid(request), 'repo': Repo(request.registry.se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_pre_render(self, event, signal):\n t = ppb.get_time() - self.start_time\n self.frames += 1\n print(f\"Frame {self.frames} rendered at {t}\")", "def addBeforeRender(call, args=(), kwargs={}, nodeClass='Write'):", "def _before_render_event(self, *args, **kwargs):\n for chart in...
[ "0.6392563", "0.637537", "0.62949324", "0.56300217", "0.5565096", "0.554508", "0.554508", "0.55141723", "0.54848456", "0.5452291", "0.53380793", "0.53380674", "0.53212523", "0.531709", "0.52783054", "0.52707314", "0.52675736", "0.52643305", "0.5262123", "0.5244581", "0.524166...
0.0
-1
IFieldWidget factory for LocationWidget.
def LocationFieldWidget(field, request): return FieldWidget(field, LocationWidget(request))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.fields = [ \n \n #plugins.FieldWidget(\"widget\", descr=\"Start from widget\",\n # default=\"/\"),\n #plugins.FieldMarker(\"markersearch\", descr=\"Search for marker\"),\n #plugins.FieldMarker(\"markerreplac...
[ "0.5998817", "0.5998817", "0.58848", "0.5651634", "0.56191385", "0.56007206", "0.5575786", "0.53905076", "0.5337973", "0.5329842", "0.5285621", "0.52263105", "0.52263105", "0.5196118", "0.51863796", "0.5159046", "0.5151313", "0.5149169", "0.5144681", "0.5127543", "0.5118616",...
0.8268078
0
The `Dataset` is created in `phase.py`.
def __init__(self, dataset: ds.Dataset, settings): self.dataset = dataset self.settings = settings self.visualizer = visualizer.Visualizer()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_datasets(cls, dataset_config, phase):\n raise NotImplementedError", "def __init__(self, dataset: Dataset):\n self.dataset = dataset", "def generateDataset(self):\n if self.outdir[-1] != \"/\": \n self.outdir += \"/\"\n self.outdir += \"dataset_trackml\"\n ...
[ "0.69201654", "0.6653272", "0.64672613", "0.63746583", "0.6292204", "0.627583", "0.62632644", "0.6217298", "0.62082493", "0.6206257", "0.6194928", "0.6150871", "0.61010015", "0.60949945", "0.60660505", "0.60438836", "0.5999239", "0.5978874", "0.59778184", "0.59778184", "0.594...
0.55406415
73
Returns the fit of a list of Profiles (Gaussians, Exponentials, etc.) to the dataset, using a model instance.
def log_likelihood_function(self, instance: af.ModelInstance) -> float: model_data = self.model_data_from_instance(instance=instance) fit = self.fit_from_model_data(model_data=model_data) return fit.log_likelihood
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, models, x, y, z=None, xbinsize=None, ybinsize=None, err=None, bkg=None, bkg_scale=1, **kwargs):\n\n tie_list = []\n try:\n n_inputs = models[0].n_inputs\n except TypeError:\n n_inputs = models.n_inputs\n\n self._data = Dataset(n_inputs, x, y, z, ...
[ "0.6609139", "0.63325053", "0.63325053", "0.63325053", "0.63325053", "0.63325053", "0.63325053", "0.63325053", "0.63325053", "0.63325053", "0.63325053", "0.62771976", "0.62404776", "0.6146944", "0.61149955", "0.6077977", "0.6064517", "0.6041971", "0.6025611", "0.60122913", "0...
0.0
-1
To create the summed profile of all individual profiles in an instance, we can use a list comprehension to iterate over all profiles in the instance. Note how we now use `instance.profiles` to get this dictionary, where in chapter ` we simply used `instance`.
def model_data_from_instance(self, instance: af.ModelInstance) -> np.ndarray: return sum( [ profile.profile_from_xvalues(xvalues=self.dataset.xvalues) for profile in instance.profiles ] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_all(profile):\n params = {}\n params[\"profile\"] = profile\n response = utils.do_request(instanceprofile, \"get\", params)\n data = utils.get_data(\"InstanceProfiles\", response)\n return data", "def add_profile(self, profile):\r\n self.profiles.append(profile)", "def calculate...
[ "0.61369634", "0.5885941", "0.5739842", "0.56562793", "0.5639097", "0.5628797", "0.56232256", "0.56074524", "0.5585603", "0.5508757", "0.5508473", "0.549711", "0.54968506", "0.54808754", "0.54765385", "0.54575425", "0.54535663", "0.5451851", "0.54071444", "0.54000574", "0.537...
0.58057755
2
Call the `FitDataset` class in `fit.py` to create an instance of the fit, whose `log_likelihood` property is used in the `log_likelihood_function`.
def fit_from_model_data(self, model_data: np.ndarray) -> f.FitDataset: return f.FitDataset(dataset=self.dataset, model_data=model_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_likelihood_function(self, instance):\r\n\r\n xvalues = np.arange(self.data.shape[0])\r\n model_data = instance.profile_from_xvalues(xvalues=xvalues)\r\n residual_map = self.data - model_data\r\n chi_squared_map = (residual_map / self.noise_map) ** 2.0\r\n log_likelihood =...
[ "0.64182335", "0.6336622", "0.63175833", "0.6288201", "0.6241241", "0.61574674", "0.61114955", "0.60703874", "0.6052201", "0.60460335", "0.60191625", "0.59869045", "0.5968725", "0.5947575", "0.59368837", "0.5896655", "0.58380103", "0.5819216", "0.5817973", "0.5807584", "0.580...
0.0
-1
This visualize function is used in the same fashion as it was in chapter 1. The `Visualizer` class is described in tutorial 2 of this chapter.
def visualize( self, paths: af.Paths, instance: af.ModelInstance, during_analysis: bool ): model_data = self.model_data_from_instance(instance=instance) fit = self.fit_from_model_data(model_data=model_data) self.visualizer.visualize_dataset(paths=paths, dataset=self.dataset) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_visuals(self):\n pass", "def visualize(self):\n # TODO\n #pyLDAvis.enable_notebook()\n #vis = pyLDAvis.gensim.prepare(self.lda_model, self.stemmed_corpus)\n return", "def visualise(self):\n\n scores, education = self.get_data()\n self.write_data(scores, education)\n...
[ "0.7063717", "0.70084274", "0.6780399", "0.67113185", "0.6641346", "0.6596172", "0.634411", "0.62974614", "0.6267937", "0.62584573", "0.6230526", "0.62199605", "0.6215069", "0.62079453", "0.6161333", "0.6143889", "0.6129229", "0.6113831", "0.6110358", "0.6108171", "0.6070151"...
0.0
-1
Save files like the dataset, mask and settings as pickle files so they can be loaded in the ``Aggregator``
def save_attributes_for_aggregator(self, paths): # These functions save the objects we will later access using the aggregator. They are saved via the `pickle` # module in Python, which serializes the data on to the hard-disk. with open(f"{paths.pickle_path}/dataset.pickle", "wb") as f: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pickle_data(self):\n if 'data_sets.pckl' in self.expected_pickles:\n to_file(\n self.data_sets,\n os.path.join(self.logdir, 'data_sets.pckl')\n )\n if 'all_params.pckl' in self.expected_pickles:\n to_file(\n self.all_pa...
[ "0.71841556", "0.7051201", "0.6999294", "0.69657177", "0.6965532", "0.67290497", "0.6701712", "0.67006266", "0.66806704", "0.6629543", "0.662331", "0.66160923", "0.6615659", "0.66139543", "0.659722", "0.65589774", "0.65515673", "0.65493506", "0.6524547", "0.64821887", "0.6479...
0.7810631
0
Initializes pythontwitter wrapper with the Twitter API credentials
def __init__(self): self.api = Api(consumer_key=credentials["consumer_key"], consumer_secret=credentials["consumer_secret"], access_token_key=credentials["access_token_key"], access_token_secret=credentials["access_token_secret"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_twitter():\n auth = tweepy.OAuthHandler(credentials[\"twitter\"][\"consumer_key\"], credentials[\"twitter\"][\"consumer_secret\"])\n auth.set_access_token(credentials[\"twitter\"][\"access_token\"], credentials[\"twitter\"][\"access_token_secret\"])\n return tweepy.API(auth)", "def __init__(se...
[ "0.8182253", "0.7952092", "0.78614396", "0.78030735", "0.7798696", "0.7798696", "0.77020943", "0.7680609", "0.76543593", "0.75703394", "0.75466865", "0.7542911", "0.7506404", "0.74154884", "0.7342675", "0.72171617", "0.71095985", "0.71095985", "0.71095985", "0.71095985", "0.7...
0.6326717
40
Verifies if the given tokens are valid
def verify_credentials(self): try: self.api.VerifyCredentials() logging.info('Successfully verified') return True except TwitterError as e: logging.error('Error verifying credentials: %s', e.message[0]['message']) return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unused_token_is_valid(self):\n assert self.token.is_valid()", "async def validate_token(self, token):", "def _check_tokens(number_token=None, name_token=None, gpe_token=None):\n assert number_token is None or number_token == number_token.lower(), \\\n \"Tokens need to be lowercase: %s...
[ "0.76983315", "0.7479158", "0.73251635", "0.7157225", "0.71501803", "0.7138056", "0.7013063", "0.69469047", "0.6733868", "0.66120076", "0.65514505", "0.6477569", "0.6383798", "0.6369523", "0.6334665", "0.6297028", "0.6261812", "0.6243167", "0.62244207", "0.62236446", "0.61701...
0.0
-1
Posts a twit on the moody_py account
def tweet(self, twitter_post, instruction): if instruction is None: logging.error('Instruction parameter missing') return TwitterResponse(description='Instruction parameter missing') if instruction == Instruction.PROCESS_WEATHER_DATA: twit_content = "{}, {} {} C {}"....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_to_twitter(tweet):\n auth = tweepy.OAuthHandler(\n os.environ['BLADAMADUR_CONSUMER_KEY'],\n os.environ['BLADAMADUR_CONSUMER_SECRET'])\n auth.set_access_token(\n os.environ['BLADAMADUR_ACCESS_TOKEN'],\n os.environ['BLADAMADUR_ACCESS_TOKEN_SECRET'])\n api = tweepy.API(au...
[ "0.7384305", "0.73712504", "0.697456", "0.6869901", "0.6778252", "0.6729129", "0.6716007", "0.670674", "0.6551957", "0.65180176", "0.6512323", "0.6452721", "0.643159", "0.641381", "0.63216686", "0.6315954", "0.6310251", "0.629947", "0.6298899", "0.6287242", "0.6287242", "0....
0.687649
3
The name of this component.
def name(self): return "component_manager"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_component_name(self):\n return self._name", "def name(self):\r\n return self.component.get(\"Name\", \"\")", "def name(self):\r\n return self.component.get(\"Name\", \"\")", "def get_name(self):\n return COMPONENT_LIST[self.index][0]", "def name(self):\n return se...
[ "0.9065345", "0.897935", "0.897935", "0.8652009", "0.8357189", "0.8357189", "0.8357189", "0.8357189", "0.8357189", "0.8357189", "0.8357189", "0.8357189", "0.8357189", "0.8357189", "0.83296686", "0.83296686", "0.83296686", "0.83296686", "0.83296686", "0.83296686", "0.83296686"...
0.0
-1
Called by the simulation context.
def setup(self, configuration, lifecycle_manager): self.configuration = configuration self.lifecycle = lifecycle_manager self.lifecycle.add_constraint( self.get_components_by_type, restrict_during=["initialization", "population_creation"], ) self.lifecycl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n\t\t\n\t\tpass", "def run(self): \r\n return", "def make_simulation(self):\n pass", "def run(self):\r\n pass", "def RUN(self):", "def postRun(self):\n pass", "def _setup_simulation(self\n ) -> None:\n pass", "def run(s...
[ "0.70393395", "0.69843966", "0.69002396", "0.68817323", "0.67909", "0.67798424", "0.67723346", "0.6762831", "0.6762831", "0.6762831", "0.6762831", "0.6762831", "0.6762831", "0.6762831", "0.6762831", "0.6762831", "0.6762831", "0.6762831", "0.6762831", "0.6762831", "0.6762831",...
0.0
-1
Registers new managers with the component manager. Managers are configured and setup before components.
def add_managers(self, managers: Union[List[Any], Tuple[Any]]): for m in self._flatten(managers): self.apply_configuration_defaults(m) self._managers.add(m)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_manager(self) -> None:\n\n #Clean out the process list.\n self.process_list.clear()\n for _ in range(self.num_processes):\n p = Process(target=self.multiprocessing_job,\n args=(self.process_job,))\n self.process_list.append(p)\n sel...
[ "0.61248213", "0.60335684", "0.6032508", "0.5993886", "0.59699", "0.58547497", "0.5809432", "0.56251633", "0.56170464", "0.56035906", "0.55961794", "0.5585247", "0.5480994", "0.54456997", "0.53996974", "0.53993297", "0.53955936", "0.5385212", "0.5380328", "0.5357524", "0.5357...
0.74649
0
Register new components with the component manager. Components are configured and setup after managers.
def add_components(self, components: Union[List[Any], Tuple[Any]]): for c in self._flatten(components): self.apply_configuration_defaults(c) self._components.add(c)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_component(var, config):\n id_ = text_type(var.base)\n if id_ not in CORE.component_ids:\n raise ValueError(u\"Component ID {} was not declared to inherit from Component, \"\n u\"or was registered twice. Please create a bug report with your \"\n ...
[ "0.6344829", "0.63038844", "0.6204114", "0.6132295", "0.6074433", "0.5977594", "0.5963998", "0.5922624", "0.591374", "0.58610815", "0.5751899", "0.57106787", "0.5632077", "0.5617429", "0.56010264", "0.559912", "0.5562307", "0.5527054", "0.551372", "0.551043", "0.5477497", "...
0.5851719
10