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
sending all relevant scene information to all clients, for status update
def send_scene_informations(self): self.send_player_position() self.send_player_direction() self.send_grafik_objects()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def update(self):\n \n logging.info('updating state...')\n info = await self.send_command(\"$dat\", \"upd01-\")\n if not info:\n msg = \"Unable to get data about windows and scenes from Gateway\"\n return msg\n\n logging.debug('hub response is :')\n lo...
[ "0.60041046", "0.59992117", "0.5972423", "0.5819911", "0.5718183", "0.5576376", "0.5558921", "0.55262274", "0.5505325", "0.5475588", "0.54616416", "0.5444071", "0.5439299", "0.5424768", "0.54154384", "0.5349631", "0.5341202", "0.5330424", "0.5319409", "0.5318403", "0.530497",...
0.77263695
0
send positions of all player to all clients
def send_player_position(self): pl_coor_dict = {} for pl in self.player_list: #coor_list = [[p.x(),p.y()] for p in pl._line_list] pl_coor_dict[pl.id] = pl.get_line_list_float() self.on_data_to_all_clients({"game":{"player_coor":pl_coor_dict}})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_msg_to_players(players, msg=\"\"):\n for player in players:\n player.player_socket.send(msg + \"\\n\")", "def send_player_direction(self):\n pl_dir_dict = {}\n for pl in self.player_list:\n pl_dir_dict[pl.id] = pl.direction\n self.on_data_to_all_clients({\"game\...
[ "0.71883184", "0.6897638", "0.67860633", "0.6763005", "0.6666125", "0.6314095", "0.6149467", "0.6116273", "0.6100776", "0.60904455", "0.60173345", "0.6011354", "0.5980113", "0.5946969", "0.5932228", "0.59281164", "0.5904502", "0.5900891", "0.58715874", "0.5848904", "0.5835822...
0.7897912
0
send direction of all player to the server
def send_player_direction(self): pl_dir_dict = {} for pl in self.player_list: pl_dir_dict[pl.id] = pl.direction self.on_data_to_all_clients({"game":{"player_dir":pl_dir_dict}})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_player_direction(self,direction):\n pass", "async def send_dms(self):\n # Player 1 info\n info = \"\"\n for k, v in self.p1_moves.items():\n info += f\"Type **{k}** for **{v}**\\n\"\n\n embed = discord.Embed(\n title=f\"RPS in #{self.channel.nam...
[ "0.6904939", "0.63594335", "0.6280396", "0.60382164", "0.6019095", "0.5836359", "0.5783612", "0.5775737", "0.5773039", "0.5698471", "0.568822", "0.56532097", "0.56252", "0.5607198", "0.5595909", "0.5570109", "0.55576384", "0.5543813", "0.55298716", "0.5492103", "0.54724264", ...
0.8593915
0
process a batch of k7 data to aod data
def run(self, year, month, day): try: self.__download(year, month, day) except: err_msg = "[download]->{0}".format(sys.exc_info()[1]) print err_msg logging.error(err_msg) return try: self.__unrar(year, month, day) e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(self, data_batch: Any, data_samples: Sequence[dict]) -> None:", "def __data_generation(self, batch_data):\n X = np.zeros((self.batch_size, self.num_features), dtype=float)\n y = np.zeros((self.batch_size, self.num_outputs), dtype=float)\n\n for i, sample in batch_data.iterrows():...
[ "0.6077993", "0.59293693", "0.58010113", "0.57387745", "0.57387745", "0.5557606", "0.55523646", "0.5549795", "0.55199504", "0.54765236", "0.5470754", "0.5459762", "0.5458714", "0.54408133", "0.5438925", "0.5334758", "0.5333314", "0.5331136", "0.53106886", "0.52860236", "0.528...
0.0
-1
run step by step for dev testing
def run_dev(self, year, month, day, step): if step == 1: try: self.__download(year, month, day) except: err_msg = "[download]->{0}".format(sys.exc_info()[1]) print err_msg logging.error(err_msg) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TestOneStep(self):\n pass", "def main():\n run_test_all()", "def runTests(self):\n \n pass", "def runFunc(runType):\n logger.info('Running test locally with development environment')\n runProcess('local', ['invoke', '-v', '--config-file', 'run_config.yaml'])", "def runtest(sel...
[ "0.6946755", "0.689978", "0.67207056", "0.66583073", "0.663308", "0.660766", "0.6507847", "0.6494383", "0.6468679", "0.64583427", "0.64412826", "0.6440748", "0.6406907", "0.63950074", "0.6394978", "0.6392331", "0.6387707", "0.6383412", "0.6378931", "0.63360447", "0.63303214",...
0.6413963
12
download k7 data through ftp.
def __download(self, year, month, day): print 'Download...' logging.info('[download]->Download...') t = datetime.datetime(year, month, day) spdata.download(stime=t, stations=self.aodSetting.stations, ftp_dir=self.aodSetting.ftp_root, data_dir=self.aodSetting.dd_dir, ftp_ip=self.aodSettin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_data(self, filename=None):\n if (filename is None): filename = ['Public','Gathering.dat']\n elif (type(filename) is str): filename = [filename]\n elif (type(filename) is list): pass\n else: raise TypeError('Require the file path (\\'Public/Gathering.dat\\')')\n\n sel...
[ "0.64380985", "0.6341836", "0.6291272", "0.61992234", "0.61770105", "0.6147908", "0.6088427", "0.60708237", "0.6060267", "0.6028903", "0.60202116", "0.5973396", "0.59491414", "0.59483415", "0.59292954", "0.5885672", "0.58776695", "0.58719426", "0.5834144", "0.5829435", "0.579...
0.62414247
3
unzip the downloaded k7 files.
def __unrar(self, year, month, day): print 'Un-rar...' logging.info('[unrar]->Un-rar...') k7dir = self.aodSetting.k7_dir t = datetime.datetime(year, month, day) stids = self.aodSetting.stations.getstIds() # Loop - unrar files for each station for stid in stids: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _unzip_files(self) -> None:\n for file in self.input_path.iterdir():\n if is_zipfile(file):\n with ZipFile(file, mode=\"r\") as archive:\n archive.extractall(path=self.temp_path)", "def unzip() -> None:\n logger = logging.getLogger(__name__)\n logger....
[ "0.67345315", "0.66036296", "0.6459418", "0.63836205", "0.6344491", "0.6254143", "0.62338066", "0.6205159", "0.6141289", "0.61412406", "0.61354464", "0.61244124", "0.6117852", "0.6092154", "0.6087271", "0.6069659", "0.60132784", "0.59876263", "0.5933005", "0.5920788", "0.5919...
0.0
-1
decoding the k7 files and merge all of k7 files in specific date range into a single k7 file
def __merge(self, year, month, day): print 'Merge...' logging.info('[merge]->Merge...') k7dir = self.aodSetting.k7_dir # path.join(baseDir, 'k7') mdir = self.aodSetting.merge_dir # path.join(baseDir, 'merge') t = datetime.datetime(year, month, day) stids = self.aodSet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\r\n\r\n directory = 'D:\\\\Profession\\\\Intern\\\\Assignments\\\\Codes\\\\Assignement Codes\\\\Part 2\\\\data_dumps'\r\n path = os.path.join(directory, 'dump_3')\r\n if not (os.path.exists(path)):\r\n os.mkdir(path)\r\n\r\n for date in range(1, 31):\r\n # date-month-year\r\n ...
[ "0.5749903", "0.55136085", "0.5509204", "0.5468086", "0.538251", "0.5376807", "0.536799", "0.5353574", "0.53223854", "0.53129154", "0.52146643", "0.5213128", "0.52057177", "0.51921964", "0.5189649", "0.5172596", "0.51672804", "0.51579833", "0.5130428", "0.5128183", "0.5115077...
0.6418639
0
calculate the aod file
def __cal_aod(self, year, month, day): print 'Calculate...' logging.info('[calculate]->Calculate...') t = datetime.datetime(year, month, day) ddir = self.aodSetting.data_dir wdir = self.aodSetting.p_aot_dir ascdir = self.aodSetting.ascii_dir aotdir = self.aodSet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_opal(self, file_name):\n \n return 0", "def aovsPath(self):\n\t\treturn fl.File( self._path + '/aovs.data' )", "def arff_file(data,attributes,relation,description,output_dir=\"./\",filename=\"tmp\"):\n x = []\n for k in attributes:\n x.append(k[0])\n data_write = {}\n ...
[ "0.5947568", "0.58376205", "0.5767446", "0.5706364", "0.56674826", "0.5640036", "0.56169784", "0.5545555", "0.5503337", "0.5500597", "0.546921", "0.54391", "0.54287213", "0.5404696", "0.5369557", "0.5313572", "0.53117436", "0.5296597", "0.5285791", "0.52849066", "0.5265977", ...
0.71632695
0
Test the behavior of spec
def test_spec(self): u_spec = leabra.UnitSpec() u_spec.act_thr = 0.25 u = leabra.Unit(spec=u_spec) # by default, copyspec=False u2 = leabra.Unit(spec=u_spec) self.assertEqual(u.spec.act_thr, 0.25) self.assertEqual(u2.spec.act_thr, 0.25) u.spec.act_thr = 0.30 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spec_tests():\n pass", "def test_basic_execution(self):", "def test_T01():", "def test_let(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def test_bed(self):\n #TODO write bed tests", "def spec(self) -> bool:\n\t\tretu...
[ "0.7441077", "0.7135826", "0.7132918", "0.69778395", "0.6925052", "0.6925052", "0.6925052", "0.6925052", "0.6925052", "0.6907251", "0.68216866", "0.67737484", "0.67737484", "0.6766573", "0.6734277", "0.67254025", "0.67254025", "0.67170155", "0.6712714", "0.6712714", "0.670945...
0.68294686
10
Test that forcing activity behaves as expected
def test_forced_act(self): u = leabra.Unit() u.force_activity(0.5) u.calculate_net_in() u.cycle('minus') self.assertEqual(u.act, 0.5) # is it maintained? for _ in range(10): u.calculate_net_in() u.cycle('minus') self.assertEqua...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_activity(self):\n pass", "def test_create_activity(self):\n pass", "def test_get_activity(self):\n pass", "def test_get_activity(self):\n pass", "def manipulate_activity():\n pass", "def test_act_on_settings(self):\n pass # TODO(tlarsen)", "def tes...
[ "0.7063998", "0.6907587", "0.6682218", "0.6682218", "0.6436824", "0.6383743", "0.6383743", "0.62944734", "0.6199359", "0.6198656", "0.61355084", "0.6128582", "0.608371", "0.60338753", "0.6028483", "0.5990039", "0.59850067", "0.5970036", "0.59694934", "0.59281826", "0.59158045...
0.68137604
2
Test that the longterm average are correctly updated.
def test_avg_l(self): u_spec = leabra.UnitSpec(g_bar_e=0.3, g_bar_l=0.3, g_bar_i=1.0) u = leabra.Unit(spec=u_spec) for _ in range(20): u.add_excitatory(1.0) u.calculate_net_in() u.cycle('minus') self.assertEqual(u.avg_l, 0.40) u.spec.update_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mean(self):\n pass", "def test_mean(self):\n pass", "def test_compute_metrics(self):\n with self.test_session() as sess:\n tf.set_random_seed(1234)\n dut = _setup_trainer(self.tmpdir)\n\n sess.run(tf.global_variables_initializer())\n ses...
[ "0.6695123", "0.6695123", "0.6322456", "0.62833387", "0.62269557", "0.6221759", "0.6209817", "0.6205302", "0.62012064", "0.61570823", "0.6138694", "0.6086192", "0.6057636", "0.6040159", "0.6011267", "0.60064286", "0.5958843", "0.5958843", "0.5958843", "0.59416413", "0.5934692...
0.69294035
0
Test that the unit activity is behaving well under excitation.
def test_act(self): spec = leabra.UnitSpec(g_bar_e=0.40, g_bar_l=2.80, g_bar_i=1.00, g_l=1.0, e_rev_e=1.00, e_rev_l=0.15, e_rev_i=0.15, act_thr=0.25, act_gain=600.00, act_sd=0.01) u = leabra.Unit(spec=spec) for _ in range(15): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_work_without_activity(human):\n with pytest.raises(AttributeError):\n human.work()", "def test_launch_failures_hw(self):\n self.test_launch_failures()", "def test_run_ended(self):", "def testFailure():\n run(\"chariot-me\") #Start management-engine without initial deplflag\n egres...
[ "0.7335777", "0.7193599", "0.71814764", "0.7141535", "0.6771068", "0.67386454", "0.6735247", "0.670248", "0.6625328", "0.659727", "0.6576637", "0.65378594", "0.6536924", "0.6535871", "0.65232897", "0.65107983", "0.64797604", "0.6475129", "0.6453638", "0.6439196", "0.6437578",...
0.6264284
37
Test the threshold for xx1 functions
def test_xx1_thr(self): u_spec = leabra.UnitSpec() u_spec.act_thr = 0.25 u = leabra.Unit(spec=u_spec) self.assertEqual(u_spec.xx1(-0.1), 0.0) self.assertTrue(0.0 < u_spec.xx1(0.1)) self.assertEqual(u_spec.noisy_xx1(-0.1), 0.0) self.assertTrue(0.1 < u_spec.noisy_xx...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_thresholding(x):\n return x > threshold_otsu(x)", "def _check_threshold(threshold, value):\r\n return threshold[0](value, threshold[1])", "def global_threshold(img, threshold_method):\n pass", "def evaluate(self, threshold=0.5):\n pass", "def threshold(self,thresholdValue):\n ...
[ "0.7725878", "0.6990938", "0.6906055", "0.6781788", "0.66641164", "0.66137177", "0.6556111", "0.6470207", "0.6446204", "0.6439647", "0.6415058", "0.63528293", "0.63288236", "0.62733644", "0.6249242", "0.62310404", "0.62025386", "0.62004095", "0.61916935", "0.6184021", "0.6153...
0.67071444
4
Test if units with forced activity update their averages
def test_avgs_forced(self): u = leabra.Unit() for t in range(10): u.force_activity(1.0) u.calculate_net_in() u.cycle('minus') for name in ['avg_ss', 'avg_s', 'avg_m', 'avg_s_eff']: self.assertTrue(getattr(u, name) != 0.15)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_average(self):\n avg_orders = Decimal(self._uncertain_demand.average_orders)\n self.assertEqual(avg_orders, 50)", "def should_average(self):\n return self._should_average", "def trigger_measurement_with_mass_flow_t_comp_and_averaging(self):\n return self.execute(SdpI2cCm...
[ "0.6194015", "0.60837054", "0.58219624", "0.57840586", "0.57701164", "0.5766448", "0.5765421", "0.5758668", "0.56976837", "0.56943905", "0.56729764", "0.56564695", "0.56349504", "0.5634266", "0.56338817", "0.5632846", "0.5626187", "0.561752", "0.5612526", "0.56117576", "0.559...
0.722404
0
Test quantitative equivalence with emergent on the xx1 function.
def test_emergent_xx1(self): xx1_data = data.parse_xy('convolve_nxx1.txt') spec = leabra.UnitSpec(adapt_on=False, noisy_act=True, act_gain=40, act_sd=0.01) receiver = leabra.Unit(spec=spec) receiver.cycle('minus') # create the noisy_xx1 convolution ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_xx1_thr(self):\n u_spec = leabra.UnitSpec()\n u_spec.act_thr = 0.25\n u = leabra.Unit(spec=u_spec)\n self.assertEqual(u_spec.xx1(-0.1), 0.0)\n self.assertTrue(0.0 < u_spec.xx1(0.1))\n self.assertEqual(u_spec.noisy_xx1(-0.1), 0.0)\n self.assertTrue(0.1 < u_s...
[ "0.64280814", "0.6261571", "0.6162461", "0.61146444", "0.60372925", "0.5985458", "0.59624684", "0.59294164", "0.59135175", "0.58800495", "0.5852574", "0.5826231", "0.58108443", "0.5767499", "0.575935", "0.5757728", "0.5744132", "0.5743049", "0.5740862", "0.57356805", "0.57282...
0.72790396
0
Test quantitative equivalence with emergent on the neuron tutorial.
def test_emergent_neuron(self): check = True for adapt_on in [False, True]: neuron_data = data.parse_unit('neuron_adapt.dat' if adapt_on else 'neuron.dat') spec = leabra.UnitSpec(adapt_on=adapt_on, noisy_act=True, g_bar_e=0.3, g_bar_l=0.3, g_b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_neuron(self):\r\n # crear una lista 1-D (Horizontal, Entradas).\r\n Z = [1, 2, 3]\r\n # crear una lista 1-D (Vertical, Pesos de la red).\r\n W = [10, 20, 30]\r\n # Inicializamos la neurona, y obtenemos el valor que toma dado W * Z\r\n # X(k) = W * Z\r\n res...
[ "0.6686928", "0.6533093", "0.6525016", "0.64122593", "0.6292761", "0.62885284", "0.622003", "0.62067026", "0.61581796", "0.6143428", "0.61156917", "0.61012167", "0.6086759", "0.6082188", "0.6054977", "0.6037327", "0.60279274", "0.6006935", "0.60018116", "0.59948033", "0.59834...
0.6972024
0
Returns a handle to an open connection to the mongo db
def get_db(db=None): if db is None: db = ideagenstest return get_mongodb(db['url'], db['port'], db['dbName'], db['user'], db['pswd'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_db_connection():\n client = MongoClient() #'104.131.185.191', 27017\n db = client[\"225VOH\"]\n return client, db", "def get_connection():\n return MongoClient(\"mongodb://username:password@localhost:27017\")", "def get_connection(self):\n\t\tfrom pymongo import MongoClient\n\n\t\tif s...
[ "0.80200183", "0.7941817", "0.7930454", "0.7876856", "0.7773081", "0.772081", "0.76380205", "0.75901055", "0.75638014", "0.7555717", "0.7388763", "0.73846686", "0.7339755", "0.7277495", "0.7248042", "0.7173492", "0.7163325", "0.7161241", "0.7124021", "0.7117875", "0.70666003"...
0.0
-1
Add a list of excluded participants based on a set of usernames. Can't base on user_id because there are duplicate user_id's with the same user name
def add_excl_parts(db, usernames): desc = "Replicating the effect " + \ "of priming with common vs rare ideas in individual " + \ "brainstorming with revised interface" exp_id= 'tN33ATDiCukWfj5G7' # exps = db.experiments.find() exp = db.experiments.find_one({'_id': exp_id}) db.experiments...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_usernames(self, usernames):\n\t\tself.usernames += self._coerce_list(usernames)", "def get_ingred_exclusions(user_id):\n\n exclusions = ExcludedIngredient.query.filter_by(user_id=user_id).all()\n if exclusions:\n exclusion_list = []\n for exclusion in exclusions:\n exclu...
[ "0.60056657", "0.58411485", "0.5776767", "0.57505184", "0.57505184", "0.57290083", "0.5695878", "0.5579431", "0.5529767", "0.5501804", "0.549265", "0.5400099", "0.53770614", "0.5350103", "0.5335042", "0.53326446", "0.52876663", "0.52876663", "0.52825737", "0.52825737", "0.528...
0.69511336
0
takes db parameters and returns a connected db object usign those
def get_mongodb(dbUrl, dbPort, dbName, dbUser=None, dbPswd=None): if ((dbUser == None) and (dbPswd == None)): dbURI = "mongodb://" + dbUrl + ":" + \ str(dbPort) + "/" + dbName elif ((dbUser == "") and (dbPswd == "")): dbURI = "mongodb://" + dbUrl + ":" + \ str(dbPort) + "/" + dbName else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_db():\n\n def dict_factory(cursor, row):\n \"\"\"\n Creates dict from row.\n\n Args:\n cursor: DB cursor.\n row: Row.\n\n Returns:\n dict: Dict of results.\n \"\"\"\n d = {}\n for idx, col in enumerate(cursor.description):...
[ "0.75570565", "0.7331119", "0.73260736", "0.7320136", "0.72991186", "0.72591406", "0.72268337", "0.72137827", "0.71695155", "0.71635467", "0.7161651", "0.7161571", "0.7161415", "0.7160452", "0.71597546", "0.71348345", "0.7116581", "0.7108206", "0.7085266", "0.70741093", "0.70...
0.0
-1
Constructor that sets the data root directory of the utility and the parameters of the database to operate on
def __init__(self, data_path='data', db_params=ideagens): my_path = path.abspath(data_path) self.path = my_path self.db_params = db_params self.db = get_db(self.db_params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.filepath = os.path.dirname(__file__)\n self.filepath = os.path.join(self.filepath, \"Datenbank\")\n self.filepath_render_database = os.path.join(self.filepath, self.render_database)\n self.filepath_object_database = os.path.join(self.filepath, self.object_data...
[ "0.7692113", "0.7485547", "0.7096281", "0.70213985", "0.6860665", "0.68553454", "0.6828117", "0.6802415", "0.67979676", "0.6768281", "0.6652036", "0.6593271", "0.65823466", "0.65577674", "0.65354234", "0.6481026", "0.6476851", "0.64603406", "0.6454555", "0.6447259", "0.644643...
0.78404117
0
Get a list of documents from the db collection for specified fields only. fields is list of field names for each document.
def get_data(self, collection, fields=None, filters=None): data = self.db[collection].find(filters) if fields is None: return data else: filtered_data = [] for doc in data: rowDict = {} for field in fields: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def only(self, *fields):\n for field in fields:\n path = \".\".join(self.document._meta.resolve_subfield_hierarchy(field.split(\".\")))\n self._only_fields.add(path)\n if self.query._Cursor__fields is None:\n # Identifier and version fields must always be included\n self.query._Curs...
[ "0.6406087", "0.6140172", "0.6130618", "0.6042337", "0.60035366", "0.5963449", "0.5830266", "0.57392967", "0.57133764", "0.5711136", "0.56971174", "0.56897503", "0.56877464", "0.56624216", "0.5639431", "0.5594121", "0.5571269", "0.55386645", "0.55327886", "0.552651", "0.55089...
0.6569988
0
Perform a similar operation to a sql join for 2 sets of data. base_data list of fields to extend with joined data join_data dictionary of data, indexed by base_field value base_field value to use as key in lookup in join_data dictionary join_fields list of field data to replace the base_field id The modified base_data ...
def join_data(self, base_data, join_data, base_field, join_fields): for data in base_data: extra = join_data[data[base_field]] for field in join_fields: data[field] = extra[field] return base_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_join(data: JoinedQueryData, verbose: bool) -> str:\n # The collection (sometimes referred to as \"type\" in the docs) to join\n string = 'type:' if verbose else ''\n string += str(data.collection)\n # The fields used to link the two collections\n if (parent := data.field_on) is not None:...
[ "0.63011765", "0.6102088", "0.6041325", "0.58504885", "0.58337146", "0.5824748", "0.5823174", "0.5774815", "0.5771162", "0.5677486", "0.5626348", "0.5621308", "0.5617843", "0.55927736", "0.55664855", "0.54893863", "0.5447424", "0.5423097", "0.5384637", "0.5383763", "0.5378737...
0.8677487
0
Get a list of all the ideas
def get_ideas(self): fields = ['content', 'clusterIDs', 'isGamechanger', 'userID', 'promptID'] return self.get_data("ideas", fields)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_meals():", "def get_queryset(self):\n return Objective.objects.filter(perspective__description='Learning and Capacity').order_by('code')", "def get_assay_solutions(self):\n vocabs = []\n assay = self.get_assay()\n if not assay:\n return vocabs\n for sol...
[ "0.6047027", "0.596079", "0.5894852", "0.5878744", "0.5878744", "0.58675534", "0.5793577", "0.57694536", "0.57275474", "0.57194996", "0.5701384", "0.5672025", "0.56617755", "0.56588876", "0.56406057", "0.56047946", "0.5599134", "0.5578972", "0.5569903", "0.5548997", "0.554799...
0.6485765
0
Get a list of all the ideas
def get_clusters(self): fields = ['name', ] return self.get_data("clusters", fields)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ideas(self):\n fields = ['content', 'clusterIDs', 'isGamechanger',\n 'userID', 'promptID']\n return self.get_data(\"ideas\", fields)", "def get_all_meals():", "def get_queryset(self):\n return Objective.objects.filter(perspective__description='Learning and Capacity...
[ "0.6485765", "0.6047027", "0.596079", "0.5894852", "0.5878744", "0.5878744", "0.58675534", "0.5793577", "0.57694536", "0.57275474", "0.57194996", "0.5701384", "0.5672025", "0.56617755", "0.56588876", "0.56406057", "0.56047946", "0.5599134", "0.5578972", "0.5569903", "0.554899...
0.0
-1
Get a list of all the ideas
def get_users(self): fields = ['name', ] return self.get_data("myUsers", fields)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ideas(self):\n fields = ['content', 'clusterIDs', 'isGamechanger',\n 'userID', 'promptID']\n return self.get_data(\"ideas\", fields)", "def get_all_meals():", "def get_queryset(self):\n return Objective.objects.filter(perspective__description='Learning and Capacity...
[ "0.6485765", "0.6047027", "0.596079", "0.5894852", "0.5878744", "0.5878744", "0.58675534", "0.5793577", "0.57694536", "0.57275474", "0.57194996", "0.5701384", "0.5672025", "0.56617755", "0.56588876", "0.56406057", "0.56047946", "0.5599134", "0.5578972", "0.5569903", "0.554899...
0.0
-1
This function creates a GUI obj and draw the simulation board
def initGameState(self): print("Setting game state: ") self.playGUI = GUI() self.playGUI.drawBoard(self.player)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_GUI(self):\n # root object, highest point in GUI, window\n GUI = tk.Tk()\n GUI.title('Sudoku')\n\n # background to fill in the window\n canvas = tk.Canvas(GUI,\n height=self.window_height,\n width=self.window_width,\n...
[ "0.7151314", "0.7061625", "0.6972889", "0.69183123", "0.68531877", "0.6804946", "0.67883235", "0.6772686", "0.6707081", "0.6605524", "0.6539703", "0.6533666", "0.65030825", "0.64919126", "0.645551", "0.6448594", "0.6443375", "0.6423321", "0.6410087", "0.6408588", "0.6392138",...
0.0
-1
This function creates 2 csv files (m_GreenPiece.csv and m_RedPiece.csv) based on the chess piece list data
def genDataFiles(self, pieceList): b_list, r_list = list(), list() for i in range(len(pieceList)): eval("{}.append((pieceList[i]['Name'], pieceList[i]['Pos']))".format('b_list' if pieceList[i]['Team'] == -1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file(self):\n result = []\n completePath = CompletePath(self.path, self.filename) \n with open(completePath.path(), 'w', newline='') as csvfile:\n fieldnames = ['Activity', 'Points']\n writer = csv.DictWriter(csvfile, fieldnames = fieldnames)\n writer.writ...
[ "0.577005", "0.56117916", "0.54306716", "0.5400523", "0.53685206", "0.5366225", "0.5328159", "0.53274345", "0.53264546", "0.5310038", "0.52820057", "0.52732444", "0.52692014", "0.52437043", "0.52368194", "0.522381", "0.5191414", "0.5183072", "0.5179588", "0.5169188", "0.51512...
0.78872997
0
This function calls the inputMove() function
def playGame(self): print("\nPlay Game") if (self.EndGame()): print("EndGame stt: ", self.EndGame()) print("The End") return True else: # Get pieceList from thong input_result = self.inputMove() # input move return 2 forms...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __process_input(self, input_):\n if self.state.game_over:\n if input_.key_pressed:\n self.state.exit = True\n else:\n if input_.action == 'PLAYER_UP':\n self.state.player.direction = 'U'\n elif input_.action == 'PLAYER_DOWN':\n ...
[ "0.7072983", "0.69347125", "0.6717801", "0.6645006", "0.6645006", "0.6645006", "0.6634736", "0.66273606", "0.6622313", "0.6620156", "0.66164476", "0.66120136", "0.6598716", "0.65917563", "0.6580514", "0.6560492", "0.6544803", "0.6444798", "0.644479", "0.644001", "0.64037025",...
0.0
-1
This function checks whether the BoardData_update.csv is still open to avoid problem when writing to that file
def checkOpenStatus(self): xl = win32.gencache.EnsureDispatch('Excel.Application') update_file = "BoardData_update.csv" update_file_pth = os.path.join(self.current_dir, 'src', update_file) if xl.Workbooks.Count > 0: print("opened: ", xl.Workbooks.Count) # if non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __check_write_success(self, update_data, path, method):\n #Initiate line-counter\n current_line = 1\n #Calculate what line will have the row we are looking for.\n looking_for_line = self.__row_id_in_file(list(update_data)[0])\n row_id = list(update_data)[0]\n #open fil...
[ "0.5843392", "0.58275557", "0.5788735", "0.57246226", "0.5717325", "0.56745094", "0.56287354", "0.5576904", "0.55670744", "0.55064464", "0.54561514", "0.54476815", "0.5400796", "0.5398325", "0.53946525", "0.53489804", "0.5316601", "0.53152823", "0.53104585", "0.52899975", "0....
0.675971
0
This function give the index of a key in the dictionary in a list that match the input value
def find(self, list, key, value): for i, dic in enumerate(list): if dic[key] == value: return i return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findIndex(lst, key, value):\r\n\r\n for i, dic in enumerate(lst):\r\n if dic['properties'][key] == value:\r\n return i\r\n return -1", "def find(lst, key, value):\n\n for i, dic in enumerate(lst):\n if dic[key] == value:\n return i\n return None", "def linear...
[ "0.80608493", "0.7877168", "0.7741012", "0.75335795", "0.73866296", "0.7343798", "0.725151", "0.69240844", "0.6870099", "0.68550146", "0.6810738", "0.68026084", "0.6739354", "0.6683892", "0.666758", "0.66640234", "0.66579", "0.6631289", "0.6626184", "0.66238743", "0.66025114"...
0.84405464
0
This function handles the inputs from the recognition system and call the AlphaBeta function
def inputMove(self): # Check if BoardData_update is still opended self.checkOpenStatus() self.genDataFiles(self.player.getCurrentPieceList()) print("PieceRecog.exe", len(self.player.getCurrentPieceList())) # Call the recognition function os.system("PieceRecog.exe " + st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_compute_alphas(self):\n\t\tdetails = self.watcher.analyze(layers=[self.second_layer], pool=False, randomize=False, plot=False, mp_fit=False, pl_package=WW_POWERLAW)\n\t\t#d = self.watcher.get_details(results=results)\n\t\ta = details.alpha.to_numpy()\n\t\tself.assertAlmostEqual(a[0],1.74859, places=3)\n\t...
[ "0.5983545", "0.5803987", "0.5793107", "0.57146734", "0.558493", "0.5578768", "0.5578768", "0.55334127", "0.5491118", "0.5359632", "0.53505504", "0.5339986", "0.5333948", "0.53233486", "0.5307697", "0.5304445", "0.5276514", "0.5271035", "0.52671754", "0.52498364", "0.52494586...
0.0
-1
Simulation chess engine which will replace the player role. The depth in this chess engine is fixed to 2
def autochess(self): print("Player {}: depth = 2".format(self.player.getCurrentPlayer())) self.player.changeCurrentPlayer() red_start = time.time() result = self.alphabeta(2, True, -9999, 9999, 2) red_end = time.time() red_elapse = red_end - red_start print("red ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play_game(self, k, maxiter=80):\n episode_end = False\n turncount = 0\n tree = Node(self.env.board, gamma=self.gamma) # Initialize the game tree\n\n # Play a game of chess\n while not episode_end:\n state = np.expand_dims(self.env.layer_board.copy(), axis=0)\n ...
[ "0.6021178", "0.5980791", "0.5744953", "0.5693278", "0.5628124", "0.55482346", "0.5477458", "0.54460293", "0.5431414", "0.542534", "0.54016364", "0.5384369", "0.53777295", "0.5365708", "0.5363621", "0.53609574", "0.5342275", "0.53383505", "0.53202564", "0.53122914", "0.529054...
0.0
-1
This function calls the Minimax algorithm with AlphaBeta pruning and update the Board data with its result and pass that result to the SCARA arm
def setNextMove_AB(self): print("Player {} depth = 2".format(self.player.getCurrentPlayer())) # Set timer start here: black_start = time.time() # Call Alpha Beta algorithm. Result is a dict: (score, piece, pos) result = self.alphabeta(2, False, -9999, 9999, 2) # Set time...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_ai():\n print(\"Minimax AI\") # First line is the name of this AI \n color = int(input()) # Then we read the color: 1 for dark (goes first), \n # 2 for light. \n\n while True: # This is the main loop \n # Read in the current game status, for example:\n # \"SC...
[ "0.6739058", "0.66835195", "0.66799206", "0.6660185", "0.6656803", "0.6656803", "0.6570939", "0.6370557", "0.6370331", "0.6335045", "0.6319892", "0.62688786", "0.6221413", "0.622117", "0.6218329", "0.61801255", "0.6123658", "0.61101794", "0.6104088", "0.61020035", "0.6071752"...
0.6949715
0
This function update the current position of the chess piece in the chess piece list
def movePiece(self, pieceList, piece, pos): # check captured: check = self.player.checkCaptured(self.pieceList, pos) for i in range(len(pieceList)): # print("I{} = ".format(i),self.pieceList['Symbol'][i]) if piece == pieceList[i]['Symbol']: # print('Old: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self): # called to update this piece's position\r\n \r\n if self.name == \"white\" and self.y == 25: self.crowned()\r\n elif self.name == \"black\" and self.y >= 350: self.crowned()\r\n self.draw()", "def update_state(self):\n self.reset_state()\n for piece in...
[ "0.70116913", "0.6867341", "0.6747652", "0.6747652", "0.67394334", "0.6716448", "0.6712994", "0.66439164", "0.6630502", "0.6586831", "0.65586555", "0.6537414", "0.65296495", "0.65072405", "0.65052354", "0.6481683", "0.64677644", "0.64517635", "0.6444109", "0.6429925", "0.6427...
0.6776017
2
This function calls the isGeneralExist() function to check if the game has ended
def EndGame(self): check_endgame = not self.player.getPlayer().isGeneralExist() return check_endgame
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_game_end(self):\r\n\r\n if np.all(self.remaining == -1): # end of game\r\n self.show_results() # show the final results\r\n sys.exit() # exit the program\r", "def check_game_over(self):\n for piece in self.pieces:\n if not piece.destroyed:\n ...
[ "0.655188", "0.6521891", "0.6394489", "0.6333242", "0.6310302", "0.6310302", "0.62986654", "0.62562", "0.62385774", "0.6233926", "0.6220784", "0.6182156", "0.61446255", "0.6126335", "0.6113239", "0.60957617", "0.60863745", "0.60460824", "0.59908366", "0.5977668", "0.59536237"...
0.7835693
0
This function clone the current State to not affect the current chess piece list
def nextState(self, piece, pos): # Copy current pieceList to new state obj nextState = copy.deepcopy(self) nextState.movePiece(nextState.player.getCurrentPieceList(), piece, pos) return nextState
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def myclone(self):\n new_state = GameState(self.size)\n for rc in self.gameState:\n new_state.gameState[rc] = self.gameState[rc] \n new_state.numRebels = self.numRebels\n new_state.numSith = self.numSith\n new_state.numJedi = self.numJedi\n new_state.numT...
[ "0.7235795", "0.7170529", "0.70201683", "0.69685066", "0.6800548", "0.6752228", "0.6737828", "0.6681385", "0.66702825", "0.6632915", "0.662159", "0.6373292", "0.6328631", "0.63259995", "0.63209665", "0.63136923", "0.628523", "0.6269973", "0.62681705", "0.6263873", "0.62616587...
0.6757453
5
Minimax algorithm with AlphaBeta pruning. This algorithm is upgraded to fix the pruning problem at the highest depth
def alphabeta(self, depth, isMax, alpha, beta, depth_flag): # Check for endgame condition: if self.EndGame() == True: # print(self.player.getCurrentPieceList()) result = { "Score": '', "Piece": '', "Pos": '' } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimax(board: bytearray,\n depth: int, # depth of current plies (0 = deepest)\n alpha: int, \n beta: int, \n max_player: bool, # is this maximzing player?\n at_top: bool=False, # are we the top call to this?\n ):\n \n # base cases:\n ...
[ "0.75425935", "0.74693", "0.73752105", "0.7092995", "0.7008297", "0.6930921", "0.6910464", "0.6905876", "0.6891868", "0.6854438", "0.68499684", "0.68315196", "0.6827699", "0.6825186", "0.67290574", "0.67262363", "0.6707463", "0.6678839", "0.66525674", "0.66510415", "0.6541357...
0.6647835
20
Convert price string to int.
def convert_prices(price): return int(price.replace("$", "").replace(",", ""))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_integer_price(decimal_price):\n return int(float(decimal_price) * 100)", "def format_price(self, price_text):\n return int(re.sub(r\"\\D\", \"\", price_text))", "def dec2int(r: str) -> int:", "def _str_to_int(in_str):\n if in_str == '':\n return 0\n return int(in_str, 1...
[ "0.7487968", "0.70949787", "0.7048899", "0.7001138", "0.6740254", "0.6589532", "0.65539086", "0.65201676", "0.6513394", "0.6505703", "0.64942455", "0.64933985", "0.64712745", "0.64681584", "0.6453859", "0.64247787", "0.6400984", "0.6392125", "0.637679", "0.63657695", "0.63581...
0.7599279
0
Convert date string to datetime.
def convert_date(date_str): return datetime.strptime(date_str, "%d/%m/%Y")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_to_datetime(datestr):\n\n from dateutil import parser\n from datetime import datetime\n\n date = parser.parse(datestr)\n return date", "def parse_datetime(date_str: str) -> datetime:\n return dateutil.parser.parse(date_str)", "def to_datetime(date_string):\n return dt.strptime(date_st...
[ "0.8128393", "0.8001215", "0.7989846", "0.798428", "0.79651654", "0.7881875", "0.7866022", "0.78598154", "0.78395015", "0.77747935", "0.7715534", "0.76870006", "0.75268126", "0.7498706", "0.74965304", "0.7485769", "0.74842775", "0.746032", "0.7424017", "0.74084324", "0.739559...
0.75608206
12
Extract key information from supplied dicts.
def process_property(prop): output = {} output['Property'] = prop['PropertyAddress'] output['Sale date'] = convert_date(prop['DateSold']) output['Sale price'] = convert_prices(prop['SalePrice']) output['Rates value'] = convert_prices(prop['CapitalValue']) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_keys(dic, *keys):\n for k in keys:\n if k not in dic:\n raise KeyError(\"key %r is not in original mapping\" % k)\n r1 = {}\n r2 = {}\n for k, v in dic.items():\n if k in keys:\n r1[k] = v\n else:\n r2[k] = v\n return r1, r2", "def ...
[ "0.69396967", "0.65762895", "0.60969096", "0.6032293", "0.58696604", "0.5815913", "0.5800308", "0.5795667", "0.5753932", "0.5684017", "0.56767654", "0.5654763", "0.5616689", "0.5562791", "0.5560253", "0.5541182", "0.5537519", "0.54865456", "0.54665345", "0.5452122", "0.543408...
0.0
-1
Scrape the most recent sales from the specified QV URL (region).
def get_sale_prices(): r = requests.post(settings.qv_url, data=REQUEST_DATA) response = r.json() data_processed = [process_property(prop) for prop in response['LocalAreaSales']] return data_processed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_search(self):\n # Call the website\n self.driver.get(self.BASE_URL)\n\n # Request the proper historical data\n self.select_proper_version()\n self.save_image()\n\n # If the entity exists in this historical version, extract the data\n if self.select_proper_reg...
[ "0.55092543", "0.55061114", "0.54281896", "0.52271366", "0.5180293", "0.5082719", "0.50809556", "0.50806385", "0.5078647", "0.5068418", "0.50643146", "0.5047871", "0.49885723", "0.49187106", "0.4887966", "0.48736772", "0.48600337", "0.48512283", "0.48398307", "0.4830591", "0....
0.51767665
5
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.7274154", "0.7247606", "0.7247606", "0.7247606", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.72756827", "0.7249146", "0.7249146", "0.7249146", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", ...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.72740597", "0.72474295", "0.72474295", "0.72474295", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331",...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.7275837", "0.72492236", "0.72492236", "0.72492236", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", ...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.74556196", "0.74288356", "0.74288356", "0.74288356", "0.7237776", "0.7237776", "0.7237776", "0.7237776", "0.7237776", "0.7237776", "0.7237776", "0.7237776", "0.7237776", "0.7237776", "0.7237776", "0.7237776", "0.7237776", "0.7237776", "0.7237776", "0.7237776", "0.7237776",...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.72756827", "0.7249146", "0.7249146", "0.7249146", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", ...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.72740597", "0.72474295", "0.72474295", "0.72474295", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331",...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.7275837", "0.72492236", "0.72492236", "0.72492236", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", ...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.7274154", "0.7247606", "0.7247606", "0.7247606", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.72756827", "0.7249146", "0.7249146", "0.7249146", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", ...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.72740597", "0.72474295", "0.72474295", "0.72474295", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331",...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.7275837", "0.72492236", "0.72492236", "0.72492236", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", ...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.7274154", "0.7247606", "0.7247606", "0.7247606", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.72756827", "0.7249146", "0.7249146", "0.7249146", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", ...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.72740597", "0.72474295", "0.72474295", "0.72474295", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331",...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.7275837", "0.72492236", "0.72492236", "0.72492236", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", ...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.7274154", "0.7247606", "0.7247606", "0.7247606", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.72756827", "0.7249146", "0.7249146", "0.7249146", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", ...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.72740597", "0.72474295", "0.72474295", "0.72474295", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331",...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.7275837", "0.72492236", "0.72492236", "0.72492236", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", ...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.7274154", "0.7247606", "0.7247606", "0.7247606", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.72756827", "0.7249146", "0.7249146", "0.7249146", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", ...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.72740597", "0.72474295", "0.72474295", "0.72474295", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331", "0.7114331",...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.7275837", "0.72492236", "0.72492236", "0.72492236", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", "0.7115413", ...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.7274154", "0.7247606", "0.7247606", "0.7247606", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "0.7113835", "...
0.0
-1
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature
def __init__(self, *args): #cannot find CLR method pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs): # real signature unknown; restored from __doc__\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signature unknown\n pass", "def __init__(self, *args, **kwargs): # real signa...
[ "0.72756827", "0.7249146", "0.7249146", "0.7249146", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", "0.7115314", ...
0.0
-1
Applies the transforms to the input image.
def __call__(self, image: Union[Tensor, Image]) -> Tensor: return self.transform(image)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _apply_transform(self, img: np.ndarray): \n img = self.transform(image=img)[\"image\"]\n return img", "def _apply_transform(self, img: np.ndarray): \n img = self.transform(image=img)[\"image\"]\n return img", "def _apply_transform(self, x, transform_parameters):\n # x is ...
[ "0.78274447", "0.78274447", "0.73057055", "0.7134887", "0.69119126", "0.69119126", "0.69119126", "0.6858849", "0.68499225", "0.68282694", "0.6821925", "0.6816408", "0.6813896", "0.67515564", "0.6749164", "0.6738225", "0.67337704", "0.6722991", "0.671074", "0.6646072", "0.6643...
0.615406
40
Applies the transforms to the input image.
def __call__(self, image: Union[Tensor, Image]) -> Tensor: return self.transform(image)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _apply_transform(self, img: np.ndarray): \n img = self.transform(image=img)[\"image\"]\n return img", "def _apply_transform(self, img: np.ndarray): \n img = self.transform(image=img)[\"image\"]\n return img", "def _apply_transform(self, x, transform_parameters):\n # x is ...
[ "0.78274447", "0.78274447", "0.73057055", "0.7134887", "0.69119126", "0.69119126", "0.69119126", "0.6858849", "0.68499225", "0.68282694", "0.6821925", "0.6816408", "0.6813896", "0.67515564", "0.6749164", "0.6738225", "0.67337704", "0.6722991", "0.671074", "0.6646072", "0.6643...
0.615406
41
Return a context manager which manages the lifetime of a guarded scope.
def guarded(phi: List[CircuitStatement], guard_idf: HybridArgumentIdf, is_true: bool) -> ContextManager: phi.append(CircGuardModification(guard_idf, is_true)) yield phi.append(CircGuardModification(None))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def context_local(context=None):\n class manager(object):\n def __init__(self, ctx):\n \"\"\"\n :type ctx: Context\n \"\"\"\n self.context = ctx.copy()\n\n def __enter__(self):\n self.orig_context = context_get()\n context_set(self....
[ "0.72501886", "0.6513197", "0.60733324", "0.6048442", "0.60429126", "0.6010695", "0.5881372", "0.5877266", "0.57822174", "0.5732369", "0.5726881", "0.5629307", "0.5621824", "0.5597244", "0.55930954", "0.5543057", "0.55411077", "0.5521868", "0.55116427", "0.550153", "0.5498804...
0.0
-1
Function to load rates from Norges Bank.
def run_load_fx(): from integrations.norges_bank.utils.fx import load_fx load_fx() logger.info('Loaded FX-rates from Norges Bank')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_currency_rates(url=\"http://www.nbrb.by/API/ExRates/Rates?Periodicity=0\") -> dict:\n data = {}\n response = requests.get(url)\n if response.status_code == 200:\n data = get_json(response)\n return data", "def getData(self):\n\n url = 'https://www.ecb.europa.eu/stats/eurofxref...
[ "0.6234643", "0.5868967", "0.58248913", "0.58198726", "0.57753855", "0.5621314", "0.55591446", "0.55049", "0.5376426", "0.5365806", "0.5357714", "0.53376746", "0.53337437", "0.5299859", "0.52955884", "0.5285284", "0.5275836", "0.5268934", "0.5255301", "0.52466327", "0.5239159...
0.63152975
0
Computes policy with a weight of a matrix
def policy(matrix, weight): # for each column of weights, sum (matrix[i] * weight[i]) using dot product dot_product = matrix.dot(weight) # find the exponent of the calculated dot product exp = np.exp(dot_product) # policy is exp / sum(exp) policy = exp / np.sum(exp) return policy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calcMaxEntPolicy(trans_mat, horizon, r_weights, state_features):\n\tn_states = np.shape(trans_mat)[0]\n\tn_actions = np.shape(trans_mat)[1]\n\n\tpartition = np.zeros((n_states, 1))\n\tpolicy = np.zeros((n_states, n_actions))\n\n\tpartition[n_states-1] = 1\n\treward = np.exp(np.dot(r_weights, state_features.T))...
[ "0.645586", "0.63133764", "0.63012934", "0.60636747", "0.60606676", "0.605857", "0.60234654", "0.5999505", "0.59799826", "0.5944463", "0.5941373", "0.59219086", "0.592158", "0.58848405", "0.5873565", "0.58386296", "0.58148813", "0.58018655", "0.5767474", "0.5761609", "0.57509...
0.86566025
0
Computes the Monte Carlo policy gradient based on the policy calculated from the above policy() function
def policy_gradient(state, weight): # first calculate policy using the policy function above Policy = policy(state, weight) # get action from policy action = np.random.choice(len(Policy[0]), p=Policy[0]) # reshape single feature from policy s = Policy.reshape(-1, 1) # apply softmax function ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def policy_gradient(self, loader):\n\n net = nn.DataParallel(self.agent, device_ids=self.gpus)\n total_steps = len(loader)\n \n for step_idx, src in enumerate(tqdm(loader, desc='Calculating policy gradient...', leave=False)):\n\n # Decode fragments and smiles, and get loss\n ...
[ "0.7161173", "0.7032053", "0.68745005", "0.68698114", "0.6776028", "0.6714242", "0.65616333", "0.6516723", "0.64023477", "0.6382716", "0.6294712", "0.62807685", "0.6279373", "0.62744296", "0.62561136", "0.6107736", "0.61047393", "0.606276", "0.6048897", "0.60471356", "0.60091...
0.7108714
1
This step takes in raw data and outputs features suitable for an ML model.
def compute_features(input: str, output: str): co.nb.matplotlib_inline() df = pd.read_csv(input) # Show proportion of customers exited vs retained labels = 'Exited', 'Retained' sizes = [df.Exited[df['Exited'] == 1].count(), df.Exited[df['Exited'] == 0].count()] explode = (0, 0.1) fig1, ax1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateFeatures(self, data):\n pass", "def extract_features(self, inputs):\n pass", "def createMLData(self):\n\n if self._verbose:\n print('\\nCreate ML Data')\n\n # Minimum required number of input data for ML training under the\n # current implemented setup....
[ "0.7104645", "0.67514604", "0.6521787", "0.6518997", "0.6508287", "0.64788514", "0.63838124", "0.632782", "0.62780243", "0.62633497", "0.6249205", "0.6240376", "0.62220335", "0.6219605", "0.62063205", "0.6204144", "0.6161946", "0.6157869", "0.6146887", "0.6146828", "0.6140769...
0.0
-1
Fit a machine learning model.
def fit(model, input: str, output: str): print(f"Fitting model of type: {model}") # Define the model. Use a randomized search to efficiently explore the # hyperparameter space in a limited time. if model == "logistic": # Primal logistic regression param_dist = { 'C': logunif...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_model(self):\n logger.info('Fitting model')\n if self.traj_dict is None:\n self.traj_dict = self.get_traj_dict()\n self.model.fit(self.traj_dict.values())", "def fit_training_data(self):\n self.model.fit(self.X_train)", "def fit(self, X, y):\n self.model = ...
[ "0.77583563", "0.76801455", "0.74248505", "0.7397779", "0.7377171", "0.7368339", "0.7294504", "0.7290782", "0.7290782", "0.7290782", "0.7290782", "0.7290782", "0.7290782", "0.7290782", "0.7290782", "0.7290782", "0.7290782", "0.72613734", "0.722498", "0.7219712", "0.71763957",...
0.68260574
56
Backtest the model against the given features. Output a DataFrame that
def backtest(features: str, model: str, output: str): # Load model from data store with open(model, "rb") as f: mdl = joblib.load(f) # Load feature data. In a true pipeline there would be a split between # training and testing data, but this was omitted for clarity. # # ** Never run a r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_forest_test_Data(strat_test_set):\n logging.info(\"Random forest.....\")\n X_test = strat_test_set.drop(\"median_house_value\", axis=1)\n y_test = strat_test_set[\"median_house_value\"].copy()\n X_test_num = X_test.drop(\"ocean_proximity\", axis=1)\n imputer = SimpleImputer(strategy=\"med...
[ "0.6345319", "0.63277817", "0.6277333", "0.6158429", "0.61521703", "0.61427313", "0.6100492", "0.6037001", "0.6009598", "0.60037315", "0.59914774", "0.5963398", "0.59282446", "0.5915352", "0.5909637", "0.5890372", "0.588733", "0.5859227", "0.5789517", "0.57549775", "0.5742304...
0.7583552
0
Plot the true positive rate vs false positive rate for each model.
def analyze(results: str): # Initialize plot co.nb.matplotlib_inline() plt.figure(figsize=(5, 4), linewidth=1) for model in os.listdir(results): # For each model, read in the results DataFrame df = pd.read_csv(os.path.join(results, model)) # Compute statistics auc = roc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_tp_rate(tp_rate):\r\n # Calculate the means for plotting\r\n means = pd.DataFrame(tp_rate.groupby(\"Temperature [°C]\").mean()[\"True Positive Rate [%]\"]).reset_index()\r\n ax = sns.swarmplot(y='True Positive Rate [%]',x=\"Temperature [°C]\", data=means, palette=\"magma_r\", edgecolor=\"black\",...
[ "0.63636893", "0.61657566", "0.6158322", "0.61474645", "0.6131326", "0.61257786", "0.60458773", "0.59943515", "0.59793687", "0.59292173", "0.5920243", "0.58957326", "0.5851733", "0.5817033", "0.5779324", "0.57768863", "0.57759243", "0.57722485", "0.5761979", "0.57581687", "0....
0.0
-1
The translation table from PIF field to MDF field The dictionary contains multiple levels. The first level is the "block" in the corresponding MDF output. The second level is the name of the field in a flattened PIF and the value of that key is the name of the field in the MDF block and a function that translates the P...
def get_translations(self) -> Dict[str, Dict[str, Tuple[str, Type]]]: return { 'material': {'elemental_proportion': ('elemental_proportions', dict)}, }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field_mapping(self):\n fields = self.fields\n if self.target_field is not None:\n del fields[self.target_field.get('name')]\n field_labels = list(self.fields.keys())\n\n field_mapping = {\n name: (\n field_labels.index(name),\n lambda value, e=e: self.parse_type(value, e)\n ...
[ "0.5871717", "0.5462577", "0.543782", "0.536871", "0.5336033", "0.53021574", "0.5231751", "0.51640385", "0.50003684", "0.49734783", "0.492218", "0.4920944", "0.48893556", "0.4860132", "0.4791568", "0.47843945", "0.4777327", "0.47663555", "0.47152624", "0.47021145", "0.4693048...
0.5236178
6
Push an item onto the stack. No return value.
def push(self, item): self.stack.append(item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(self, item):\r\n self.stack.insert(0, item)", "def push(self, item):\n\n self._stack.append(item)", "def push(self, item):\n self._items.append(item)\n # This operation increments the number of items\n # in the stack, we need to update the count variable\n sel...
[ "0.90451604", "0.8828648", "0.84492636", "0.8447282", "0.8417025", "0.8344185", "0.818139", "0.81461024", "0.8125367", "0.8123161", "0.8120266", "0.8086752", "0.80313486", "0.8019047", "0.7989268", "0.7989268", "0.79771405", "0.79666865", "0.79666865", "0.79666865", "0.796668...
0.90169555
2
Pop the topmost item off the stack. Returns the item.
def pop(self): item = self.stack[-1] self.stack = self.stack[:-1] return item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop(self):\n try:\n if self.size() > 0:\n top = self.top()\n self.items.pop()\n return top\n else:\n raise IndexError('Cannot pop item, stack is empty.')\n except IndexError as err:\n print(err)\n ...
[ "0.9038657", "0.89699066", "0.8646669", "0.8436965", "0.8425731", "0.8394855", "0.8379378", "0.83787584", "0.8376376", "0.836779", "0.8341289", "0.83400613", "0.83147097", "0.8313943", "0.8297329", "0.8291556", "0.8232232", "0.82071257", "0.82069063", "0.81836283", "0.8150139...
0.9046111
0
Peek at the topmost item of the stack without popping. Returns the item, or None on underflow.
def peek(self): try: return self.stack[-1] except IndexError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peek(self):\n if self.isEmpty():\n raise Exception(\"Stack underflow\") # Nothing to peek at\n return self.first.Item # most recently added item", "def peek(self):\n if not self.is_empty():\n return self._stack_items[-1]\n else:\n raise StackException('Peek oper...
[ "0.7854999", "0.7848019", "0.77432376", "0.7725692", "0.7712781", "0.7672322", "0.76620185", "0.7641305", "0.7610284", "0.76081336", "0.7587791", "0.7587791", "0.75744694", "0.7550017", "0.75288725", "0.7514343", "0.75083995", "0.7495166", "0.74850506", "0.7464874", "0.745950...
0.80332464
0
Returns whether or not the stack is empty.
def is_empty(self): return len(self.stack) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.the_stack) == 0", "def empty(self) -> bool:\n return len(self.stack) == 0", "def empty(self):\n return len(self.stack) == 0", "def empty(self):\n return len(self.stack) == 0", "def empty(self):\r\n return len(self.stack) == 0", "def...
[ "0.92969453", "0.90845764", "0.9067046", "0.9067046", "0.9049475", "0.9040509", "0.90028155", "0.8970693", "0.8958459", "0.894402", "0.8918213", "0.89048815", "0.88327855", "0.8823499", "0.8811676", "0.87955076", "0.87955076", "0.8791064", "0.87125903", "0.8611502", "0.859849...
0.92230463
1
Return number of items on the stack.
def __len__(self): return len(self.stack)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size(self): #returns the size or number of items in the stack\n if self.is_empty():\n return 0\n else:\n return self.num_items", "def size(self):\n return self.N # Number of items in the stack", "def size(self):\n return len(self._stack_items...
[ "0.87046397", "0.8648053", "0.8380214", "0.80204916", "0.80051744", "0.79051936", "0.79051936", "0.7672555", "0.7672555", "0.7635527", "0.76000184", "0.75771415", "0.7474788", "0.73247254", "0.7290252", "0.725836", "0.7244049", "0.722061", "0.72152984", "0.7203107", "0.710687...
0.7670148
9
String representation of the stack.
def __repr__(self): return str(self.stack)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getStackString(self):\n return \"\".join(self.stack[:0:-1])", "def __repr__(self):\n return str(self._stack_items)", "def __str__(self):\n return \"The stack contains: \" + str(self.the_stack)", "def __str__(self):\n data_str = [str(i) for i in self._data]\n return \"ST...
[ "0.85406256", "0.8412833", "0.8216093", "0.8198461", "0.8198461", "0.818666", "0.8168011", "0.81232345", "0.7814737", "0.7814737", "0.76956904", "0.76956904", "0.76956904", "0.76956904", "0.7628415", "0.7368872", "0.715802", "0.7069953", "0.67405593", "0.67273206", "0.6695258...
0.87551796
0
Validates that the string is a correct infix expression. Also, replaces unary minus operators with a 'u'. Returns a valid, tokenized string on success; raises ExpressionError if the input is erroneous.
def validate(string): tokens = string.split() # Remembers if the previous token was an operator opflag = True ## Highly inefficient validity checking begins here ## # List of operators as they would appear in the infix expression operators = ['+', '-', '*', '/', '^', 'sqrt'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_infix(string):\n return postfix(infix_to_postfix(string))", "def parse_infix(input: str) -> Node:\n parsed = ParsedString(input).tokenize()\n ans = parse_e(parsed)\n return ans", "def infix_to_postfix(string):\n \n # Validate and tokenize the string\n tokens = validate(string)...
[ "0.67217284", "0.66280156", "0.66256684", "0.6390146", "0.63846296", "0.6309319", "0.63021815", "0.6235218", "0.61009157", "0.60545176", "0.60317606", "0.60182995", "0.5994529", "0.5970374", "0.59688133", "0.5967874", "0.59608865", "0.59466004", "0.5895652", "0.5879398", "0.5...
0.75027424
0
Function to convert a single input infix string to postfix notation. It is assumed that tokens in the string are separated by whitespace. Returns the postfix expression on success; raises ExpressionError if the input expression is erroneous.
def infix_to_postfix(string): # Validate and tokenize the string tokens = validate(string) # Initialize the stack s = Stack() # Ready the final postfix expression postfix = '' # List of operators that have to be handled operators = ['+', '-', '*', '/', '^', 'sqrt', 'u-', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infix_to_postfix(string):\n tokenlist = string.split()\n output = []\n stack = create_stack()\n for token in tokenlist:\n if token == '(':\n stack.push(token)\n elif token == ')':\n toptoken = stack.pop()\n while toptoken != '(':\n outpu...
[ "0.82886326", "0.8267429", "0.8116412", "0.80532104", "0.79317456", "0.7838054", "0.78235006", "0.7815421", "0.77934223", "0.7734474", "0.7727248", "0.7694409", "0.7610501", "0.7605938", "0.75745595", "0.75698835", "0.74956685", "0.7477651", "0.7460197", "0.7417434", "0.73968...
0.8161909
2
Take in as input a list The function multiply_list() will multiply all of the numbers in the list. If any item in the list is invalid return False.
def multiply_list(input): result = 1 #if there is no numbers in list return False if not input: return False #if the list contains strings or 0 return False else: for x in input: if type(x) == str or x == 0: return False else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mul():\n l = [1, 2, 3, 4]\n assert s7.mul(*l) == 1 * 2 * 3 * 4\n assert s7.mul(10, 20) == 200\n assert s7.mul(1.0, 2.0, 100.0) == 200.0", "def multiply_list(lst):\n if lst == []:\n return 1\n else:\n return lst[0] * multiply_list(lst[1:])", "def listMul(l):\n \n #...
[ "0.6760711", "0.6697329", "0.64938724", "0.64613146", "0.63816386", "0.6319394", "0.63060385", "0.6242373", "0.62085116", "0.6153073", "0.6107456", "0.6038584", "0.602507", "0.600547", "0.5875371", "0.5868004", "0.5868004", "0.58225316", "0.5819411", "0.5819411", "0.579956", ...
0.80064815
0
Parse query param and take validated names
def parse_query_param(self, sideload_parameter): self.relations_to_sideload = set(sideload_parameter.split(",")) & set( self._sideloadable_fields.keys() ) return self.relations_to_sideload
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_params(self, params):\r\n if params[0] == \":\":\r\n params = [params[1:]]\r\n else:\r\n params = params.split(\" :\", 1)\r\n if len(params) == 1:\r\n last_arg = None\r\n else:\r\n last_arg = params[1]\r\n ...
[ "0.6670326", "0.6389083", "0.6330131", "0.62615776", "0.6193709", "0.61634845", "0.60988027", "0.60571504", "0.6051584", "0.6048205", "0.60453707", "0.5957845", "0.5956611", "0.59373385", "0.58949566", "0.589364", "0.58637", "0.58585805", "0.5825855", "0.58050853", "0.5799345...
0.0
-1
Returns config for tf.session
def get_config(): config = tf.ConfigProto(allow_soft_placement=True) config.gpu_options.allow_growth=True return config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _config_session(self):\n config = tf.ConfigProto()\n config.gpu_options.allow_growth = True\n config.gpu_options.visible_device_list = str(self.device_num)\n return tf.Session(config=config)", "def get_config():\n config = tf.ConfigProto(allow_soft_placement=True)\n config.g...
[ "0.7999958", "0.7535755", "0.72901034", "0.7119736", "0.6969369", "0.6781894", "0.65969217", "0.64716965", "0.6348045", "0.6322737", "0.631881", "0.62444156", "0.6241746", "0.6201172", "0.61908853", "0.61729336", "0.6153548", "0.6133191", "0.6101502", "0.6080999", "0.6076644"...
0.75894344
1
Load checkpoint from the ckpt_dir (if unspecified, this is train dir) and restore it to saver and sess, waiting 10 secs in the case of failure. Also returns checkpoint name.
def load_ckpt(saver, sess, ckpt_dir="train"): while True: try: latest_filename = "checkpoint_best" if ckpt_dir=="eval" else None ckpt_dir = os.path.join(FLAGS.log_root, ckpt_dir) ckpt_state = tf.train.get_checkpoint_state(ckpt_dir, latest_filename=latest_filename) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_ckpt(saver, sess, ckpt_dir=\"train\"):\n while True:\n try:\n latest_filename = \"checkpoint_best\" if ckpt_dir == \"eval\" else None\n ckpt_dir = os.path.join(FLAGS.log_root, ckpt_dir)\n ckpt_state = tf.train.get_checkpoint_state(ckpt_dir, latest_filename=latest...
[ "0.8223236", "0.78587455", "0.77297467", "0.7691358", "0.7526772", "0.7455489", "0.7162959", "0.7072553", "0.7010319", "0.69536954", "0.6937316", "0.6916923", "0.68400085", "0.6833414", "0.6830013", "0.68147194", "0.6802229", "0.67763555", "0.67456764", "0.6729885", "0.669250...
0.8222074
1
Compute the log of the sum of exponentials of input elements.
def logsumexp(a, axis=None, b=None, keepdims=False, return_sign=False): if b is not None: a, b = np.broadcast_arrays(a, b) if np.any(b == 0): a = a + 0. # promote to at least float a[b == 0] = -np.inf a_max = np.amax(a, axis=axis, keepdims=True) if a_max.ndim > 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_sum_exp(x):\n log_reduce_sum = P.ReduceSum()\n log = P.Log()\n exp = P.Exp()\n x_max = max(x.data)\n return log(log_reduce_sum(exp(x - x_max), 1)) + x_max", "def log_sum_exp(self, x):\n b = numpy.max(x[(x<sys.maxsize)]) # ignore inf values\n\n s = b + numpy.log(numpy.sum(nu...
[ "0.8021816", "0.7973607", "0.79658216", "0.7952592", "0.79182106", "0.79182106", "0.7760167", "0.7711429", "0.76088345", "0.7591885", "0.7590158", "0.75868016", "0.7528201", "0.73942685", "0.7390474", "0.73903686", "0.7328685", "0.72765005", "0.72420055", "0.72006994", "0.720...
0.6233052
64
Defines an initializer for the Xavier distribution. Specifically, the output should be sampled uniformly from [epsilon, epsilon] where epsilon = sqrt(6) / e.g., if shape = (2, 3), epsilon = sqrt(6 / (2 + 3)) This function will be used as a variable initializer.
def xavier_weight_init(shape): lim = np.sqrt(6. / sum(shape)) out = np.random.uniform(-lim, lim, shape) return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def XavierInit(self):\n\n raw_std = (2 / (self.num_input + self.num_output))**0.5\n if 'relu' == self.act_function:\n init_std = raw_std * (2**0.5)\n elif 'sigmoid' == self.act_function:\n init_std = raw_std\n else:\n init_std = raw_std # * 4\n\n ...
[ "0.713179", "0.694579", "0.6937731", "0.6779628", "0.6648162", "0.6642838", "0.6642838", "0.65998244", "0.6546982", "0.6546982", "0.6505124", "0.64154625", "0.64006364", "0.6392973", "0.6384507", "0.63683206", "0.62566024", "0.622814", "0.6173743", "0.6173743", "0.61022276", ...
0.6419569
11
Constructs word2idx dict from Glove pretrained embeddings and writes it to word2idx.txt file in data directory of the project.
def construct_dict(self): i = 0 self.word2idx = dict() fi = open(self.config.word_vec_fi_glove, 'r') for line in fi: self.word2idx[line.split(" ")[0]] = i i += 1 self.vocab_size = i self.write_dict() fi.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_idx2word():\n idx2word = {}\n d = train_data.shared['word2idx']\n for word, idx in d.items():\n print(word)\n idx2word[idx] = word\n if config.use_glove_for_unk:\n d2 = train_data.shared['new_word2idx']\n for word, idx in d2.items():\...
[ "0.7383777", "0.71597224", "0.6914332", "0.6700071", "0.66937166", "0.6675268", "0.6658766", "0.6642013", "0.65650064", "0.6545669", "0.6526046", "0.6516871", "0.65157616", "0.6507262", "0.6481229", "0.6472119", "0.6454776", "0.6420657", "0.6418853", "0.64167535", "0.64134", ...
0.7407205
0
Creates embedding matrix from input file and writes to binary file Considering numpy rowmajor order stores word vector rowwise.
def construct_embedding(self): i = 0 self.load_dicts() embedding_shape = (max(self.word2idx.values()) + 1, self.embedding_size) self.embedding = np.zeros(embedding_shape) with open(self.config.word_vec_fi_glove, 'r') as fi: for line in fi: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_embedding_matrix(filepath, word_index, embedding_dim):\n vocab_size = len(word_index) + 1 # Adding again 1 because of reserved 0 index\n embedding_matrix = np.zeros((vocab_size, embedding_dim))\n\n with open(filepath) as f:\n for line in f:\n word, *vector = line.split()\n ...
[ "0.71148777", "0.6811717", "0.66535574", "0.6645278", "0.6578764", "0.65542287", "0.65381473", "0.6517769", "0.65073204", "0.6506877", "0.6471639", "0.64159757", "0.6356227", "0.6192997", "0.6183885", "0.61746114", "0.6166684", "0.61592853", "0.6129667", "0.6122645", "0.60884...
0.69728744
1
Helper function to add new token to self.word2idx and embedding to self.embeddings
def add_embedding(self, token, embedding): self.word2idx[token] = self.vocab_size self.vocab_size += 1 self.embedding = np.vstack((self.embedding, embedding))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_dict(self, tokens):\n# TODO: ?add normalization of a token?\n for token in tokens:\n if self.embedding_words and (token not in self.embedding_words):\n continue\n self.freq[token] += 1\n if token not in self.tok2ind:\n index = len(sel...
[ "0.6996325", "0.6894177", "0.6658061", "0.65426093", "0.6435544", "0.6401983", "0.6349686", "0.63282156", "0.6324981", "0.6320355", "0.6309303", "0.6281128", "0.6220901", "0.62193155", "0.61735755", "0.61483675", "0.6124767", "0.61123055", "0.61009485", "0.6099443", "0.605398...
0.77013934
0
Averages word vectors that occur in both glove and paragram and creates union of two embeddings
def add_paragram(self): num_new_words = 720000 new_embeddings = np.empty((num_new_words, self.embedding_size)) concat_emb = np.zeros((2, self.embedding_size)) new_word2idx = dict() new_words_count = 0 self.load_all() fi = open(self.config.word_vec_fi_paragram, "r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_averaging(wv, words):\n all_words, mean = set(), []\n \n for word in words:\n if isinstance(word, np.ndarray):\n mean.append(word)\n elif word in wv.vocab:\n mean.append(wv.vectors_norm[wv.vocab[word].index])\n all_words.add(wv.vocab[word].index)\n\n...
[ "0.70063585", "0.65691555", "0.655092", "0.65492266", "0.64220226", "0.63821906", "0.6352523", "0.63278", "0.6304237", "0.63029516", "0.6285422", "0.6161037", "0.61082405", "0.60827434", "0.6066551", "0.605643", "0.60406655", "0.6036333", "0.6034815", "0.60307336", "0.6029545...
0.68158096
1
Adds unknown token to word2idx dictionary and computes vector as an average of random sample as suggested by Pennington
def add_unknown_token(self): self.load_all() sample_idxs = np.random.randint(0, self.embedding.shape[0], self.config.embedding_sample_size) unknown_vector = np.mean(self.embedding[sample_idxs, :], axis=0) self.add_embedding(self.config.unknown_tok...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_average_vec(tokens_list, vector, generate_missing=False, k=300):\r\n if len(tokens_list)<1:\r\n return np.zeros(k)\r\n \r\n if generate_missing:\r\n vectorized = [vector[word] if word in vector else np.random.rand(k) for word in tokens_list]\r\n else:\r\n vectorized = [vect...
[ "0.6838759", "0.65651834", "0.6410613", "0.6106581", "0.6086365", "0.6085573", "0.6080259", "0.6050455", "0.6035664", "0.5996665", "0.59961116", "0.5990178", "0.5940137", "0.5930811", "0.59277254", "0.5890196", "0.588386", "0.58830386", "0.58822876", "0.58559144", "0.5849721"...
0.69098496
0
Replaces each Quora question with indexes corressponding to respective position of tokens in embedding matrix. If include_unknown is true, then replaces with corressponding index, ignores otherwise.
def sentences_2_idxs(self): fo_pos = open(self.config.parsed_train_file_pos, 'w') fo_neg = open(self.config.parsed_train_file_neg, 'w') self.load_dicts() labels = pd.read_csv(self.config.train_file, usecols=["target"]) labels = list(labels.values[:, 0]) questions = pd.re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embed(raw_seq, index_dict):\n return np.asarray([index_dict[word.lower()]\n if word.lower() in index_dict\n else index_dict[OOV_TOKEN] for word in raw_seq])", "def convert_questions_to_features(examples, tokenizer, max_query_length=None):\n\n unique_id = 1000...
[ "0.5196209", "0.508824", "0.50696385", "0.50494385", "0.50279325", "0.49846712", "0.4941945", "0.493053", "0.49194095", "0.49090177", "0.4737878", "0.47329834", "0.47198913", "0.46659964", "0.46623522", "0.46447614", "0.46400312", "0.46255264", "0.4593311", "0.4577011", "0.45...
0.48166406
10
Replaces each Quora question with indexes corressponding to respective position of tokens in embedding matrix. If include_unknown is true, then replaces with corressponding index, ignores otherwise.
def predict_sentences_2_idxs(self): fo = open(self.config.parsed_predict_file, 'w') self.load_dicts() questions = pd.read_csv(self.config.predict_file, usecols=["question_text"], index_col=False) unk_idx = self.word2idx[self.config.unknown_token] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embed(raw_seq, index_dict):\n return np.asarray([index_dict[word.lower()]\n if word.lower() in index_dict\n else index_dict[OOV_TOKEN] for word in raw_seq])", "def convert_questions_to_features(examples, tokenizer, max_query_length=None):\n\n unique_id = 1000...
[ "0.5195214", "0.50893027", "0.5070433", "0.50482714", "0.49829122", "0.4942411", "0.49302742", "0.49184462", "0.49094704", "0.4815408", "0.47388384", "0.47334188", "0.47175914", "0.4665474", "0.46608728", "0.4643911", "0.46391892", "0.46259004", "0.4593503", "0.45771012", "0....
0.502763
4