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
This generalization of kron can be used in 2 ways. It can straight forwardly take the tensor product of operators given the arguments i.e superkron(I,Z,X) will return the tensor product of I, Z and X. It can also do something more general. It can accept a dictionary of operators and a string variable that specifies in ...
def superkron(*args, val=0, string=''): out = 1 if val == 0: for i in range(len(args)): out = kron(out, args[i]) else: for digit in string: out = kron(out, args[0][digit]) return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrapped_kronecker(operator_1, operator_2):\n return scipy.sparse.kron(operator_1, operator_2, 'csc')", "def _kron_core(*ops, stype=None, coo_build=False, parallel=False):\n tmp_stype = \"coo\" if coo_build or stype == \"coo\" else None\n reducer = par_reduce if parallel else functools.reduce\n re...
[ "0.6527015", "0.65184176", "0.6495759", "0.6454937", "0.64209217", "0.6300958", "0.62514806", "0.6235155", "0.5904813", "0.58663565", "0.57320786", "0.5712016", "0.5634301", "0.5531212", "0.55011654", "0.5418882", "0.5387492", "0.53842014", "0.53497887", "0.5278386", "0.52774...
0.6138414
8
Gets a complex vector in C^d and produces a real vector in R^2d
def realify(vec): realified = [] a = vec.tolist() for i in a[0]: real_part = i.real realified.append(real_part) for i in a[0]: imag_part = i.imag realified.append(imag_part) realified = np.array(realified) return realified
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complex_magnitude(c):\n return (c * c.conjugate()) ** 0.5", "def complex(real, imag):", "def _complex(real, imag):\n real = np.asarray(real)\n imag = np.asarray(imag)\n cplx = 1j * imag \n return cplx + real", "def complex_inverse(c1,cr):", "def real_of_complex(z):\n return np.vstack...
[ "0.7253624", "0.7182984", "0.71656555", "0.70819247", "0.70349497", "0.6909833", "0.67579955", "0.6634494", "0.65789676", "0.6569811", "0.6563385", "0.6507573", "0.64937395", "0.64186794", "0.6414348", "0.64124167", "0.6404053", "0.63613313", "0.6354115", "0.6311204", "0.6250...
0.5668276
69
Useful when constructing unitaries to make quantum states. It needs to be input into gram schmidt orthogonalization method
def construct_preunitary(arr, array_list): s = array_list[1].shape preunitary = np.array([]) preunitary = np.append(preunitary, arr) preunitary = preunitary.reshape(1, s[1]) for i in range(1, len(array_list)): preunitary = np.hstack((preunitary, array_list[i])) preunitary = preunitary.re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__( self , power , the_phis = None ) :\n\n ## check the arguments \n assert isinstance ( power , num_types ) and int ( power ) == power and 0 <= power, \\\n \"Phases: invalid type/value for ``power''-parameter: %s/%s\" % ( power , type(power) )\n power = int ( powe...
[ "0.5909385", "0.5810368", "0.5763187", "0.57423675", "0.5733273", "0.5709202", "0.56170774", "0.56161934", "0.55760515", "0.55707914", "0.54700404", "0.5450743", "0.53737944", "0.5371641", "0.53648967", "0.535579", "0.5338217", "0.53352964", "0.53315026", "0.53248763", "0.532...
0.0
-1
Removes specific words from files and returns the file with same name but bad lines are removed
def remove_line(file, string=[]): with open(file, 'r') as f, open('tmp.txt', '+a') as new_f: for line in f: clean = True for word in string: if word in line: clean = False if clean is True: new_f.write(line) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_GOs(self):\n\n file = open(self.filename, 'r')\n new_file = open(self.temp_filename, 'w')\n for line in file:\n if \"GO\" not in line and \"go\" not in line:\n new_file.write(line)\n file.close()\n new_file.close()\n self.overwrite_file...
[ "0.6530023", "0.64687544", "0.64657426", "0.643936", "0.63439274", "0.6255501", "0.6159948", "0.6086295", "0.6086085", "0.60616916", "0.60099834", "0.5958632", "0.5916732", "0.58726555", "0.58483857", "0.5817161", "0.5817054", "0.5814065", "0.58092576", "0.5801109", "0.580010...
0.6500035
1
Write data to file in column format. Each keyword is a column
def save_to_file(name='', **kwargs): string = '' for k in kwargs: string += '{' + k + '}' + ' ' string += '\n' file = open(name, 'a') file.write(string.format(**kwargs)) file.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_data(self, filename,\n columns=('Q', 'R', 'dR'),\n header=None):\n if header is None:\n header = \"# %s\\n\"%' '.join(columns)\n with open(filename, 'wb') as fid:\n fid.write(asbytes(header))\n data = np.vstack([getattr(se...
[ "0.6221027", "0.6078891", "0.60711247", "0.6039951", "0.60351264", "0.60065895", "0.5969383", "0.5945531", "0.5918868", "0.59003776", "0.58955956", "0.588802", "0.58851725", "0.58790314", "0.5869868", "0.5849799", "0.5838432", "0.58361983", "0.5770194", "0.5768405", "0.576294...
0.0
-1
Internal tag stripping utility used by strip_tags.
def _strip_once(value): s = MLStripper() s.feed(value) s.close() return s.get_data()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_tag(args):", "def strip_tags(src):\n res = ''.join(BeautifulSoup(src).findAll(text=True))\n res = re.sub(r\"\\s+\", \" \", res).strip()\n return res", "def _strip_tags(value):\r\n return re.sub(r'<[^>]*?>', ' ', force_unicode(value))", "def _preprocess(self, tagged: List[Tuple]) -> Tup...
[ "0.6422434", "0.6422135", "0.6417006", "0.64156944", "0.63390356", "0.6240141", "0.6196964", "0.61389947", "0.61058277", "0.6091044", "0.6082325", "0.60043335", "0.5998592", "0.5998592", "0.59793687", "0.5949377", "0.59187335", "0.5878682", "0.58657026", "0.5850112", "0.58437...
0.0
-1
Return the given HTML with all tags stripped.
def strip_tags(value): # Note: in typical case this loop executes _strip_once once. Loop condition # is redundant, but helps to reduce number of executions of _strip_once. value = str(value) while "<" in value and ">" in value: new_value = _strip_once(value) if value.count("<") == new_va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stripHTMLTags (html):\r\n import re\r\n text = html\r\n \r\n # apply rules in given order!\r\n rules = [\r\n { r'>\\s+' : u'>'}, # remove spaces after a tag opens or closes\r\n { r'\\s+' : u' '}, # replace consecutive spaces\r\n { r'\\s*<br\\s*/?>\\s*' : u'\\n'},...
[ "0.82184535", "0.81930643", "0.81557626", "0.8141694", "0.81045276", "0.81004316", "0.803043", "0.79539573", "0.7940033", "0.7934653", "0.7933371", "0.79037124", "0.78986967", "0.7886259", "0.7878473", "0.7878473", "0.7841912", "0.78334934", "0.78334934", "0.78146344", "0.780...
0.0
-1
Searches the directory recursively for files with the passedin file name (not file path) set. Returns the file names of any matches.
def _FindFileNamesInDirectory(input_api, dir_path, search_file_names): matches = [] for _, _, file_names in input_api.os_walk(dir_path): for file_name in file_names: if file_name in search_file_names: matches.append(file_name) return matches
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _recursive_file_search(self, path, pattern):\n matches = []\n for root, dirnames, filenames in os.walk(path):\n for filename in fnmatch.filter(filenames, pattern):\n matches.append(os.path.join(root, filename))\n\n return matches", "def find_files(directory, fil...
[ "0.7796083", "0.7477516", "0.7372066", "0.733775", "0.72947305", "0.72270644", "0.7131149", "0.71299195", "0.7121892", "0.71138424", "0.7109738", "0.7094641", "0.7090112", "0.7039987", "0.70312285", "0.6994089", "0.69901896", "0.6963479", "0.69572544", "0.69526935", "0.693415...
0.7325236
4
Check that if |request_update_for_shell_apk_version| is updated it is the only change in the CL.
def _CheckChromeUpdateTriggerRule(input_api, output_api): if _CheckVersionVariableChanged(input_api, REQUEST_UPDATE_FOR_VERSION_LOCAL_PATH, REQUEST_UPDATE_FOR_VERSION_VARIABLE): if (len(input_api.AffectedFiles()) != 1 or len(input_api.Aff...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_updates():\n last_version = str(request.urlopen(__source__).read().decode(\"utf8\"))\n if str(open(__file__).read()) != last_version:\n log.warning(\"Theres new Version available!, Update from \" + __source__)\n else:\n log.info(\"No new updates!,You have the lastest version of...
[ "0.69817704", "0.68537796", "0.67906266", "0.6604481", "0.6522289", "0.64818054", "0.64153945", "0.63426113", "0.6202474", "0.6198753", "0.61828953", "0.61085165", "0.6076537", "0.60127264", "0.6009001", "0.60024965", "0.5982071", "0.59345007", "0.59335583", "0.59049", "0.589...
0.6769555
3
Check that if a file in $WAM_MINT_TRIGGER_LOCAL_PATHS is updated that |template_shell_apk_version| is updated as well.
def _CheckCurrentVersionIncreaseRule(input_api, output_api): files_requiring_version_increase = [] for f in input_api.AffectedFiles(): if f.ChangedContents(): local_path = input_api.os_path.relpath( f.AbsoluteLocalPath(), input_api.PresubmitLocalPath()).replace('\\', '/') for tri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_updates():\n last_version = str(request.urlopen(__source__).read().decode(\"utf8\"))\n if str(open(__file__).read()) != last_version:\n log.warning(\"Theres new Version available!, Update from \" + __source__)\n else:\n log.info(\"No new updates!,You have the lastest version of...
[ "0.59480643", "0.58289295", "0.57964", "0.57759136", "0.53680897", "0.5334255", "0.5307752", "0.5295217", "0.528286", "0.525433", "0.52535343", "0.52270526", "0.5215952", "0.52041125", "0.5189144", "0.51874846", "0.5187396", "0.51703596", "0.5161194", "0.51581484", "0.5148415...
0.5407697
4
Checks that if a file has been added to a res/ directory that its file name is unique to the res/ directory. res/values/dimens.xml and res/valuesv17/dimens.xml > OK res/values/dimens.xml and libs/common/res_splash/values/dimens.xml > BAD
def _CheckNoOverlappingFileNamesInResourceDirsRule(input_api, output_api): res_dir_file_names_map = {} for f in input_api.AffectedFiles(): local_path = input_api.os_path.relpath( f.AbsoluteLocalPath(), input_api.PresubmitLocalPath()).replace('\\', '/') for res_dir_local_path in RES_DIR_LOCAL...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_resfile(listname):\r\n global results_file, directory_res\r\n try:\r\n results_file = open(directory_res+listname+\".output\", \"r\")\r\n return True\r\n except:\r\n return False", "def validate(self, spec):\n d = spec.directory\n for file_name in os.listdir(...
[ "0.6195069", "0.61837715", "0.6021968", "0.5920074", "0.583933", "0.58312166", "0.56605995", "0.5639456", "0.5594713", "0.55712736", "0.55012786", "0.55012786", "0.5501188", "0.54754484", "0.54694206", "0.5450779", "0.5419939", "0.54080826", "0.5407323", "0.53906304", "0.5371...
0.5596819
8
Checks common to both upload and commit.
def _CommonChecks(input_api, output_api): result = [] result.extend(_CheckChromeUpdateTriggerRule(input_api, output_api)) result.extend(_CheckCurrentVersionIncreaseRule(input_api, output_api)) result.extend(_CheckNoOverlappingFileNamesInResourceDirsRule(input_api, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testCheckChangeOnUploadWithEmptyAffectedFileList(self, _):\n diff_file_chromium1_h = ['some diff']\n diff_file_chromium2_h = ['another diff']\n diff_file_layout_test_html = ['more diff']\n mock_input_api = MockInputApi()\n mock_input_api.files = []\n # Access to a prot...
[ "0.61919343", "0.6017219", "0.5985389", "0.59435034", "0.59289926", "0.5904462", "0.58712673", "0.58421326", "0.5817588", "0.5799402", "0.5788161", "0.5749811", "0.5734672", "0.5721772", "0.57161516", "0.5686996", "0.5659645", "0.56544584", "0.5618077", "0.5618063", "0.559031...
0.0
-1
Pickles the raw images
def dump(self, img_labels, images_base_directory, destination_pickle_path, destination_pickle_file_name, preprocessing_transformer): # Load images_base_directory # files_per_pickle = len(img_labels) // parts # pickle_part_num = 1 result = None images = [] for i in range(l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getimgs():", "def Read_Raw_Images(path_data,path_labels):\n \n data = skimage.io.imread(path_data).astype(np.float32)\n for i in range(data.shape[0]):\n data[i,...] = skimage.exposure.rescale_intensity(data[i,...], out_range=(0,1))\n data_labels = skimage.io.imread(path_labels) > 0\n \n...
[ "0.6534259", "0.62466824", "0.61905247", "0.61871415", "0.6170488", "0.60333925", "0.6026292", "0.6017525", "0.5964287", "0.5951983", "0.59493524", "0.59432364", "0.5941363", "0.5899673", "0.5880692", "0.58698577", "0.58665174", "0.5857296", "0.5857296", "0.5857296", "0.58539...
0.6040779
5
Checks if parameter is output parameter. Returns True if parameter has key 'gisprompt.age' == 'new', False otherwise.
def isOutput(parameter): try: if '@age' in parameter['gisprompt'].keys(): return (parameter['gisprompt']['@age'] == 'new') else: return False except KeyError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_output(self, output):\n return output == self.output", "def check(self) -> Tuple[bool, str]:\n if self[\"changed\"]:\n return True, \"\"\n else:\n return False, \"The \" + self[\"name\"] + \" parameter have to be set\"", "def params_ok(): \n \n if ...
[ "0.5807495", "0.56992525", "0.557156", "0.5501243", "0.54481214", "0.5438", "0.5403741", "0.53788143", "0.53770506", "0.5369349", "0.53541017", "0.5340148", "0.5340148", "0.5340148", "0.530699", "0.52968436", "0.5277953", "0.5249121", "0.5176042", "0.5163241", "0.5161659", ...
0.924517
0
Parses output of GRASS interfacedescription and returns openEO process object
def ParseInterfaceDescription(xml_string, keys=None): gm_dict = xmltodict.parse(xml_string)['task'] module_id = gm_dict['@name'] description = gm_dict['description'] categories = gm_dict['keywords'].replace(' ', '').split(',') categories.append('grass-module') parameters = {} returns = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process():\n reader = owslib.wps.WPSDescribeProcessReader()\n root = reader.readFromString(open(resource_file(\"process_description.xml\")).read())\n xml = root.findall(\"ProcessDescription\")[0]\n return owslib.wps.Process(xml)", "def parse_os_info(self):\n pipe = subprocess.Popen([self.c...
[ "0.5585331", "0.55455714", "0.55155593", "0.5485775", "0.5353875", "0.52453214", "0.5239776", "0.515878", "0.5139114", "0.51333976", "0.5119332", "0.5111082", "0.5097562", "0.5060103", "0.5051946", "0.50517285", "0.5047649", "0.50408345", "0.50263286", "0.50263286", "0.502632...
0.47916546
52
From the game result string, extract the winner's id.
def _determine_winner(game_result): return next(line for line in game_result.splitlines() if re.compile(_WINNING_RANK_STRING).search(line)).split(_SPACE_DELIMITER)[_BOT_ID_POSITION]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_uniprot_id(uniprot_result):\n id_lines = [l for l in uniprot_result.split('\\n') if l.startswith('ID')]\n\n for id_line in id_lines:\n return id_line.split()[1]\n\n return None", "def get_run_id_from_result(model_result):\n if 'ml_flow' not in model_result:\n return None...
[ "0.6389786", "0.6329488", "0.61289394", "0.5958591", "0.5893738", "0.5817661", "0.5805153", "0.58014286", "0.5724729", "0.56584716", "0.56151605", "0.5602205", "0.55870014", "0.55432886", "0.55321854", "0.54670435", "0.54463226", "0.54409176", "0.5419892", "0.53860986", "0.53...
0.7051588
0
Plays one game considering the specified bots and the game and map constraints.
def _play_game(binary, map_width, map_height, bot_commands): game_run_command = '\"{}\" -d "{} {}" -t'.format(binary, map_width, map_height) for bot_command in bot_commands: game_run_command += " \"{}\"".format(bot_command) return subprocess.check_output(game_run_command, shell=True).decode()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_game(map_settings, players, **kwargs) -> Union[Result, List[Optional[Result]]]:\n if sum(isinstance(p, (Human, Bot)) for p in players) > 1:\n host_only_args = [\"save_replay_as\", \"rgb_render_config\", \"random_seed\", \"sc2_version\", \"disable_fog\"]\n join_kwargs = {k: v for k, v in kw...
[ "0.64811915", "0.6312781", "0.60999507", "0.60926616", "0.6040818", "0.59653705", "0.59286845", "0.5846582", "0.5824571", "0.5776197", "0.576185", "0.57472235", "0.5744895", "0.57314324", "0.56971264", "0.56946355", "0.56720424", "0.5665085", "0.56599295", "0.56463945", "0.56...
0.5764885
10
Runs number_of_runs games using the designated bots and binary, recording the tally of wins per player
def play_games(binary, map_width, map_height, bot_commands, number_of_runs): print("Comparing Bots!") result = {} if not(len(bot_commands) == 4 or len(bot_commands) == 2): raise IndexError("The number of bots specified must be either 2 or 4.") for current_run in range(0, number_of_runs): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run_match(bots, nr_of_games) -> dict:\n\n start, game_results = datetime.now().timestamp(), _run_games(nr_of_games, bots)\n match_duration = datetime.now().timestamp() - start\n\n match_json = _match_result(game_results, match_duration)\n _print_match_end_score(match_json, match_duration)\n ret...
[ "0.6457276", "0.6405058", "0.63816977", "0.6365274", "0.6318773", "0.62803453", "0.6180857", "0.6159016", "0.6089046", "0.59996665", "0.59805876", "0.5962676", "0.59359556", "0.59175366", "0.59158796", "0.5890217", "0.5871049", "0.5856832", "0.58529985", "0.58124524", "0.5800...
0.7698103
0
r"""Verify a simple DAG pipeline runs and captures logs as expected.
def test_run_and_logs(self, registered_model): create_standard_model = functools.partial( registered_model.create_standard_model, code_dependencies=[], environment=Python([]), ) echo_model_ver = create_standard_model(Echo) double_model_ver = create_sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_build_pipeline_six(self):\n args = \"Test_APP FIVE A B\".split(\" \")\n task_list = build_pipeline(args, False)\n self.assertEqual(1, len(task_list))", "def test_pipeline_runner_main():\n working_dir = os.path.join(\n os.getcwd(),\n 'tests')\n pypyr.pipelinerunne...
[ "0.65219057", "0.64891356", "0.64445233", "0.64214414", "0.6386529", "0.6375167", "0.62957263", "0.6271578", "0.6222027", "0.61659265", "0.60646236", "0.60298234", "0.60103154", "0.5998008", "0.5974212", "0.5972701", "0.59685767", "0.594035", "0.58930403", "0.58778256", "0.58...
0.6119972
10
Save a PNG plot visualizing posterior uncertainty on heldout data.
def plot_heldout_prediction(input_val, y_val, mu_val, sigma_val, fname=None, n=1, title=""): fig = figure.Figure(figsize=(9, 3 * n)) canvas = ba...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cb_save(event):\n fig.savefig('sample.univariate_discrete.py.png', dpi=300, format='png', transparent=True)", "def save(file_name):\n setup()\n plt.savefig(file_name)", "def export(self, path):\r\n # Save plot as png\r\n dt = m.get_instance().dt\r\n self.perception_history = m...
[ "0.72815305", "0.6994909", "0.68869275", "0.65535516", "0.6454215", "0.6431693", "0.6421337", "0.63826656", "0.63084036", "0.6303676", "0.6301993", "0.629871", "0.6241234", "0.6240071", "0.6239843", "0.6228209", "0.62094927", "0.611023", "0.6079249", "0.60417473", "0.60310334...
0.6270795
12
Construct a Game bean beanContext is an instance of nova.beanContext.BeanContext
def createBean(self, beanContext): currentTime = DateTime.now() return game.Game().construct(self.serialNum(), self.startTime(), self.endTime(), currentTime, nextProductionTime(currentTime, self), \ self.deathProbeCost(), self.spyProbeCost(), self.factoryCost(), self.speedCost(), self.rangeCost(), self.pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,context=''):\n if context=='': \n context_name=self.__class__.__name__\n else: \n context_name=context+'.'+self.__class__.__name__ \n if not (context_name in self.__class__._nInstancesContextList):\n self.__class__._nInstancesContextList.appen...
[ "0.5429802", "0.5398456", "0.52547485", "0.51466453", "0.5145113", "0.5114401", "0.5002459", "0.49618447", "0.49233636", "0.49038294", "0.4899187", "0.48675564", "0.48630452", "0.48493588", "0.4817039", "0.4813379", "0.48067135", "0.48053434", "0.48048058", "0.480347", "0.479...
0.77193683
0
Return the 'Nobody' player for the game
def nobody(self): return self._mk_store.fetchObjectsOfClass(Player, clauses="WHERE gameId = %d AND name = 'Nobody'" % self.sqlObjRef())[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opponent(self, player):\r\n # player = core.BLACK (can do this for any static var)\r\n if player == core.BLACK:\r\n return core.WHITE\r\n else:\r\n return core.BLACK", "def get_opponent(self):\n for cell in self.__state.board.find_workers():\n play...
[ "0.7179082", "0.71346235", "0.70811814", "0.7037287", "0.6971815", "0.69505286", "0.6927338", "0.68758464", "0.68403226", "0.6769221", "0.67114675", "0.6703061", "0.6703061", "0.6701386", "0.6669454", "0.66185004", "0.6609078", "0.6556283", "0.6543647", "0.6519385", "0.651381...
0.80251557
0
Draw something to a surface. The offset is a x and y tuple which offsets the final position.
def draw(self, screen, offsets: tuple): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self, offset: IntegerPosition2D, canvas: Canvas) -> None:\n canvas_position: IntegerPosition2D\n if not self.buffer:\n canvas_position = IntegerPosition2D(0, 0)\n else:\n row: int = self.buffer.get_row(self.index)\n column: int = self.buffer.get_column...
[ "0.71174616", "0.6813651", "0.6532218", "0.6521753", "0.6519349", "0.6490653", "0.6319898", "0.6258449", "0.6215199", "0.6161956", "0.6161956", "0.61448157", "0.6084019", "0.60630345", "0.60574555", "0.6041663", "0.59853274", "0.5980514", "0.59275645", "0.5915207", "0.5913053...
0.70662737
1
Gets called 60 times a second.
def tick(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def everytime(self):\n return True", "async def _timein_refresh(self):\n\t\t\n\t\tawait self.refresh_cache()", "def _inst_run(self):\r\n self._inst_get_img_info_from_db()\r\n print(\"run method: \", time.ctime())\r\n th = threading.Timer(\r\n 10,\r\n self._inst...
[ "0.6385242", "0.63584125", "0.6151215", "0.6067275", "0.6057214", "0.605076", "0.60446185", "0.60382575", "0.60161215", "0.59875643", "0.5986476", "0.59559673", "0.58786386", "0.5877851", "0.58549607", "0.5854388", "0.58293724", "0.58263654", "0.57705706", "0.57678723", "0.57...
0.5468217
63
Add a thing to a specific section. Leaving out index will append it, otherwise will insert at specific index.
def add_to_drawn(section: str, thing: Base, index: int=None): if index is None: drawn[section].append(thing) else: drawn[section].insert(index, thing)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_new_section(self, name, context=...):\n ...", "def add_section(self, section, lyrics):\n self.sections[section] = lyrics", "def add_section(self, section_name: str) -> None:\n pass", "def add_section(self, section_name: str) -> None:\n pass", "def add_section(self, secti...
[ "0.6761237", "0.66035444", "0.6566462", "0.6566462", "0.6247197", "0.61579007", "0.61553264", "0.60965484", "0.6061076", "0.6059241", "0.6051624", "0.604102", "0.6035189", "0.60212517", "0.6017513", "0.6003912", "0.599046", "0.59664154", "0.5942525", "0.59222454", "0.58979625...
0.76561177
0
Remove a thing from a specific section using a specific index.
def remove_from_drawn(section: str, index: int): del drawn[section][index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, index):\n raise NotImplementedError()", "def delete_at_index(self, index: int) -> T:\n pass", "def delete_at_index(self, index: int) -> T:\n pass", "def removeRow(self, index: int) -> None:\n ...", "def __delitem__(self, index: Any) -> None:\n del self.co...
[ "0.70469296", "0.69429576", "0.69429576", "0.6858212", "0.67361236", "0.66979665", "0.6678134", "0.66500795", "0.6619056", "0.6598444", "0.6516929", "0.6505775", "0.6504128", "0.6432966", "0.6431581", "0.6431434", "0.63970387", "0.63944894", "0.639437", "0.6385715", "0.631306...
0.7609031
0
This will execute all the operations selection according to the instance.
def ks_execute_operation(self): if self.ks_sync_orders or self.ks_sync_customers or self.ks_sync_coupons or self.ks_sync_products or \ self.ks_sync_attributes or self.ks_sync_product_tags or self.ks_sync_product_category or \ self.ks_sync_payment_gateways or self.ks_publish_produ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(self):", "def execute(self):", "def execute(self):", "def execute(self):", "def execute(self):\r\n pass", "def execute(self):\n\t\tpass", "def execute(self):\n\n pass", "def execute(self):\n\n pass", "def execute(self):\n\n pass", "def execute(self):\n\n ...
[ "0.662009", "0.662009", "0.662009", "0.662009", "0.6608843", "0.6564755", "0.655838", "0.655838", "0.655838", "0.655838", "0.6540609", "0.6540609", "0.6540609", "0.6540609", "0.6540609", "0.6540609", "0.6421845", "0.6409058", "0.63194174", "0.63194174", "0.6228255", "0.6196...
0.0
-1
Tests whether network rejects invalid hidden_layers inputted from user
def test_user_hidden_layers_input_rejections(): inputs_that_should_fail = [[["linearr", 33]], [["linear", 12, 33]], [["gru", 2, 33]], [["lstm", 2, 33]], [["lstmr", 33]], [["gruu", 33]], [["gru", 33], ["xxx", 33]], [["linear", 33], ["gru", 12], ["gru", 33]] ] for input in inputs_th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_RNN_layers_valid(self):\n error_msg_layer_type = \"First element in a layer specification must be one of {}\".format(self.valid_RNN_hidden_layer_types)\n error_msg_layer_form = \"Layer must be of form [layer_name, hidden_units]\"\n error_msg_layer_list = \"Layers must be provided as ...
[ "0.7171822", "0.63561493", "0.610897", "0.6082803", "0.6039953", "0.6018404", "0.57547784", "0.5728571", "0.57113945", "0.5701364", "0.5636148", "0.5581209", "0.55617243", "0.5515967", "0.55017126", "0.5476648", "0.54517835", "0.54494756", "0.5427705", "0.5413505", "0.5391189...
0.69881386
1
Tests whether network rejects invalid hidden_layers inputted from user
def test_user_hidden_layers_input_acceptances(): inputs_that_should_work = [[["linear", 33]], [["linear", 12]], [["gru", 2]], [["lstm", 2]], [["lstm", 1]], [["gru", 330]], [["gru", 33], ["linear", 2]] ] for input in inputs_that_should_work: assert RNN(input_dim=1, layers_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_RNN_layers_valid(self):\n error_msg_layer_type = \"First element in a layer specification must be one of {}\".format(self.valid_RNN_hidden_layer_types)\n error_msg_layer_form = \"Layer must be of form [layer_name, hidden_units]\"\n error_msg_layer_list = \"Layers must be provided as ...
[ "0.7171822", "0.69881386", "0.63561493", "0.6082803", "0.6039953", "0.6018404", "0.57547784", "0.5728571", "0.57113945", "0.5701364", "0.5636148", "0.5581209", "0.55617243", "0.5515967", "0.55017126", "0.5476648", "0.54517835", "0.54494756", "0.5427705", "0.5413505", "0.53911...
0.610897
3
Tests that create_hidden_layers works correctly
def test_hidden_layers_created_correctly(): layers = [["gru", 25], ["lstm", 23], ["linear", 5], ["linear", 10]] rnn = RNN(input_dim=5, layers_info=layers, hidden_activations="relu", output_activation="relu") assert type(rnn.hidden_layers[0]) == nn.GRU assert rnn.hidden_layers[0].input_si...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_visibility(self, data, visible):\n layer = Points(data)\n assert layer.visible is True\n\n layer = Points(data, visible=visible)\n assert layer.visible is visible\n\n layer.visible = not visible\n assert layer.visible is not visible", "def build_layers(self):\n ...
[ "0.6285836", "0.619946", "0.617445", "0.6167124", "0.5950911", "0.5936817", "0.58561146", "0.5794933", "0.5788519", "0.5737324", "0.5709296", "0.570217", "0.56971806", "0.5679431", "0.56654364", "0.5664339", "0.56596035", "0.56536275", "0.56391835", "0.56333864", "0.56308633"...
0.7149164
0
Tests that create_output_layers works correctly
def test_output_layers_created_correctly(): layers = [["gru", 25], ["lstm", 23], ["linear", 5], ["linear", 10]] rnn = RNN(input_dim=5, layers_info=layers, hidden_activations="relu", output_activation="relu") assert rnn.output_layers[0].in_features == 5 assert rnn.output_layers[0].out_features == 10 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_output_head_layers():\n for output_dim in [[[\"linear\", 3],[\"linear\", 9]], [[\"linear\", 4], [\"linear\", 20]], [[\"linear\", 1], [\"linear\", 1]]]:\n nn_instance = RNN(input_dim=5, layers_info=[[\"gru\", 20], [\"lstm\", 8], output_dim],\n hidden_activations=\"relu\",...
[ "0.70297605", "0.69095945", "0.67008126", "0.6463796", "0.64326644", "0.62291646", "0.615556", "0.615226", "0.60517156", "0.6034557", "0.60170466", "0.6016979", "0.60113925", "0.60038334", "0.5999134", "0.5999134", "0.5973484", "0.5926574", "0.59118354", "0.5879324", "0.58793...
0.7599407
0
Tests whether network rejects an invalid output_dim input from user
def test_output_dim_user_input(): inputs_that_should_fail = [-1, "aa", ["dd"], [2], 0, 2.5, {2}] for input_value in inputs_that_should_fail: with pytest.raises(AssertionError): RNN(input_dim=3, layers_info=[2, input_value], hidden_activations="relu", output_activation="relu") with p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error(input_, output):\n global number_of_neurons_by_layer\n if len(output) != number_of_neurons_by_layer[-1]:\n raise IndexError(\n f\"\\033[91mDesired output length is incorrect. It must be {number_of_neurons_by_layer[-1]}.\\033[m\")\n output = np.array(output).reshape(len(output),...
[ "0.6838607", "0.6454841", "0.63032913", "0.6283632", "0.6166759", "0.61523336", "0.6115839", "0.608904", "0.6088475", "0.6049992", "0.60479885", "0.60479844", "0.6031168", "0.6017515", "0.601701", "0.5978786", "0.59750605", "0.5965413", "0.59618676", "0.5956854", "0.59553415"...
0.71197593
0
Tests whether network rejects an invalid hidden_activations or output_activation from user
def test_activations_user_input(): inputs_that_should_fail = [-1, "aa", ["dd"], [2], 0, 2.5, {2}, "Xavier_"] for input_value in inputs_that_should_fail: with pytest.raises(AssertionError): RNN(input_dim=4, layers_info=[["linear", 2]], hidden_activations=input_value, output_ac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_hidden_layers_input_rejections():\n inputs_that_should_fail = [[[\"linearr\", 33]], [[\"linear\", 12, 33]], [[\"gru\", 2, 33]], [[\"lstm\", 2, 33]], [[\"lstmr\", 33]],\n [[\"gruu\", 33]], [[\"gru\", 33], [\"xxx\", 33]], [[\"linear\", 33], [\"gru\", 12], [\"gru\", 33]]...
[ "0.646115", "0.588715", "0.5790413", "0.5729977", "0.5634677", "0.56261045", "0.5624805", "0.56081295", "0.55690366", "0.55218625", "0.5504632", "0.5499097", "0.5493358", "0.54845136", "0.54714316", "0.5470243", "0.54539776", "0.544579", "0.5414394", "0.53987086", "0.53792995...
0.6299433
1
Tests whether network rejects an invalid initialiser from user
def test_initialiser_user_input(): inputs_that_should_fail = [-1, "aa", ["dd"], [2], 0, 2.5, {2}, "Xavier_"] for input_value in inputs_that_should_fail: with pytest.raises(AssertionError): RNN(input_dim=4, layers_info=[["linear", 2]], hidden_activations="relu", output_activat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parameter_net_invalid(self, mock_ghn, mock_grnam, mock_pwnam):\n # Should pass\n self.driver.check_for_setup_error()\n # Should throw exceptions\n self._fail_network_list = True\n self.configuration.hgst_net = 'Fred'\n self.assertRaises(exception.VolumeDriverExcep...
[ "0.6485824", "0.6225917", "0.61696994", "0.6149689", "0.6108564", "0.60041595", "0.5883205", "0.5870985", "0.5809604", "0.5742367", "0.5724536", "0.5699671", "0.5689126", "0.5671148", "0.56684226", "0.56614745", "0.56337553", "0.5632013", "0.5615396", "0.56135267", "0.5600927...
0.5697767
12
Tests whether batch_norm_layers method works correctly
def test_batch_norm_layers(): layers = [["gru", 20], ["lstm", 3], ["linear", 4], ["linear", 10]] rnn = RNN(layers_info=layers, hidden_activations="relu", input_dim=5, output_activation="relu", initialiser="xavier", batch_norm=True) assert len(rnn.batch_norm_layers) == 3 assert rnn.batch_no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cnn_batchnorm_dim(self):\n model = modelgen.generate_CNN_model((None, 20, 3), 2, [32, 32], 100)\n batchnormlay = model.layers[2]\n assert batchnormlay.output_shape == (None, 20, 32)", "def test_cnn_enough_batchnorm(self):\n model = modelgen.generate_CNN_model((None, 20, 3), 2...
[ "0.8106033", "0.80667454", "0.7956286", "0.78110313", "0.77823645", "0.74154824", "0.73335415", "0.7272949", "0.7086378", "0.70444816", "0.70052063", "0.6950574", "0.6918558", "0.6895405", "0.6852374", "0.6791033", "0.6783299", "0.6750765", "0.67006516", "0.6681655", "0.66285...
0.79899555
2
Tests that it throws an error if user tries to provide list of hidden layers that include linear layers where they don't only come at the end
def test_linear_layers_only_come_at_end(): layers = [["gru", 20], ["linear", 4], ["lstm", 3], ["linear", 10]] with pytest.raises(AssertionError): rnn = RNN(layers_info=layers, hidden_activations="relu", input_dim=4, output_activation="relu", initialiser="xavier", batch_norm=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_RNN_layers_valid(self):\n error_msg_layer_type = \"First element in a layer specification must be one of {}\".format(self.valid_RNN_hidden_layer_types)\n error_msg_layer_form = \"Layer must be of form [layer_name, hidden_units]\"\n error_msg_layer_list = \"Layers must be provided as ...
[ "0.74692565", "0.69579005", "0.6833342", "0.6695402", "0.6636951", "0.66085696", "0.6465696", "0.64110804", "0.63803566", "0.6348933", "0.6182347", "0.616117", "0.61357015", "0.60021096", "0.59823257", "0.5962591", "0.59096926", "0.59012794", "0.58661574", "0.5831734", "0.582...
0.6448731
7
Tests whether network outputs data that has gone through correct activation function
def test_output_activation(): RANDOM_ITERATIONS = 20 input_dim = 100 for _ in range(RANDOM_ITERATIONS): data = torch.randn((25, 10, 100)) RNN_instance = RNN(layers_info=[["lstm", 20], ["gru", 5], ["linear", 10], ["linear", 3]], hidden_activations="relu", input_dim=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sigmoid_activation(self):\n self.assertEqual([0.5, 0.5], list(\n af.Sigmoid().output(np.array([0, 0]))))\n self.assertEqual([0.25, 0.25], list(\n af.Sigmoid().derivative(np.array([0, 0]))))", "def test_output_activation_return_return_final_seq_only_off():\n RANDOM_...
[ "0.68730205", "0.67846847", "0.66975826", "0.6651164", "0.661632", "0.6461441", "0.63807184", "0.63212496", "0.6313192", "0.63074267", "0.62492007", "0.62348425", "0.6229038", "0.6172399", "0.61524916", "0.61336595", "0.61072147", "0.60924554", "0.60870665", "0.6061939", "0.6...
0.72898424
0
Tests whether network outputs data that has gone through correct activation function
def test_output_activation_return_return_final_seq_only_off(): RANDOM_ITERATIONS = 20 input_dim = 100 for _ in range(RANDOM_ITERATIONS): data = torch.randn((25, 10, 100)) RNN_instance = RNN(layers_info=[["lstm", 20], ["gru", 5], ["linear", 10], ["linear", 3]], hidd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_output_activation():\n RANDOM_ITERATIONS = 20\n input_dim = 100\n for _ in range(RANDOM_ITERATIONS):\n data = torch.randn((25, 10, 100))\n RNN_instance = RNN(layers_info=[[\"lstm\", 20], [\"gru\", 5], [\"linear\", 10], [\"linear\", 3]],\n hidden_activations...
[ "0.72898424", "0.68730205", "0.66975826", "0.6651164", "0.661632", "0.6461441", "0.63807184", "0.63212496", "0.6313192", "0.63074267", "0.62492007", "0.62348425", "0.6229038", "0.6172399", "0.61524916", "0.61336595", "0.61072147", "0.60924554", "0.60870665", "0.6061939", "0.6...
0.67846847
2
Tests whether setting a y range works correctly
def test_y_range(): for _ in range(100): val1 = random.random() - 3.0*random.random() val2 = random.random() + 2.0*random.random() lower_bound = min(val1, val2) upper_bound = max(val1, val2) rnn = RNN(layers_info=[["lstm", 20], ["gru", 5], ["lstm", 25]], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_y_range_user_input():\n invalid_y_range_inputs = [ (4, 1), (2, 4, 8), [2, 4], (np.array(2.0), 6.9)]\n for y_range_value in invalid_y_range_inputs:\n with pytest.raises(AssertionError):\n print(y_range_value)\n rnn = RNN(layers_info=[[\"lstm\", 20], [\"gru\", 5], [\"lstm\...
[ "0.69887966", "0.6787549", "0.6728513", "0.6704412", "0.66581345", "0.6623556", "0.65083843", "0.6419491", "0.64088297", "0.6408696", "0.6345011", "0.6308929", "0.62689686", "0.62398374", "0.62286705", "0.61892277", "0.6184476", "0.6139843", "0.6135049", "0.6135049", "0.61283...
0.7210425
0
Tests whether is able to handle user inputting None as output activation
def test_deals_with_None_activation(): assert RNN(layers_info=[["lstm", 20], ["gru", 5], ["lstm", 25]], hidden_activations="relu", output_activation=None, initialiser="xavier", input_dim=5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_none_input(self):\n eq_(None, output())", "def noinput():\n env.prompt = False", "def NoPrompt(self) -> bool:", "def __init__(self):\n self.the_input = raw_input().strip().replace(' ', '')\n if self.the_input == '':\n print ('No input detected')\n exit(1...
[ "0.79208875", "0.6521303", "0.6440907", "0.63686097", "0.6247845", "0.6149467", "0.614875", "0.60871434", "0.6086204", "0.6085143", "0.60612893", "0.60589445", "0.59811735", "0.5976643", "0.59697825", "0.59590137", "0.59576726", "0.5948883", "0.5945956", "0.5917923", "0.58935...
0.0
-1
Tests that check_input_data_into_forward_once method only runs once
def test_check_input_data_into_forward_once(): rnn = RNN(layers_info=[["lstm", 20], ["gru", 5], ["lstm", 25]], hidden_activations="relu", input_dim=5, output_activation="relu", initialiser="xavier") data_not_to_throw_error = torch.randn((1, 4, 5)) data_to_throw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_forward(self):\n validate_forward()", "def check_Data(self):\r\n \r\n if self._target_data is None:\r\n self.processData()", "def has_buffered_inputs(self):", "def forward_once(self, x):\n\t\t#x = F.normalize(self.network(x), p=2)\n\t\tx = self.network(x)\n\t\treturn ...
[ "0.61968815", "0.58582073", "0.5682138", "0.5575721", "0.5539609", "0.5531701", "0.5507432", "0.5409996", "0.53948504", "0.5367557", "0.5359325", "0.533804", "0.5321757", "0.52892125", "0.5246141", "0.52032685", "0.51893234", "0.51822394", "0.5180504", "0.5171261", "0.5169993...
0.6379902
0
Tests whether network rejects invalid y_range inputs
def test_y_range_user_input(): invalid_y_range_inputs = [ (4, 1), (2, 4, 8), [2, 4], (np.array(2.0), 6.9)] for y_range_value in invalid_y_range_inputs: with pytest.raises(AssertionError): print(y_range_value) rnn = RNN(layers_info=[["lstm", 20], ["gru", 5], ["lstm", 25]], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_target(self):\n y_valid = np.random.randint(2, size=100)\n y_invalid = np.random.uniform(size=100)\n\n oz = ClassBalance()\n\n with pytest.raises(YellowbrickValueError):\n oz.fit(y_invalid)\n\n with pytest.raises(YellowbrickValueError):\n oz...
[ "0.69277006", "0.67759", "0.66113496", "0.6391974", "0.6369389", "0.63201374", "0.63130033", "0.62934816", "0.626229", "0.624285", "0.62060905", "0.6107401", "0.60435826", "0.6005684", "0.5997749", "0.5965224", "0.59253037", "0.59052044", "0.5887826", "0.58822834", "0.5843428...
0.81492263
0
Checks if a given network is able to solve a simple problem
def solves_simple_problem(X, y, nn_instance): optimizer = optim.Adam(nn_instance.parameters(), lr=0.15) for ix in range(800): out = nn_instance.forward(X) loss = torch.sum((out.squeeze() - y) ** 2) / N optimizer.zero_grad() loss.backward() optimizer.step() print("LOSS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_whole_network(self):\n if not self.network.check_network():\n # check_network has failed, issue error\n self._display_semantic_error(\"network\")", "def test_check_network(network_with_devices):\n network = network_with_devices\n devices = network.devices\n names ...
[ "0.7131779", "0.7025503", "0.6738139", "0.63704544", "0.63352126", "0.63034153", "0.62601763", "0.6208311", "0.6193372", "0.61778873", "0.61509526", "0.61064", "0.60851043", "0.60542005", "0.60393006", "0.601454", "0.6002187", "0.5981219", "0.5966142", "0.59387124", "0.591576...
0.0
-1
Tests whether a small range of networks can solve a simple task
def test_model_trains(): for output_activation in ["sigmoid", "None"]: rnn = RNN(layers_info=[["gru", 20], ["lstm", 8], ["linear", 1]], input_dim=15, hidden_activations="relu", output_activation=output_activation, initialiser="xavier") assert sol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self, network):\n # Convert to a network if it is not.\n if not isinstance(network, NeuralNetwork):\n network = NeuralNetwork(network)\n \n steps, _, _ = self._loop(network, max_steps=100000)\n if steps < 100000:\n print((\"Failed 100k test with %d...
[ "0.6783458", "0.64321506", "0.62441313", "0.61896414", "0.61744946", "0.612199", "0.6099211", "0.6083165", "0.60603386", "0.6048442", "0.60126317", "0.59663063", "0.595257", "0.58757645", "0.5870619", "0.58563685", "0.585211", "0.585142", "0.5799482", "0.57957184", "0.5793637...
0.54056114
83
Tests that it raises an error if we try to do an embedding on negative data
def test_error_when_provide_negative_data_for_embedding(): N = 250 X = torch.randn((N, 5, 15)) X[0:125, 0, 3] += 20.0 y = X[:, 0, 3] > 5.0 y = y.float() with pytest.raises(AssertionError): rnn = RNN(layers_info=[["gru", 20], ["lstm", 8], ["linear", 1]], input_dim=15, hi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_extract_incorrect_embeddings():\n with pytest.raises(ValueError):\n model = BERTopic(language=\"Unknown language\")\n model._extract_embeddings([\"Some document\"])", "def test_embedder_raises_exception_for_incorrect_input_type(self):\n embed = layers.Embed(num_embeddings=10, feature...
[ "0.7797407", "0.69551307", "0.6756526", "0.6376604", "0.620987", "0.61232376", "0.6023977", "0.59729695", "0.59117335", "0.58505356", "0.5842247", "0.5827982", "0.5789328", "0.5751712", "0.56799704", "0.5669994", "0.56527793", "0.56489265", "0.56377167", "0.5577644", "0.55776...
0.7570276
1
Tests whether create_embedding_layers method works correctly
def test_embedding_layers(): for embedding_in_dim_1, embedding_out_dim_1, embedding_in_dim_2, embedding_out_dim_2 in zip(range(5, 8), range(3, 6), range(1, 4), range(24, 27)): nn_instance = RNN(input_dim=15, layers_info=[["gru", 20], ["lstm", 8], ["linear", 1]], embedding_dimensions...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_embedding_matrix_shape(self):\n num_embeddings = 10\n features = 5\n embed = layers.Embed(num_embeddings=num_embeddings, features=features)\n inputs = np.expand_dims(np.arange(features, dtype=np.int64), 1)\n variables = embed.init(jax.random.PRNGKey(0), inputs)\n embedding_matrix = varia...
[ "0.6754671", "0.66972744", "0.6680853", "0.65963113", "0.65625614", "0.64607567", "0.6458213", "0.643751", "0.64041454", "0.6341409", "0.62876004", "0.62862927", "0.6283644", "0.6279857", "0.61914355", "0.61818564", "0.61757904", "0.617194", "0.6163812", "0.6151228", "0.61408...
0.7215121
0
Tests that model trains when using embeddings
def test_model_trains_with_embeddings(): N = 250 X = torch.randn((N, 5, 15)) X[0:125, 0, 3] += 20.0 y = X[:, 0, 3] > 5.0 y = y.float() Z = copy.deepcopy(X) Z[:, :, 0] = abs(Z[:, :, 0]).long() rnn = RNN(layers_info=[["gru", 20], ["lstm", 8], ["linear", 1]], input_dim=15, hi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_build_with_embeddings(self):\n # Train a very small model\n dataset = KDDCupDataset()\n dataset.create_fixed_samples(\n *self.data, samples_num=1, partition_sizes=self.partition_sizes)\n dataset.set_current_sample(0)\n sentences = [[str(x) for x in numpy.arang...
[ "0.72196376", "0.71237755", "0.704444", "0.6993473", "0.68587327", "0.677294", "0.675533", "0.6684885", "0.66717297", "0.6624322", "0.6594463", "0.6589527", "0.6489075", "0.6450095", "0.63827366", "0.6311518", "0.62798834", "0.62602514", "0.6243312", "0.6233273", "0.62169766"...
0.6352863
15
Tests whether dropout layer reads in probability correctly
def test_dropout(): rnn = RNN(layers_info=[["lstm", 20], ["gru", 10], ["linear", 20], ["linear", 1]], hidden_activations="relu", output_activation="sigmoid", dropout=0.9999, initialiser="xavier", input_dim=15) assert rnn.dropout_layer.p == 0.9999 assert ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _Dropout(self, name, drop_prob):\n return super()._Dropout(name, keep_prob=1.0 - drop_prob)", "def compute_dropout(self, activations, dropout_prob = 0.5):\n # handle error\n if dropout_prob < 0 or dropout_prob > 1:\n dropout_prob = 0.5\n # scale the activations (see http://...
[ "0.67629886", "0.6578518", "0.6430722", "0.62942684", "0.62148696", "0.62001896", "0.61766964", "0.616204", "0.6118928", "0.6095642", "0.6074857", "0.60608095", "0.6050995", "0.60476774", "0.60386544", "0.59819704", "0.5975472", "0.59751296", "0.5924714", "0.5882051", "0.5881...
0.6646074
1
Tests that all activations get accepted
def test_all_activations_work(): nn_instance = RNN(layers_info=[["lstm", 20], ["gru", 10], ["linear", 20], ["linear", 1]], hidden_activations="relu", output_activation=None, dropout=0.0000001, initialiser="xavier", input_dim=15) for key in nn_instance.str_to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_accept_or_reject(self):\n for decision, expected_status in [(1, Transfer.ACCEPTED), (0, Transfer.REJECTED)]:\n transfer = random.choice(Transfer.objects.filter(process_status=Transfer.VALIDATED))\n self.assert_status_code(\n \"get\", reverse(\"appraise:list\"), ...
[ "0.6415789", "0.6383503", "0.6199055", "0.61586833", "0.6149722", "0.6138494", "0.6132158", "0.60875577", "0.60807586", "0.6079302", "0.6033272", "0.6018975", "0.601579", "0.5988945", "0.59615004", "0.59433323", "0.5895086", "0.58526635", "0.5849961", "0.5830023", "0.58249617...
0.56912756
54
Tests that all initialisers get accepted
def test_all_initialisers_work(): nn_instance = RNN(layers_info=[["lstm", 20], ["gru", 10], ["linear", 20], ["linear", 1]], hidden_activations="relu", output_activation=None, dropout=0.0000001, initialiser="xavier", input_dim=15) for key in nn_instance.str_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_01_Init(self):\n pass", "def test_init(self):\n self.assertEqual(self.ing_mgr.ingredient_list, [])\n self.assertEqual(self.ing_mgr.user_input, True)", "def test_init_default(self):\n self._test_init_default()", "def test_initialization(self):\n self.assertEqual(sel...
[ "0.70216167", "0.6774803", "0.66703606", "0.64539313", "0.6438114", "0.63028103", "0.6296848", "0.62899536", "0.6286861", "0.6273079", "0.6268029", "0.6249012", "0.62255603", "0.62252647", "0.6224343", "0.61891216", "0.6178358", "0.6172544", "0.61631143", "0.61234355", "0.611...
0.592791
55
Tests whether network outputs of correct shape
def test_output_shapes(): rnn = RNN(layers_info=[["gru", 20], ["lstm", 8], ["linear", 3]], hidden_activations="relu", initialiser="xavier", input_dim=15) output = rnn(X) assert output.shape == (N, 3) rnn = RNN(layers_info=[["gru", 20], ["lstm", 8], ["linear", 7]], hidden_act...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unet_verify_output_shape(simple_unet_data):\n unet = models.UNet()\n output = unet(simple_unet_data)\n print(\"Input shape:\", simple_unet_data.shape)\n print(\"Output shape:\", output.shape)\n assert simple_unet_data.shape == output.shape", "def dimension_check():\n print(\"### DIMENS...
[ "0.7367588", "0.7063788", "0.69999754", "0.69562316", "0.6948631", "0.68892664", "0.68857855", "0.6879901", "0.6879901", "0.68292147", "0.6785833", "0.6736189", "0.6731217", "0.6698011", "0.6661939", "0.6600723", "0.6569839", "0.6545449", "0.6511452", "0.6490843", "0.6480389"...
0.7374896
0
Checks whether network only accepts a valid boolean value for return_final_seq_only
def test_return_final_seq_user_input_valid(): for valid_case in [True, False]: assert RNN(layers_info=[["gru", 20], ["lstm", 8], ["linear", 7]], hidden_activations="relu", initialiser="xavier", return_final_seq_only=valid_case, input_dim=15) for invalid_case in [[True], 22, [1, 3], (T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __bool__(self):\r\n return self.valid", "def check_for_bool(check):", "def validate(self):\n\t\trVal = False\n\t\t#return rVal\n\t\treturn True", "def __bool__(self):\n return self.is_valid", "def validate(self):\n # rVal = False\n # return rVal\n return True", "def...
[ "0.6146068", "0.6059029", "0.59578097", "0.5924273", "0.5922708", "0.5791276", "0.57778454", "0.5729236", "0.57164973", "0.5700221", "0.56962913", "0.56714386", "0.5657782", "0.5627528", "0.56212014", "0.5613088", "0.5606647", "0.5603606", "0.55852324", "0.5579543", "0.556653...
0.5744099
7
Tests that having multiple output heads catches errors from user inputs
def test_output_heads_error_catching(): output_dims_that_should_break = [["linear", 2, 2, "SAME", "conv", 3, 4, "SAME"], [[["lstm", 3], ["gru", 4]]], [[2, 8]], [-33, 33, 33, 33, 33]] for output_dim in output_dims_that_should_break: with pytest.raises(AssertionError):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bad_input():\n\n for arg in ['5', 'ch']:\n rv, out = getstatusoutput('{} {}'.format(prg, arg))\n assert rv == 0\n expected = 'I do not know \"{}\".'.format(arg)\n assert out.strip() == expected", "def test_001(self):\n user_input = [\"0\",\"0\",\"1\"]\n with ...
[ "0.7316071", "0.685618", "0.6823957", "0.6820864", "0.6810941", "0.6792938", "0.6758819", "0.6752919", "0.66592836", "0.6565772", "0.6560659", "0.6541746", "0.6538069", "0.6533875", "0.65189856", "0.6461399", "0.64344615", "0.6359316", "0.63488054", "0.6324248", "0.63083804",...
0.64847004
15
Tests whether the output head layers get created properly
def test_output_head_layers(): for output_dim in [[["linear", 3],["linear", 9]], [["linear", 4], ["linear", 20]], [["linear", 1], ["linear", 1]]]: nn_instance = RNN(input_dim=5, layers_info=[["gru", 20], ["lstm", 8], output_dim], hidden_activations="relu", output_activation=["softm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_gz_batch(self):\n assert self.design.layout.layers[0].name == 'top'", "def test_output_head_shapes_correct():\n N = 20\n X = torch.randn((N, 10, 4)) * -20.0\n for _ in range(25):\n nn_instance = RNN(input_dim=4,\n layers_info=[[\"gru\", 20], [\"lstm\", 8], [\"linear\", ...
[ "0.64709437", "0.6327445", "0.62262976", "0.6176358", "0.61338794", "0.6049259", "0.5949284", "0.5947901", "0.5946794", "0.594015", "0.5908161", "0.5864121", "0.582288", "0.58142173", "0.5809196", "0.5793423", "0.57716125", "0.5731328", "0.57262856", "0.5711052", "0.569529", ...
0.73129505
0
Tests that output head activations work properly
def test_output_head_activations_work(): output_dim = [["linear", 5], ["linear", 10], ["linear", 3]] nn_instance = RNN(input_dim=5, layers_info=[["gru", 20], ["lstm", 8], output_dim], hidden_activations="relu", output_activation=["softmax", None, "relu"]) x = torch.randn((20, 12,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_trn_head():\n from mmaction.models.heads.trn_head import (RelationModule,\n RelationModuleMultiScale)\n trn_head = TRNHead(num_classes=4, in_channels=2048, relation_type='TRN')\n trn_head.init_weights()\n\n assert trn_head.num_classes == 4\n as...
[ "0.6236734", "0.6213275", "0.6145977", "0.5907997", "0.5812824", "0.57191104", "0.56966907", "0.5668249", "0.5625803", "0.5543424", "0.55362344", "0.5510609", "0.5454253", "0.544644", "0.5443262", "0.54215544", "0.5415511", "0.54015803", "0.5390789", "0.538465", "0.5355284", ...
0.5559491
9
Tests that the output shape of network is correct when using multiple outpout heads
def test_output_head_shapes_correct(): N = 20 X = torch.randn((N, 10, 4)) * -20.0 for _ in range(25): nn_instance = RNN(input_dim=4, layers_info=[["gru", 20], ["lstm", 8], ["linear", 1], ["linear", 12]], hidden_activations="relu") out = nn_instance(X) assert o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_shapes_coupling_out(self):\n\n out_single = self.coupling_net_odd(self.x_single_odd, self.y_single)\n out_batch = self.coupling_net_odd(self.x_batch_odd, self.y_batch)\n\n self.assertEqual(out_single.shape[0], 1,\n 'Batch shape mismatch on single instance in Co...
[ "0.7296105", "0.7296105", "0.70709145", "0.70210224", "0.6994198", "0.6923519", "0.6618199", "0.65257", "0.65257", "0.6494162", "0.6463666", "0.6409217", "0.62905854", "0.62666196", "0.61876714", "0.61641824", "0.61295414", "0.61267626", "0.61267626", "0.61154383", "0.6108088...
0.7155083
2
Decorator to set waiting cursor while function is running.
def waiting_cursor(function): def new_function(self): QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) try: function(self) except Exception as e: raise e print("Error {}".format(e.args[0])) finally: QApplication.restoreOverrideCu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_cursor(win):\n win.app.setOverrideCursor(gui.QCursor(core.Qt.WaitCursor))\n yield\n win.app.restoreOverrideCursor()", "def wait(func):\n def decorator(self, pkt: str) -> None:\n init_time = time.perf_counter()\n func(self, pkt)\n while time.perf_counter()...
[ "0.621839", "0.6173325", "0.60418564", "0.5873782", "0.58133435", "0.5802555", "0.56343734", "0.5622056", "0.55775356", "0.5572662", "0.55615383", "0.5531714", "0.54737693", "0.5402359", "0.5394669", "0.5377479", "0.5330632", "0.5328029", "0.53188837", "0.53006744", "0.530067...
0.7422905
0
Slot triggered when the button is clicked. Creates a new .csl file.
def on_pushButtonHelp_clicked(self, checked): help = Help.MainApp() help.setWindowTitle('Help for ' + TITLE) help.show() help.textEdit.setText(helpText)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cb_new(self, button):\n print(\"New File callback\")\n self.cb_save_as(button)", "def CreateNewFile(self):\n\t\tself.acad.Documents.Add()", "def newFile(self):\n self.open_file_name = None\n self.ui.main_edit.setText(\"\")\n self.saveEnabled(False)", "def new(self):\r\n...
[ "0.6893947", "0.66023135", "0.6593208", "0.65121573", "0.6401062", "0.63207823", "0.62781936", "0.62067664", "0.6142108", "0.61093783", "0.6075374", "0.6015218", "0.58974504", "0.58847827", "0.5734388", "0.5707925", "0.56786156", "0.56684", "0.5659722", "0.56219506", "0.56217...
0.0
-1
Slot triggered when the button is clicked. Creates a new .csl file.
def on_pushButtonCheck_clicked(self, checked): # get the file name to open #cslDir = self.settings.value('CslDir', '') # default = '' #options = QFileDialog.Options() #fileName, _ = QFileDialog.getOpenFileName(self, # "Open csl file", # cslDir, # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cb_new(self, button):\n print(\"New File callback\")\n self.cb_save_as(button)", "def CreateNewFile(self):\n\t\tself.acad.Documents.Add()", "def newFile(self):\n self.open_file_name = None\n self.ui.main_edit.setText(\"\")\n self.saveEnabled(False)", "def new(self):\r\n...
[ "0.6895971", "0.6606282", "0.65964454", "0.6513772", "0.64039904", "0.63240844", "0.62802327", "0.6209494", "0.61432064", "0.61116624", "0.60776496", "0.6018341", "0.5897397", "0.58868194", "0.57367384", "0.5708123", "0.56786484", "0.56706613", "0.5660706", "0.5622602", "0.56...
0.52957624
44
Slot triggered when the thread issues signal finishedSig.
def onThreadFinished(self): # reenable the button now thread method is finished self.pushButtonCheck.setEnabled(True) self.debug('Thread Method Finished!') qApp.restoreOverrideCursor()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __finish(self):\n self.finished.emit()", "def thread_finished(self):\n # self.worker.join()\n self.worker = None\n self.want_to_abort = False", "def finished(self, reply):\n pass", "def _finished(self) -> None:", "def finishThread(self):\n logging.info(\"Fin Th...
[ "0.7433008", "0.69723034", "0.67958206", "0.66644305", "0.6616974", "0.6565671", "0.6560136", "0.6429806", "0.6407112", "0.6362226", "0.63549864", "0.63026565", "0.62754816", "0.6253748", "0.6246546", "0.62232757", "0.6211996", "0.61976945", "0.6186162", "0.6116034", "0.60947...
0.6425185
8
Override inherited QMainWindow resize event. Saves the window geometry.
def resizeEvent(self, event): self.settings.setValue("geometry", self.saveGeometry()) super().resizeEvent(event)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resizeEvent(self, *args, **kwargs):\n self.windowMoved.emit()", "def resizeEvent(self, event):\r\n QDialog.resizeEvent(self, event)\r\n self.emit(SIGNAL(\"size_change(QSize)\"), self.size())", "def resizeEvent(self, event):\n self.resized.emit()\n return super(PiWndow, se...
[ "0.7568738", "0.73874474", "0.73514515", "0.7263355", "0.7208239", "0.7027689", "0.6980282", "0.6977833", "0.6970731", "0.6908289", "0.6868141", "0.682982", "0.6793767", "0.6758908", "0.6676213", "0.6672818", "0.6643312", "0.64994204", "0.6469828", "0.6464748", "0.64348876", ...
0.78121006
0
Override inherited QMainWindow move event. Saves the window geometry.
def moveEvent(self, event): self.settings.setValue("geometry", self.saveGeometry()) super().moveEvent(event)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moveEvent(self, *args, **kwargs):\n self.windowMoved.emit()", "def resizeEvent(self, *args, **kwargs):\n self.windowMoved.emit()", "def ev_windowmoved(self, event: WindowMoved) -> None:", "def _positionWindow(self):\n\t\tscreen = QtGui.QDesktopWidget().screenGeometry()\n\t\tself.setGeometry...
[ "0.7606414", "0.71723086", "0.71219075", "0.6784356", "0.66384774", "0.663542", "0.65639585", "0.65360874", "0.6531752", "0.6499311", "0.64266163", "0.6333455", "0.63130426", "0.62280285", "0.6225158", "0.62186563", "0.61726123", "0.6161794", "0.6124457", "0.61130536", "0.599...
0.7580476
1
Gets a random dad joke.
async def dadjoke(self, ctx): author = ctx.message.author joke = await self.get_joke() data = Embed.create(self, ctx, title='Demaratus Dad Jokes :joy:', description=joke) image = (f"https://media.discordapp.net/attachments/745608075670585344/770068453502877716...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_joke():\n joke = None\n\n while joke is None:\n service_num = randint(1, NUM_SERVICES)\n joke = load_joke(service_num)\n return joke", "def get_joke(self):\n if not self.jokes:\n self.__init__()\n index = random.randint(0, len(self.jokes) - 1)\n joke...
[ "0.7188688", "0.6922877", "0.68233687", "0.6660566", "0.6432047", "0.6295852", "0.59438914", "0.58900243", "0.5767906", "0.5690085", "0.56747085", "0.56361866", "0.5629127", "0.5591978", "0.55778074", "0.55778074", "0.55778074", "0.55380374", "0.5513841", "0.5504545", "0.5501...
0.5504928
19
Pop some bubble wrap!
async def bubblewrap(self, ctx): data = Embed.create( self, ctx, title="Bubblewrap!", description=( "||pop||||pop||||pop||||pop||||pop||||pop||||pop||||pop||||pop||||pop||\n" "||pop||||pop||||pop||||pop||||pop||||pop||||pop||||pop||||pop||||pop||\n" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop_bubble(self):\n i = self.cursor_bubble_collide()\n if i != -1:\n bubble = self.all_bubbles.sprites()[i]\n bubble.bubblekill()\n self.increase_score(bubble.get_value() * Settings.points_multiplier)", "def pop():", "def pop(self):", "def pop(self):", "de...
[ "0.6925461", "0.66646165", "0.6537013", "0.6537013", "0.6212795", "0.6212795", "0.61346465", "0.612005", "0.59507227", "0.5943642", "0.59259933", "0.5899823", "0.58830035", "0.58816", "0.5865467", "0.584214", "0.58349234", "0.5826333", "0.580838", "0.57985026", "0.5770079", ...
0.58795863
14
Replace acauses with those in the bridge map.
def get_computed_dataframe(self, df): df = add_nid_metadata(df, ['data_type_id'], **self.cache_options) has_verbal_autopsy = self.VA in df['data_type_id'].unique() if self.needs_bridging(has_verbal_autopsy): sheet_name = self.get_sheet_name(has_verbal_autopsy) map_df = p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def acause_to_bridge_code(self, df):\n df['swap'] = 0\n df.loc[\n (df['acause'] != df['bridge_code']) &\n (df['bridge_code'].notnull()),\n 'swap'\n ] = 1\n df.loc[df['swap'] == 1, 'acause'] = df['bridge_code']\n self.causes_not_in_bridge_map(df)\n...
[ "0.61886996", "0.57108057", "0.55985564", "0.55602914", "0.5543052", "0.544156", "0.53855085", "0.53791714", "0.52379787", "0.51952946", "0.51637304", "0.5134801", "0.51123565", "0.51105", "0.5107196", "0.50854534", "0.50727737", "0.5067354", "0.5023531", "0.5018238", "0.4986...
0.0
-1
Check data type and source to see if the bridge map is needed.
def needs_bridging(self, has_verbal_autopsy): sources_to_bridge_map = [ "India_SCD_states_rural", "India_CRS", "India_MCCD_states_ICD9", "India_MCCD_states_ICD10", "India_Maharashtra_SCD", "India_MCCD_Orissa_ICD10", "India_MCCD_Delhi_ICD10", "ICD9_BTL", "Russia_FM...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_base_type(cls, data):\n return _mapping_resolver.get_type(data) == \"MAPPING\"", "def checkMap(self):\n return True", "def _sanity_check_datasource(ds):\n if len(ds) != 1:\n raise SanityCheckError('GeoJSON should have only 1 layer.')\n # TODO: add more checks", "def check_Da...
[ "0.5886268", "0.5826029", "0.5767964", "0.57115424", "0.5651457", "0.5650617", "0.56332195", "0.5626689", "0.5591905", "0.5586229", "0.556025", "0.55439883", "0.55269843", "0.5517739", "0.5505605", "0.5470142", "0.54573935", "0.5434472", "0.5417162", "0.5383413", "0.5376976",...
0.60287815
0
Determine the sheet name needed based on the source.
def get_sheet_name(self, has_verbal_autopsy): source_to_sheet = { "India_MCCD_Orissa_ICD10": "India_MCCD_states_ICD10", "India_MCCD_Delhi_ICD10": "India_MCCD_states_ICD10", "Thailand_Public_Health_Statistics": "ICD10_tabulated", "India_SRS_states_report": "India_S...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sheet_name(self):\n\n xl = pd.ExcelFile(self.excel_file)\n sheet_names = xl.sheet_names\n for item in sheet_names:\n if re.match('(.*)Current primers', item, re.IGNORECASE): # Only extracts most recent primers.\n sheet_name = item\n return shee...
[ "0.7164989", "0.6308564", "0.61821693", "0.603946", "0.59906214", "0.5879506", "0.58683854", "0.5754971", "0.57401884", "0.5708304", "0.57011294", "0.55058926", "0.54911", "0.5414342", "0.5403765", "0.53900576", "0.5371769", "0.5352899", "0.53527546", "0.5343347", "0.5297994"...
0.7110151
1
Replace the acause with the bridge code.
def acause_to_bridge_code(self, df): df['swap'] = 0 df.loc[ (df['acause'] != df['bridge_code']) & (df['bridge_code'].notnull()), 'swap' ] = 1 df.loc[df['swap'] == 1, 'acause'] = df['bridge_code'] self.causes_not_in_bridge_map(df) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_cause():", "def _fix_up(self, cls, code_name):", "def replacement(exception):\n assert exception.__class__.__name__ == \"LinterFailure\"\n return exception.replacement", "def errorCodeCause(self, cause):\n pass", "def fixup(self):\n raise Exception(\"Fixup not implemented yet!...
[ "0.56187624", "0.5339114", "0.53007525", "0.5278467", "0.51992387", "0.5144127", "0.5144127", "0.4979441", "0.4972489", "0.49498683", "0.48308125", "0.48117915", "0.47808516", "0.47630504", "0.4756997", "0.47563353", "0.47268003", "0.46959338", "0.46171212", "0.4606202", "0.4...
0.63376826
0
Print causes that aren't in the bridge map, but are in the data.
def causes_not_in_bridge_map(self, df): check = set(df.loc[df['bridge_code'].isnull(), 'acause']) if len(check) > 0: print("These acauses are not in the bridge map: {}".format(check))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_out_unexplained(self):\n for node in self.vertices:\n for arc in self.out_arcs_lists[node]:\n s = self.arc_info[arc]['start']\n t = self.arc_info[arc]['destin']\n w = self.arc_info[arc]['unexplained_flow']\n print(\"({} {}) une...
[ "0.5635357", "0.5168932", "0.5168312", "0.51084465", "0.50421125", "0.5012694", "0.49809542", "0.49573722", "0.49084926", "0.4888484", "0.48796296", "0.48676422", "0.48665074", "0.4809346", "0.47892943", "0.47808835", "0.47711042", "0.47605914", "0.47398275", "0.4732302", "0....
0.7070158
0
Replace the actual data cause under certain conditions. This essentially allows mapping based on not just the cause and code system but based on other information like the location, NID, year, etc.
def special_cause_reassignment(self, df, code_system_id): cache_args = { 'force_rerun': False, 'block_rerun': True, 'cache_dir': 'standard', 'cache_results': False } # Some SRS codes get redistributed differently than # other ICD10 dataset...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_valid_mappings(self, df, code_system_id):\n # add code value from cached code map\n print(\"Adding value\")\n df = add_code_metadata(\n df, ['value'], code_system_id,\n force_rerun=False,\n block_rerun=True,\n cache_dir=self.cache_dir\n ...
[ "0.61165214", "0.58322775", "0.5648111", "0.56048506", "0.5507958", "0.55043066", "0.54737777", "0.543537", "0.53194505", "0.5253456", "0.5244946", "0.5241888", "0.5216187", "0.5211156", "0.5194944", "0.51515746", "0.5127338", "0.5109179", "0.51009274", "0.50683755", "0.50682...
0.57788795
2
Group by final columns, summing across deaths.
def collapse_and_sum_by_deaths(self, df): df = df.groupby(self.id_cols, as_index=False)[self.data_col].sum() self.assert_unique_cols_unique(df) return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _aggregate(group_df):\n out = {}\n for col in data_columns:\n # The name of the error column (if it exists)\n error_col = f\"{col}_moe\"\n\n # remove any NaN rows\n subset = group_df.dropna(subset=[col], how=\"any\")\n\n # aggregat if we had ...
[ "0.5318467", "0.5297273", "0.5217793", "0.5203764", "0.5133742", "0.50570774", "0.5016997", "0.49657285", "0.49467602", "0.4945261", "0.49407688", "0.49390042", "0.48924458", "0.48900697", "0.4883349", "0.48651448", "0.48445007", "0.4817701", "0.48097548", "0.47966254", "0.47...
0.75622433
0
Test that the mapping worked. Runs a suite of assertions to make sure that mapping was successful.
def assert_valid_mappings(self, df, code_system_id): # add code value from cached code map print("Adding value") df = add_code_metadata( df, ['value'], code_system_id, force_rerun=False, block_rerun=True, cache_dir=self.cache_dir ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_map(self):\r\n\r\n header, mapping_data = check_map(self.valid_mapping_data_golay)\r\n\r\n expected_header =\\\r\n ['SampleID',\r\n 'BarcodeSequence',\r\n 'LinkerPrimerSequence',\r\n 'Description']\r\n expected_mapping_data =\\\r\n ...
[ "0.7310833", "0.6937956", "0.6737042", "0.67209184", "0.6715749", "0.67143923", "0.66619116", "0.66569936", "0.66303176", "0.6584895", "0.6484949", "0.6411683", "0.6405239", "0.6371015", "0.63441306", "0.6323892", "0.6319045", "0.6312411", "0.62868655", "0.62857336", "0.62508...
0.0
-1
Test that columns that should uniquely identify the dataframe do.
def assert_unique_cols_unique(self, df): assert not df.duplicated(self.unique_cols).any()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkcolumnstest(chosen_columns, chosen_df):\n if not all([item in chosen_columns for item in chosen_df.columns]):\n raise ValueError('Columns do not match')", "def verify_columns_in_dataframe(df, columns):\n\n if not isinstance(columns, list):\n columns = [columns]\n return set(column...
[ "0.7065261", "0.68916535", "0.67887884", "0.6769533", "0.67213285", "0.6651365", "0.6554256", "0.64366084", "0.64201415", "0.64169556", "0.640995", "0.63906235", "0.63551354", "0.63454103", "0.6342936", "0.63194436", "0.6296456", "0.62885845", "0.626959", "0.6255762", "0.6241...
0.81844956
0
Filter out mutation features, ensuring that a feature is not entirely an artifact of mutation rate.
def mut_filter(df, rate, binary_cutoff=12): get_min_count = lambda s: s.value_counts().min() if len(s.unique()) > 1 else -1 df = df[df.apply(get_min_count, axis=1) > binary_cutoff] cc = H.screen_feature(rate, rev_kruskal, df) fc_apply = lambda s: fc(s, rate) direction = df.apply(fc_apply, axis=1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_filtered_features(self, features):\n return [\n feature\n for feature in features\n if \"\".join(feature.qualifiers.get(\"is_edit\", \"false\")) != \"true\"\n ]", "def apply_feature_filter(self):\n self.features = set()\n for language in se...
[ "0.6798122", "0.65159315", "0.6311767", "0.6206602", "0.6020291", "0.6020286", "0.59741116", "0.5803234", "0.57466453", "0.56200033", "0.5560362", "0.5550866", "0.5536949", "0.55036086", "0.5501796", "0.54453415", "0.54438686", "0.5440273", "0.53379816", "0.5326922", "0.53198...
0.0
-1
Extract copy number features.
def cn_filter(df, binary_cutoff=12): del_df = (df.ix['Deletion'].dropna(1) < 0).astype(int) del_df = del_df[del_df.sum(1) >= binary_cutoff] del_df.index = del_df.index.droplevel(1) del_df = del_df.T amp_df = (df.ix['Amplification'].dropna(1) > 0).astype(int) amp_df = amp_df[amp_df.sum(1) >= bina...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extract_features(self):\n # print(os.getpid())\n return {n:self._extract_feature(f) for (n,f) in self.features.items()}", "def extract_features(self, inputs):\n pass", "def make_returnn_audio_features_func():\n return _extract", "def extract_features(self):\n self.extract_fe...
[ "0.6355945", "0.6265867", "0.60493034", "0.5984363", "0.58230263", "0.5735201", "0.57213664", "0.57068473", "0.5680347", "0.5680347", "0.5655088", "0.560756", "0.55590224", "0.55192435", "0.54978615", "0.54792076", "0.5478675", "0.54740584", "0.5422775", "0.541428", "0.537273...
0.0
-1
Process real valued feature into binary feature.
def process_real(df): df_c = df.copy() df_c = df_c.apply(lambda s: H.to_quants(s, std=1), axis=1) df_c = df_c > 0 if type(df.index) == pd.MultiIndex: df_c.index = map(lambda s: '_'.join(s), df_c.index) return df_c.T
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_feature(self, feature):\n self.num_features += 1\n\n def create_int_feature(values):\n feature = tf.train.Feature(\n int64_list=tf.train.Int64List(value=list(values)))\n return feature\n\n features = collections.OrderedDict()\n features[\...
[ "0.6582357", "0.64743507", "0.6151538", "0.6109762", "0.60528004", "0.6031506", "0.60027516", "0.59822625", "0.58153456", "0.5803053", "0.5775498", "0.57638526", "0.5762423", "0.5737403", "0.5713473", "0.570815", "0.56762433", "0.56180775", "0.560164", "0.5593572", "0.5569730...
0.0
-1
Binarize a feature to minimize the difference in sum of squares between the two resulting groups.
def binarize_feature(f): f = f - f.mean() f2 = (f.order() ** 2) split = f.ix[(f2.cumsum() - (f2.sum() / 2.)).abs().idxmin()] return f > split
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binarize(self):\n # Loop through the ratings and binarize based on overall average rating\n rating_sum = np.sum(self.ratings)\n rating_count = np.count_nonzero(self.ratings)\n rating_avg = (1.0 * rating_sum) / rating_count\n\n def binary_transform(x, rating_avg):\n if x == 0.0:\...
[ "0.5834405", "0.5714596", "0.56099087", "0.53564245", "0.5345524", "0.5343635", "0.53198165", "0.5301293", "0.5279895", "0.52382255", "0.52295107", "0.5213143", "0.5212723", "0.51760197", "0.51498497", "0.51463294", "0.5144221", "0.5110803", "0.5091475", "0.50752646", "0.5073...
0.64920145
0
Screens out redundant pathways with high correlation above _cutoff_. Pathways are ranked based on lack of correlation to the background signal. Then if two pathways have high correlation the lower ranked pathway is removed.
def remove_redundant_pathways(pathways, rna, cutoff=.7, binarize=False): #bg = H.screen_feature(background, spearman_pandas, pathways) dx = pd.DataFrame({p: ttest_rel(rna.df.ix[l.index].T.dot(l)) for p,l in rna.loadings.iteritems()}).T dx = dx.t.abs() dd = pathways.ix[dx.index[::-1]].T.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __generate_all_shortest_paths(self,cutoff = 10):\n if cutoff < 1:\n cutoff = 10\n self.__logger.info(\"cutoff value must be a positive integer. Set back to default value: 10\")\n\n all_pair_shortest_paths = nx.all_pairs_shortest_path(self.G, cutoff=cutoff)\n for item ...
[ "0.58749056", "0.5758001", "0.5598225", "0.5390486", "0.5309527", "0.5248357", "0.5210141", "0.5127525", "0.5095731", "0.5082875", "0.5073413", "0.5005037", "0.498891", "0.4978641", "0.49535555", "0.49215704", "0.492009", "0.48521635", "0.48403457", "0.48393774", "0.4787763",...
0.6945232
0
Pull the most differentially expressed genes from the rna expression object.
def extract_diff_exp_rna(rna, n=300, binarize=False): genes = rna.features.ix[['real', 'binary']].index.get_level_values(1) dd = rna.df.ix[genes].dropna() rr = dd.apply(exp_change, 1) d2 = dd.ix[rr.sort('F').index[-n:]].xs('01', 1, 1) if binarize is False: return d2 else: real_ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def differential_gene_expression(phenotypes,\n gene_expression,\n output_filename,\n max_number_of_genes_to_show=20,\n number_of_permutations=10,\n title=N...
[ "0.5540566", "0.55107176", "0.55078834", "0.5460858", "0.5407551", "0.5332774", "0.5270649", "0.5269659", "0.5216537", "0.52059203", "0.51554185", "0.51399195", "0.51355946", "0.51238877", "0.51074076", "0.50921005", "0.5082791", "0.50656515", "0.5041371", "0.5040676", "0.503...
0.5214804
9
Correct pvalues multiple ways along multiindex.
def corrections(vec): bonf_all = vec * len(vec) bonf_within = vec.groupby(level=0).apply(lambda s: s * len(s)) bh_all = H.bhCorrection(vec) bh_within = vec.groupby(level=0).apply(H.bhCorrection).order() two_step = bh_within * len(vec.groupby(level=0).size()) q = pd.concat([vec, bh_within, bh_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pval_pairs(self, idx0, idx1):\n pass", "def test_correct_p_values_large_correction(self):\r\n exp = [1, None, 0.03, 0.03]\r\n obs = self.mc._correct_p_values([0.5, None, 0.01, 0.01])\r\n self.compare_multiple_level_array(obs, exp)", "def test_showalter_index():\n pressure = ...
[ "0.59434146", "0.5774727", "0.52260697", "0.5221227", "0.5216993", "0.5191264", "0.5181901", "0.5160022", "0.50624126", "0.5048196", "0.5009357", "0.49917948", "0.49787354", "0.49680746", "0.4957835", "0.4956589", "0.49506983", "0.49300522", "0.49235076", "0.49085063", "0.490...
0.0
-1
Run before each test method to initialize test environment.
def setUp(self): super(TestCase, self).setUp() # Change the default directory that the tempfile # module places temporary files and directories in self.useFixture(fixtures.NestedTempfile()) # Create a temporary directory and set it as $HOME in the environment. self.useFix...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n test_env_setup()", "def setUp(self):\n\n BaseTest.setUp(self)", "def setUp(self):\n MainTests.setUp(self)", "def before_run_tests(cls):\n pass", "def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass", "def setUp(self):\...
[ "0.84060824", "0.7896673", "0.7857576", "0.77827775", "0.76289546", "0.76258075", "0.7622942", "0.7581788", "0.7581788", "0.75668246", "0.75593936", "0.75593936", "0.7546393", "0.75383157", "0.7528227", "0.74921465", "0.74873954", "0.7485794", "0.7485794", "0.7485794", "0.748...
0.0
-1
Replace a function for the duration of the test. Use the monkey patch fixture to replace a function for the duration of a test. Useful when you want to provide fake methods instead of mocks during testing. This should be used instead of self.stubs.Set (which is based on mox) going forward.
def stub_out(self, old, new): self.useFixture(fixtures.MonkeyPatch(old, new))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch(original_module):\n def wrap(override_fn):\n original_fn = getattr(original_module, override_fn.__name__)\n setattr(original_module, override_fn.__name__, partial(override_fn, original_fn))\n\n # Don't actually modify the function being decorated.\n return override_fn\n ...
[ "0.66126996", "0.6246913", "0.59958524", "0.59808385", "0.5970251", "0.5970251", "0.59676784", "0.5964168", "0.5732706", "0.5707334", "0.568837", "0.56609994", "0.5626188", "0.56159544", "0.5610572", "0.55929077", "0.555881", "0.55573034", "0.55572486", "0.5480746", "0.547858...
0.698745
1
Use python mock to mock an object attribute Mocks the specified objects attribute with the given value. Automatically performs 'addCleanup' for the mock.
def mock_object(self, obj, attr_name, new_attr=None, **kwargs): if not new_attr: new_attr = mock.Mock() patcher = mock.patch.object(obj, attr_name, new_attr, **kwargs) patcher.start() self.addCleanup(patcher.stop) return new_attr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_object(mocker):\n\n def _object(obj_to_patch, attribute, return_value):\n mock_func = mocker.patch.object(obj_to_patch, attribute)\n if return_value is not None:\n mock_func.return_value = return_value\n\n return _object", "def mock_side_effect(self, original_object, attr...
[ "0.6999446", "0.64985067", "0.6480005", "0.61804056", "0.6107706", "0.6030694", "0.59762293", "0.58769643", "0.58677036", "0.58640003", "0.5860096", "0.585139", "0.5840659", "0.58258325", "0.5818307", "0.58063465", "0.58023256", "0.57815766", "0.5776021", "0.5776021", "0.5748...
0.7388397
1
ROI on the surface or volume with a given centre and radius
def py_SurfStatROI(centre, radius, surf): sys.exit("Function py_SurfStatROI is under development")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def objects_radius(self, centre, radius):", "def extract_roi_from_volume(volume, in_center, output_shape, fill = 'random'):\n input_shape = volume.shape \n if(fill == 'random'):\n output = np.random.normal(0, 1, size = output_shape)\n else:\n output = np.zeros(output_shape)\n r0max = ...
[ "0.6983759", "0.6608037", "0.6608037", "0.6565604", "0.6497947", "0.6497947", "0.6379288", "0.6208821", "0.61896527", "0.6177499", "0.61722773", "0.6139702", "0.607727", "0.6039256", "0.59929496", "0.5988569", "0.5976138", "0.597191", "0.5934677", "0.5894657", "0.5884144", ...
0.7116994
0
Check that the games data is correct.
def _data_integrity_check(df): if df is None or len(df) == 0: logging.info("Dataframe is empty! No games data recorded.") return if not isinstance(df, pd.DataFrame): raise ValueError(f"Type of df is {type(df)}, it should be pandas.DataFrame") logging.info(f"Checking integrity of ga...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def check_games(self, ctx):\n print(self.data)\n print(self.games_info)", "def isValid(self, game):\n return True", "def check_game_sanity(game_val, log):\n\n global __problem_deck_index__\n\n supply = game_val.get_supply()\n if game_val.any_resigned():\n return True ...
[ "0.75368327", "0.70760256", "0.69226396", "0.6563712", "0.65609324", "0.6393713", "0.63804436", "0.637144", "0.6327626", "0.6323198", "0.6308842", "0.6299205", "0.6270144", "0.62564266", "0.622065", "0.6184035", "0.61409825", "0.61319643", "0.6127695", "0.6106813", "0.6062647...
0.66139734
3
Gets the latest season and season type in the games data
def _get_latest_season_and_type(df): if df is None or len(df) == 0: return (None, None) if not isinstance(df, pd.DataFrame): raise ValueError(f"Type of df is {type(df)}, it should be pandas.DataFrame") df = df[df['state_of_game'] == 'POST'] latest_season = df['season'].max() season...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latestGamePack(team):\n lgr= get('schedule', {'ver':'v1', 'sportId':1, 'date':today, 'teamId':team, 'fields':['dates','games','gamePk'] })\n return lgr['dates'][0]['games'][0]['gamePk']", "def getseason(data):\n ## Season key is the most reliable\n season = data.get(\"season\")\n if season:\n ...
[ "0.6553931", "0.6546608", "0.6442716", "0.64363", "0.6434008", "0.6398952", "0.62399364", "0.6105547", "0.6082319", "0.6062433", "0.59988546", "0.59488773", "0.59089303", "0.5888597", "0.5820921", "0.5803751", "0.57766825", "0.5746373", "0.57297796", "0.5726727", "0.5723362",...
0.7470444
0
Uses the semantic ordering of season types to get the latest/max
def _get_latest_season_type(season_types_list): if not isinstance(season_types_list, (list, tuple)): raise ValueError(f"type of {type(season_types_list)} for season_type_list not list or tuple") latest_season_type = season_types_list[0] if len(season_types_list) > 1: for season_type in seas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_latest_season_and_type(df):\n if df is None or len(df) == 0:\n return (None, None)\n\n if not isinstance(df, pd.DataFrame):\n raise ValueError(f\"Type of df is {type(df)}, it should be pandas.DataFrame\")\n\n df = df[df['state_of_game'] == 'POST']\n latest_season = df['season'].m...
[ "0.672219", "0.5860014", "0.57655185", "0.57589823", "0.55447674", "0.5494647", "0.5436334", "0.5394017", "0.53333473", "0.5325742", "0.52458227", "0.52447414", "0.52128184", "0.5152866", "0.51410383", "0.5102868", "0.5095066", "0.5065986", "0.5064631", "0.50637007", "0.50637...
0.71224105
0
Removes the latest season and season type from df.
def _truncate_games_df(df, season, season_type): return df[(df['season'] != season) | (df['type'] != season_type)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _drop_last_season_championship_matches(self, df: pd.DataFrame) -> pd.DataFrame:\n max_season = df[\"season\"].max()\n\n if self._resume:\n # Check if max season changed\n if max_season != self._model_settings[\"max_season\"]:\n raise ValueError(\"Current max s...
[ "0.6965733", "0.63223386", "0.6169938", "0.5764446", "0.5585531", "0.5310778", "0.5301593", "0.52592826", "0.5258071", "0.52488506", "0.5140651", "0.5111419", "0.50804186", "0.5079051", "0.5058062", "0.49890277", "0.4945572", "0.4936485", "0.49139735", "0.48739588", "0.481331...
0.7332864
0
Drops rows from the games table that are of season and season_type.
def _truncate_games_table(db_conn, season, season_type): delete_statement = f"DELETE FROM games WHERE season = {season} and type = '{season_type}'" logging.info(f"Truncating games table with statement: {delete_statement}") db_conn.execute(delete_statement)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _truncate_games_df(df, season, season_type):\n return df[(df['season'] != season) | (df['type'] != season_type)]", "def update_season_table(session, sched_tbl, season_df):\n date = datetime.date(datetime.now())\n update_query = session.query(sched_tbl).filter(sched_tbl.start_time < date,\n ...
[ "0.762441", "0.6251675", "0.61136353", "0.5862718", "0.56220615", "0.54519236", "0.5399716", "0.537986", "0.53599685", "0.5343498", "0.5125028", "0.51231134", "0.50927806", "0.5061084", "0.50600594", "0.5034044", "0.502096", "0.49832642", "0.4961268", "0.4951709", "0.49427244...
0.7035129
1
Enumerates all combos of season and season types
def _get_seasons_grid(start_season, start_season_type): if start_season not in list(range(config.START_SEASON, config.CURRENT_SEASON + 1)): raise ValueError(f"Start season of {start_season} not valid.") if start_season_type not in config.SEASON_TYPES: raise ValueError(f"Start season type {start...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def season_choices():\n return [(s, s) for s in range(0, 3)]", "def distributeSeason(self):\n i = 1\n for day in self.daylist:\n if i >= monthbeg[5] and i < monthbeg[9]: #june through SEpt as per SCE\n day.season = 'summer' #https://www.sce.com/resident...
[ "0.7313621", "0.60445046", "0.59210426", "0.5904497", "0.5747831", "0.57103455", "0.5611361", "0.55891776", "0.5507902", "0.5506329", "0.5493918", "0.5421824", "0.5413071", "0.5396443", "0.5385352", "0.53806645", "0.5351801", "0.5346506", "0.5319504", "0.52745056", "0.5232151...
0.6033037
2
Runs the nflscrapr R script for the given season and type
def _extract_games_data(season, season_type): nflscrapr.run( 'games', season=season, season_type=season_type ) nflscrapr_output = etl_tools.extract_from_csv(config.GAMES_DUMP_CSV_PATH) return nflscrapr_output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrape():\n league_year = Config.get_property(\"league_year\")\n\n # Create table\n season_data = client.season_schedule(league_year)\n season_data = br_enum_to_string(season_data)\n return season_data", "def get_schedules_for_season(self, season, season_type=\"REG\"):\n try:\n ...
[ "0.58400744", "0.5825069", "0.5700488", "0.56795895", "0.5633705", "0.550612", "0.5492933", "0.54907745", "0.5442901", "0.5320366", "0.52981234", "0.5222515", "0.51775146", "0.5153715", "0.5135699", "0.5109447", "0.50783205", "0.5008098", "0.50059414", "0.5002093", "0.4990885...
0.61678904
0
Runs the workflow for extracting and loading games data. Finds the starting point for extracting new data Extracts new data using the nflscrapr module Loads to database
def run(): games_db_conn = db.get_db_eng() games_query = "SELECT * FROM GAMES" games_data = etl_tools.extract_from_db(games_db_conn, games_query) _data_integrity_check(games_data) latest_season, latest_season_type = _get_latest_season_and_type(games_data) logging.info(f"Latest season and type i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_and_preprocess(self):\n print('Preparing steering angle database.')\n print('Downloading...')\n self.download()\n print('Preprocessing...')\n self.preprocess()", "def scrape_all():\n\n # Scrape team information by season\n for team in scrape_utils.team_names(...
[ "0.6121077", "0.6028184", "0.59892666", "0.59821534", "0.5883398", "0.585514", "0.58488256", "0.583428", "0.5776301", "0.577098", "0.57684034", "0.5755793", "0.57253456", "0.5703388", "0.56687576", "0.56505823", "0.56160414", "0.560584", "0.56016344", "0.5601598", "0.55712277...
0.72591263
0
Convert the labelme annotations to coco format and validate the annotations with randomly picked 5 images. If the annotation is incorrect, the program terminates.
def convert_labelme_to_coco(path_to_data): # convert labelme annotations to coco labelme2coco.convert(path_to_data, path_to_data + r'\coco_annotation.json') # Open the coco format data with open(path_to_data + r'\coco_annotation.json') as f: coco_d = json.load(f) # Get the category...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_annotation(target, images, bbox_path):\n good_image_paths = []\n bad_image_paths = []\n bb = read_annotation_yolov5(bbox_path)\n for path in images:\n basename = os.path.basename(path) # extract file name only (e.g., bear_013.jpg)\n basename_no_ext = os.path.splitext(basenam...
[ "0.6922452", "0.6743097", "0.67311317", "0.6724994", "0.64523804", "0.6366201", "0.6221984", "0.6215864", "0.6204359", "0.6179897", "0.61457837", "0.613554", "0.6132579", "0.60457397", "0.602493", "0.5998027", "0.5937625", "0.5865713", "0.5820261", "0.5809766", "0.5806412", ...
0.6996364
0
Update the prediction model with the new data.
def update_model(path_to_data, path_to_model): # Open the annotation files. with open(path_to_data + r'\coco_annotation.json') as f: coco_d = json.load(f) # Get the categories. categories = [] for cat in coco_d['categories']: categories.append(cat['name']) # Register th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_predictions(data):\n # TODO: Priority 1 - update predictions with inference results\n # TODO: Understand from a research team exactly what the data is going to look like\n trackID = data[0]\n prediction = data[1]\n confidence = data[2]\n to_Insert_Array = [trackID, prediction, confiden...
[ "0.72333366", "0.7135157", "0.7065093", "0.7044976", "0.67507654", "0.66787064", "0.66733956", "0.66451544", "0.66342115", "0.6553452", "0.6528085", "0.6525013", "0.64743006", "0.64256346", "0.6359152", "0.6347298", "0.6312711", "0.62738705", "0.6263622", "0.62602943", "0.623...
0.5957653
58
Read the poses_bounds.npy file produced by LLFF imgs2poses.py.
def read_meta(in_dir, use_ndc): poses_bounds = np.load(os.path.join(in_dir, 'poses_bounds.npy')) # (N_images, 17) c2ws = poses_bounds[:, :15].reshape(-1, 3, 5) # (N_images, 3, 5) bounds = poses_bounds[:, -2:] # (N_images, 2) H, W, focal = c2ws[0, :, -1] # correct c2ws: original c2ws has rotatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_las_bounds(fpath):\n with laspy.file.File(fpath) as f:\n return Bounds(*(f.header.min + f.header.max))", "def load_poses(self):\n print('Loading poses for sequence ' + self.sequence + '...')\n\n pose_file = os.path.join(self.pose_path, self.sequence + '.txt')\n\n # Read an...
[ "0.66865915", "0.61436146", "0.60371596", "0.5696726", "0.5668809", "0.5654928", "0.56231886", "0.5586926", "0.5579912", "0.55704826", "0.5489618", "0.5483596", "0.54541075", "0.54122", "0.5406048", "0.5370545", "0.53350437", "0.5314571", "0.5290624", "0.52806646", "0.5278963...
0.59269446
3
Overload this method when doing extra feature processes or data augmentation.
def __getitem__(self, idx): record = self.records[idx] return np.array(record['feat']), np.array(record['label'], dtype=np.int64)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feature():\n pass", "def feat():\n pass", "def augment(self, *args, **kwargs):\n pass", "def _data_augmentation(feature_dict):\n image_features = feature_dict[_transformed_name(constants.IMAGE_KEY)]\n image_features = _image_augmentation(image_features)\n feature_dict[_transformed_n...
[ "0.67851365", "0.6742683", "0.6596476", "0.64233947", "0.6299479", "0.62270296", "0.61860555", "0.61621183", "0.6025776", "0.6020395", "0.5981607", "0.59511673", "0.5922805", "0.5918472", "0.59114283", "0.5909907", "0.59008974", "0.5896712", "0.5865747", "0.58578086", "0.5854...
0.0
-1
Convert an array of export statements (what we get from envextra in the config) into a dict
def env_lines_to_dict(self, env_lines): env_dict = {} for env_line in env_lines: split_env_line = shlex.split(env_line) if split_env_line[0] == "export": split_env_line = split_env_line[1:] for item in split_env_line: if "=" in item: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_configurations():\n pass", "def export(self) -> Dict[str, Any]:\n return {\n \"name\": self.name,\n \"channels\": [channel for channel in self.channels],\n \"packages\": self.packages.export(),\n \"logs\": [log for log in self.logs],\n \...
[ "0.59988654", "0.59330225", "0.5903955", "0.56446517", "0.5643221", "0.56416047", "0.54888237", "0.5403373", "0.53202504", "0.52638626", "0.5262855", "0.5257865", "0.5199736", "0.5194403", "0.5183345", "0.5182272", "0.51688004", "0.5123766", "0.5117179", "0.5108427", "0.51010...
0.6357385
0
Construct a job submission script
def job_script(self): quoted_arguments = quote_arguments([self._command_template]) quoted_environment = quote_environment(self.env_dict) job_header_lines = "\n".join( "%s = %s" % (k, v) for k, v in self.job_header_dict.items() ) return self._script_template % { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_submission_script(path,\n script_name,\n save_history=True,\n walltime=10,\n allocation='p30653',\n cores=1,\n memory=4...
[ "0.7447285", "0.70335376", "0.6996281", "0.68916833", "0.68905133", "0.6690032", "0.65249985", "0.6521264", "0.6519338", "0.6451723", "0.64462316", "0.64395326", "0.63563967", "0.63540643", "0.6347614", "0.63037384", "0.6277216", "0.6258536", "0.6221125", "0.6196768", "0.6189...
0.64803964
9
Quote a string or list of strings using the Condor submit file "new" argument quoting rules. Returns str The arguments in a quoted form. Warnings You will need to surround the result in doublequotes before using it in the Arguments attribute. Examples >>> quote_arguments(["3", "simple", "arguments"]) '3 simple argument...
def quote_arguments(args): if isinstance(args, str): args_list = [args] else: args_list = args quoted_args = [] for a in args_list: qa = _double_up_quotes(a) if " " in qa or "'" in qa: qa = "'" + qa + "'" quoted_args.append(qa) return " ".join(quo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def argument_list_quote(arguments):\n args = []\n for arg in arguments:\n args.append(argument_quote(arg))\n return '\"%s\"' % ' '.join(args)", "def _quote_arguments(args):\n return map(lambda x: '\"{}\"'.format(x) if ' ' in x else '{}'.format(x), args)", "def argument_quote(argument):\n...
[ "0.7215548", "0.6580144", "0.6086504", "0.5937315", "0.5752094", "0.56268567", "0.55315644", "0.544126", "0.54088515", "0.533452", "0.5203533", "0.5165263", "0.51386887", "0.51292366", "0.5123674", "0.50810844", "0.5078379", "0.5072677", "0.50487226", "0.50456464", "0.5013752...
0.74514025
0
Quote a dict of strings using the Condor submit file "new" environment quoting rules. Returns str The environment in quoted form. Warnings You will need to surround the result in doublequotes before using it in the Environment attribute. Examples >>> from collections import OrderedDict >>> quote_environment(OrderedDict...
def quote_environment(env): if not isinstance(env, dict): raise TypeError("env must be a dict") entries = [] for k, v in env.items(): qv = _double_up_quotes(str(v)) if " " in qv or "'" in qv: qv = "'" + qv + "'" entries.append("%s=%s" % (k, qv)) return " ".j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_environment(envdict):\n lines = []\n for k, v in envdict.iteritems():\n if \" \" in v: # NOTE: per the spec, one might want to handle all 'whitespace' chars.\n v = v.replace(\"'\", \"''\")\n v = \"'%s'\" % v\n v = v.replace('\"', '\"\"')\n lines.append('%...
[ "0.75373447", "0.6221324", "0.6093788", "0.5934985", "0.5808252", "0.57019943", "0.5597145", "0.5515628", "0.5512391", "0.547237", "0.5445413", "0.5308214", "0.5276308", "0.52133214", "0.51868063", "0.5152444", "0.50912315", "0.5079086", "0.50783825", "0.5009073", "0.50075024...
0.8446683
0