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
convert netcdf data to rfm input atmosphere
def netcdf_atm_to_rfm(data, gases=None, filename='std.atm'): if gases is None: gases = ['H2O', 'CO2'] nlev = len(data['z'][:]) lines = [] # required sections lines.append(str(nlev) +'\n' ) lines.append('*HGT [km]\n') lines.append(ncvar_to_str(data, 'z', unit_factor=0.001)) lines.append('*PRE [mb]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def F_read_S5P_nc(self,fn,data_fields,data_fields_l2g=[]):\n from netCDF4 import Dataset\n ncid = Dataset(fn,'r')\n outp = {}\n for i in range(len(data_fields)):\n tmp = ncid[data_fields[i]]\n tmpdtype = tmp.dtype\n if not data_fields_l2g:\n ...
[ "0.60380644", "0.5983513", "0.5963582", "0.59113955", "0.5888357", "0.5790534", "0.5732397", "0.56976193", "0.56545323", "0.56313956", "0.56020343", "0.5597237", "0.55848056", "0.5533071", "0.5520608", "0.5515718", "0.5493376", "0.54359525", "0.54149514", "0.5412181", "0.5402...
0.5679294
8
Handles the view, creating a window with received messages, input field and a send button
def __init__(self, controller): self.controller = controller self.top = tkinter.Tk() self.top.title("Chatter") self.input = tkinter.StringVar() # For the messages to be sent. self.input.set("") """Message box""" messages_frame = tkinter.Frame(self.top) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_messages(self):\r\n self.clear_screen()\r\n user_label = Label(self.root, text=\"Hello \" + self.username,\r\n font=self.title_font, bg=self.bg_color, height=2)\r\n user_label.pack(pady=10, padx=50)\r\n messages_frame = Frame(self.root)\r\n mess...
[ "0.6463644", "0.6435802", "0.6249434", "0.6225735", "0.6175273", "0.61514634", "0.61473054", "0.6112437", "0.6067888", "0.60428005", "0.60217667", "0.6010846", "0.6000327", "0.59954065", "0.59937036", "0.59228635", "0.590236", "0.58884555", "0.5888028", "0.5829711", "0.581294...
0.7003499
0
get optimizer from params
def get_optimizer(params, custom_scheduler=None): other_args = {} if "clipnorm" in params: other_args["clipnorm"] = params.clipnorm if "clipvalue" in params: other_args["clipvalue"] = params.clipvalue if params.lr_decay_policy == "exp": lr = tf.keras.optimizers.schedules.Exponen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_optimizer(self):\n raise NotImplementedError", "def get_optimizer(self, optimizer, params):\n # Reference: https://pytorch.org/docs/stable/optim.html#per-parameter-options\n optimizer = getattr(optim, optimizer, \"Adam\")(\n [\n {'params': self.shared_conv....
[ "0.80132973", "0.76865035", "0.7493171", "0.74402606", "0.728855", "0.7225693", "0.7208306", "0.7100353", "0.6969457", "0.6934559", "0.6931398", "0.6917518", "0.6908583", "0.6907022", "0.6898751", "0.6863753", "0.686088", "0.6857952", "0.68151736", "0.67938507", "0.6792012", ...
0.6859656
17
Tests that, for entries with the matching TAS, Appropriations deobligations_recoveries_r_cpe equals the sum of all corresponding entries for Object Class Program Acitivity fields ussgl487100_downward_adjus_cpe, ussgl497100_downward_adjus_cpe, ussgl487200_downward_adjus_cpe, ussgl497200_downward_adjus_cpe
def test_success(database): tas = TASFactory() database.session.add(tas) database.session.flush() ap = AppropriationFactory(account_num=tas.account_num, deobligations_recoveries_r_cpe=8) # Contributes 4 op_1 = ObjectClassProgramActivityFactory( account_num=tas.account_num, ussgl487100_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fuel_cost(pudl_out_eia):\n print(\"\\nCalculating fuel costs by individual generator...\")\n fc = pudl_out_eia.fuel_cost()\n print(\" fuel_cost: {} records found\".format(len(fc)))\n if not single_records(fc):\n raise AssertionError(\"Found non-unique generator fuel cost records!\")"...
[ "0.5436577", "0.52429354", "0.523207", "0.5228745", "0.52223706", "0.5203418", "0.51979107", "0.51606166", "0.5154838", "0.5142103", "0.5075186", "0.50743043", "0.5066038", "0.5055073", "0.5044971", "0.5031934", "0.50278634", "0.5023637", "0.5020341", "0.50052", "0.50018525",...
0.507704
10
Tests that, for entries with the matching TAS, Appropriations deobligations_recoveries_r_cpe does not equals the sum of all corresponding entries for Object Class Program Acitivity fields ussgl487100_downward_adjus_cpe, ussgl497100_downward_adjus_cpe, ussgl487200_downward_adjus_cpe, ussgl497200_downward_adjus_cpe
def test_failure(database): tas = TASFactory() database.session.add(tas) database.session.flush() ap = AppropriationFactory(account_num=tas.account_num, deobligations_recoveries_r_cpe=7) # Contributes 4 op_1 = ObjectClassProgramActivityFactory( account_num=tas.account_num, ussgl487100_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testConsistency(self):\n #self.assertAlmostEqual(self.fxlinkedcashflow.amount(),0)", "def test_compute_grade_for_non_fa_enrollment_not_verified(self):\n course_key = self.run_no_fa.edx_course_key\n enrollment = self.enrollments.get(course_key)\n enrollment.data['mode'] = 'audit'\n...
[ "0.5512458", "0.5480747", "0.5375207", "0.5313387", "0.53087294", "0.52570003", "0.524053", "0.52381057", "0.5225757", "0.52240884", "0.5212196", "0.5205005", "0.5172426", "0.5153656", "0.51530707", "0.5118384", "0.5104104", "0.5065984", "0.5061357", "0.505969", "0.5052817", ...
0.52771646
5
Return 0 if a == b, 1 if a > b, else 1.
def compare_versions(a, b): a, b = version_to_ints(a), version_to_ints(b) for i in range(min(len(a), len(b))): if a[i] > b[i]: return 1 elif a[i] < b[i]: return -1 return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare(a,b):\r\n if a>b:\r\n return 1\r\n elif a==b:\r\n return 0\r\n else:\r\n return -1", "def compare(x, y):\n if x >= y:\n return 1.0\n else:\n return 0.0", "def compare(a, b):\n if a > b:\n return a\n return b", "def _cmp(a, b): # pyli...
[ "0.75257117", "0.70145875", "0.68630075", "0.67423034", "0.6732942", "0.66136074", "0.6569695", "0.64914453", "0.64882374", "0.6481441", "0.6381524", "0.6365701", "0.63373196", "0.62131846", "0.62080413", "0.6164161", "0.6141892", "0.6137344", "0.6122447", "0.61053973", "0.60...
0.55792224
73
u"""Split StringList into list of StringList
def split_blocks(strings): blocks = [StringList()] for item in strings.xitems(): # (source, offset, value) if item[2].strip(): blocks[-1].append(item[2], source=item[0], offset=item[1]) elif len(blocks[-1]): blocks.append(StringList()) # remove the last block if empt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _split_input_list(str_list):\r\n\r\n new_list = re.split(r'[\\n\\r\\s,]', str_list)\r\n new_list = [s.strip() for s in new_list]\r\n new_list = [s for s in new_list if s != '']\r\n\r\n return new_list", "def multiSplit(stringList, tokenList=[\" \"]):\r\n if not stringList: return []\r\n if ...
[ "0.7860924", "0.71834123", "0.71373975", "0.6994113", "0.69898045", "0.69133914", "0.6884402", "0.6856875", "0.68344647", "0.68336713", "0.67163867", "0.67152244", "0.67131823", "0.6695745", "0.6667128", "0.6640036", "0.6596695", "0.6583621", "0.65143436", "0.6511531", "0.650...
0.0
-1
u"""Join list of StringList to single StringList
def join_blocks(blocks): strings = StringList() for block in blocks: strings.extend(block) strings.extend(StringList([u''])) # insert a blank line # remove the last blank line if strings and not strings[-1]: del strings[-1] return strings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_join(the_list):\n return ' '.join(the_list)", "def join_list(items: Iterable[str]) -> str:\n\n return ITEM_SEPARATOR.join(items)", "def list_string(join_list):\n joined_list = '[{}]'.format(join_list, join_list)\n return joined_list", "def join_list(jlist, joiner=', '):\n if len(jlist...
[ "0.8205867", "0.81064206", "0.7733766", "0.7700534", "0.762689", "0.7539793", "0.74885464", "0.7354173", "0.7304979", "0.7285159", "0.7253279", "0.7208964", "0.72020966", "0.71971995", "0.7148965", "0.7118522", "0.7087361", "0.7035065", "0.7017025", "0.6976172", "0.6976172", ...
0.0
-1
u"""Align StringList if header is not empty, add header
def align_strings(strings, header=''): spaces = [len(l)-len(l.lstrip()) for l in strings.data if l] min_spaces = min(spaces) if spaces else 0 if min_spaces > 0 or header: for index in range(len(strings.data)): strings.data[index] = header + strings.data[index][min_spaces:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def header(List):\n headers = []\n restes = []\n for element in List:\n if isinstance(element, str):\n restes.append('')\n headers.append(element)\n elif isinstance(element, list):\n counter = 0\n restes.pop()\n restes.extend(element)\n ...
[ "0.64122003", "0.6266514", "0.5951054", "0.5781972", "0.5749648", "0.5705214", "0.56616527", "0.5596404", "0.5591171", "0.55200005", "0.5484643", "0.5462037", "0.5460574", "0.54580504", "0.5446216", "0.54273564", "0.5410737", "0.5407855", "0.5390078", "0.53741413", "0.5374005...
0.6849348
0
u"""Get the description of the field
def get_description(self, field_comment_option): desc = StringList() pre_blocks = split_blocks(self.pre_comments) post_blocks = split_blocks(self.comment + self.post_comments) if 'up-all' in field_comment_option: desc = join_blocks(pre_blocks) elif 'up' in field_comme...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_description(self, field_name='DESCRIPTION'):\n return self.get_html(field_name)", "def get_description(self):", "def description(self):", "def description(self):\n\n return self._get_field(\"description\")", "def get_description(self):\n pass", "def get_description(self) -> s...
[ "0.8046305", "0.8034182", "0.7925482", "0.7922851", "0.79104394", "0.7889596", "0.7884635", "0.7884635", "0.7868697", "0.78344506", "0.78344506", "0.7763387", "0.7748559", "0.7748559", "0.7748559", "0.7748559", "0.7738811", "0.7723243", "0.7717596", "0.77102005", "0.77004015"...
0.0
-1
Test a typical blogging scenario with comments and likes.
def test_posting(): bob = models.User.objects.create(email='bob@blog.hexlet.io') alice = models.User.objects.create(email='alice@blog.hexlet.io') assert models.User.objects.count() == 2 bobs_intro = models.Post.objects.create( title='Hello, World!', body="Hi there, I'm Bob!", c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_like_a_comment(self):\n self.base_test()", "def test_blog_add():", "def test_dislike_a_comment(self):\n self.base_test()", "def test_issue_post_comment_reaction(self):\n pass", "def test_user_can_get_a_comment(self):\n token1 = self.create_user(VALID_USER_DATA)\n ...
[ "0.7523803", "0.66962063", "0.6619535", "0.6491393", "0.63756716", "0.62736326", "0.62686616", "0.61566114", "0.6090354", "0.6031872", "0.60019535", "0.60016125", "0.5959157", "0.59560525", "0.5952762", "0.5942275", "0.59248835", "0.5920651", "0.59175867", "0.5917306", "0.590...
0.6350174
5
Try to import and return module, or return None if the module does not exist.
def try_import(module, default=None): try: return importlib.import_module(module) except ImportError: return default
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_module(name) -> Optional[ModuleType]:\n\n try:\n return importlib.import_module(name)\n except ModuleNotFoundError:\n return None", "def import_or_none(library):\n try:\n return importlib.import_module(library)\n except ImportError:\n return None", "def _get_m...
[ "0.7837974", "0.75869286", "0.7369042", "0.7268747", "0.7056078", "0.7056078", "0.70377046", "0.70377046", "0.70377046", "0.69279057", "0.68842643", "0.6857886", "0.6832459", "0.6797039", "0.6796271", "0.6792751", "0.6765652", "0.67623574", "0.6736071", "0.6666858", "0.661674...
0.78851616
0
Return the current object. This is useful if you want the real object behind the proxy at a time for performance reasons or because you want to pass the object into a different context.
def _get_current_object(self): loc = object.__getattribute__(self, '_Proxy__local') if not hasattr(loc, '__release_local__'): return loc(*self.__args, **self.__kwargs) try: return getattr(loc, self.__name__) except AttributeError: raise RuntimeError('n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_object(proxy):\n return proxy.__current_object__()", "def __current_object__(self):\n return self.__lookup()", "def _get_current_object(self):\n if not hasattr(self.__local, '__release_local__'):\n return self.__local()\n try:\n return getattr(self.__lo...
[ "0.86627316", "0.7780114", "0.77054226", "0.77054226", "0.7560016", "0.7132897", "0.7088699", "0.7008438", "0.6984951", "0.6984951", "0.6924909", "0.6718924", "0.65716755", "0.6560612", "0.65047556", "0.6426463", "0.6426463", "0.6426463", "0.640996", "0.636042", "0.636042", ...
0.8246899
1
The worker function, invoked in a thread. 'nums' is a list of numbers to factor. The results are placed in outdict.
def worker(nums, outdict): for n in nums: outdict[n] = primes2(n)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def worker(nums, outdict):\n print(threading.current_thread().name)\n print (\"pid:\", os.getpid())\n for n in nums:\n outdict[n] = factorize_naive(n)", "def worker(nums, out_q):\n outdict = {}\n print(threading.current_thread().name)\n print (\"pid:\", os.get...
[ "0.8537473", "0.79964024", "0.56695455", "0.5614573", "0.55069506", "0.54787064", "0.5360072", "0.5346579", "0.5330501", "0.532612", "0.530941", "0.5307435", "0.5305602", "0.53041404", "0.526302", "0.5257719", "0.5185135", "0.5185093", "0.51676595", "0.5140484", "0.51248294",...
0.7520257
2
Creates a DH rotation matrix for forward kinematics.
def rot(a, alpha, S, theta): return np.array([ # eqn 3.7 pg 36 [cos(theta), -sin(theta), 0.0, a], [sin(theta) * cos(alpha), cos(theta) * cos(alpha), -sin(alpha), -sin(alpha) * S], [sin(theta) * sin(alpha), cos(theta) * sin(alpha), cos(alpha), cos(alpha) * S], [0.0, 0.0, 0.0, 1.0] ]) # return np.array([ # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dhMatrix(self):\n row1 = np.array([np.cos(self.theta), -np.sin(self.theta)*np.cos(self.alpha), np.sin(self.theta)*np.sin(self.alpha), self.a*np.cos(self.theta)])\n row2 = np.array([np.sin(self.theta), np.cos(self.theta)*np.cos(self.alpha), -np.cos(self.theta)*np.sin(self.alpha), self.a*np.sin(s...
[ "0.7027864", "0.6109269", "0.6107896", "0.59823763", "0.5921101", "0.5783457", "0.57613975", "0.5735776", "0.5721824", "0.55084693", "0.5489177", "0.5487608", "0.5457247", "0.54503125", "0.54430765", "0.5437407", "0.5428085", "0.54130256", "0.5402257", "0.5370192", "0.5362484...
0.0
-1
Creates a transform from the leg frame to the foot. params = [[a, alpha, S, theta],[a, alpha, S, theta],...]
def T(params, phi): # handle the base frame, eqn 3.9, p36 t = np.array([ [cos(phi), -sin(phi), 0.0, 0.0], [sin(phi), cos(phi), 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0] ]) for i, p in enumerate(params): t = t.dot(rot(*p)) return t
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def T2(params):\n\t# handle the base frame, eqn 3.9, p36\n\tt = np.array([\n\t\t[1.0, 0.0, 0.0, 0.0],\n\t\t[0.0, 1.0, 0.0, 0.0],\n\t\t[0.0, 0.0, 1.0, 0.0],\n\t\t[0.0, 0.0, 0.0, 1.0]\n\t])\n\tfor i, p in enumerate(params):\n\t\tt = t.dot(rot(*p))\n\treturn t", "def CreateDHHomoTransform(alpha, a, d, theta):\n\n ...
[ "0.62162757", "0.58422446", "0.5733727", "0.5644279", "0.5590058", "0.5450843", "0.5309373", "0.53000003", "0.5293114", "0.52761006", "0.52697295", "0.5269417", "0.525969", "0.5253017", "0.52501714", "0.5247682", "0.5230527", "0.52099335", "0.5163592", "0.5143559", "0.5139012...
0.61880344
1
Creates a transform from the leg frame to the foot. params = [[a, alpha, S, theta],[a, alpha, S, theta],...]
def T2(params): # handle the base frame, eqn 3.9, p36 t = np.array([ [1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0] ]) for i, p in enumerate(params): t = t.dot(rot(*p)) return t
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def T(params, phi):\n\t# handle the base frame, eqn 3.9, p36\n\tt = np.array([\n\t\t[cos(phi), -sin(phi), 0.0, 0.0],\n\t\t[sin(phi), cos(phi), 0.0, 0.0],\n\t\t[0.0, 0.0, 1.0, 0.0],\n\t\t[0.0, 0.0, 0.0, 1.0]\n\t])\n\tfor i, p in enumerate(params):\n\t\tt = t.dot(rot(*p))\n\treturn t", "def CreateDHHomoTransform(a...
[ "0.6187362", "0.5845504", "0.5735868", "0.5645705", "0.5591346", "0.5451531", "0.53119457", "0.52992576", "0.5295918", "0.5275266", "0.5272088", "0.5268932", "0.52600217", "0.5254501", "0.52495295", "0.5248859", "0.52300406", "0.5211535", "0.5166836", "0.5144489", "0.5140848"...
0.6215197
0
(str) Returns the unique id for this type of mob
def get_id(self): return self._id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_id(self) -> str:\n return 'remo_device_' + self._remo_device.id + '_' + self._sensor_class", "def unique_id(self):\n return self.device_id + '_' + self._sensor_type", "def unique_id(self) -> str:\n return '{0}_{1}'.format(self._mac.replace(':', ''), self.entity_id)", "def uniq...
[ "0.80457294", "0.7965213", "0.7771157", "0.76887536", "0.7688311", "0.76702464", "0.76526463", "0.7642204", "0.7642204", "0.7642204", "0.7642204", "0.7642204", "0.7642204", "0.7642204", "0.7642204", "0.7606737", "0.75862837", "0.75435287", "0.75236124", "0.75172436", "0.75060...
0.0
-1
(str) Returns the physical (x, y) size of this mob
def get_size(self): return self._size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size(self):\n return (self.width)", "def w(self):\r\n return self.size.x", "def get_obj_size(self, name):\n\t\t# get handle\n\t\t# size of red blood cell\n\t\twidth = 60.35\n\t\treturn width", "def size(self):\n return self.width", "def size(self):\n return self.width", "def s...
[ "0.7287195", "0.72191817", "0.7189938", "0.7154307", "0.7154307", "0.7154307", "0.7154307", "0.7154307", "0.7154307", "0.7154307", "0.71415067", "0.71038955", "0.70029455", "0.70017046", "0.69861937", "0.6981482", "0.6966186", "0.69474447", "0.69292176", "0.69198775", "0.6916...
0.0
-1
Set the tempo of this mob.
def set_tempo(self, tempo): self._tempo = tempo
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_time(self, value: float):\n super().set_time(value)\n self.music.set_time(value)", "def tempo(beats, trk=None, bt=480):\n if not trk:\n trk = MidiTrack()\n trk.name = \"Tempo variation\"\n trk.append(MetaMessage(\"set_tempo\",\n tempo=beats[0],\...
[ "0.6575831", "0.6197611", "0.6102213", "0.5778988", "0.57423013", "0.5625058", "0.55944127", "0.557968", "0.5546541", "0.5523865", "0.5509457", "0.54904044", "0.5483288", "0.54639083", "0.5456773", "0.54504484", "0.5445503", "0.54454434", "0.54385287", "0.5428541", "0.5408127...
0.84690374
0
Advance this mob by one time step
def step(self, time_delta, game_data): # Track time via time_delta would be more precise, but a step counter is simpler # and works reasonably well, assuming time steps occur at roughly constant time deltas self._steps += 1 vx = self.get_tempo() self.set_velocity((vx, self.get_ve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def advance(self):\n self.amount = self._nextAmount", "def _advance(self):\n self._current += 1", "def advance(self, amount=1):\n raise NotImplementedError()", "def advance(self, amount):\n raise NotImplementedError()", "def _advance(self):\t\t# override inherited version\n ...
[ "0.714236", "0.7019324", "0.69135535", "0.6892576", "0.6886331", "0.6824957", "0.681575", "0.6811951", "0.6650154", "0.6648557", "0.66437864", "0.66320413", "0.66188264", "0.6618412", "0.6574639", "0.6568197", "0.65536726", "0.6512819", "0.6509724", "0.650555", "0.6493394", ...
0.0
-1
Construct a new cloud mob.
def __init__(self, fire_range=10): super().__init__(self._id, size=(16, 24), weight=0, tempo=80) self._last_drop = time.time() self._fire_range = fire_range
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, name):\n self.cloud = name\n self.cloudtype = \"multipass\"\n config = Config()\n self.default = config[f\"cloudmesh.volume.{self.cloud}.default\"]\n self.cm = CmDatabase()", "def _init_cloud(self, cloud_arg):\n # Disable too broad exception warning\n ...
[ "0.64294577", "0.6175119", "0.5926375", "0.58847517", "0.5880627", "0.5617271", "0.56119907", "0.55758023", "0.554229", "0.5502998", "0.54886425", "0.5480605", "0.54640466", "0.54085916", "0.5401484", "0.5357164", "0.5349297", "0.53429914", "0.5329992", "0.5302073", "0.528674...
0.0
-1
Move towards the player and fire when within range.
def step(self, time_delta, game_data): world, player = game_data vx, vy = self.get_velocity() mob_x, mob_y = self.get_position() player_x, player_y = player.get_position() # only fire within range if abs(player_x - mob_x) < self._fire_range: vx = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self):\n\n # get the location we WOULD go to\n newX = self.xcor() + self.dx\n newY = self.ycor() + self.dy\n while (abs (newX) > self.BOX_RANGE) or (abs(newY) > self.BOX_RANGE):\n # print(\"choosing new direction... \",end=\"\")\n self.chooseNewDirection(...
[ "0.61968595", "0.6170248", "0.6166515", "0.6129309", "0.60832727", "0.60832584", "0.6014044", "0.601114", "0.5981628", "0.5953743", "0.5946923", "0.5935749", "0.59352946", "0.59157395", "0.5890171", "0.58368725", "0.582623", "0.58024716", "0.57987016", "0.57379115", "0.573666...
0.6232066
0
main entry point for histoqc pipelines
def main(argv=None): if argv is None: argv = sys.argv[1:] parser = argparse.ArgumentParser(prog="histoqc", description='Run HistoQC main quality control pipeline for digital pathology images') parser.add_argument('input_pattern', help="input filename pattern (try: *.svs or t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n print_hist_new(histogram_new(get_pledge_list()))", "def run_plot(args):\n # print(\"running chronqc_plot\")\n chronqc_plot.main(args)", "def main(arguments):\n auth = (arguments['username'], arguments['token'])\n data_collector = DataCollector(arguments['repo name'],\n ...
[ "0.64033383", "0.6262794", "0.61313564", "0.60832924", "0.60832614", "0.60386324", "0.5999072", "0.5999072", "0.5931503", "0.59036714", "0.58954185", "0.5868609", "0.58654493", "0.5856093", "0.5855897", "0.58351755", "0.58313406", "0.58169144", "0.5814098", "0.5782732", "0.57...
0.74855036
0
__init__ is always the name of the constructor of a class. A constructor is the method that gets called when we create a new object. The first parameter of any method in Python must be self. self refers to the object that is created by this class. rgb is the other parameter, and will be a RGB tuple.
def __init__(self, rgb): ## The following are this class's attributes self.r = rgb[0] self.g = rgb[1] self.b = rgb[2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *rgb):\n self.alpha = 255\n if len(rgb) == 1:\n\t #Accept a string in the hext fromat made by color_rgb func.\n\t if isinstance(rgb[0],str):\n self.rgb = rgb_color(rgb[0])\n\t else:\n self.rgb=rgb[0]\n elif len(rgb) == 3:\n self...
[ "0.8136972", "0.77231884", "0.76384777", "0.7483035", "0.7460879", "0.73115057", "0.72980946", "0.71933264", "0.7148572", "0.7148572", "0.7148572", "0.7131563", "0.7131563", "0.7131563", "0.7131563", "0.7131563", "0.7131563", "0.7131563", "0.7070099", "0.7070099", "0.70283335...
0.8728064
1
Returns the tuple corresponding with this pixel.
def get_tuple(self): return (self.r, self.g, self.b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_info_in_tuple(self):\r\n return self.key, self.value, self.get_color(), self.size_tree", "def get_value_tuple(self, index):\n return (self.color_lookup_table_points[0][index],\n self.color_lookup_table_points[1][index],\n self.color_lookup_table_points[2][index...
[ "0.7446234", "0.7247504", "0.721311", "0.7123951", "0.7038608", "0.70002913", "0.69405144", "0.6797578", "0.674756", "0.67272466", "0.67135227", "0.6685013", "0.6671659", "0.6653", "0.6596942", "0.65934783", "0.65755326", "0.65621746", "0.6548689", "0.6532319", "0.6498623", ...
0.7828132
1
Return True if this is a grayscale pixel, and False otherwise.
def is_grayscale(self): return self.r == self.g == self.b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _isGrayscale(self, img: ndarray) -> bool:\n if len(np.squeeze(img).shape) == 2:\n return True\n else:\n return False", "def is_grayscale(img):\n return len(img.shape) == GS", "def isGray(self):\n return _libsbml.Unit_isGray(self)", "def is_gray(img: np.ndarra...
[ "0.78892565", "0.77772844", "0.76133263", "0.7463029", "0.7115401", "0.6903107", "0.68816495", "0.6827548", "0.674197", "0.67197865", "0.66625893", "0.64859575", "0.6473076", "0.64718765", "0.6427016", "0.61890054", "0.61247796", "0.6104257", "0.60149425", "0.5972804", "0.576...
0.84398115
1
This method sets the r, g, and b attributes of this pixel.
def set_rgb(self, r, g, b): self.r = r self.g = g self.b = b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setRgb ( self, r, g = 0.0, b = 0.0 ):\n self.setRgba( r, g, b )", "def setPixel(self, x, y, r, g, b):\n self.array[x, y, 0] = (r)\n\tself.array[x, y, 1] = (g)\n\tself.array[x, y, 2] = (b)\n #QD & DT 4.2.15\n\n #_tkExec(self.image.put, \"{%s}\"%color_rgb(r,g,b), (x, y))", "def se...
[ "0.7381146", "0.72884506", "0.72397053", "0.68300134", "0.6787732", "0.6683633", "0.6643094", "0.6466936", "0.6457594", "0.6386721", "0.63136405", "0.6310134", "0.63059825", "0.62479043", "0.62479043", "0.61410093", "0.6104015", "0.605565", "0.6053823", "0.605312", "0.6047067...
0.78087
1
Return the nth term in the fibonacci series starting with 0 and 1.
def fibonacci(n): if n == 1: return 0 elif n == 2: return 1 else: return fibonacci(n-2) + fibonacci(n-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fibonacci_term(n):\n return int(((1+sqrt(5))**n-(1-sqrt(5))**n)/(2**n*sqrt(5)))", "def fibonacci(n):\n\tfib_seq = []\n\tnth_term = 0\n\t\n\tfor i in range(0,n+1):\n\t\tif i == 0:\n\t\t\tfib_seq.append(0)\n\t\tif i == 1:\n\t\t\tfib_seq.append(1)\n\t\tif i > 1:\n\t\t\tnth_term = fib_seq[-1] + fib_seq[-2]\n\...
[ "0.8039447", "0.7930601", "0.78808546", "0.7765923", "0.76415265", "0.7609987", "0.7565677", "0.75637174", "0.7555507", "0.75182575", "0.7509442", "0.7487715", "0.7481205", "0.7480034", "0.74709594", "0.7470538", "0.74611616", "0.74527943", "0.74487466", "0.7443433", "0.74399...
0.73186946
48
Return the nth term in the lucas series starting with 2 and 1.
def lucas(n): if n == 1: return 2 elif n == 2: return 1 else: return lucas(n-2) + lucas(n-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_term(x):\n if x%2 == 0:\n return x/2\n else:\n return 3*x + 1", "def lucas(n):\n lucval = sum_series(n, 2, 1)\n print(lucval)\n return lucval", "def lucas(n):\n\tlucas_seq = []\n\n\tfor i in range(0,n+1):\n\t\tif i == 0:\n\t\t\tlucas_seq.append(2)\n\t\tif i == 1:\n\t\t\tlu...
[ "0.7215954", "0.66910076", "0.64849555", "0.6452454", "0.64070886", "0.63902944", "0.586178", "0.57736903", "0.576211", "0.573471", "0.5733081", "0.5708258", "0.5707477", "0.5672134", "0.5671918", "0.567083", "0.5665579", "0.5655143", "0.5655143", "0.5650137", "0.5641816", ...
0.5727022
11
Return the nth term in a userdefined series.
def sum_series(n, first=0, second=1): if n == 1: return first elif n == 2: return second else: return sum_series(n-2, first, second) + sum_series(n-1, first, second)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_term(x):\n if x%2 == 0:\n return x/2\n else:\n return 3*x + 1", "def __getitem__(self,i):\n\t\treturn self.series[i]", "def sin_series(x, n):\n return sum((sin_term(x, i) for i in xrange(0, n)))", "def n_series(self):\n return self.container['n_series']", "def sin_ter...
[ "0.6483167", "0.60635984", "0.60177684", "0.5872444", "0.5829992", "0.57477325", "0.5719357", "0.56117225", "0.5607872", "0.560388", "0.55832386", "0.5571805", "0.5567936", "0.5563789", "0.5530493", "0.55152863", "0.5464244", "0.54197884", "0.5417285", "0.53827643", "0.536878...
0.5034378
53
Initializes the Convolutional Neural Network (CNN) used by the model.
def _initialize_cnn(image_size, action_size, learning_rate=None): # All layers are randomly initialized using Glorot initializer # Create the Inputs of the Neural Network image_input = Input(shape=(image_size, image_size, 1)) scalar_input = Input(shape=(2,)) # Create the first...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, model_config):\n # Training Parameters\n self.__learning_rate = model_config[\"cnnLearningRate\"]\n\n # Network Parameters\n self.__num_classes = model_config[\"numClasses\"]\n self.__weight_decay = 1e-4\n self.__num_gpus = model_config[\"numGpus\"]\n ...
[ "0.7434375", "0.7389311", "0.72427696", "0.6963498", "0.69261545", "0.6910583", "0.68948525", "0.68908554", "0.6839511", "0.67768586", "0.67682993", "0.6751567", "0.67511356", "0.6715346", "0.6707571", "0.66812485", "0.6671512", "0.6626081", "0.66145283", "0.6601314", "0.6599...
0.6945522
4
Generates the appropriate dictionaries from the provided action list
def _initialize_dicts(action_list): act_to_int = {} int_to_act = {} # Loop through the list and store it in the dictionaries for i, action in enumerate(action_list): act_to_int[action] = i int_to_act[i] = action return act_to_int, int_to_act
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_actions(self) -> list:\n pass", "def action_map(self) -> Dict[str, CLIActionType]:\n return add_dicts({\n \"dump\": self.dump_action,\n \"dump-macrosizes\": self.dump_macrosizes_action,\n \"dump_macrosizes\": self.dump_macrosizes_action,\n \...
[ "0.6746407", "0.66974306", "0.66112036", "0.6559247", "0.65344566", "0.6474273", "0.64630806", "0.63628864", "0.63465184", "0.6333028", "0.62804365", "0.6198757", "0.59783435", "0.5952686", "0.59122527", "0.590847", "0.59036595", "0.59000826", "0.5885315", "0.5858818", "0.584...
0.739009
0
Returns the weights of the neural network
def get_weights(self): return self._cnn_model.get_weights()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_weights(self):\n return self.weights\n #print(W)", "def get_weights(self):", "def get_weights(self):\n return self.nn.get_param_values()", "def get_weights(self):\n weights = []\n for layer in self.layers:\n weights += layer.weights\n return K.batch_get_value(weight...
[ "0.8321432", "0.8301214", "0.8146208", "0.8118076", "0.81030613", "0.81030613", "0.8071399", "0.8067196", "0.8067196", "0.80529034", "0.80529034", "0.80529034", "0.80529034", "0.79859567", "0.79371953", "0.79371953", "0.79371953", "0.7870353", "0.7870353", "0.7870353", "0.787...
0.7773752
32
Loads the weights of the neural network
def set_weights(self, weights): self._cnn_model.set_weights(weights)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_weights(self):\n self.npz_weights = np.load(self._weight_file)\n self._load_byte_embedding()\n self._load_cnn_weights()\n self._load_highway()\n self._load_projection()", "def load_weights(self, weights):\n\n i = 0\n for l in range(1, self.num_layers()):...
[ "0.81067663", "0.7864145", "0.7706678", "0.76773834", "0.7589726", "0.74698347", "0.7362779", "0.736005", "0.72535807", "0.7232248", "0.72109824", "0.7169889", "0.71345806", "0.71209586", "0.70447147", "0.70214546", "0.7007186", "0.7007186", "0.69439834", "0.6933072", "0.6932...
0.0
-1
Load pretrained weights for the CNN from the specified path
def load_weights_file(self, file_path): # Load the weights self._cnn_model.load_weights(file_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_pretrained_net_weights(net, ckpt_path):\n print(\"Loading Model: \", ckpt_path)\n print('')\n\n net.load_weights(ckpt_path).expect_partial()", "def load_weights(self, path: str):\n self.load_state_dict(torch.load(path))", "def load_weights(self, path: str):\n self.load_state_dic...
[ "0.7715949", "0.7478819", "0.7478819", "0.74023044", "0.7388873", "0.7361498", "0.73348725", "0.73348725", "0.7241301", "0.72256935", "0.71313363", "0.69333124", "0.69114554", "0.69024783", "0.6840412", "0.6821405", "0.6792394", "0.6791614", "0.67718136", "0.67372996", "0.673...
0.7162399
10
Stores the weights of the CNN in the specified location, using the specified name
def save_weights_file(self, file_path, file_name): # Join the path with the file name and append the extension (h5) path = join(file_path, "{}.h5".format(file_name)) # Store the weights self._cnn_model.save_weights(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_weights(self, location: str):\n\n # import torch\n torch = import_optional_dependency(\"torch\")\n torch.save(self.model.state_dict(), self._set_save_location(location))", "def save_weight_in_epoch(net):\n global weights\n input_layer_weight = net.train_layers[0].weight.copy()...
[ "0.67885274", "0.6347566", "0.61101085", "0.6032156", "0.6032156", "0.5960693", "0.58964086", "0.58633757", "0.58447206", "0.579632", "0.579632", "0.57656044", "0.5718184", "0.56983596", "0.56717837", "0.5646993", "0.55740446", "0.5572367", "0.5566657", "0.555882", "0.5549468...
0.5738875
12
Batch predicts the QValues of a batch of States
def predict(self, states, chunk_size): # Prepare the list of states using the network format unwrapped_states = [state.unwrap_state() for state in states] # Split the list of states into chunks of chunk_size number_of_lists = len(unwrapped_states) / chunk_size chunked_states = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict_batch(self, states: np.ndarray):\n return self.model(states, training=False)", "def predict_batch(self, states):\n\n s0 = np.concatenate(states[:,0]).reshape((self._batch_size, ) + self._state_shape[0]) \n # s1 = np.concatenate(states[:,1]).reshape((self._batch_size, self._sta...
[ "0.71947056", "0.71274537", "0.70448834", "0.6747603", "0.6720133", "0.66935927", "0.66238874", "0.6473343", "0.64364564", "0.6431032", "0.6426252", "0.63937783", "0.63863385", "0.63812405", "0.6336416", "0.6333197", "0.6297144", "0.6285546", "0.62243015", "0.61945873", "0.61...
0.65948176
7
Given a state, returns the optimal action (according to the model policy) to be taken.
def act(self, state): # Prepare the state for the neural network state_image, state_scalars = state.unwrap_state() # Predict the action using the CNN predicted_actions = self._cnn_model.predict([np.asarray([state_image]), np.asarray(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_optimal_action(self, state):\n # check if there are multiple equivalent optimal actions\n if sum(self.Q_values[state] == np.amax(self.Q_values[state])) > 1:\n # select one of the optimal actions randomly\n idxs = np.where(self.Q_values[state] == np.amax(self.Q_values[sta...
[ "0.81077707", "0.8093176", "0.7922624", "0.79208237", "0.79140586", "0.790481", "0.7872246", "0.78628343", "0.77500004", "0.77186334", "0.7693651", "0.76785064", "0.7668536", "0.76535875", "0.7647951", "0.7631164", "0.7619717", "0.76134783", "0.7589017", "0.7585482", "0.75512...
0.72329056
63
Given a list of states and their updated predictions, fit the CNN to learn weights for these new values
def fit_model(self, states, predictions, chunk_size): # Prepare the list of states using the network format unwrapped_states = [state.unwrap_state() for state in states] # Split the list of states and predictions into chunks of chunk_size number_of_lists = len(unwrapped_states) / chunk...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(features, targets, weights, bias):\n # see gradient_descent for explanation\n epochs = 100\n learning_rate = 0.1\n\n picture_nb = 2\n\n # Print current accuracy. How many people have been classified as sick/healthy correctly?\n predictions = predict(features, weights, bias)\n print(\...
[ "0.6389247", "0.6271829", "0.62178546", "0.6152139", "0.6109844", "0.6055006", "0.6037283", "0.6012927", "0.5968832", "0.59394944", "0.5935348", "0.5909079", "0.58944637", "0.58884853", "0.587932", "0.58745384", "0.58618677", "0.5860424", "0.5860368", "0.58590674", "0.5852561...
0.6178482
3
Delete links on the container
def delete_container_links(container): container_uri = container.cdn_uri.replace("http://", "") domain = get_domain() if domain: for record in pyrax.cloud_dns.get_record_iterator(domain): if record.type == "CNAME" and record.data == container_uri: print("Unlinking %s" % r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_link():", "def delete_container(self, container: Container):", "def delete_link(self):\n self.link_layout.links_list.remove_widget(self)\n self.link_layout.links.remove(self.text)\n utils.update_data()\n utils.data[self.link_layout.parent_screen.name]['links'] = self.link...
[ "0.76768744", "0.691312", "0.6862549", "0.6743283", "0.6653135", "0.6498238", "0.6472545", "0.6456422", "0.6323648", "0.6303841", "0.6291867", "0.62405205", "0.6238634", "0.62103117", "0.61937076", "0.5988736", "0.59731394", "0.5970793", "0.594171", "0.59104294", "0.5887923",...
0.7854271
0
Get the last modified datetime for a container
def get_container_last_modified(container): objects = container.get_objects(limit=1) if len(objects): return datetime.datetime.strptime(objects[0].last_modified, _PARSER_FORMAT) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_modified_at(self) -> str:\n return pulumi.get(self, \"last_modified_at\")", "def last_modified_at(self) -> str:\n return pulumi.get(self, \"last_modified_at\")", "def last_modified_time(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"last_modified_time\")", "def last_mo...
[ "0.7555496", "0.7555496", "0.75193024", "0.7496126", "0.7496126", "0.74697715", "0.7412751", "0.7412751", "0.7412751", "0.7412751", "0.7412751", "0.7412751", "0.7311992", "0.7278188", "0.7254314", "0.7219902", "0.7196855", "0.7105135", "0.7090801", "0.7081383", "0.70422727", ...
0.8489138
0
Generates all a list of all containers matching a certain prefix, except the last "" ones.
def get_outdated_containers(prefix, num_to_keep=2): most_recent = [] for container_name in pyrax.cloudfiles.list_containers(): if container_name.startswith(prefix): container = pyrax.cloudfiles.get_container(container_name) last_modified = get_container_last_modified(container) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_containers_names(client, prefix=DOCK_CONTAINER_NAME_PREFIX):\n\n return [str(container.name) for container in client.containers.list(\"all\") if prefix in container.name]", "def list_containers(self, name_prefix=None):\n container_list = self.client.get_account()[1]\n\n if name_prefix:\n...
[ "0.69304466", "0.64303565", "0.63686144", "0.6298443", "0.61471915", "0.6133167", "0.6027998", "0.591743", "0.5897735", "0.5830035", "0.5825641", "0.5812814", "0.5802283", "0.57742286", "0.57635385", "0.57623243", "0.57075894", "0.5706502", "0.56450987", "0.5637083", "0.56289...
0.6463593
1
Attempts to read the given ExcelFile and returns the data as a tuple (headers, list of dicts) The first row is considered the header row. Parsing stops at the first column with empty header.
def read_xls(filename): wb = load_workbook(filename, read_only=True) if len(wb.sheetnames) > 1: raise ValueError('only single-sheet workbooks supported') ws = wb.active # active sheet headers = None outdata = list() for row in ws.iter_rows(): if not headers: headers ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_xlsx(filename):\n from openpyxl import load_workbook\n\n workbook = load_workbook(filename=filename)\n worksheet = workbook.get_sheet_by_name(workbook.get_sheet_names()[0])\n row_it = worksheet.iter_rows()\n split_row_list = ([cell.value if cell.value is not None else \"\"\n ...
[ "0.651729", "0.64198995", "0.63598114", "0.62849253", "0.6137743", "0.612996", "0.60210395", "0.5933359", "0.59227514", "0.5904994", "0.5890231", "0.5737812", "0.5731709", "0.57270443", "0.57237005", "0.5712983", "0.56776345", "0.5667989", "0.564994", "0.5644384", "0.5620857"...
0.6834978
0
Saves the file from the given file form into /tmp using a temporary name which preserves the suffix, stores the temporary name in the form, and reads the file content. WTF is NOT used for the file handling, since the file upload handling seems broken.
def save_to_tmp(form): file = request.files.get('file') suffix = os.path.splitext(secure_filename(file.filename))[-1] tf = tempfile.NamedTemporaryFile(dir='/tmp', delete=False, suffix=suffix, prefix='lpm_tmp_') filepath = tf.name tf.close() file.save(filepath) form.tmpname.data = os.path.bas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_uploaded_file(f):\n tfile = tempfile.NamedTemporaryFile(delete=False)\n for chunk in f.chunks():\n tfile.write(chunk)\n tfile.close()\n return tfile.name", "def extract_filepath(form):\n return os.path.join('/tmp/', secure_filename(form.tmpname.data))", "def missing_but_potenti...
[ "0.6999891", "0.6876595", "0.6282418", "0.61502916", "0.60941184", "0.6052424", "0.60009044", "0.59599507", "0.5925253", "0.5897284", "0.58814937", "0.5876699", "0.58743423", "0.58587784", "0.5825322", "0.576916", "0.57485294", "0.57369435", "0.57234985", "0.57125956", "0.570...
0.78922766
0
Returns the file path represented by the form
def extract_filepath(form): return os.path.join('/tmp/', secure_filename(form.tmpname.data))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_upload_path(self):\n location = self.get_storage().location\n return self.cleaned_data['key_name'][len(location):]", "def file_path(self) -> Path:\n return self._input_file", "def path(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"path\")", "def fpath(self):\n ...
[ "0.70559305", "0.69773567", "0.6857498", "0.67373013", "0.6730273", "0.67279446", "0.67258567", "0.6721358", "0.66846657", "0.6671747", "0.6671747", "0.6671747", "0.6671747", "0.6671747", "0.6671747", "0.6671747", "0.6671747", "0.6671747", "0.6671747", "0.6671747", "0.6671747...
0.75473195
0
Load gene and trait data from a file into a dictionary. File assumed to be a CSV containing fields name, mother, father, trait. mother, father must both be blank, or both be valid names in the CSV. trait should be 0 or 1 if trait is known, blank otherwise.
def load_data(filename): data = dict() with open(filename) as f: reader = csv.DictReader(f) for row in reader: name = row["name"] data[name] = { "name": name, "mother": row["mother"] or None, "father": row["father"] or None,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(filename):\n data = dict()\n with open(filename) as f:\n reader = csv.DictReader(f)\n for row in reader:\n name = row[\"name\"]\n data[name] = {\n \"name\": name,\n \"mother\": row[\"mother\"],\n \"father\": row[\"...
[ "0.7161335", "0.6256714", "0.6057112", "0.5882449", "0.58573693", "0.58507997", "0.584045", "0.57748455", "0.5722949", "0.56721675", "0.5641511", "0.5613904", "0.5599517", "0.55784625", "0.55653006", "0.55469626", "0.54307306", "0.54268855", "0.54145217", "0.5414053", "0.5411...
0.71564037
1
Return a list of all possible subsets of set s.
def powerset(s): s = list(s) return [ set(s) for s in itertools.chain.from_iterable( itertools.combinations(s, r) for r in range(len(s) + 1) ) ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_subsets(self, ss):\n return chain(*map(lambda x: combinations(ss, x), range(1, len(ss)+1)))", "def sub_sets(s):\n r = [[]]\n for e in s:\n print 'r: %-55r e: %r' % (e,r)\n r += [sorted(x + [e]) for x in r]\n return r", "def powerset(s):\n return chain.from_iterable(comb...
[ "0.8129389", "0.787879", "0.7453355", "0.7359878", "0.733008", "0.7236916", "0.7206298", "0.7166167", "0.70329934", "0.7017981", "0.7017981", "0.6989447", "0.6956409", "0.68236494", "0.6768661", "0.6760932", "0.6653045", "0.6587314", "0.65813375", "0.6475858", "0.64621377", ...
0.74347126
3
Add to `probabilities` a new joint probability `p`. Each person should have their "gene" and "trait" distributions updated. Which value for each distribution is updated depends on whether the person is in `have_gene` and `have_trait`, respectively.
def update(probabilities, one_gene, two_genes, have_trait, p): for person in probabilities: # count the genes for the person geneCount = 0 if person in one_gene: geneCount = 1 elif person in two_genes: geneCount = 2 # check the trait hasTrait...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_probabilities(self):\n self.probabilities = self.pheromones**self.EXP_PH * self.mcv**self.EXP_MCV", "def calculate_genotype_probabilities(self):\n for name, member in self.members.items():\n member.genotype_probabilities = self.genotype_probabilities_of(name)", "def add_pres...
[ "0.66382325", "0.59155154", "0.590946", "0.58607185", "0.5817059", "0.5806549", "0.5781411", "0.570775", "0.5676578", "0.56284326", "0.5609379", "0.55766016", "0.5545323", "0.5538337", "0.5505827", "0.5495825", "0.5493841", "0.5479561", "0.5453029", "0.5448534", "0.54455036",...
0.7667227
0
Update `probabilities` such that each probability distribution is normalized (i.e., sums to 1, with relative proportions the same).
def normalize(probabilities): for person in probabilities: # normalize the "gene" geneSum = probabilities[person]["gene"][0] + probabilities[person]["gene"][1] + probabilities[person]["gene"][2] for i in range(3): probabilities[person]["gene"][i] /= geneSum # normalize ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(init_probs):\n total_prob = sum(init_probs)\n if total_prob > 0. + InferenceUtils._eps:\n for idx in range(len(init_probs)):\n init_probs[idx] = init_probs[idx] / total_prob\n\n # TODO: check refactor > do we have to return distrib with new insta...
[ "0.7348318", "0.68965816", "0.68523186", "0.67245287", "0.65878546", "0.6497214", "0.63326037", "0.61899316", "0.6167956", "0.60946774", "0.6094176", "0.6080334", "0.6080117", "0.60709256", "0.60655546", "0.5976193", "0.5956363", "0.59385234", "0.59376335", "0.5935575", "0.59...
0.7671539
0
Returns wether the code is currently in the runtime or building phase
def is_runtime_phase(): return os.getenv('FAIRING_RUNTIME', None) != None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_runtime(self):\n\n return self.is_valid_platform() and self['ENVIRONMENT']", "def has_compiled(self, phase='predict'):\n return self._graph_executor.has_compiled(phase)", "def is_devel(self):\r\n\r\n return self.is_debug()", "def in_build(self):\n\n return self.is_valid_pla...
[ "0.6960687", "0.6873371", "0.67680323", "0.66959435", "0.64917874", "0.64917874", "0.6448313", "0.6100761", "0.605261", "0.6036466", "0.60267997", "0.6004312", "0.60020846", "0.59926885", "0.5991379", "0.59727997", "0.5934243", "0.59249496", "0.59081984", "0.59026945", "0.590...
0.73991734
0
Opens a URI without using a proxy and reads all data from it.
def _ReadNoProxy(uri): return urllib2.build_opener(urllib2.ProxyHandler({})).open( urllib2.Request(uri), timeout=1).read()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open(self) -> None:\n\n self.r = urlopen(self.url(), timeout=self.TIMEOUT)", "def open(self, fullurl, data=None, method=None):\n fullurl = unwrap(toBytes(fullurl))\n # percent encode url, fixing lame server errors for e.g, like space\n # within url paths.\n fullurl = quote(...
[ "0.63884306", "0.62678653", "0.62050414", "0.5982591", "0.59400105", "0.59224564", "0.58880776", "0.5879283", "0.58296996", "0.5797411", "0.57586926", "0.5745863", "0.574048", "0.5739027", "0.5690802", "0.56879985", "0.55849826", "0.5552425", "0.5544786", "0.5528398", "0.5522...
0.6911702
0
Get the default service account for the host GCE instance. Fetches GOOGLE_GCE_METADATA_DEFAULT_ACCOUNT_URI and returns its contents.
def DefaultAccount(self): if not self.connected: return None try: return _ReadNoProxy(GOOGLE_GCE_METADATA_DEFAULT_ACCOUNT_URI) except urllib2.HTTPError as e: if e.code == 404: return None raise MetadataServerException(e) except urllib2.URLError as e: raise CannotC...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_credentials(scopes):\n credentials, _ = google.auth.default(scopes=scopes)\n return credentials", "def get_service_account_name():\n # Get the credential\n if os.path.exists(os.getenv(\"GCP_AUTOMATION_CONFIG\")):\n credential_location = os.getenv(\"GCP_AUTOMATION_CONFIG\")\n ...
[ "0.6467155", "0.61172706", "0.60549235", "0.60172904", "0.5775506", "0.574537", "0.574537", "0.57407176", "0.5729527", "0.56457466", "0.56095725", "0.551219", "0.5442747", "0.5438566", "0.5413697", "0.5372204", "0.5372204", "0.5372204", "0.5355967", "0.53399086", "0.53399086"...
0.8137239
0
Get the project that owns the current GCE instance. Fetches GOOGLE_GCE_METADATA_PROJECT_URI and returns its contents.
def Project(self): if not self.connected: return None try: return _ReadNoProxy(GOOGLE_GCE_METADATA_PROJECT_URI) except urllib2.HTTPError as e: raise MetadataServerException(e) except urllib2.URLError as e: raise CannotConnectToMetadataServerException(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetProject(self):\n errors = []\n objects = list(request_helper.MakeRequests(\n requests=[(self.compute.projects,\n 'Get',\n self.messages.ComputeProjectsGetRequest(\n project=properties.VALUES.core.project.Get(\n ...
[ "0.69035757", "0.6895152", "0.67446786", "0.6714865", "0.6683495", "0.66086197", "0.6555879", "0.6526271", "0.64918816", "0.64403236", "0.64297616", "0.6398177", "0.6322898", "0.63193315", "0.63193315", "0.63193315", "0.63193315", "0.63193315", "0.63193315", "0.6280249", "0.6...
0.8417992
0
Get the list of service accounts available from the metadata server.
def Accounts(self): if not self.connected: return [] try: accounts_listing = _ReadNoProxy( GOOGLE_GCE_METADATA_ACCOUNTS_URI + '/') accounts_lines = accounts_listing.split() accounts = [] for account_line in accounts_lines: account = account_line.strip('/') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_accounts(self) -> Sequence[str]:\n return pulumi.get(self, \"service_accounts\")", "def list_accounts(self):\n pass", "def get_accounts(self):\r\n return self._accounts", "def get_accounts(self):\n return self.accounts", "def get_accounts(self):\n\n\t\treturn self.__...
[ "0.7727759", "0.7191721", "0.71418333", "0.7078873", "0.70322686", "0.70096487", "0.6996888", "0.6991004", "0.69906896", "0.6844258", "0.68132955", "0.68014175", "0.67935866", "0.67425555", "0.6742149", "0.6738644", "0.67116845", "0.66877526", "0.66752905", "0.6649459", "0.66...
0.7544532
1
Get a singleton that fetches GCE metadata.
def Metadata(): def _CreateMetadata(unused_none): global _metadata if not _metadata: _metadata = _GCEMetadata() _metadata_lock.lock(function=_CreateMetadata, argument=None) _metadata_lock.unlock() return _metadata
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_metadata(self) -> Metadata:\n manifest = self._get_manifest()\n\n return Metadata(**manifest[\"metadata\"])", "def get(self):\n return self._metadata", "def get_metadata(self):\n return self.manager.get_metadata(self)", "def get_instance():\r\n try:\r\n module_i...
[ "0.64651906", "0.60670877", "0.60101914", "0.6000224", "0.5893446", "0.58755267", "0.58519554", "0.5821281", "0.5796832", "0.57793313", "0.5768779", "0.57570475", "0.5755814", "0.5720616", "0.5706986", "0.5677855", "0.56741625", "0.5664571", "0.5660234", "0.56291467", "0.5610...
0.7494278
0
according to training data train the KNN classifier
def fit(self,X_train,y_train): assert X_train.shape[0] == y_train.shape[0], \ "the size of X_train must equal to the size of y_train" assert self.k <= X_train.shape[0],\ "the size of X_train must be at least k" self._X_train =X_train self._y_train =y_train r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_knn(training_data):\n return knnclassifier(training_data, keys, 3)", "def train(self, trainingData, trainingLabels, validationData, validationLabels): \n \n # might be useful in your code later...\n # this is a list of all features in the training set.\n self.features = list(set([ f f...
[ "0.8516999", "0.7823553", "0.7806558", "0.7783955", "0.774235", "0.7562412", "0.75370073", "0.7523061", "0.7501932", "0.7477647", "0.7460583", "0.74477917", "0.7445679", "0.7436067", "0.73269796", "0.72857934", "0.7206517", "0.7178852", "0.7145309", "0.7112316", "0.71121633",...
0.67825705
72
Returns the base path of the Access Zone.
def get_zone_base_path(self, access_zone): try: zone_path = (self.zone_summary_api. get_zones_summary_zone(access_zone)).to_dict() return zone_path['summary']['path'] except Exception as e: error_msg = self.determine_error(error_obj=e) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_path(self):\n return self._base_path", "def get_zonepath(self, refresh=False):\n return self.get_attr(ZONE_ENTRY['ZROOT'], refresh)", "def get_base_path(self) -> str:\n raise NotImplementedError()", "def base_path(self):\n return Path(self.path)", "def base_path(self):\...
[ "0.7329515", "0.7076482", "0.70471233", "0.69008577", "0.6893322", "0.6753992", "0.6714823", "0.6711664", "0.6498454", "0.6451775", "0.6409097", "0.63424486", "0.6325115", "0.63007265", "0.6269372", "0.62501705", "0.61877066", "0.6175071", "0.61656606", "0.6154836", "0.615305...
0.8123169
0
Use this command to edit a task. $ trackmywork edit 2 m "Changing the task message" t 3h l ""
def command(task_id, message, time, project, category, links): task = storage.get_by_id(task_id) if not task: click.echo(f"Task {task_id} not found.") sys.exit(1) new_values = { 'message': message, 'time': time, 'project': project, 'category': category, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit(tid, tag, description, title, priority, end):\n try:\n manager = Actions()\n if tid is None:\n raise ValueError(\"Input tid!\")\n manager.edit_task(tid,\n title=title,\n tag=tag,\n priority=priori...
[ "0.76266325", "0.7618207", "0.7132559", "0.6808483", "0.67945284", "0.6653009", "0.6628986", "0.6628269", "0.65990484", "0.6581324", "0.6560869", "0.6440934", "0.63683903", "0.63630384", "0.6324294", "0.6316813", "0.62791055", "0.62666583", "0.6233657", "0.6183895", "0.618219...
0.79256684
0
A dict of x, y, width and height of the trimmed area within the original image.
def sprite_source_size(self): if self.trimmed: return { 'x': self.trim_offsets[0], 'y': self.trim_offsets[1], 'w': self.trim_offsets[2] - self.trim_offsets[0], 'h': self.trim_offsets[3] - self.trim_offsets[1], } else...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trim_image(image):\n bbox = image.getbbox()\n return image.crop(bbox)", "def crop(self, image):\n\t\treturn image.copy()[self.ymin:self.ymax,self.xmin:self.xmax]", "def crop_bounding_box(im, x, y, w, h):\n return im[y:y+h, x:x+w]", "def as_bounds(self) -> Dict[str, float]:\n return {\...
[ "0.63789374", "0.6179232", "0.6122598", "0.60189074", "0.5899477", "0.5826279", "0.57770544", "0.57470673", "0.57237035", "0.5674101", "0.5668785", "0.5613715", "0.56072557", "0.55902934", "0.5586875", "0.55865693", "0.558306", "0.55677956", "0.5558475", "0.5552691", "0.55526...
0.6814099
0
The area covered by the sprite's bounding rectangle.
def area(self): return self.width * self.height
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self):\n return self.__height * self.__width", "def area(self):\n return self.__height * self.__width", "def area(self):\n return self.__height * self.__width", "def area(self):\n\t\treturn self.height * self.height", "def area(self):\n\t\treturn self.width * self.height", "...
[ "0.7478449", "0.7478449", "0.7478449", "0.7476616", "0.74157476", "0.73980355", "0.7392112", "0.73849994", "0.7384757", "0.734239", "0.734239", "0.73328555", "0.73328555", "0.73328555", "0.73328555", "0.73328555", "0.73216444", "0.7305702", "0.72778875", "0.72726625", "0.7264...
0.733007
23
The sum of width and height. Note that this is not ACTUALLY the circumference!
def circumference(self): return self.width + self.height
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculatearea(self):\r\n return self.width * self.height", "def calculateperimeter(self):\r\n return (self.width * 2) + (self.height * 2)", "def perimeter(self):\n return 2 * (self.height + self.width)", "def perimeter(self):\n\t\treturn 2 * (self.width + self.height)", "def perime...
[ "0.71800035", "0.7149736", "0.71027356", "0.7078878", "0.702873", "0.6946088", "0.6882668", "0.6881731", "0.68220913", "0.68220913", "0.6779442", "0.6777669", "0.6764908", "0.6764908", "0.6764908", "0.6764908", "0.6764908", "0.6764908", "0.6764908", "0.6764908", "0.67477906",...
0.76774967
0
A key function for sorting Sprites by their width attribute.
def sort_width(sprite): return sprite.width
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_height(sprite):\n return sprite.height", "def sort_area(sprite):\n return sprite.area", "def sort_key(self):\n ...", "def sort(self, key_func):\n pass", "def sort_name(sprite):\n return sprite.name", "def sort_sprites(sprites, sort_type):\n sort_func = globals()['sort_'...
[ "0.6224015", "0.62071264", "0.58886963", "0.58881176", "0.5798669", "0.56780237", "0.5575542", "0.55297107", "0.55194455", "0.5511433", "0.54910177", "0.5479103", "0.5464517", "0.53186625", "0.52034795", "0.5186224", "0.51494133", "0.5060388", "0.5024787", "0.5022377", "0.500...
0.7824869
0
A key function for sorting Sprites by their height attribute.
def sort_height(sprite): return sprite.height
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_width(sprite):\n return sprite.width", "def sort_area(sprite):\n return sprite.area", "def sort(self, key_func):\n pass", "def sort_maxside(sprite):\n return max(sprite.width, sprite.height)", "def _get_heightmap_key(self, p1: Point3D, p2: Point3D, p3: Point3D) -> Hashable:\n ...
[ "0.661695", "0.6535336", "0.5951767", "0.579211", "0.57219535", "0.5710713", "0.5638926", "0.56159556", "0.5582387", "0.54221755", "0.5271681", "0.5271681", "0.5271681", "0.5250129", "0.52144355", "0.51565444", "0.5136759", "0.51224595", "0.51046467", "0.50399035", "0.5033076...
0.7621063
0
A key function for sorting Sprites by their name attribute.
def sort_name(sprite): return sprite.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_key(self):\n ...", "def sort(self, key_func):\n pass", "def sort_sprites(sprites, sort_type):\n sort_func = globals()['sort_' + sort_type]\n return sorted(sprites, key=sort_func, reverse=sort_type != 'name')", "def get_sort_key(self) -> str:\n return self.name", "def _gr...
[ "0.6631027", "0.647035", "0.64167017", "0.62548167", "0.61942005", "0.61473954", "0.6139011", "0.5985338", "0.5959501", "0.5932297", "0.59291553", "0.58704185", "0.58239174", "0.581752", "0.5782962", "0.5782962", "0.5645406", "0.56444883", "0.5636112", "0.56198025", "0.561727...
0.7530825
0
A key function for sorting Sprites by their area property.
def sort_area(sprite): return sprite.area
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort(self, key_func):\n pass", "def sort_key(self):\n ...", "def sort_sprites(sprites, sort_type):\n sort_func = globals()['sort_' + sort_type]\n return sorted(sprites, key=sort_func, reverse=sort_type != 'name')", "def sortRegioni(tupla):\n\t\n\treturn int(tupla[0])", "def sort_wid...
[ "0.6032342", "0.58830875", "0.5752889", "0.5739861", "0.5715908", "0.5654399", "0.5630161", "0.56174624", "0.55439436", "0.5515432", "0.5481578", "0.5455596", "0.53962964", "0.5306955", "0.5306776", "0.528841", "0.5274715", "0.5272779", "0.52226514", "0.52061397", "0.5150963"...
0.7870696
0
A key function for sorting Sprites by their circumference property.
def sort_circumference(sprite): return sprite.circumference
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key(o):\n return hypot((x - o.x), (y - o.y))", "def sort_area(sprite):\n return sprite.area", "def sort_width(sprite):\n return sprite.width", "def sort(self, key_func):\n pass", "def test_sorting():\n circles = [Circle(i) for i in range(10, 1, -1)] \n sorted_circles = sorted(...
[ "0.63177353", "0.5916227", "0.5636585", "0.5474369", "0.54349333", "0.5429711", "0.53461033", "0.5339276", "0.5286037", "0.52746147", "0.51721734", "0.5159244", "0.5094792", "0.5085343", "0.50837994", "0.5022103", "0.50191337", "0.4900456", "0.4859315", "0.48354027", "0.47914...
0.73712957
0
A key function for sorting Sprites by the longest of their two sides.
def sort_maxside(sprite): return max(sprite.width, sprite.height)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longest_key(self):\n longest = None\n for key in self:\n if not longest or len(key) > len(longest):\n longest = key\n return longest", "def sort_width(sprite):\n return sprite.width", "def sort_area(sprite):\n return sprite.area", "def longest_name():\...
[ "0.6207665", "0.6047913", "0.60159534", "0.59955096", "0.5969164", "0.58554727", "0.5801387", "0.57013625", "0.5664634", "0.564134", "0.5636362", "0.560898", "0.559832", "0.5524619", "0.54948455", "0.5493564", "0.5433914", "0.5429683", "0.5356947", "0.53369766", "0.5325361", ...
0.64841
0
A utility function for sorting a list of Sprite instances. sort_sprite should be one of 'width', 'height', 'name', 'area', 'circumference', or 'maxside'
def sort_sprites(sprites, sort_type): sort_func = globals()['sort_' + sort_type] return sorted(sprites, key=sort_func, reverse=sort_type != 'name')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_name(sprite):\n return sprite.name", "def sort_area(sprite):\n return sprite.area", "def sort_width(sprite):\n return sprite.width", "def sort_height(sprite):\n return sprite.height", "def sort_maxside(sprite):\n return max(sprite.width, sprite.height)", "def sort_circumference(sp...
[ "0.726147", "0.71374565", "0.69908696", "0.6874966", "0.64026535", "0.59863085", "0.5448864", "0.540087", "0.5330147", "0.5279491", "0.5238275", "0.5176354", "0.5150514", "0.5124298", "0.51124424", "0.51010805", "0.51010805", "0.50985247", "0.5098512", "0.5050989", "0.5047450...
0.8211479
0
Return a Layout containing the provided sprites laid out linearly horizontally.
def layout_horizontal(sprites): result = Layout() for sprite in sprites: result.sprite_positions.append(SpritePosition(sprite, result.width, 0)) result.width += sprite.width result.height = max(result.height, sprite.height) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layout_vertical(sprites):\n result = Layout()\n for sprite in sprites:\n result.sprite_positions.append(\n SpritePosition(sprite, 0, result.height))\n result.height += sprite.height\n result.width = max(result.width, sprite.width)\n return result", "def render(\n x...
[ "0.76347125", "0.56856465", "0.55034906", "0.5402938", "0.53874", "0.53240436", "0.5251552", "0.5226913", "0.51918864", "0.518357", "0.51514846", "0.51079714", "0.50302404", "0.5003588", "0.49906033", "0.49579713", "0.49318057", "0.4931599", "0.48837286", "0.48821652", "0.488...
0.87087053
0
Return a Layout containing the provided sprites laid out linearly vertically.
def layout_vertical(sprites): result = Layout() for sprite in sprites: result.sprite_positions.append( SpritePosition(sprite, 0, result.height)) result.height += sprite.height result.width = max(result.width, sprite.width) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def layout_horizontal(sprites):\n result = Layout()\n for sprite in sprites:\n result.sprite_positions.append(SpritePosition(sprite, result.width, 0))\n result.width += sprite.width\n result.height = max(result.height, sprite.height)\n return result", "def render(\n xs: np.array,...
[ "0.7490819", "0.5380607", "0.5287634", "0.5109913", "0.5051685", "0.5043355", "0.5035227", "0.5022621", "0.499461", "0.49869573", "0.49815091", "0.49762812", "0.49273208", "0.4921848", "0.49192566", "0.489987", "0.4887431", "0.48632923", "0.48544025", "0.48367232", "0.4823511...
0.8863264
0
Monotonic annealing of betaVAE loss. From 0 to 1. If you want to use a standard betaVAE loss, simply set beta_start !=0 and don't call update_beta()
def __init__(self, anneal_start, anneal_time, beta_start): self.anneal_start = anneal_start self.anneal_time = anneal_time self.beta = beta_start
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_prop_beta(self):\n # reproducible arbitrariness\n np.random.seed(1321)\n\n self.rule.alpha = 0\n self.rule.beta = 0.5\n\n self.conductor.out_step = np.random.randn(self.Nc)\n self.tutor.out_step = np.random.randn(self.Ns)\n\n factor = 1.5\n tmax = 7*self.dt\n\n W0 = np.copy(self...
[ "0.6509265", "0.6509265", "0.6322778", "0.6224168", "0.6191585", "0.6191585", "0.6142072", "0.6140275", "0.6116168", "0.6099783", "0.60765684", "0.60172945", "0.6004222", "0.6004222", "0.599266", "0.598975", "0.5988927", "0.5982294", "0.59485126", "0.5926383", "0.5920471", ...
0.0
-1
Implements startified kfold CV for training torch neural nets. This supposes your model has a 'train_model()' method that is callable.
def __init__(self, cv=10, lr=1e-2, n_epochs=10, train_p=10, test_p=10, num_workers=0, save_all=True, save_best=False, path_dir='./', model_prefix='trained_model_'): self.cv = cv #self.return_model = return_model # Init result dict self.cv_res_dict = {c:{} for c in range(self.cv)} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, model_type, params=None):\n Model = load_model_class(model_type)\n self.model_type = model_type\n X, y = self.task.make_dataset()\n self.final_data = X.copy()\n # Save preds\n preds = np.zeros_like(y.values).astype(np.float)\n with TMPFolder():\n ...
[ "0.69685215", "0.6756511", "0.65048367", "0.64416087", "0.6429771", "0.6426257", "0.6393962", "0.63887835", "0.63617903", "0.63469464", "0.6314964", "0.62932384", "0.62518114", "0.62518114", "0.62503785", "0.62380105", "0.6236457", "0.6222333", "0.6220971", "0.6211385", "0.61...
0.6004838
41
Run the Kfold cross validation. model is a blank version of the model you want to train, which will be copied at each CV iteration
def train_kfold(self, blank_model, model_params, dataset, batch_size, drop_last_batch=True): kfold = StratifiedKFold(n_splits=self.cv, shuffle=True) best_val_loss = 999999 best_cv = 0 best_model = None for i, (train_idx, test_idx) in enumerate(kfold.split(dataset, dataset.targets...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_validation(exp_name):\n click.echo(\"Mode: Cross-validation.\")\n # defaults = get_defaults()\n\n # fitted_model_filename = add_extension(fitted_model_filename)\n\n # derive final path for fitted model as base output path for fitted models + model filename\n # fitted_model_path = os.path.j...
[ "0.758794", "0.7510445", "0.73646635", "0.7363736", "0.7361118", "0.72702056", "0.7174628", "0.7130998", "0.696685", "0.69646007", "0.69556", "0.693936", "0.692508", "0.68650997", "0.6853345", "0.6849685", "0.68461406", "0.68451124", "0.6834828", "0.6817886", "0.6797188", "...
0.7932286
0
Checks if the sentiment for our stockName is positive or negative, returns True if majority of valid tweets have positive sentiment
def stockSentiment(stockName, numTweets=100): listOfTweets = user.search(stockName, count=numTweets) threshold = posSentTweet = negSentTweet = 0 for tweet in listOfTweets: analysis = TextBlob(tweet.text) if analysis.sentiment.polarity >= threshold: posSentTweet = posSentTweet +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_positive(text) :\n r = requests.post(\"http://text-processing.com/api/sentiment/\", data={'text': text})\n return r.json()['probability']['pos'] > r.json()['probability']['neg']", "def test(self, tweets, without_neutral=True):\n correct = 0\n total = 0\n for tweet in tweets:\n ...
[ "0.7007031", "0.6616565", "0.6460929", "0.63501424", "0.62836975", "0.61827385", "0.6182005", "0.61268514", "0.60830224", "0.60300577", "0.6004018", "0.59769857", "0.5955943", "0.59269845", "0.59109956", "0.5867363", "0.58236325", "0.57529086", "0.5736752", "0.56542516", "0.5...
0.80119866
0
Description Simulate Spin Echo Saturation Recovery Experiment sig = Mz (1 np.exp(RepTime/T1))
def T1_vTR(TR, *args): T1= args[0] Mz= args[1] return Mz * (1-np.exp(-TR/T1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simulate(self, simtime, szType, iIdLow, iIdHigh):\n self.szType = szType\n self.simtime = simtime\n self.iIdLow = iIdLow\n self.iIdHigh = iIdHigh\n self.logger.debug('SIMULATING:' + str(szType) + ' ' + str(iIdLow) + ' ' + str(iIdHigh)) \n\n self.evAPI.clear()\n self.evSimulate.set()", "...
[ "0.59798604", "0.57713073", "0.57594365", "0.5739354", "0.5733285", "0.57070225", "0.5666689", "0.56394607", "0.5625149", "0.55907357", "0.5575093", "0.5543309", "0.553642", "0.55286187", "0.5514215", "0.55103993", "0.547642", "0.54672897", "0.5457322", "0.5406124", "0.539181...
0.0
-1
Setup the Bluetooth Speaker platform.
def setup_platform(hass, config, add_devices, discovery_info=None): name = config.get(CONF_NAME) address = config.get(CONF_ADDRESS) volume = float(config.get(CONF_VOLUME)) pre_silence_duration = float(config.get(CONF_PRE_SILENCE_DURATION)) post_silence_duration = float(config.get(CONF_POST_SILENCE_D...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n try:\n print(\"Initializing driver\")\n pcms = alsaaudio.pcms()\n mixers = alsaaudio.mixers()\n print(f'Available PCMs: {pcms}')\n print(f'Available Mixers: {mixers}')\n self._device = alsaaudio.PCM(device=self._dev_name)\n...
[ "0.5857222", "0.58364004", "0.57944995", "0.5762191", "0.57366234", "0.5734976", "0.5726399", "0.56645304", "0.5656306", "0.56462806", "0.5613873", "0.5611077", "0.5602112", "0.55981094", "0.5579357", "0.557577", "0.5571606", "0.55591726", "0.5554699", "0.5537336", "0.5531611...
0.7132496
0
Return the name of the device.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._device.name", "def name(self):\n return self._device.name", "def name(self):\n return self._device.name", "def name(self):\n return self.device.name()", "def name(self):\n return f\"{get_device_name(self._data, 0, self._name)}\"", "def nam...
[ "0.8977436", "0.8977436", "0.8977436", "0.89167935", "0.88203055", "0.8726581", "0.86898243", "0.86898243", "0.8656703", "0.8576422", "0.85648245", "0.85648245", "0.85312635", "0.84561723", "0.84341395", "0.8311056", "0.8280482", "0.8255242", "0.8219552", "0.81260407", "0.809...
0.0
-1
Return the state of the device.
def state(self): if self._is_standby: return STATE_OFF else: return STATE_PLAYING
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state(self):\n return self.device.value()", "def state(self):\n return self._device.value", "def state(self) -> 'outputs.DeviceStateResponse':\n return pulumi.get(self, \"state\")", "def get_device_state(self):\n\t\treturn call_sdk_function('PrlSrvCfgDev_GetDeviceState', self.handle)...
[ "0.8931779", "0.8878994", "0.86772364", "0.8229383", "0.806395", "0.80581075", "0.8034137", "0.7993603", "0.7934417", "0.78348917", "0.78155345", "0.7754617", "0.7741858", "0.76588523", "0.7580099", "0.7580099", "0.75347555", "0.75329316", "0.75180656", "0.75160116", "0.75160...
0.0
-1
Flag media player features that are supported.
def supported_features(self): return SUPPORT_BLU_SPEAKER
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supported_features(self):\n return (\n mp.const.MediaPlayerEntityFeature.VOLUME_SET\n | mp.const.MediaPlayerEntityFeature.VOLUME_STEP\n | mp.const.MediaPlayerEntityFeature.PLAY\n | mp.const.MediaPlayerEntityFeature.PAUSE\n | mp.const.MediaPlayerEnti...
[ "0.79162157", "0.79162157", "0.77791554", "0.7476486", "0.7467145", "0.7328483", "0.69506764", "0.69506764", "0.69506764", "0.69506764", "0.67855734", "0.67855734", "0.67855734", "0.67855734", "0.6685326", "0.66093063", "0.6521871", "0.6308293", "0.6255429", "0.62159616", "0....
0.63023895
18
Volume level of the media player (0..1).
def volume_level(self): return self._volume
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volume_level(self):\n if 'mixer volume' in self._status:\n return int(self._status['mixer volume']) / 100.0", "def volume_level(self) -> float:\n return int(self._state.get(\"playback_volume\", 0)) / 100", "def volume_level(self):\n return self._client.volume / 100", "def ...
[ "0.8231598", "0.81743926", "0.81468326", "0.8081239", "0.7887484", "0.7882927", "0.7876234", "0.780876", "0.75135154", "0.7511744", "0.7446892", "0.738979", "0.73027813", "0.7302239", "0.72877175", "0.72790325", "0.7231676", "0.71916056", "0.7176369", "0.71501255", "0.7145039...
0.78353214
10
Set volume level, range 0..1.
def set_volume_level(self, volume): # self._vlc.audio_set_volume(int(volume * 100)) self._volume = volume
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_volume_level(self, level):\n self._remote.volume(int(level * 60))", "def set_volume_level(self, volume):\n targetVolume = volume * 100\n tempVolume = -1\n oldVolume = -2\n i = 0\n while int(targetVolume) != tempVolume:\n self.getVolume()\n t...
[ "0.84339803", "0.8411518", "0.84037226", "0.8316456", "0.82789934", "0.82789934", "0.8202789", "0.81447035", "0.80928236", "0.7977751", "0.78011876", "0.777941", "0.7766126", "0.77488804", "0.77103066", "0.7688502", "0.76654124", "0.7562445", "0.7531979", "0.7451874", "0.7416...
0.82855743
4
Load in the library
def LoadP0DBANFF(): if len(getenv('P0DBANFFROOT')) <= 0: print 'P0DBANFFROOT NOT exported. Please export it now' sys.exit(1) loadStatus = gSystem.Load("libP0DBANFF") if not (loadStatus == 0 or loadStatus == 1): print "Unable to load libP0DBANFF.so. gSystem.Load(\"libP0DBANFF\") retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self):", "def load(self):\n pass", "def load(self):\n pass", "def load(self):\n pass", "def load(self):\n pass", "def load(path):\n pass", "def __init__(self):\n self._ll = LowLevelLibs()\n self._lib = self._ll.phe", "def _load(self):\n ...
[ "0.70443517", "0.70292526", "0.70292526", "0.70292526", "0.70292526", "0.70226806", "0.687295", "0.68523484", "0.680124", "0.6791935", "0.6789508", "0.6789508", "0.6761987", "0.6761987", "0.6760501", "0.6756113", "0.67412704", "0.6740313", "0.67212427", "0.6637887", "0.653991...
0.0
-1
return comment count, 1 when fail
def parseCommentsTotalCount(data): p = re.compile(r"\d+ Reviews") for line in data: line = line.replace(",", "") match = re.search(p, line) if match != None: getNmbr = match.group().split(" ") return int(getNmbr[0]) return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_comments(self):\n return self.run_query(f\"count({self.r}/comment)\")", "def getCommentCount(self, source):\n commentStart = source.find('item?id=')\n commentCountStart = source.find('>', commentStart) + 1\n commentEnd = source.find('</a>', commentStart)\n commentCoun...
[ "0.7983523", "0.7680182", "0.76503277", "0.7482219", "0.738433", "0.71507025", "0.71094567", "0.71063197", "0.6992267", "0.6884895", "0.68337625", "0.66024953", "0.65616924", "0.6524886", "0.6475075", "0.64730674", "0.64689136", "0.6402383", "0.63697183", "0.6307186", "0.6199...
0.66294706
11
return (begin, end) tuple which contains linenumbers of start/stop of comment area.
def commentsStartStopLineNmbr(data): begin = 0 end = 0 i = 0 if data is None or len(data) < 1: return None while i < len(data): if "<table class=\"CMheadingBar\"" in data[i]: if begin is 0: begin = i else: end = i ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_range(self) -> Tuple[int, int]:\n if self._line_range is None:\n node_extent = self.node.extent\n comment_extent = self.node.comment_extent\n if comment_extent.start.file is None:\n comment_extent = node_extent\n\n self._line_range = (\n ...
[ "0.69204915", "0.61163014", "0.6087544", "0.60657454", "0.59917873", "0.5966549", "0.5957662", "0.5908033", "0.5874553", "0.5856955", "0.58159626", "0.5809588", "0.57954884", "0.57809764", "0.57749593", "0.57746506", "0.57473797", "0.56913483", "0.5633429", "0.5627474", "0.56...
0.7108393
0
Parse comments from site
def parseComments(data): global comments reviewBegins = '<div style="margin-left:0.5em;">' reviewEnds = '<div style="padding-top: 10px; clear: both; width: 100%;">' stars_line = 'margin-right:5px;' stars = re.compile('\d+.\d+ out of 5 stars') header_line = '<span style="vertical-align:middle;"' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_comments_html(advertise: Dict[str, Any]) -> Optional[List[str]]:\n if \"comments_html\" in advertise.keys():\n\n filtred_comments: str = advertise[\"comments_html\"][200::]\n\n tmp: List[str] = re.split(\"[ \\n\\t]{2,}\", filtred_comments)\n if '' in tmp:\n ...
[ "0.70923054", "0.6858415", "0.6827713", "0.66849715", "0.64667034", "0.64621407", "0.64451265", "0.629178", "0.6278752", "0.62266237", "0.6181161", "0.6092758", "0.6089912", "0.60620606", "0.6055307", "0.6054427", "0.6050955", "0.60060996", "0.60034513", "0.59695345", "0.5960...
0.70183945
1
Generate a list of comment page links that can be feed for QueueWorker
def generatePageLinks(link, pagesTotal): return [generatePageNumberLink(link, cnt) for cnt in range(1, pagesTotal + 1)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_comments(**kwargs):\r\n\r\n # Log in to get cookies.\r\n cookies = _login(**kwargs)\r\n\r\n if 'r' not in kwargs:\r\n # This is the first comments request.\r\n # Make the comments request and set an empty list.\r\n kwargs['r'] = requests.get('https://news.ycombinator.com/thre...
[ "0.6424372", "0.61619884", "0.60559094", "0.60140413", "0.597905", "0.58676094", "0.58666897", "0.58566916", "0.58566916", "0.58446044", "0.5822474", "0.5797674", "0.5779639", "0.577098", "0.5734908", "0.5733753", "0.57330626", "0.57314", "0.5689055", "0.56715876", "0.5667957...
0.0
-1
Parses the response content to pull errors. Child classes should override this method based on what the errors in the XML response body look like. They can choose to look at the 'ack', 'Errors', 'errorMessage' or whatever other fields the service returns. the implementation below is the original code that was part of e...
def _get_resp_body_errors(self): if self._resp_body_errors and len(self._resp_body_errors) > 0: return self._resp_body_errors errors = [] warnings = [] resp_codes = [] if self.verb is None: return errors dom = self.response.dom() if dom...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __parse_response(self, response_text):\n root = etree.fromstring(response_text)\n namespace = re.search('{(.*)}', root.tag).group(1)\n status_path = '{%s}Status' % namespace\n status = int(root.findtext(status_path))\n response = None\n if status != 0:\n res...
[ "0.71550524", "0.69809824", "0.68810725", "0.67953825", "0.6791895", "0.6750196", "0.6719506", "0.66831756", "0.65668875", "0.6557811", "0.65548986", "0.65261036", "0.6501146", "0.64835584", "0.6470674", "0.64509344", "0.6349157", "0.63469356", "0.6333514", "0.63147753", "0.6...
0.7791317
0
Initialize all necessary data needed to perform the rule check. Child classes that need to save some context data should override this method, and create the data structures they need in order to perform their checks, and save this data in self as attributes. To avoid attribute collisions, attribute names starting with...
def init_context_data(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.data = None\n self.decisionTree = {}\n self.enClass = 0\n self.nlClass = 0\n self.listAttributes = [\"Contains-het\", \"Contains-de\", \"Contains-een\", \"Contains-en/aan\", \"Contains-ij\", \"wordLength14\",\n \"Contains-a/...
[ "0.5826407", "0.5806933", "0.5788446", "0.5787996", "0.5787823", "0.57581276", "0.5739409", "0.5691293", "0.5691293", "0.5691293", "0.5691293", "0.5691293", "0.5664666", "0.5664666", "0.5664666", "0.5654279", "0.5651187", "0.56497914", "0.5635051", "0.56341904", "0.56249326",...
0.6084732
0
Process the given line from the file being checked. The file to be checked is read line by line, and this function gets called once for each line, in order.
def process_line(self, lineno, line, eol): if self.STOP_READING_FILE_AFTER_TOO_MANY_ERRORS and self.more_errors_found: # No need to look for more errors; we would not be reporting # those additional errors anyway. return err_msg = self.check_rule(lineno, line, eol) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_idx_file_line(self, line):\n pass", "def process_line(self, line):\n find_result = re.findall(LINE_REGEX, line)\n line_data = {r[0]: r[1] for r in find_result}\n self.process_url(line_data.get('request_to'))\n self.process_status_code(line_data.get('response_status'...
[ "0.7340729", "0.6554694", "0.6405173", "0.63888186", "0.6383101", "0.63341737", "0.6317198", "0.6300656", "0.6275625", "0.62440765", "0.61268103", "0.612122", "0.61137253", "0.60549444", "0.6026391", "0.6018848", "0.5995426", "0.5963723", "0.59199643", "0.5854003", "0.5837594...
0.6337497
5
Report an error the given line contains a style violation. This is an abstract method which we expect child classes to override.
def check_rule(self, lineno, line, eol): raise FileCheckerError("abstract RuleChecker.check_rule method called")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_lint_fail_malformed(self, style):\n with ExpectedException(LinterFailure):\n run_linter_throw(\"path/to/file\",\n \"{s}\\n{m} Text{e}\",\n style,\n whitelist=[\"headerblock/desc_space\"])", "def test_li...
[ "0.6626349", "0.65848786", "0.6539725", "0.6537982", "0.6529508", "0.6484742", "0.6360805", "0.63549435", "0.63236624", "0.6321738", "0.6300427", "0.63000774", "0.62983173", "0.62970287", "0.6293438", "0.6250637", "0.6243179", "0.6238774", "0.62107635", "0.6199619", "0.619664...
0.61459404
21
Report errors only detectable after having read the entire file. By default, do nothing. Child classes which need a global view of the file's content in order to determine whether the file passes the checks or not should override this method.
def global_check(self): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __checkFile(self, filename):\n \n try:\n with open(filename, 'r') as f:\n first_line = f.readline()\n \n if not len(first_line.split(\"\\t\")) == 19:\n raise BadProteomeScoutFile(\"N/A\")\n \n \n e...
[ "0.683596", "0.65415645", "0.6473566", "0.64157987", "0.6406997", "0.6387932", "0.62599313", "0.61593133", "0.61191034", "0.6091732", "0.6073135", "0.6047026", "0.60329115", "0.6029888", "0.60236704", "0.6015206", "0.6012399", "0.60092527", "0.5963437", "0.59592223", "0.59323...
0.0
-1
Test calling the API with no hub parameters.
def test_execute_api_no_parameters(self): quantum_program = self._get_quantum_program() # Invoke with no hub, group or project parameters. quantum_program.set_api(QE_TOKEN, QE_URL) # Store the original post() method. post_original = quantum_program._QuantumProgram__api.req.post...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_calls_no_parameters(self):\n quantum_program = self._get_quantum_program()\n\n # Invoke with no hub, group or project parameters.\n quantum_program.set_api(QE_TOKEN, QE_URL)\n\n self.log.info(quantum_program.online_backends())\n self.log.info(quantum_program.get_back...
[ "0.7423339", "0.64586014", "0.64206874", "0.64088386", "0.63991106", "0.6361055", "0.62986827", "0.629394", "0.62418467", "0.6160967", "0.6126278", "0.6110391", "0.610358", "0.60599864", "0.6019738", "0.6018282", "0.6018282", "0.6013314", "0.5997314", "0.5992922", "0.5979506"...
0.62655735
8
Test calling the API with hub parameters.
def test_execute_api_parameters(self): quantum_program = self._get_quantum_program() # Invoke with hub, group and project parameters. quantum_program.set_api(QE_TOKEN, QE_URL, QE_HUB, QE_GROUP, QE_PROJECT) # Store the original post() method. post_original = quantum_program._Qua...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_calls_parameters(self):\n quantum_program = self._get_quantum_program()\n\n # Invoke with hub, group and project parameters.\n quantum_program.set_api(QE_TOKEN, QE_URL, QE_HUB, QE_GROUP, QE_PROJECT)\n\n self.log.info(quantum_program.online_backends())\n self.log.info...
[ "0.6999683", "0.6878062", "0.6741749", "0.6428878", "0.6323766", "0.6147671", "0.61081624", "0.60488415", "0.59844303", "0.5959556", "0.58946943", "0.58925784", "0.5891898", "0.58849823", "0.5856749", "0.5833805", "0.58224916", "0.5817903", "0.5803768", "0.5800796", "0.579476...
0.61099404
6
Test calling the API with invalid hub parameters.
def test_execute_invalid_api_parameters(self): quantum_program = self._get_quantum_program() # Invoke with hub, group and project parameters. FAKE_QE_HUB = 'HUB' FAKE_QE_GROUP = 'GROUP' FAKE_QE_PROJECT = 'PROJECT' quantum_program.set_api(QE_TOKEN, QE_URL, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_hubs_fail(self):\n with self.assertRaises(AssertionError):\n self.resource.hubs(-1)", "def test_invalid_request(self):\n response = self.client.post(telemetry_url)\n self.assertEqual(400, response.status_code)\n\n response = self.client.post(telemetry_url, {\n ...
[ "0.7026234", "0.66320807", "0.66060495", "0.660001", "0.6568346", "0.6549651", "0.6541933", "0.65326697", "0.653062", "0.6522051", "0.6499948", "0.6408988", "0.6408759", "0.6399277", "0.63575727", "0.62974006", "0.6244453", "0.6229556", "0.62143123", "0.62074286", "0.6193638"...
0.6960295
1
Test calling the API with modified hub parameters.
def test_execute_api_modified_parameters(self): quantum_program = self._get_quantum_program() # Invoke with hub, group and project parameters. FAKE_QE_HUB = 'HUB' FAKE_QE_GROUP = 'GROUP' FAKE_QE_PROJECT = 'PROJECT' quantum_program.set_api(QE_TOKEN, QE_URL, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_calls_parameters(self):\n quantum_program = self._get_quantum_program()\n\n # Invoke with hub, group and project parameters.\n quantum_program.set_api(QE_TOKEN, QE_URL, QE_HUB, QE_GROUP, QE_PROJECT)\n\n self.log.info(quantum_program.online_backends())\n self.log.info...
[ "0.72585666", "0.658508", "0.6462637", "0.6403695", "0.6275603", "0.62741715", "0.6166477", "0.59010184", "0.5899192", "0.5890859", "0.58898914", "0.5822162", "0.5803467", "0.5787644", "0.57832736", "0.577041", "0.5768365", "0.5740819", "0.5731347", "0.57308006", "0.57163054"...
0.6671979
1
Test calling some endpoints of the API with no hub parameters.
def test_api_calls_no_parameters(self): quantum_program = self._get_quantum_program() # Invoke with no hub, group or project parameters. quantum_program.set_api(QE_TOKEN, QE_URL) self.log.info(quantum_program.online_backends()) self.log.info(quantum_program.get_backend_paramete...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_simple_request(self):\n urls = [\"https://api.omniture.com/admin/1.4/rest/\",\n \"https://api2.omniture.com/admin/1.4/rest/\",\n \"https://api3.omniture.com/admin/1.4/rest/\",\n \"https://api4.omniture.com/admin/1.4/rest/\",\n \"https://ap...
[ "0.7140949", "0.65379906", "0.64931345", "0.63607204", "0.63213974", "0.6265517", "0.6238395", "0.62368876", "0.6218834", "0.6218165", "0.6208521", "0.61820996", "0.61808807", "0.6177925", "0.6150597", "0.614194", "0.6130757", "0.612733", "0.6124778", "0.6115707", "0.6114818"...
0.70893246
1
Test calling some endpoints of the API with hub parameters.
def test_api_calls_parameters(self): quantum_program = self._get_quantum_program() # Invoke with hub, group and project parameters. quantum_program.set_api(QE_TOKEN, QE_URL, QE_HUB, QE_GROUP, QE_PROJECT) self.log.info(quantum_program.online_backends()) self.log.info(quantum_pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_simple_request(self):\n urls = [\"https://api.omniture.com/admin/1.4/rest/\",\n \"https://api2.omniture.com/admin/1.4/rest/\",\n \"https://api3.omniture.com/admin/1.4/rest/\",\n \"https://api4.omniture.com/admin/1.4/rest/\",\n \"https://ap...
[ "0.6746003", "0.6493288", "0.63161945", "0.6263593", "0.6245531", "0.6164344", "0.61339265", "0.6113354", "0.61105967", "0.60806125", "0.60394204", "0.6035437", "0.6033574", "0.60083216", "0.59718585", "0.5939808", "0.5932727", "0.5923979", "0.59126633", "0.590975", "0.589610...
0.67583245
0
Softmax loss function, naive implementation (with loops)
def softmax_loss_naive(W, X, y, reg): # Initialize the loss and gradient to zero. loss = 0.0 dW = np.zeros_like(W) num_train = X.shape[1] # d*n num_class = W.shape[0] ############################################################################# # Compute the softmax loss and its gradient using ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax_loss_naive(W, X, y, reg):\n # Initialize the loss and gradient to zero.\n loss = 0.0\n dW = np.zeros_like(W)\n\n #############################################################################\n # TODO: Compute the softmax loss and its gradient using explicit loops. #\n # Store the ...
[ "0.794127", "0.7863673", "0.78596497", "0.7849857", "0.780424", "0.7799934", "0.7777369", "0.77458", "0.77311796", "0.7709332", "0.7688144", "0.7652083", "0.7635259", "0.76216215", "0.76211196", "0.7620951", "0.7617473", "0.76145816", "0.76001376", "0.7588893", "0.7585911", ...
0.7765571
7
Softmax loss function, vectorized version. Inputs and outputs are the same as softmax_loss_naive.
def softmax_loss_vectorized(W, X, y, reg): # Initialize the loss and gradient to zero. loss = 0.0 dW = np.zeros_like(W) ############################################################################# # Compute the softmax loss and its gradient using no explicit loops. # # Store the loss in loss and t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax_loss_naive(W, X, y, reg):\n # Initialize the loss and gradient to zero.\n loss = 0.0\n dW = np.zeros_like(W)\n num_train = X.shape[1]\n num_classes = W.shape[0]\n #############################################################################\n # Compute the softmax loss and its gradient usi...
[ "0.76844597", "0.7556882", "0.7555581", "0.7532509", "0.75233024", "0.7515324", "0.7510046", "0.74741167", "0.7471145", "0.7467806", "0.7466315", "0.7430024", "0.74299157", "0.742984", "0.74270153", "0.74259764", "0.7412057", "0.74095315", "0.74081475", "0.7386265", "0.738568...
0.71266216
80