query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Returns the ViewElements object associated with the object's class. The returned object can be used to access all the view elements associated with the class.
def trait_view_elements ( self ): return self.__class__.class_trait_view_elements()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_trait_view_elements ( cls ):\n return cls.__dict__[ ViewTraits ]", "def view(self):\n return self._view_class(self)", "def get_view(self):\n for w in self.child_widgets():\n return w", "def get_view ( self, object ):\n return self.view", "def views(self):\r\...
[ "0.7115698", "0.6358545", "0.6134244", "0.6044983", "0.5874732", "0.58438504", "0.57887167", "0.5715125", "0.5644803", "0.5597866", "0.5577847", "0.5561441", "0.5508119", "0.5507669", "0.55027175", "0.5488991", "0.5456775", "0.5453829", "0.5448694", "0.54299605", "0.53836036"...
0.68420166
1
Returns the ViewElements object associated with the class. The returned object can be used to access all the view elements associated with the class.
def class_trait_view_elements ( cls ): return cls.__dict__[ ViewTraits ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trait_view_elements ( self ):\n return self.__class__.class_trait_view_elements()", "def view(self):\n return self._view_class(self)", "def get_view(self):\n for w in self.child_widgets():\n return w", "def getViews(self):\n raise NotImplementedError()", "def view...
[ "0.69987655", "0.6314625", "0.6076076", "0.60502577", "0.6036594", "0.577361", "0.5769521", "0.5760625", "0.5759953", "0.5729227", "0.5707806", "0.5667476", "0.5667459", "0.56308", "0.5608086", "0.5558152", "0.55277455", "0.55063367", "0.5492773", "0.5482256", "0.54760814", ...
0.7372777
0
Returns a dictionary containing the definitions of all of the trait attributes of this object that match the set of metadata criteria.
def traits ( self, **metadata ): traits = self.__base_traits__.copy() for name in self.__dict__.keys(): if name not in traits: trait = self.trait( name ) if trait is not None: traits[ name ] = trait if len( metadata ) == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attributes_metadata(self):\n\n attribute_meta = collections.defaultdict(dict)\n\n for attribute in self.attributes:\n attribute_meta[attribute.name]['valuemap'] = attribute.valuemap\n attribute_meta[attribute.name]['qualifiers'] = attribute.qualifiers\n\n return dict(...
[ "0.7249715", "0.701137", "0.701137", "0.66442627", "0.6524752", "0.64437425", "0.6420204", "0.6414024", "0.63503736", "0.6348395", "0.6322816", "0.6297726", "0.62878114", "0.6222519", "0.61846226", "0.61397904", "0.61185944", "0.611537", "0.6106369", "0.609271", "0.60782975",...
0.67845094
3
Returns a dictionary containing the definitions of all of the trait attributes of the class that match the set of metadata criteria.
def class_traits ( cls, **metadata ): if len( metadata ) == 0: return cls.__base_traits__.copy() result = {} for meta_name, meta_eval in metadata.items(): if type( meta_eval ) is not FunctionType: metadata[ meta_name ] = _SimpleTest( meta_eval ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attributes_metadata(self):\n\n attribute_meta = collections.defaultdict(dict)\n\n for attribute in self.attributes:\n attribute_meta[attribute.name]['valuemap'] = attribute.valuemap\n attribute_meta[attribute.name]['qualifiers'] = attribute.qualifiers\n\n return dict(...
[ "0.68591374", "0.67183685", "0.67183685", "0.6694591", "0.6648074", "0.6356712", "0.6346735", "0.6252706", "0.62233305", "0.62102", "0.61872417", "0.61740786", "0.61126864", "0.60940385", "0.603699", "0.6022116", "0.5960168", "0.5945254", "0.5938842", "0.59247947", "0.5905271...
0.6778053
1
Returns a list of the names of all trait attributes whose definitions match the set of metadata criteria specified.
def trait_names ( self, **metadata ): return self.traits( **metadata ).keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attrs(self):\n return [name for name in self.traits() if self.trait_metadata(name, \"attr\")]", "def attrs(self):\n return [name for name in self.traits() if self.trait_metadata(name, \"attr\")]", "def class_trait_names ( cls, **metadata ):\n return cls.class_traits( **metadata ).keys(...
[ "0.7302168", "0.7302168", "0.63058066", "0.6274375", "0.6248903", "0.6107232", "0.60708135", "0.5896398", "0.5839022", "0.5827281", "0.58270544", "0.5826019", "0.58208394", "0.58203703", "0.5783917", "0.5751298", "0.57125586", "0.5644148", "0.5625836", "0.56247765", "0.559326...
0.727666
2
Returns a list of the names of all trait attributes whose definitions match the set of metadata criteria specified.
def class_trait_names ( cls, **metadata ): return cls.class_traits( **metadata ).keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attrs(self):\n return [name for name in self.traits() if self.trait_metadata(name, \"attr\")]", "def attrs(self):\n return [name for name in self.traits() if self.trait_metadata(name, \"attr\")]", "def trait_names ( self, **metadata ):\n return self.traits( **metadata ).keys()", "def...
[ "0.7302168", "0.7302168", "0.727666", "0.6274375", "0.6248903", "0.6107232", "0.60708135", "0.5896398", "0.5839022", "0.5827281", "0.58270544", "0.5826019", "0.58208394", "0.58203703", "0.5783917", "0.5751298", "0.57125586", "0.5644148", "0.5625836", "0.56247765", "0.5593262"...
0.63058066
3
Get presentation string of object.
def __str__(self): t = Template( """ <h4>$title</h4> $imgs $footnotes <hr/>""") # Return result. return t.substitute({ "title": self.title, "imgs": self.render_images(), "footnotes": self.render_footn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_str(self, obj):\n if self.pretty:\n return pprint.pformat(obj)\n else:\n return str(obj)", "def __repr__(self):\n format_string = self.__class__.__name__ + '('\n for t in self.transforms:\n format_string += f'\\n {t}'\n format_string ...
[ "0.7532989", "0.7114322", "0.6822366", "0.6800005", "0.6745579", "0.6712902", "0.6671583", "0.66520745", "0.6650797", "0.6624461", "0.6623283", "0.6623283", "0.6623283", "0.6623283", "0.6623283", "0.6623283", "0.6623283", "0.6623283", "0.6623283", "0.6623283", "0.6623283", ...
0.0
-1
Sets the plan_type of this Coverage.
def plan_type(self, plan_type): allowed_values = ["PPO", "HMO", "UNKNOWN"] # noqa: E501 if (self._configuration.client_side_validation and plan_type not in allowed_values): raise ValueError( "Invalid value for `plan_type` ({0}), must be one of {1}" # noqa: E...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plan(self, plan):\n\n self._plan = plan", "def SetType(self, ct_type):\r\n\r\n self._type = ct_type", "def set_type(self, type):\n self.type = type", "def set_type(self, type):\n self.type = type", "def set_type(self, type):\n self._type = type", "def schedule_type(...
[ "0.65996706", "0.65409553", "0.6472678", "0.6472678", "0.64411205", "0.6425523", "0.6425523", "0.64197", "0.6414196", "0.62454444", "0.61953306", "0.60962695", "0.60174125", "0.598808", "0.598808", "0.598808", "0.59785974", "0.59785974", "0.59785974", "0.5895885", "0.5870454"...
0.81874585
0
Sets the end_date of this Coverage.
def end_date(self, end_date): self._end_date = end_date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_date(self, end_date):\n self._end_date = end_date", "def coverage_end_date(self, coverage_end_date):\n\n self._coverage_end_date = coverage_end_date", "def coverage_end_date(self, coverage_end_date):\n\n self._coverage_end_date = coverage_end_date", "def set_end_date(self, date):...
[ "0.88387686", "0.86962634", "0.86962634", "0.8588706", "0.8545356", "0.82517916", "0.8201665", "0.8118219", "0.8116101", "0.8009223", "0.79495656", "0.7753214", "0.76863015", "0.747641", "0.736343", "0.7189802", "0.7094919", "0.7094919", "0.7094919", "0.70281756", "0.70061046...
0.8874975
3
Sets the type of this Coverage.
def type(self, type): allowed_values = ["VISION", "DENTAL", "MEDICAL", "HEALTH", "DEATH_COVER", "TOTAL_PERMANENT_DISABILITY", "ACCIDENTAL_DEATH_COVER", "INCOME_PROTECTION", "DEATH_TOTAL_PERMANENT_DISABILITY", "OTHER"] # noqa: E501 if (self._configuration.client_side_validation and type ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_type(self, type):\n self.type = type", "def set_type(self, type):\n self.type = type", "def set_type(self, type):\n self._type = type", "def SetType(self, ct_type):\r\n\r\n self._type = ct_type", "def set_type(self, type, asset=None):\n self._set_property('pc:type...
[ "0.7840302", "0.7840302", "0.7741099", "0.74387985", "0.7376227", "0.72777694", "0.72777694", "0.7265618", "0.7248968", "0.72474843", "0.72474843", "0.72474843", "0.72474843", "0.72474843", "0.72474843", "0.72474843", "0.72474843", "0.72474843", "0.72474843", "0.72474843", "0...
0.6673879
52
Sets the start_date of this Coverage.
def start_date(self, start_date): self._start_date = start_date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_date(self, start_date):\n \n self._start_date = start_date", "def start_date(self, start_date):\n self._start_date = start_date", "def start_date(self, start_date):\n if start_date is None:\n raise ValueError(\"Invalid value for `start_date`, must not be `None`\...
[ "0.8849892", "0.87420374", "0.8573919", "0.8524821", "0.84364605", "0.8288916", "0.8288916", "0.8267746", "0.790393", "0.7767776", "0.770781", "0.72306526", "0.7194386", "0.7032111", "0.7032111", "0.7020181", "0.6844589", "0.6712894", "0.6686032", "0.6669154", "0.66461456", ...
0.87911475
5
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, Coverage): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, Coverage): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", ...
0.0
-1
Add an array of Point objects The skeleton needs to be populated with its segments before calling this method. Segments need to have the point count (Segment.pointcount) for this method to pass the points to their correct segments.
def add_points(self, points): c = 0 point_count = 0 seg_count = self.segments[c].pointcount for point in points: point_count += 1; s = self.segments[c] if point_count > seg_count: c =+ 1 seg_count += self.segments[c].po...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_points(self, points):\n # TODO: maybe tay into account leaf_size or maybe external chunk size is enough\n # for split in np.array_split(points, self.leaf_size):\n self._add_leaf(points, None)", "def add_points(self, *points):\r\n for pts in points:\r\n if not isinst...
[ "0.69908977", "0.6924786", "0.69151545", "0.68857086", "0.669715", "0.6604968", "0.6561548", "0.63526505", "0.615614", "0.60864747", "0.6060742", "0.6040317", "0.5952948", "0.5928178", "0.5911921", "0.5874591", "0.5846516", "0.57557154", "0.57289875", "0.57057774", "0.5704275...
0.69558066
1
a constructor for the TextModel class
def __init__(self, model_name): self.name = model_name self.words = {} self.word_lengths = {} self.stems={} self.sentence_lengths={} self.endings={} self.total = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, text):\n\n self.text = text", "def __init__(self, text):\n self.text = text", "def __init__(self, text):\n self.text = text", "def __init__(self,\n text: str) -> None:\n\n super().__init__(text)", "def __init__(self, tokenizer, model, text=None...
[ "0.7422422", "0.7347982", "0.7347982", "0.7083003", "0.70051116", "0.6944997", "0.67722434", "0.67104936", "0.6645276", "0.6632868", "0.6632868", "0.6632868", "0.6632868", "0.6632868", "0.6632868", "0.6632868", "0.6632868", "0.6632868", "0.6540648", "0.6521952", "0.6520165", ...
0.6177789
39
returns the model name, number of words and number of word lengths in the dictionary
def __repr__(self): s= 'text model name: ' + self.name + '\n' s+= 'number of words: ' + str(len(self.words)) + '\n' s+='number of word lengths: ' + str(len(self.word_lengths))+'\n' s+='number of word stems: ' + str(len(self.stems)) + '\n' s+='number of sentence lengths: ' + str(l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, model_name):\n self.name = str(model_name)\n self.numwords = 0\n self.words = {} #how many types of words\n self.word_lengths = {} #how many word lengths\n self.stems = {} #how many stems\n self.sentence_lengths = {} #how many sentence lengths\n s...
[ "0.7216381", "0.66041285", "0.64716375", "0.6439382", "0.6403826", "0.63772523", "0.62535375", "0.6180672", "0.6159909", "0.6119545", "0.6099896", "0.5993539", "0.599347", "0.59202695", "0.5907893", "0.58977383", "0.58976674", "0.588987", "0.58821434", "0.5863835", "0.5862241...
0.6127196
9
checks for a suffix and returns it
def ending(s): if len(s) > 4: if s[-2:] == 'ed': return 'ed' elif s[-2:] == 'er': return 'er' elif s[-3:]=='ing': return 'ing' elif s[-3:]=='ily': return 'ily' elif s[-2:] == 'ly': return 'ly' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_suffix(suffix: str, word: str):\n return word.endswith(suffix)", "def suffix(self) -> typing.Optional[str]:\n return self._values.get('suffix')", "def suffix(self):\n return self[\"suffix\"]", "def suffix(self):\n return self[\"suffix\"]", "def removesuffix(self, x) -> String...
[ "0.78620005", "0.75828964", "0.74372447", "0.74372447", "0.72073585", "0.7205478", "0.71993834", "0.71993834", "0.71993834", "0.71342146", "0.710814", "0.7063348", "0.7060691", "0.70558757", "0.7052936", "0.7052936", "0.7025339", "0.70101523", "0.70039064", "0.70002913", "0.6...
0.0
-1
Closes the database session after each request.
def close_db(error): storage.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_db_session(self, session):\r\n session.close()", "def after_request():\n db.close()", "def close(self):\n if self.authenticated:\n self.db.logout()\n if self.connection is not None:\n self.connection.close()", "def teardown_request(exception):\n if d...
[ "0.8110407", "0.7753594", "0.77217776", "0.75928366", "0.7384172", "0.7376199", "0.7353973", "0.73509383", "0.73196524", "0.7307376", "0.7307376", "0.7307376", "0.7307376", "0.7307376", "0.7307376", "0.7287967", "0.72746843", "0.7270765", "0.72533697", "0.72533697", "0.725336...
0.0
-1
Flask route at /hbnb. Fills the hbnb homepage.
def hbnb(): states = storage.all(State).values() states = sorted(states, key=lambda k: k.name) st_ct = [] # Sort cities inside each states for state in states: st_ct.append([state, sorted(state.cities, key=lambda k: k.name)]) amenities = storage.all(Amenity).values() amenities = so...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n return \"Hello HBNB!\"", "def index():\n response.view_title = myconf.get('app.name') + ' Home Page'\n return dict(message='')", "def hello_hbnb():\n return render_template('contact_us.html')", "def home():\n payload = manager.get_payload()\n return render_template('index.htm...
[ "0.7443706", "0.65811014", "0.653675", "0.6414784", "0.64034665", "0.63931346", "0.6357144", "0.6350925", "0.6347675", "0.63474023", "0.63466084", "0.6293009", "0.6293009", "0.6293009", "0.6293009", "0.62878007", "0.6281002", "0.62774676", "0.6277451", "0.6273539", "0.6264542...
0.0
-1
Return the macaddr of the spa wifi
def get_macaddr(self): return self.macaddr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mac():\n\n interface = [x for x in netifaces.interfaces() if 'wlan' in x or 'wlp' in x][0]\n return netifaces.ifaddresses(interface)[netifaces.AF_LINK][0]['addr']", "def get_mac(self) -> str:\n self.sendline(\"iw {} info\".format(self.iface_dut))\n # We are looking for MAC definition ...
[ "0.80236024", "0.75477827", "0.74468887", "0.735236", "0.7316297", "0.7302612", "0.7287245", "0.7265488", "0.72178465", "0.71928966", "0.71795547", "0.7065681", "0.7054268", "0.70459473", "0.70179325", "0.6986395", "0.6977939", "0.6892038", "0.6829231", "0.6829231", "0.678885...
0.64319426
33
return True if admin has permission and else False
def hasPerm(self,request): request.needAuthType(request.ADMIN) request.checkArgs("perm_name","admin_username") if request.auth_name!=request["admin_username"]: request.getAuthNameObj().canDo("SEE ADMIN PERMISSIONS") return admin_main.getLoader().getAdminByName(request...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_main_admin(self):\n if self.user is None:\n return False\n return self.user.has_permission(\"admin\")", "def check_admin() -> bool:\n return ctypes.windll.shell32.IsUserAnAdmin() == 1", "def is_administrator(self):\n return False", "def admin(self):\n if s...
[ "0.8294695", "0.82505375", "0.8240802", "0.81962305", "0.8156185", "0.81511855", "0.8129814", "0.8123106", "0.80915314", "0.8064388", "0.8064388", "0.8020813", "0.7981043", "0.7978934", "0.79182297", "0.79153806", "0.79153806", "0.790319", "0.790319", "0.7892414", "0.7892414"...
0.7836217
25
Get a random element from the collection.
def getRandom(self) -> int: # print(self.ind) return choice(self.items)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_element(self) -> 'PFElement':\n return random.choice(list(iter(self)))", "def _rand_elem(self, iterable):\n\n lst = list(iterable)\n idx = self._rand_int(0, len(lst))\n return lst[idx]", "def getRandom(self):\n random_index = randint(0, len(self.list_val)-1)\n ...
[ "0.7651958", "0.7149041", "0.70814615", "0.7044879", "0.70404017", "0.7034526", "0.6959262", "0.69563407", "0.68719393", "0.68376184", "0.6797525", "0.670551", "0.6692588", "0.6692588", "0.6692588", "0.6692588", "0.66815263", "0.66744214", "0.6673934", "0.66513956", "0.663908...
0.6697882
12
calculate the distance of each 2D points from the center (xc, yc)
def calc_R(xc, yc): return sqrt((x-xc)**2 + (y-yc)**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dist(x,y,xc=0.,yc=0.):\n return sqrt((x-xc)**2+(y-yc)**2)", "def _distance2d(x, y, center=None):\n if center is None:\n xc, yc = np.mean(x), np.mean(y)\n else:\n xc, yc = center[0], center[1]\n r = np.sqrt((x-xc)**2 + (y-yc)**2).ravel()\n return r", "def...
[ "0.74404234", "0.7137503", "0.71229076", "0.6839393", "0.67520154", "0.6622933", "0.66085243", "0.65774816", "0.6509382", "0.64701796", "0.6452887", "0.6414572", "0.64142925", "0.63884366", "0.63667786", "0.63655823", "0.6351538", "0.6347358", "0.6333488", "0.63114494", "0.63...
0.0
-1
Convert a scipy sparse matrix to a torch sparse tensor.
def sparse_mx_to_torch_sparse_tensor(sparse_mx): sparse_mx = sparse_mx.tocoo().astype(np.float32) indices = torch.from_numpy( np.vstack((sparse_mx.row, sparse_mx.col)).astype(np.int64)) values = torch.from_numpy(sparse_mx.data) shape = torch.Size(sparse_mx.shape) return torch.sparse.FloatTen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csr2tensor(self, matrix: sp.csr_matrix):\n matrix = matrix.tocoo()\n x = torch.sparse.FloatTensor(\n torch.LongTensor(np.array([matrix.row, matrix.col])),\n torch.FloatTensor(matrix.data.astype(np.float32)),\n matrix.shape,\n ).to(self.device)\n retu...
[ "0.8299787", "0.8148542", "0.8045949", "0.80325705", "0.80134654", "0.79973555", "0.79973555", "0.7985302", "0.7985302", "0.7985302", "0.7977018", "0.79650825", "0.7754673", "0.7713117", "0.7429514", "0.7429514", "0.735423", "0.71969247", "0.7156927", "0.69882196", "0.6969645...
0.80300856
11
Parses the property's value.
def get_property_value(self, reply): self.logger.debug("Attempting to parse %s's value", reply) if isinstance(reply, GetPropertyReply): if 8 == reply.format: if hasattr(reply.value, 'buf'): value = str(reply.value.buf()) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_value(cls, value):\n return value", "def parse_value(cls, value):\n return value", "def parse_value(cls, value):\n raise NotImplementedError(\"subclass must implement parse_value()\")", "def parse(self, value):\n raise NotImplementedError(\"Please implement the Class\")"...
[ "0.74567074", "0.74567074", "0.67889404", "0.6679075", "0.6486109", "0.63721883", "0.632833", "0.6242701", "0.6185294", "0.6101606", "0.6095932", "0.6026381", "0.6013318", "0.59587044", "0.5914812", "0.59128195", "0.5889779", "0.5883207", "0.58717465", "0.5858357", "0.5827920...
0.6967067
2
Asks user to specify a city, month, and day to analyze.
def get_filters(): print('Hello! Let\'s explore some US bikeshare data!') # TO DO: get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs cities = ['chicago', 'new york city', 'washington'] city_good = 'n' while city_good == 'n': city =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)", "def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f...
[ "0.66714007", "0.65354675", "0.64593667", "0.6374057", "0.6348314", "0.63097656", "0.62868035", "0.6259136", "0.62316", "0.62130964", "0.62050414", "0.6181105", "0.6171822", "0.61686903", "0.6158568", "0.61582303", "0.61532456", "0.61444426", "0.6131269", "0.610484", "0.61025...
0.57692695
72
Loads data for the specified city and filters by month and day if applicable.
def load_data(city, month, day): # load data file into a dataframe df = pd.read_csv(CITY_DATA[city]) # convert the Start Time column to datetime df['Start Time'] = pd.to_datetime(df['Start Time']) # extract month and day of week from Start Time to create new columns df['month'] = df['Start Ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ...
[ "0.81320685", "0.8108889", "0.8045821", "0.8042514", "0.80090284", "0.80071104", "0.79991937", "0.7998333", "0.7988789", "0.797905", "0.79737365", "0.79610896", "0.7956163", "0.7947432", "0.79463065", "0.7908287", "0.7908229", "0.7904569", "0.7900715", "0.78930074", "0.788921...
0.77491575
49
Displays statistics on the most frequent times of travel.
def time_stats(df): months = ['all', 'january', 'february', 'march', 'april', 'may', 'june'] days = ['all', 'sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'] print('\nCalculating The Most Frequent Times of Travel...\n') start_time = time.time() df['Start Ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\...
[ "0.80247396", "0.80233026", "0.7915788", "0.78266186", "0.7822246", "0.78143597", "0.77659196", "0.7740343", "0.773628", "0.77344066", "0.76867086", "0.7668633", "0.7651731", "0.7644636", "0.76399267", "0.76367253", "0.7625196", "0.7623158", "0.7612803", "0.76002145", "0.7583...
0.7053383
91
Displays statistics on the most popular stations and trip.
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip...\n') start_time = time.time() # TO DO: display most commonly used start station popular_start_station = df['Start Station'].mode()[0] print("The most popular start station is {}.".format(popular_start_station)) #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m...
[ "0.7815675", "0.7662213", "0.7553417", "0.74914914", "0.74748665", "0.7446617", "0.7428588", "0.74237514", "0.74177027", "0.7400495", "0.7387161", "0.7385634", "0.73647535", "0.735934", "0.73566747", "0.73548365", "0.7351854", "0.7351274", "0.735057", "0.73421645", "0.7340198...
0.7121673
62
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print('\nCalculating Trip Duration...\n') start_time = time.time() # TO DO: display total travel time total_duration = df['Trip Duration'].sum() duration_string = str(datetime.timedelta(seconds=int(total_duration))) duration_string = duration_string.replace(' ', ''...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri...
[ "0.814274", "0.8025143", "0.80041367", "0.79496753", "0.7937415", "0.79312176", "0.7926815", "0.7915187", "0.79142886", "0.7908032", "0.79055744", "0.7900715", "0.7891682", "0.78894734", "0.7886722", "0.78851086", "0.7884266", "0.7882474", "0.78738385", "0.78686154", "0.78664...
0.76541585
79
Initializes neural network with 3 convolutional layers and 1 fullyconnected layer.
def __init__(self, Nchannels, Nsamples, output_units): super(conv2DNet_1, self).__init__() # Layer 1 l1_channels = 16 self.conv1 = nn.Conv2d(1, l1_channels, (Nchannels, 1), padding = 0) self.batchnorm1 = nn.BatchNorm2d(l1_channels, False) # final size bsize x 1 x l1_channels x ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_layers(self):\n self.relu = nn.ReLU(inplace=True)\n self.cls_convs = nn.ModuleList()\n self.reg_convs = nn.ModuleList()\n for i in range(self.stacked_convs):\n chn = self.in_channels if i == 0 else self.feat_channels\n self.cls_convs.append(\n ...
[ "0.7472666", "0.73977536", "0.73484737", "0.7269336", "0.72688764", "0.7210978", "0.71856695", "0.71799654", "0.717974", "0.7157589", "0.71530175", "0.7147972", "0.71275854", "0.71214545", "0.7115341", "0.70854706", "0.7084484", "0.70780665", "0.7070742", "0.7059944", "0.7044...
0.0
-1
Applies forward pass consisting of 3 convolutional layers followed by a fullyconnected linear layer.
def forward(self, x): # Layer 1 x = F.elu(self.conv1(x)) # bsize x l1_channels x 1 x Nsamples x = self.batchnorm1(x) x = F.dropout(x, 0.25) x = x.permute(0, 2, 1, 3) # bsize x 1 x l1_channels x Nsamples # Layer 2 x = self.padding1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, x):\n\n x = F.max_pool2d(F.relu(self.batch_norm1(self.conv1(x))), 3, stride=2, padding=1)\n x = F.max_pool2d(F.relu(self.batch_norm2(self.conv2(x))), 3, stride=2, padding=1)\n x = F.max_pool2d(F.relu(self.batch_norm3_b(self.conv3_b(F.relu(self.batch_norm3_a(self.conv3_a(x)))))), 3, strid...
[ "0.7332494", "0.7319827", "0.7144881", "0.71123207", "0.709837", "0.70697784", "0.70541847", "0.6945545", "0.693962", "0.686619", "0.68218064", "0.6816627", "0.6810239", "0.677971", "0.673936", "0.6722642", "0.67043847", "0.6697434", "0.669198", "0.6684526", "0.66803217", "...
0.73849595
0
Standard definition of the softmax function
def softmax(x): return np.exp(x) / np.sum(np.exp(x), axis=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(x):\n \"\"\"\"\"\"\n return exp(x) / sum(exp(x), axis=0)", "def softmax(x):\n #pass # TODO: Compute and return softmax(x)\n return np.exp(x) / np.sum(np.exp(x), axis=0)", "def softmax(x): \n return np.exp(x) / np.sum(np.exp(x), axis=0)", "def softmax(x):\n # ...
[ "0.84756714", "0.8455151", "0.83407307", "0.83404344", "0.8333861", "0.8310943", "0.82958037", "0.8276476", "0.82595813", "0.8244072", "0.82290536", "0.82290536", "0.8205396", "0.8193545", "0.8189999", "0.8189999", "0.8179601", "0.8175118", "0.8174349", "0.8159165", "0.813881...
0.8230934
15
Check if all elements of self are respectively equal to elements in other
def __eq__(self, other): if(not(self.checkCmp(other))): return False cmpflag = True for li1, li2 in zip(self.vector, other): if(li1 != li2): cmpflag = False return cmpflag
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def almost_equals(self, other):\n if self.__class__ is other.__class__ and len(self) == len(other):\n for a, b in zip(self, other):\n if not a.almost_equals(b):\n return False\n return True\n else:\n return False", "def __eq__(self,...
[ "0.7696739", "0.76858586", "0.7553242", "0.7339385", "0.73373455", "0.7336962", "0.7292206", "0.72643137", "0.725659", "0.7202528", "0.72005475", "0.7190923", "0.71680814", "0.71530485", "0.7120712", "0.71044266", "0.7046938", "0.7023484", "0.70151997", "0.70102894", "0.70028...
0.0
-1
Check if all elements of self are respectively equal to elements in other
def __ne__(self, other): return not(self.__eq__(other))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def almost_equals(self, other):\n if self.__class__ is other.__class__ and len(self) == len(other):\n for a, b in zip(self, other):\n if not a.almost_equals(b):\n return False\n return True\n else:\n return False", "def __eq__(self,...
[ "0.7696739", "0.76858586", "0.7553242", "0.7339385", "0.73373455", "0.7336962", "0.7292206", "0.72643137", "0.725659", "0.7202528", "0.72005475", "0.7190923", "0.71680814", "0.71530485", "0.7120712", "0.71044266", "0.7046938", "0.7023484", "0.70151997", "0.70102894", "0.70028...
0.0
-1
Split text string (comment) into words
def tokenize(str): return str.split()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_words(text : str) -> list:\n command_text = text.strip()\n commands = command_text.split(' ')\n return commands", "def tokenize(text):\n return text.split(' ')", "def get_words(text):\n\n only_words_text = re.compile(r'[^0-9^a-z^A-Z\\s]').sub('', text)\n return only_words_text.split(' ...
[ "0.7288073", "0.72480184", "0.7105977", "0.7054411", "0.70433086", "0.68705803", "0.6862473", "0.6831843", "0.6821556", "0.67823786", "0.6763283", "0.6715265", "0.6710809", "0.67073345", "0.6705492", "0.6694802", "0.66398674", "0.6635116", "0.66306597", "0.66165197", "0.65901...
0.0
-1
Renders the home page.
def home(): list1 = '' list2 = '' whitesite = '' cache2='' con = sqlite3.connect(base) cur = con.cursor() cur.execute("select * from white") for row in cur.fetchall(): whitesite = whitesite + row[0]+'\n' cur.execute("select * from ban") for row in cur.fetchall(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_home():\r\n\treturn render_template(\"index.html\")", "def home():\n\n return render_template('home_page.html')", "def home():\n\n return render_template(\"home.html\")", "def home():\n return render_template('home.html')", "def home():\n return render_template('home.html')", "def ...
[ "0.85574406", "0.853399", "0.8351404", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.82762724", "0.827363", "...
0.0
-1
Renders the about page.
def about(): return "123"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about():\n return render_template('about.html', title='About')", "def about():\n\n return render_template('about_page.html', title='About')", "def about():\n\n\treturn render_template(\"about.html\")", "def on_about(self):\n render_about_window()", "def about():\n return render_temp...
[ "0.85650355", "0.85034525", "0.84489655", "0.84044397", "0.8394454", "0.82935613", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82709616", "0.82680845",...
0.0
-1
Utility function that checks that the filename has an allowed extension. Used when uploading the file. Checks the modulelevel variable `ALLOWED_EXTENSIONS` for allowed uploads.
def allowed_file(filename): ALLOWED_EXTENSIONS = set(["pdf"]) return ( "." in filename and filename.rsplit(".", 1)[1].lower() in ALLOWED_EXTENSIONS )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_allowed_extension(filename):\n return '.' in filename and filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS", "def is_allowed_file(filename):\n allowed_ext = filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS\n return '.' in filename and allowed_ext", "def is_allowed_file(filename, allowe...
[ "0.8799707", "0.8668506", "0.8551998", "0.85111934", "0.85111934", "0.8493873", "0.8493873", "0.8493873", "0.8493873", "0.8493873", "0.8493873", "0.8493357", "0.8493357", "0.8482313", "0.8482313", "0.8482313", "0.8482313", "0.8482313", "0.8482313", "0.8482313", "0.8482313", ...
0.7802079
42
Get attribute of resolved attribute. The resolved attribute is where the actual loaded reference instance is stored on the referring model instance.
def __resolved_attr_name(self): return '_RESOLVED' + self._attr_name()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attribute(self):\n return getattr(self.parent_model, self.name)", "def _get_resolved(self):\n return self.__resolved", "def __getattribute__(self, attr_name: str) -> Any:\n attr_value = super().__getattribute__(attr_name)\n\n if attr_name in {\"_struct_metadata\", \"_valid_struct_me...
[ "0.6402029", "0.63460624", "0.6339", "0.6325199", "0.63221025", "0.62893313", "0.62453425", "0.6235004", "0.6233016", "0.6219533", "0.6188824", "0.61706257", "0.6102585", "0.6077589", "0.5980897", "0.5971218", "0.59586567", "0.5950579", "0.5905455", "0.58483857", "0.58264256"...
0.6904162
0
Takes a List (or np.List) and returns a np.List of the softmax output
def softmax(x): npX = np.array(x) expX = np.exp(x) return expX/sum(expX)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(input):\n list_value = []\n len_compute = input.shape[-1]\n shape_input = input.shape\n for x in input.reshape(-1, len_compute):\n # print(x)\n e_x = np.exp(x - np.max(x))\n res = e_x / e_x.sum(axis=0)\n list_value.append(res)\n\n return np.array(list_value).r...
[ "0.81420714", "0.76800984", "0.7649117", "0.7503935", "0.7478199", "0.7475148", "0.73761344", "0.7198165", "0.70765084", "0.7062951", "0.6933868", "0.69118494", "0.69118494", "0.6897624", "0.6896057", "0.68762475", "0.687072", "0.6858857", "0.6840219", "0.6835572", "0.6818635...
0.68947315
15
Cumulative distribution function for the standard normal distribution. Much faster than scipy.stats.norm.cdf even without jit (if added). Use np.erf for nonvectorized version. (adds ~1 second)
def norm_cdf(mu, sigma, x): return 0.5 * (1 + math.erf((x - mu) / (sigma * math.sqrt(2.0))))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _normal_distribution_cdf(x, stddev):\n return 0.5 * (1.0 + tf.erf(x / (math.sqrt(2) * stddev + 1e-20)))", "def std_norm_cdf(x):\r\n #Generalize for many x\r\n x = np.asarray(x).copy()\r\n cdf_x = np.zeros_like(x)\r\n N = x.size\r\n support_code = \"#include <math.h>\"\r\n code = \"\"\"\r...
[ "0.767847", "0.7547598", "0.73621356", "0.73264456", "0.72257537", "0.7179102", "0.7156002", "0.71534973", "0.6951498", "0.6791709", "0.67281115", "0.6725083", "0.66958356", "0.6686724", "0.65974194", "0.6515479", "0.6371044", "0.63550216", "0.63239247", "0.6315476", "0.63102...
0.72471195
4
3) filter geneDict on noncoding genes
def find_noncoding_genes(geneDict, df): ### tRNA's not part of the annotation, separate GTF file for these... noncoding_types = ['Mt_rRNA', 'Mt_tRNA', 'rRNA', 'miRNA', 'scRNA', 'scaRNA', 'snoRNA', 'snRNA', 'sRNA', 'vaultRNA' ] geneDic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filterGenes(genomesDict, threshold):\n\n resultDict = {}\n threshDict = {}\n\n if threshold == 0:\n return genomesDict\n\n #Obtaining the frequencies for each gene found\n logging.info('Filtering the result dictionaries with following threshold: ' + str(threshold) + '.')\n for genome_n...
[ "0.6517187", "0.59973127", "0.59713715", "0.59498125", "0.5922235", "0.5881543", "0.5771859", "0.57132214", "0.56925255", "0.56631047", "0.5659312", "0.5650732", "0.5606287", "0.5585774", "0.5558884", "0.5528005", "0.55002797", "0.54889435", "0.5487171", "0.5469382", "0.54483...
0.72774786
0
Create a flask application with certain configuration
def create_app(config_name): app = Flask(__name__) api = Api(app) CORS(app) app.config.from_object(config.configurations[config_name]) """This ensures that the urls /login and /login/ are recognized as same without considering the trailing slash """ app.url_map.strict_slashes = False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_app() -> Flask:\n logger.info('creating flask application')\n app = Flask(\n 'pasta',\n static_url_path='/static',\n static_folder='./static',\n template_folder='./views')\n config.flask.SECRET_KEY = os.urandom(32)\n config.flask.SERVER_NAME = None\n app.config.f...
[ "0.8320881", "0.82613516", "0.81839406", "0.81755877", "0.80952543", "0.8063145", "0.80428404", "0.8039477", "0.80203795", "0.800921", "0.8000817", "0.7997701", "0.79955053", "0.7995151", "0.7991429", "0.79910755", "0.79760885", "0.7955191", "0.79498166", "0.7947507", "0.7938...
0.77372634
47
Return a random card from the drawstack. If the drawstack is empty, it will be regenerated
def _random_card(self) -> Cards.Card: if len(self.drawstack) < 1: for col in list(Cards.CardColour): # Numbers 1-9 + Skip, Reverse, Draw2 for typ in list(Cards.CardType)[1:13]: self.drawstack.append(Cards.Card(typ, col)) self.drawstack.append(Cards.Card(typ, col)) self.drawstack.append(Cards....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_random_card() -> \"Card\":\n last = Card.objects.count() - 1\n index = random.randint(0, last)\n return Card.objects.all()[index]", "def draw_a_card(cards):\n import random\n card_drawn = random.choices(card_deck)\n cards.append(card_drawn[0])\n return", "def get_card(s...
[ "0.7441488", "0.7440397", "0.7075059", "0.703138", "0.7008788", "0.69914556", "0.6943711", "0.69413555", "0.69183993", "0.6898644", "0.6749779", "0.67188674", "0.6714708", "0.67104226", "0.66383463", "0.6595507", "0.65374845", "0.65081036", "0.6497055", "0.6481229", "0.645033...
0.8634099
0
Generate initial state for attn wrapped rnn cell
def initial_state(self): h_0 = tf.zeros([1, self._num_units], self._dtype) context_0 = self._compute_context(h_0) h_0 = context_0 * 0 if self._dec_init_states is None: batch_size = tf.shape(self._memory)[0] cell_states = self._cell.zero_state(batch_size, self._dt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_init_cell(batch_size, rnn_size):\n lstm = tf.contrib.rnn.BasicLSTMCell(rnn_size)\n #drop = tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=0.5)\n cell = tf.contrib.rnn.MultiRNNCell([lstm] * 3)\n initial_state = cell.zero_state(batch_size, tf.float32)\n initial_state = tf.identity(initia...
[ "0.7132366", "0.7090915", "0.69429237", "0.6908267", "0.684218", "0.6768209", "0.66969436", "0.66935176", "0.6625112", "0.65694475", "0.6542697", "0.65020555", "0.6467875", "0.64642566", "0.64642566", "0.6380301", "0.6367871", "0.6360753", "0.6336993", "0.6292103", "0.6264426...
0.68367213
5
Create a dataset that LVQ_PAK can understand.
def toLVQFile(X,Y, trainSz = None, fpath = "datasets\\lvq"): # Python handles default parameters at compile time. Awkward solution. if trainSz == None: trainSz = len(Y)/2 # Fit LDA # ... to entire data. oops! lda = LDA().fit(X,Y) # Intermediate solution to training/testing sp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dataset(opt):\n\tdata_loader = CustomDatasetDataLoader(opt)\n\tdataset = data_loader.load_data()\n\treturn dataset", "def create_dataset(opt):\n data_loader = CustomDatasetDataLoader(opt)\n dataset = data_loader.load_data()\n return dataset", "def build_dataset(self):\n self.dataset ...
[ "0.71592635", "0.7078532", "0.68327874", "0.674011", "0.6707892", "0.6664559", "0.66530573", "0.66183674", "0.6466004", "0.64567834", "0.64108497", "0.6380463", "0.63757545", "0.6357727", "0.6293597", "0.6270287", "0.6269097", "0.6228842", "0.6179571", "0.6175429", "0.6136473...
0.0
-1
Compute crossentropy loss on relation labels. Ignore diagonal entries and entries giving relations between masked out spans.
def _get_cross_entropy_loss(self, relation_scores, relation_labels): # Need to add one for the null class. scores_flat = relation_scores.view(-1, self._n_labels + 1) # Need to add 1 so that the null label is 0, to line up with indices into prediction matrix. labels_flat = relation_labels...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_entropy_loss(outputs, labels): \n# works properly\n \n m = labels.shape[0]\n p = outputs\n log_likelihood = -1*torch.log(p[range(m),labels])\n loss = torch.sum(log_likelihood) / m\n return loss.item()", "def cross_entropy_loss(labels_tensor, logits_tensor, pos_weights):\n diff = ...
[ "0.712009", "0.70225364", "0.6961675", "0.6939214", "0.68967867", "0.68864", "0.6853448", "0.68470687", "0.67875034", "0.67738473", "0.6739838", "0.6725983", "0.6717858", "0.66940284", "0.6685413", "0.66685754", "0.6650294", "0.6645746", "0.66255295", "0.66201985", "0.6617375...
0.71338195
0
Returns path to the directory where the image files are located in.
def get_frame_directory(self): return self.frame_directory
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_dir():\n directory = os.path.abspath(os.path.dirname(__file__))\n directory = os.path.join(directory, 'images')\n return directory", "def images_path(self):\n return os.path.join(self.extracted_path, \"images\")", "def get_image_dir(self):\n return self.img_dir", "def get...
[ "0.87343574", "0.8063427", "0.8015947", "0.79045343", "0.77573377", "0.75623655", "0.75016487", "0.74132186", "0.72146994", "0.72132033", "0.7168296", "0.71662945", "0.7068373", "0.7034467", "0.6993475", "0.68836826", "0.6881692", "0.68630046", "0.6842804", "0.6779864", "0.67...
0.0
-1
Returns a dictionary of the constructor parameters needed to reinitialize this decomposer instance.
def get_params(self): return { "nspecies": self.nspecies, "lmax": self.lmax, "nmax": self.nmax, "rcut": self.rcut, "sigma": self.sigma, "trans_width": self.trans_width }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_constructor_parameters(self) -> Dict[str, Any]:\n return dict(\n obs_space=self.obs_space,\n action_space=self.action_space,\n scale_imgs=self.scale_imgs,\n )", "def getInitParams(self):\n paramDict = super().getInitParams()\n paramDict['method'] = se...
[ "0.7442162", "0.68150693", "0.6808022", "0.6675666", "0.6647618", "0.65139157", "0.6408746", "0.6383646", "0.6383646", "0.6379762", "0.636821", "0.6354684", "0.6337408", "0.6300463", "0.62952626", "0.62542886", "0.62513936", "0.6229614", "0.6226545", "0.6213492", "0.6213492",...
0.61513007
24
Computes the summed radial distribution function for the specified decomposed `P` vector.
def RDF(self, dP, rx, fast=True): parts = np.zeros((len(dP), len(rx))) for i, dPi in enumerate(dP): w = np.sign(dPi[1])*np.sqrt(np.sqrt(np.abs(dPi[1]))) parts[i,:] = w*self.apnl(dPi, rx, fast=fast) return np.sum(parts, axis=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calP(self):\n N = len(self.listOfParticles)\n m = self.listOfParticles[0].m\n vsum = 0\n for particle in self.listOfParticles:\n vsum += particle.V.len()\n A = np.pi*self.R**2\n F = 0.5 * A * (2*self.R) * m * N * vsum**2\n return F", "def dist_radiu...
[ "0.6314159", "0.62371457", "0.6164323", "0.5895731", "0.5823391", "0.580841", "0.5731659", "0.5679429", "0.56705576", "0.56696606", "0.5663881", "0.56519175", "0.5645086", "0.55601126", "0.5552655", "0.55437446", "0.5531621", "0.5492125", "0.5483412", "0.5475694", "0.54485303...
0.5437653
22
Determines the distance between two DFs using the dot product metric.
def __sub__(self, other): if not hasattr(other, "dtype") or self.dtype != other.dtype: raise TypeError("Can only calculate distance between two DFs. of " "the same type.") return abs(np.dot(self.df, other.df)/(self.norm*other.norm)-1.)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(self, pt1, pt2):\r\n # productive #frequent\r\n if frequent: profprint()\r\n d = ((float(pt1[0]) - float(pt2[0])) ** 2 + (float(pt1[1]) - float(pt2[1])) ** 2 + (float(pt1[2]) - float(pt2[2])) ** 2) ** 0.5\r\n return d", "def distance(self,pt1,pt2):\n #productive #frequent\n if freq...
[ "0.6767505", "0.66965914", "0.6643104", "0.6634885", "0.6627882", "0.6607545", "0.6564397", "0.6514842", "0.64932764", "0.64868736", "0.64857775", "0.64519465", "0.6436199", "0.6421477", "0.64203244", "0.6418315", "0.64116", "0.6411081", "0.64090276", "0.6388189", "0.6386424"...
0.6504075
8
Restores a DF from file.
def from_file(filename, decomposer=None, x=None): from six.moves.cPickle import load with open(filename, 'rb') as f: data = load(f) return DF.from_dict(data, decomposer, x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_local_dataset(\n self, \n file_name: str\n ):\n pd.read_csv(file_name)\n #save", "def load() -> DataFrame:\n return load_file(__file__, \"default.csv.gz\")", "def load_file(self):\n\n self.df = self.sqlContext.read.csv(self.source, sep=self.sep, header=True, inf...
[ "0.59928375", "0.59581906", "0.5940021", "0.5889469", "0.5850384", "0.58437526", "0.58260196", "0.5813945", "0.5769381", "0.57409114", "0.5665236", "0.5646026", "0.56440026", "0.5624831", "0.5595068", "0.55518967", "0.5543048", "0.553934", "0.55236995", "0.55149215", "0.55139...
0.598158
1
Restores a DF from a serialized dict (i.e., one returned by
def from_dict(data, decomposer=None, x=None): if x is not None and data["x"] is None: data["x"] = x result = DF(data["dP"], data["catom"], data["x"], decomposer, data["dtype"]=="R", calculate=False) result.df = data["df"] return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_data_from_dict(storage, d, df):\n data = DataFactory.factories[storage].from_dict(d, df)\n return data", "def from_dict(cls, dikt) -> 'DataFileFormat':\n return util.deserialize_model(dikt, cls)", "def from_dict(cls, dikt) -> 'DataView':\n return util.deserialize_model(di...
[ "0.6646093", "0.6299715", "0.6285159", "0.60915476", "0.58948565", "0.5870701", "0.584504", "0.58111876", "0.5783925", "0.5774692", "0.5774659", "0.56885755", "0.56623095", "0.5656708", "0.56360584", "0.56145734", "0.5535191", "0.5532201", "0.5515236", "0.5500709", "0.5492723...
0.58926773
5
Returns a serializable dictionary that represents this DF.
def serialize(self, withdecomp=True, commonx=None, withdP=True): result = { "dP": self.dP if withdP else None, "catom": self.catom, "x": (None if commonx is not None and np.allclose(commonx, self.x) else self.x), "dtype": self.dtype, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self) -> Dict:\n return dict(\n name=self.name,\n typed=self.typed,\n line=self.line,\n column=self.column,\n type=str(self.type),\n )", "def as_dict(self):\n return dict(self.as_OD())", "def to_dict(self) -> dict:\n ...
[ "0.76832294", "0.7665559", "0.7604922", "0.7560921", "0.74917877", "0.7488321", "0.7452016", "0.7436024", "0.7429488", "0.74239695", "0.74239695", "0.74239695", "0.74239695", "0.74181545", "0.7414909", "0.7413423", "0.7413423", "0.7413423", "0.7413423", "0.7413423", "0.741342...
0.0
-1
Tests whether the specifed DF is similar to this one.
def same(self, other, epsilon_=None): if epsilon_ is None: return self-other < epsilon else: return self-other < epsilon_
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def similar(self, other):\r\n if self.rows == other.rows and self.columns == other.columns:\r\n return True\r\n else:\r\n return False", "def df_equal(left: pd.DataFrame, right: pd.DataFrame, **kwargs) -> bool:\n pd.testing.assert_frame_equal(left, right, **kwargs)\n ...
[ "0.69976294", "0.65393454", "0.6343995", "0.62868977", "0.62094605", "0.6167531", "0.61225456", "0.6077134", "0.60327977", "0.5929656", "0.58873004", "0.58816206", "0.584362", "0.58327645", "0.5832684", "0.5786548", "0.57839423", "0.57174987", "0.5708053", "0.56977814", "0.56...
0.0
-1
Tests the equality of this DFCollection with another.
def __eq__(self, other): if isinstance(other, DFCollection): return all([sdf == odf for sdf, odf in zip(self, other)]) else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n if not isinstance(other, DataDict):\n return False\n for key, item in self.items():\n if key not in other:\n return False\n if isinstance(item, pd.DataFrame):\n if not self[key].equals(other[key]):\n ...
[ "0.7321153", "0.7259259", "0.7256609", "0.71629655", "0.7114983", "0.70464605", "0.7044397", "0.7023681", "0.6988598", "0.69706315", "0.6929648", "0.69221437", "0.6893449", "0.68927926", "0.68721485", "0.68692607", "0.684994", "0.6836221", "0.68287075", "0.68236506", "0.68158...
0.8649632
0
Restores a DFCollection from a serialized dict (i.e., one returned by
def from_dict(data): dfs = [] decomposer = SOAPDecomposer(**data["decomposer"]) for dfdata in data["dfs"]: dfs.append(DF.from_dict(dfdata, decomposer, data["x"])) if len(dfs) > 0: dtype = dfs[0].dtype else:# pragma: no cover #We default to rad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_file(filename):\n from six.moves.cPickle import load\n with open(filename, 'rb') as f:\n data = load(f)\n return DFCollection.from_dict(data)", "def from_dict(self, data, session=False):\n for name, field in self._fields.items():\n if not session and nam...
[ "0.6325665", "0.6000796", "0.5860946", "0.5758597", "0.57526726", "0.5681839", "0.55863136", "0.55668956", "0.5544405", "0.55119216", "0.55009925", "0.5495764", "0.5478889", "0.5463957", "0.5458083", "0.5421062", "0.54140025", "0.54064083", "0.54013336", "0.5397772", "0.53805...
0.54060906
18
Returns a serializable dictionary that represents this DFCollection.
def serialize(self, withdP=False): decomposer = None if len(self) > 0: decomposer = self.dfs[0].decomposer x = self.dfs[0].x dfs = [] for df in self: dfs.append(df.serialize(withdecomp=False, commonx=x, withdP=withdP)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_dict(self):\n return dict(self._d)", "def to_dict(self) -> dict:\n return dataclasses.asdict(self)", "def to_dict(self):\n return self._dict", "def dict(self):\n return self.__data_dict", "def as_dict(self):\n return dict(self.as_OD())", "def to_dict(self):\n ...
[ "0.75616926", "0.7511635", "0.7491039", "0.74859595", "0.7482238", "0.7481384", "0.7476598", "0.7449606", "0.7449606", "0.7449606", "0.7449606", "0.7449606", "0.7449606", "0.74495673", "0.7432124", "0.74137396", "0.74137396", "0.74137396", "0.74137396", "0.74137396", "0.74137...
0.0
-1
Performs a more thorough equality check by also comparing the SOAP decomposers and RDFs.
def equal(self, other): Pok = self == other Dok = (self.decomposer.get_params() == other.decomposer.get_params()) if self.rx is not None: if other.rx is not None: Rok = (np.allclose(self.rx, other.rx) and ((self.cRDF is None and other.cRDF is No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def equal(self, other):\n return (self == other and\n self._rdfs == other._rdfs and\n self._adfs == other._adfs)", "def testEquality(self):\n pass", "def __eq__(self, other):\n if not isinstance(other, AutodetectDocumentValidationResult):\n return F...
[ "0.6582844", "0.6490502", "0.6468094", "0.646124", "0.6441796", "0.63963175", "0.63323045", "0.6321787", "0.6317981", "0.6301232", "0.6287055", "0.62754256", "0.6247537", "0.62326133", "0.61812586", "0.61812234", "0.61768264", "0.6174306", "0.6147846", "0.6146905", "0.614353"...
0.6886738
0
Returns a serializable dictionary that represents this SOAP Vector.
def serialize(self, withdecomp=True, commonrx=None, withdP=True, commonax=None): result = { "P": self.P, "dcP": self.dcP if withdP else None, "dnP": self.dnP if withdP else None, "rx": None, "ax": None, "cRDF": None, "nRDF": No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_vector_dict(self):\n return self.MOVE_DATA", "def create_vector_dict(self):\n return self.MOVE_DATA", "def as_dict(self):\r\n return {self.words[i]: self.vectors[i] for i in range(self.n)}", "def serialize(self):\n\t\treturn { 'type': self.type, 'parameters' : self.parameters}...
[ "0.7095322", "0.7095322", "0.6698339", "0.66114575", "0.657164", "0.6513534", "0.64937156", "0.64863515", "0.6451674", "0.64432317", "0.6386333", "0.6381001", "0.63809884", "0.6335962", "0.63265383", "0.6326339", "0.632167", "0.632167", "0.632167", "0.632167", "0.632167", "...
0.0
-1
Performs a more rigorous equality test for two collections by also comparing the radial and angular distribution functions.
def equal(self, other): return (self == other and self._rdfs == other._rdfs and self._adfs == other._adfs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_eq(self):\n r1 = Resources(4, 2, {\"Hadamard\": 1, \"CNOT\": 1}, {1: 1, 2: 1}, 2, Shots(100))\n r2 = Resources(4, 2, {\"Hadamard\": 1, \"CNOT\": 1}, {1: 1, 2: 1}, 2, Shots(100))\n r3 = Resources(4, 2, {\"CNOT\": 1, \"Hadamard\": 1}, {2: 1, 1: 1}, 2, Shots(100)) # all equal\n\n ...
[ "0.6245225", "0.6170157", "0.6079659", "0.6056684", "0.59617877", "0.59408987", "0.5919135", "0.588124", "0.58621323", "0.585822", "0.5832414", "0.58267003", "0.5820708", "0.5809908", "0.58022666", "0.5787736", "0.5743084", "0.57348627", "0.5733868", "0.57305956", "0.5718367"...
0.5527718
62
Returns a serializable dictionary that represents this
def serialize(self, withdP=False): if len(self) > 0: rx = self.vectors[0].rx ax = self.vectors[0].ax else: rx = None ax = None vecs = [] for vec in self.vectors: vecs.append(vec.serialize(False, rx, withdP, ax)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\r\n return self.__dict__", "def as_dict(self):\n return self.__dict__", "def asdict(self) -> dict:\n return self.__asdict(self)", "def to_dict(self):\n return to_dict(self.__dict__)", "def to_dict(self):\n return self.__dict__", "def to_dict(self):\n ...
[ "0.8595002", "0.85555863", "0.8555447", "0.85523504", "0.8523171", "0.8523171", "0.8523171", "0.8523171", "0.8523171", "0.8523171", "0.8507033", "0.8489085", "0.8478109", "0.8478109", "0.8478109", "0.8478109", "0.8478109", "0.8478109", "0.8478109", "0.8421665", "0.83539957", ...
0.0
-1
Simulate a failure to pull from origin. This test uses mocks, and doesn't reach out to the Internet.
def test_pull_from_origin_fail(run): from envoy import Response resp = Response() resp.status_code = 1 # Set a non-0 status code run.return_value = resp with pytest.raises(gitwrapper.GitException): gitwrapper.pull_from_origin('/var/git/bower-cache')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pull_error(self):\n raise NotImplementedError", "def test_fetch_url_not_ok():\n with patch(\"cheddar.index.remote.get\") as mocked:\n mocked.return_value = MagicMock()\n mocked.return_value.status_code = codes.bad_request\n with assert_raises(NotFoundError):\n f...
[ "0.70107675", "0.6947662", "0.69358534", "0.67239624", "0.6571006", "0.64593565", "0.63515395", "0.626154", "0.62339056", "0.6212326", "0.6192882", "0.61674815", "0.6139515", "0.61208487", "0.61024463", "0.60577905", "0.6035372", "0.6028136", "0.60221356", "0.6013819", "0.601...
0.7326702
0
Set the min and max values that should be allowed
def setMinMax(self): currentIndustryNum = self.myParent.myIndustry[self.myIndustryData.id] oldIndustryNum = self.myParent.myOldIndustry[self.myIndustryData.id] self.setMinValue(-currentIndustryNum) if oldIndustryNum > currentIndustryNum: self.setMaxValue(oldIndustryNum-curren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__, *,\n max: pulumi.Input[int],\n min: pulumi.Input[int]):\n pulumi.set(__self__, \"max\", max)\n pulumi.set(__self__, \"min\", min)", "def __init__(__self__, *,\n max: pulumi.Input[int],\n min: pulumi.Input[int]):\...
[ "0.7520717", "0.7520717", "0.7507985", "0.7507985", "0.7507985", "0.7507985", "0.7295363", "0.72809225", "0.72809225", "0.7242402", "0.72358733", "0.7219513", "0.7049293", "0.7033741", "0.70287097", "0.70029205", "0.6978113", "0.69233465", "0.6887454", "0.6857084", "0.6814537...
0.64361787
41
Path within data directory.
def dataPath(relative): return os.path.join(_dataDir, relative)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDataPath():\n\treturn \"..\" + os.sep + \"data\" + os.sep", "def get_data_path():\n return os.getcwd() + \"/data/\"", "def get_data_path():\n\treturn _paths[_DATA_DIRECTORY_KEY]", "def data_path(self):\n raise NotImplementedError", "def data_dir(self) -> Path:\n return self._data_di...
[ "0.8704643", "0.8704128", "0.8440264", "0.8373306", "0.8307922", "0.8163271", "0.8108895", "0.80921334", "0.79625916", "0.7922505", "0.7918759", "0.79187316", "0.79162365", "0.791422", "0.7913816", "0.79010504", "0.78894436", "0.78734744", "0.78734744", "0.7871642", "0.787097...
0.7559221
31
Generate random string of size "size" (defaults to 16)
def idGenerator(size=16, chars=string.digits + string.ascii_letters + string.digits): return ''.join(random.choice(chars) for _ in range(size))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stringGen(size, chars=string.ascii_uppercase + string.digits):\n\treturn ''.join(random.choice(chars) for _ in range(size))", "def _rand_str(size=16):\n return \"\".join(random.SystemRandom().choices(string.ascii_lowercase, k=size))", "def _random_string(self, size, chars=None):\n return ''.join(rand...
[ "0.8429512", "0.8261857", "0.822442", "0.7779204", "0.77691424", "0.769575", "0.75587434", "0.75444233", "0.74542755", "0.7438945", "0.7398973", "0.7396432", "0.73738956", "0.7364241", "0.7309675", "0.73053277", "0.7288789", "0.7277877", "0.725975", "0.7156029", "0.71492094",...
0.7638601
6
Get state for serialization. Ensures that the context stack is cleared prior to serialization, since partial functions cannot be pickled reliably.
def __getstate__(self): odict = self.__dict__.copy() odict['_contexts'] = [] return odict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getstate__(self):\n state = self.__dict__.copy()\n self.__cleanState__(state)\n return state", "def __getstate__(self):\n state = self.__dict__\n state['_lock'] = None\n return state", "def __getstate__(self):\n state = self.__dict__.copy()\n state[...
[ "0.7276553", "0.7138975", "0.7133166", "0.69625574", "0.69519717", "0.69327104", "0.68639445", "0.68538463", "0.68538463", "0.68538463", "0.68538463", "0.68538463", "0.68538463", "0.68538463", "0.68538463", "0.68538463", "0.68538463", "0.68538463", "0.68538463", "0.68538463", ...
0.66980654
84
Initializes the Species object using strain vs allele matrix
def load_from_matrix(self, strain_allele_df, filter_model_genes=True, allele_gene_sep=None): def filter_cobra_model_genes(): """Drops the alleles (columns) from Species vs Alleles matrix that are not in the genome-scale model. Parameters: ----------- ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n reset()\n\n self.n_species = 5\n self.n_examples = 100\n self.n_features = 100\n self.epsilon = 1e-5\n\n # Initialization\n self.X = np.random.rand(self.n_examples, self.n_features)\n self.y = np.random.randint(0, 2, self.n_examples)\n ...
[ "0.6287631", "0.61418396", "0.6049554", "0.5975972", "0.59754276", "0.5946852", "0.5860813", "0.58268523", "0.57499176", "0.5749532", "0.57359403", "0.5732591", "0.5714261", "0.5693881", "0.5648901", "0.5633708", "0.5630515", "0.5626761", "0.5604717", "0.56019825", "0.5600567...
0.53165716
86
Removes the association from self.model The change is reverted upon exit when using the model as a context.
def remove_from_model(self, destructive=False): self._model.remove_metabolites(self, destructive)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsetModelRef(self):\n return _libsbml.Submodel_unsetModelRef(self)", "def remove_model(self, model):\n assert isinstance(model, Model)\n\n self.model_list.remove(model)\n del self.model_dict[model.model_id]\n model.structure = None\n\n ## if the default model is bei...
[ "0.6827026", "0.68237674", "0.65594053", "0.6555517", "0.6534694", "0.64836365", "0.6468449", "0.6403428", "0.63953567", "0.637884", "0.63623077", "0.6325461", "0.6316599", "0.6224635", "0.61337614", "0.6097289", "0.60815513", "0.6040511", "0.60149527", "0.5995405", "0.598600...
0.6038041
18
Filter X and Y to have same index and drop NANs
def filter_pheno_nan(x_species, y_pheno, pheno_name, verbose=False): y = y_pheno[pheno_name] y.dropna(axis=0, how='all', inplace=True) X = x_species X = X.reindex(y.index) return X, y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_nan_samples(self, train_x, train_y):\n\n n_samples = train_x.shape[0]\n if n_samples != train_y.shape[0]:\n raise ValueError(\"x and y sample lengths don't match\")\n\n validity_array = np.zeros(n_samples)\n for i in range(n_samples):\n x_sample = train_...
[ "0.70992655", "0.6896083", "0.6887405", "0.6864373", "0.66145563", "0.6454961", "0.6421214", "0.63147473", "0.6313013", "0.62434214", "0.62400633", "0.61488336", "0.612666", "0.6085935", "0.60481715", "0.6031617", "0.5991052", "0.59695274", "0.5951884", "0.58480346", "0.58156...
0.6780217
4
Read lines from txt file
def read(self, data_path: str = None, *args, **kwargs) -> Dict: with open(data_path) as f: content = f.readlines() dataset = dict() dataset["train"] = [(line,) for line in content] dataset["valid"] = [] dataset["test"] = [] return dataset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_filename(self, filename):\r\n self.text_lines = task3.read_text_file(filename)", "def read_text_file(file_name):\n target_file = open(file_name)\n lines = target_file.readlines()\n\n target_file.close()\n return lines", "def read_txt_file(relative_path_to_txt_file: str):\n wi...
[ "0.7568076", "0.7550429", "0.7536287", "0.742346", "0.742346", "0.74187857", "0.7387999", "0.7387999", "0.73353577", "0.7314123", "0.7283472", "0.7224448", "0.7203126", "0.7201152", "0.71644336", "0.71588165", "0.71048474", "0.7094382", "0.7069796", "0.70020205", "0.6993603",...
0.0
-1
The evaluate process, calcluate the eval loss and metric.
def evaluate(exe, metric, loss, correct, dev_program, data_loader, phase="eval"): metric.reset() returns = [loss] if isinstance(correct, list) or isinstance(correct, tuple): returns.extend(list(correct)) else: returns.append(correct) for batch in data_loader: exe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self) -> Dict[str, float]:\n eval_dataloader = self.get_eval_dataloader()\n\n output = self._prediction_loop(eval_dataloader, description=\"Evaluation\")\n return output.metrics", "def eval(self):\n\n # parameters initialize\n torch = import_optional_dependency(\"t...
[ "0.74899846", "0.7473894", "0.7177148", "0.7151574", "0.7143763", "0.7094778", "0.70521444", "0.70158106", "0.6974163", "0.69477504", "0.69228894", "0.69228894", "0.6919093", "0.6907223", "0.6857874", "0.6855203", "0.6848403", "0.68474495", "0.68434274", "0.6841688", "0.68241...
0.6670292
31
def hz2cents(pitchInHz, tonic=261.626)/ convert hz to cents
def hz2cents(pitchInHz, tonic=261.626): cents = 1200*np.log2(1.0*pitchInHz/tonic) return cents
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def note2pitch(note, cents=0):\n freq = 440 * note2ratio(note - 69, cents)\n return freq", "def si_to_mph(vals):\n return vals * 3600.0 / meters_per_mile", "def raw_time_to_centi(raw_time: str) -> int:\n\n time = int(raw_time[2:7])\n minutes = time // (Time.SECOND * 100)\n\n time ...
[ "0.64433503", "0.62079906", "0.61642134", "0.6160762", "0.5976477", "0.5973125", "0.59396815", "0.5915583", "0.58915544", "0.58262277", "0.5750366", "0.57239604", "0.567089", "0.56618226", "0.5660766", "0.56244016", "0.5623901", "0.56217813", "0.5580607", "0.557691", "0.55581...
0.9625357
0
Create and save a user with the given username, email, and password.
def _create_user(self, username, email, password, phone, **extra_fields): username = self.model.normalize_username(username) user = self.model(username=username, email=email, phone=phone, **extra_fields) # using email_id instead of email user.set_password(password) user.save(using=self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_user(self, email, password,username, **extra_fields):\r\n if not email:\r\n raise ValueError('The given email must be set')\r\n if not username:\r\n raise ValueError('The given username must be set')\r\n email = self.normalize_email(email)\r\n user = se...
[ "0.85967624", "0.8440654", "0.84264034", "0.8423257", "0.84063315", "0.8393488", "0.83878005", "0.8341707", "0.8334409", "0.8332718", "0.83224976", "0.8288854", "0.827502", "0.8269521", "0.8267577", "0.81637603", "0.8159258", "0.8158126", "0.81423306", "0.8136717", "0.8127502...
0.82819235
12
Return pressure drop (psi) based on heuristics.
def _get_dP(ip, op) -> 'psi': if ('l' in ip and 'g' in op) or ('g' in ip and 'l' in op): # Latent fluid (boiling or condensing) return 1.5 elif ip == 'l': # Sensible liquid return 5 elif op == 'g': # Sensible vapor return 3
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_pressure(self) -> float: # type: ignore\n ...", "def pressure(self):\r\n self._read_temperature()\r\n\r\n # Algorithm from the BME280 driver\r\n # https://github.com/BoschSensortec/BME280_driver/blob/master/bme280.c\r\n adc = self._read24(_BME280_REGISTER_PRESSUR...
[ "0.5929737", "0.5903118", "0.5830406", "0.57982993", "0.5649691", "0.55875623", "0.5575163", "0.55590636", "0.5542457", "0.5524898", "0.5497243", "0.5474609", "0.5465228", "0.5431891", "0.541882", "0.5416765", "0.5408484", "0.54036", "0.54035014", "0.53881204", "0.5383275", ...
0.5879781
2
Return an estimate of pressure drops. Returns
def _Dp_table(cls, ci, hi, co, ho, inside_heating): cip, hip, cop, hop = ci.phase, hi.phase, co.phase, ho.phase dP_c = cls._get_dP(cip, cop) dP_h = cls._get_dP(hip, hop) if inside_heating: dP_in = dP_c dP_out = dP_h else: dP_in = dP_h ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_pressure(self) -> float: # type: ignore\n ...", "def get_pressure(self):\n\n\t\tvoltage_pressure = self.pressure_sensor.getVoltage()\n\t\tnew_value = (250 * voltage_pressure / 5) - 25\n\n\t\tself._pressure_samples.append(new_value)\n\n\t\tif not self.pressure_timer.hasPeriodPassed(self.pres...
[ "0.65462226", "0.6483933", "0.6420176", "0.62605524", "0.61167556", "0.60894585", "0.6008741", "0.5937967", "0.58765686", "0.58653706", "0.5822526", "0.5820426", "0.5812988", "0.5793003", "0.5792735", "0.57696724", "0.57687104", "0.5764833", "0.5750096", "0.57481503", "0.5746...
0.0
-1
Return overall heat transfer coefficient in kW/m2/K for concentric tubes.
def _concentric_tubes(s_tube, s_shell, Re_i, Re_o, inside_heating): raise NotImplementedError() # Get the h value for calculating U # Need: fluid properties, which are calculated at mean temperature between inlet and outlet both tube and shell side # Use continuity equation to ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def thermalConductivity(self, Tk=None, Tc=None):\n Tk = getTk(Tc, Tk)\n self.checkPropertyTempRange(\"thermal conductivity\", Tk)\n thermalConductivity = (\n 2.13014e-08 * Tk**3\n - 6.31916e-05 * Tk**2\n + 1.11629e-01 * Tk\n - 2.00043e00\n )\n...
[ "0.60779226", "0.5924128", "0.5857128", "0.58564323", "0.58514094", "0.5830105", "0.58190376", "0.58187425", "0.5786457", "0.5749674", "0.57187116", "0.5688183", "0.5679539", "0.56586283", "0.5640102", "0.56385636", "0.562866", "0.56221175", "0.5619003", "0.56082326", "0.5585...
0.53796893
44
True if POCS is setup and weather conditions are safe, False otherwise.
def is_safe(self): return self.is_setup and self.pocs.is_safe()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ready(self):\n if not self.is_setup:\n return False\n\n if self.pocs.observatory.mount.is_parked:\n print_warning('Mount is parked. To unpark run `unpark`')\n return False\n\n return self.pocs.is_safe()", "def is_setup(self):\n if self.pocs is None...
[ "0.6781441", "0.6543211", "0.6343394", "0.62981725", "0.6267585", "0.61818415", "0.615216", "0.61397934", "0.61342967", "0.61317486", "0.6084678", "0.6021381", "0.59994334", "0.5925882", "0.5910036", "0.58711314", "0.58443713", "0.58311737", "0.58311737", "0.58311737", "0.583...
0.6946813
0
Copy of skimage.color.colorconv.xyz2rgb without sRGB to linear RGB conversion
def xyz2linear_rgb(rgb): arr = _prepare_colorarray(rgb).copy() return _convert(rgb_from_xyz, arr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sRGB_to_sRGB_linear(rgb):\n return np.where(rgb <= 0.03928, rgb / 12.92, np.power((rgb + 0.055) / 1.055, 2.4))", "def srgb_to_rgb(srgb):\n\n ret = np.zeros_like(srgb)\n idx0 = srgb <= 0.04045\n idx1 = srgb > 0.04045\n ret[idx0] = srgb[idx0] / 12.92\n ret[idx1] = np.power((srgb[idx1] + 0.055...
[ "0.7423023", "0.7058805", "0.68922067", "0.6646686", "0.65456516", "0.651969", "0.6517755", "0.6494007", "0.64541024", "0.64275265", "0.636734", "0.6355332", "0.6348366", "0.6275594", "0.62734365", "0.6272642", "0.62708086", "0.62463146", "0.6244657", "0.6228655", "0.6189344"...
0.60774916
32
Copy of skimage.color.colorconv.rgb2xyz without sRGB to linear RGB conversion
def linear_rgb2xyz(rgb): arr = _prepare_colorarray(rgb).copy() return _convert(xyz_from_rgb, arr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sRGB_to_sRGB_linear(rgb):\n return np.where(rgb <= 0.03928, rgb / 12.92, np.power((rgb + 0.055) / 1.055, 2.4))", "def linearFromsRGB(c):\n if c <= 0.04045:\n return c / 12.92\n return math.pow((0.055 + c) / 1.055, 2.4)", "def lin_a98rgb_to_xyz(rgb: Vector) -> Vector:\n\n return alg.dot(RGB_TO_XY...
[ "0.7300667", "0.68105495", "0.6629093", "0.6404828", "0.6403227", "0.63833475", "0.63555765", "0.6340704", "0.63375604", "0.62844026", "0.6269481", "0.620081", "0.61803615", "0.6164831", "0.61158353", "0.6109969", "0.60983247", "0.60923177", "0.60889184", "0.607241", "0.60684...
0.65469146
3
Copy of skimage.color.colorconv.rgb2lab for linear RGB values
def linear_rgb2lab(rgb, illuminant="D65", observer="2"): return xyz2lab(linear_rgb2xyz(rgb), illuminant, observer)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linearFromsRGB(c):\n if c <= 0.04045:\n return c / 12.92\n return math.pow((0.055 + c) / 1.055, 2.4)", "def sRGBToLab(rgb):\n return xyzToLab(xyzFromsRGB(rgb), [0.9504559, 1, 1.089058])", "def sRGB_to_sRGB_linear(rgb):\n return np.where(rgb <= 0.03928, rgb / 12.92, np.power((rgb + 0.055) / 1.055...
[ "0.73782295", "0.7316201", "0.727597", "0.7130921", "0.7006965", "0.6987847", "0.69228286", "0.68951553", "0.6878933", "0.6737128", "0.6712794", "0.6665095", "0.6635229", "0.64935607", "0.6483073", "0.6374686", "0.63507605", "0.63361466", "0.6329407", "0.6321032", "0.6304532"...
0.6790627
9
Return number of nodes in binary search tree.
def size(self): return self._size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_nodes(self):\n if self.is_empty():\n return 0\n elif self.is_leaf():\n return 1\n else:\n if self.get_left():\n if self.get_right():\n return 1 + self.get_left().count_nodes() + self.get_right().count_nodes()\n ...
[ "0.8351543", "0.82648873", "0.81702185", "0.8096258", "0.80228376", "0.79952407", "0.798081", "0.78988373", "0.7850317", "0.7845933", "0.7825513", "0.76978314", "0.7689033", "0.7687506", "0.7629483", "0.75857615", "0.75857615", "0.75728494", "0.75450623", "0.74884015", "0.746...
0.0
-1
Return the max depth of the binary search tree.
def depth(self): return self._max_depth
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_tree_depth(self):\n\n depths = np.array([leaf.tree_depth for leaf in self.leaves])\n\n return depths.max()", "def _max_depth(self):\n max_depth = 0\n for node, data in self.traverse():\n max_depth = max(max_depth, data['level'])\n return max_depth", "def ma...
[ "0.85611963", "0.8247156", "0.81712496", "0.8162375", "0.8101124", "0.80669117", "0.8064293", "0.80352896", "0.8010666", "0.7918433", "0.789473", "0.77646166", "0.77548516", "0.7748836", "0.7733801", "0.7696442", "0.7680308", "0.7650054", "0.76317525", "0.75359696", "0.749083...
0.78111154
11
Set the new right and left balance.
def _new_depth(self, node, curr_depth): right = curr_depth left = curr_depth if node._rkid: right = self._new_depth(node._rkid, curr_depth + 1) if node._lkid: left = self._new_depth(node._lkid, curr_depth + 1) if right > left: return right ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _balance(self):\n if self.left is not None:\n self.left = self.left._balance()\n if self.right is not None:\n self.right = self.right._balance()\n left_height = self._get_left_height()\n right_height = self._get_right_height()\n if abs(left_height - right_height) > 1:\n if left_he...
[ "0.7193358", "0.6852323", "0.6536458", "0.6536458", "0.64843196", "0.64701253", "0.6445271", "0.6291261", "0.6272844", "0.6153494", "0.6139571", "0.6095175", "0.6095175", "0.6095175", "0.6063707", "0.6063189", "0.6042922", "0.6008766", "0.59920156", "0.59826595", "0.598137", ...
0.0
-1
Get the new max depth.
def _get_new_max(self, insert=True): right = 1 left = 1 if self._root: if self._root._rkid: right = self._new_depth(self._root._rkid, 2) if self._root._lkid: left = self._new_depth(self._root._lkid, 2) self._rbal = right ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_max_depth(self):\n return self.MAX_DEPTH", "def max_depth(self) -> int:\n return pulumi.get(self, \"max_depth\")", "def depth(self):\n return self._max_depth", "def max_depth(self) -> int:\n return 0", "def _max_depth(self):\n max_depth = 0\n for node, data...
[ "0.83674264", "0.82600397", "0.8203152", "0.80693704", "0.7971046", "0.789223", "0.77345216", "0.76835483", "0.76775944", "0.755396", "0.7552425", "0.7476909", "0.73662543", "0.7358727", "0.73505074", "0.73019785", "0.72963804", "0.72882825", "0.72334474", "0.7210142", "0.716...
0.7605794
9
Detects edges in an image. Uses Canny edge detection method. Bases thresholding on image statistics combined with the provided sigma.
def canny_edges(image, thresholding_sigma=0.33): # compute the median of the single channel pixel intensities v = np.median(image) # apply automatic Canny edge detection using the computed median lower = int(max(0, (1.0 - thresholding_sigma) * v)) upper = int(min(255, (1.0 + thresholding_sigma) * v)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edge_detection(image, sigma=0.33):\n # compute the median of the single channel pixel intensities\n v = np.median(image)\n # apply automatic Canny edge detection using the computed median\n lower = int(max(0, (1.0 - sigma) * v))\n upper = int(min(255, (1.0 + sigma) * v))\n edged = cv2.Canny(i...
[ "0.79609406", "0.7908045", "0.77093595", "0.76847136", "0.7640001", "0.75924146", "0.7459797", "0.7433382", "0.72532666", "0.72225964", "0.71686184", "0.71023804", "0.7076249", "0.6958066", "0.68751484", "0.6853335", "0.6736577", "0.67272276", "0.66508996", "0.66180295", "0.6...
0.7600349
5
Setup multipliers for stageN layers (kernel and bias)
def get_lr_multipliers(model): lr_mult = dict() for layer in model.layers: if isinstance(layer, Conv2D): # stage = 1 if re.match("Mconv\d_stage1.*", layer.name): kernel_name = layer.weights[0].name bias_name = layer.weights[1].name ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, kernel_size, filters, stage, block):\n super().__init__(name='identity' + str(stage) + block)\n filters1, filters2, filters3 = filters\n if K.image_data_format() == 'channels_last':\n bn_axis = 3\n else:\n bn_axis = 1\n\n conv_name_base = 'res' + str(stage) + block + '_b...
[ "0.6249089", "0.6072116", "0.6070728", "0.587276", "0.57109284", "0.5698923", "0.56985873", "0.569087", "0.5665633", "0.5628388", "0.5591559", "0.55882686", "0.55724263", "0.5559083", "0.5545881", "0.5541538", "0.5530732", "0.5529899", "0.5521045", "0.5520058", "0.55168074", ...
0.5489509
25
Initializes the Vanilla RNN with the provided vocabulary_size, hidden layer size, and bptt_truncate. Also initializes the functions used in this RNN.
def __init__(self, voc_size=8000, embed_size=100, hid_size=100, trunc=4, model=None): self.log = logging.getLogger("TEST.Embed") self.log.setLevel(logging.INFO) self.unknown_token = "UNKNOWN_TOKEN" self.sentence_start_token = "SENTENCE_START" self.sentence_end_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, voc_size, layer_size=512, num_layers=3, embedding_layer_size=256, dropout=0.,\n controller_type='gru', **kwargs):\n super(RNN, self).__init__()\n\n self._layer_size = layer_size\n self._embedding_layer_size = embedding_layer_size\n self._num_layers = n...
[ "0.7284881", "0.64003086", "0.6361222", "0.63580465", "0.6347471", "0.6336283", "0.62534225", "0.6225993", "0.6161096", "0.61588115", "0.6047174", "0.6019962", "0.6005152", "0.59777117", "0.5877666", "0.5875248", "0.58617556", "0.5830877", "0.58040506", "0.57922393", "0.57821...
0.6514999
1
Compute my distance from the origin
def distance_from_origin(self): return ((self.x ** 2) + (self.y ** 2)) **0.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_from_origin(self):\n return ((self.x ** 2) + (self.y ** 2)) ** 0.5", "def distance_from_origin(self):\n return ((self.x ** 2) + (self.y ** 2)) ** 0.5", "def distance_from_origin(self):\n return ((self.x ** 2) + (self.y ** 2)) ** 0.5", "def distance_from_origin(self):\n ...
[ "0.85663384", "0.85663384", "0.85663384", "0.85663384", "0.85663384", "0.85663384", "0.85663384", "0.84973544", "0.8323514", "0.8296796", "0.8215572", "0.7732662", "0.74226093", "0.7381035", "0.7292783", "0.7264896", "0.72594285", "0.7255858", "0.72473836", "0.7230952", "0.72...
0.8565058
7
Return the halfway point between myself and the target
def halfway(self, target): mx = (self.x + target.x)/2 my = (self.y + target.y)/2 return Point(mx, my)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def halfway(self, target):\r\n mx = (self.x + target.x)/2\r\n my = (self.y + target.y)/2\r\n return Point(mx, my)", "def halfway(self, target):\n mx = (self.x + target.x) / 2\n my = (self.y + target.y) / 2\n return Point(mx, my)", "def goal(target, prediction):\n ...
[ "0.8789036", "0.87399906", "0.7259315", "0.6758469", "0.6579334", "0.6313658", "0.615805", "0.60153526", "0.59883934", "0.58936673", "0.58650094", "0.58640325", "0.585778", "0.58406675", "0.5820845", "0.580087", "0.5799157", "0.5790215", "0.5785922", "0.5784319", "0.5782862",...
0.87813574
2
Return left child node (None if not set)
def get_left(self): return BinaryNode.or_none(self.left)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_leftmost_child(self):\n\t\tif self.left_child == None:\n\t\t\treturn self\n\t\telse:\n\t\t\treturn self.left_child.get_leftmost_child()", "def get_leftchild(self):\n return self._leftchild", "def left(self, node):\r\n if self._col(node.count) > 0:\r\n return self.nodes[node.cou...
[ "0.83076704", "0.8289362", "0.79454666", "0.79153305", "0.7890329", "0.781641", "0.7721424", "0.7591412", "0.7512658", "0.7491285", "0.7491285", "0.74899733", "0.7486175", "0.7470402", "0.7450443", "0.74252474", "0.7337585", "0.73302996", "0.73200154", "0.72774786", "0.727631...
0.79966176
2
Set left child to passed node if valid Updates child node with this as parent Would have decorated with or_none, but had complications with inherited decorators
def set_left(self, new_left_child): node = BinaryNode.or_none(new_left_child) self.left = node if node is not None: node.parent = self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _restructure_leftchild(self):\n left = self._leftchild\n if left.full(): # If left has both children\n if left._rightchild._height > left._leftchild._height:\n left._rotate_rightchild() # Double rotate if right unbalanced\n elif left._rightchild and not left._le...
[ "0.71900094", "0.71475196", "0.7126411", "0.70740926", "0.70345104", "0.69659567", "0.695427", "0.6944425", "0.69106203", "0.667609", "0.66436774", "0.66181445", "0.6604511", "0.6597774", "0.6597774", "0.6592089", "0.6538455", "0.6516503", "0.6516503", "0.64947724", "0.649071...
0.7475854
0
Given two dicts, merge them into a new dict as a shallow copy. Any overlapping keys in `y` will override the values in `x`.
def merge_two_dicts(x, y): z = x.copy() z.update(y) return z
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_two_dicts(x, y):\r\n z = x.copy()\r\n z.update(y)\r\n return z", "def merge_two_dicts(self, x, y):\n z = x.copy()\n z.update(y)\n return z", "def merge_two_dicts(x, y):\n\tz = x.copy()\n\tz.update(y)\n\treturn z", "def mergedict(x, y):\n z = x.copy()\n z.update(y...
[ "0.8548726", "0.8490123", "0.84873074", "0.8484024", "0.84027874", "0.84027874", "0.84027874", "0.7845553", "0.78121614", "0.72869974", "0.71975857", "0.7183314", "0.71212286", "0.7071206", "0.706308", "0.6948756", "0.6933829", "0.68975633", "0.6886659", "0.6874611", "0.68746...
0.84721476
10
Return both scale/offset reward and raw reward.
def wrapper(reward_fn, scale: float = 1.0, offset: float = 0.0, done_bonus: float = 0.0, exclude_from_score: bool = False): def fn(*args, **kwargs): reward, done = reward_fn(*args, **kwargs) if exclude_from_score: score = jnp.zeros_like(reward) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_reward_(self):\n if self._target_type == \"position\":\n dist = np.linalg.norm(self._target_diff_, ord=2)\n if self._reward_type == \"linear\":\n reward_dist = -dist\n elif self._reward_type == \"precision\":\n reward_dist = -dist +...
[ "0.7104173", "0.692538", "0.69069207", "0.69031477", "0.6853908", "0.6829797", "0.6804706", "0.6792893", "0.67796314", "0.67312807", "0.6716325", "0.67004997", "0.6661222", "0.6650941", "0.6618282", "0.65731996", "0.6534663", "0.64825994", "0.6438872", "0.63996714", "0.639861...
0.0
-1
Return all relation_ids that have anything to do with any of the specified rids.
def find_relevant_relation_ids(self, rids): if isinstance(rids, int): rids = [rids] found = set() for x in rids: found.update(self.find_relations(x)) return found
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_relations(self, rid:int, *rids):\n first = set(self.rid_to_relations.get(rid, ()))\n if rids:\n return first.intersection(*[self.rid_to_relations.get(x, set()) for x in rids])\n return first", "def has_hgids(self, ids):\n # TODO: What about round-tripped revisions?...
[ "0.7068122", "0.6178545", "0.61126", "0.5633207", "0.5621144", "0.55956775", "0.5517054", "0.544778", "0.52668095", "0.5230114", "0.5160103", "0.51375306", "0.51349616", "0.50796264", "0.5079276", "0.5060331", "0.50485295", "0.50467944", "0.5046012", "0.50338763", "0.5004158"...
0.82737875
0
Builds a help/welcome response.
def get_help_response(): card_title = "Welcome" speech_output = "Please give a command for your painting lights." response = response_builders.build_response(session_attributes, response_builders.build_speechlet_response(card_title, speech_output, reprompt_text, should_end_session)) ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_help_response():\n\n session_attributes = {}\n card_title = \"乱数のある生活\"\n speech_output = \"あなたのほしい乱数を生成します。\" \\\n \"3つの選択肢から1つを選んでほしい時は,「3つのうちから一つ選んで」と話しかけてみてください。\" \\\n \"サイコロやルーレットを振りたい時は,「サイコロを1回振って」などと話しかけてみてください。\" \\\n \"「もう一度」と話しかけ...
[ "0.69531584", "0.6669123", "0.6659305", "0.6659305", "0.66561204", "0.66448635", "0.66277796", "0.6601627", "0.65798455", "0.65738314", "0.65607375", "0.6545873", "0.6535704", "0.6518268", "0.64986205", "0.64876014", "0.6482488", "0.6476212", "0.64612633", "0.64595795", "0.64...
0.7396891
0
Builds a response with a blank message and no session data. If using session data this function would specifically have session_attributes = {} and should_end_session = True.
def handle_session_end_request(): speech_output = None response = response_builders.build_response(session_attributes, response_builders.build_speechlet_response(card_title, speech_output, reprompt_text, should_end_session)) return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_response(self, session_attributes):\n return {\n 'version': '1.0',\n 'sessionAttributes': session_attributes,\n 'response': self._build_speechlet_response()\n }", "def build_response(session_attributes, speechlet_response):\r\n #print(\"**** Session At...
[ "0.6625485", "0.64616925", "0.63275236", "0.63275236", "0.60864764", "0.5852829", "0.5755682", "0.569417", "0.5621705", "0.56033504", "0.5539452", "0.5508169", "0.55004966", "0.5447988", "0.54411197", "0.5432958", "0.5430151", "0.54139966", "0.5399279", "0.5381181", "0.537054...
0.64332974
2
Retrieves and parses the command line arguments created and defined using the argparse module. This function returns these arguments as an ArgumentParser object.
def get_input_args(): parser = argparse.ArgumentParser() parser.add_argument('--json_path', type=str, default='cat_to_name.json', help='Json path of labels to categories') parser.add_argument('--use_gpu', type=bool, default=False, help='Run with GPU') p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments():\n\n args = Arguments()\n parser = argparse.ArgumentParser(\"Update river flow directions\")\n parser.add_argument('python_config_filename',\n metavar='python-config-filename',\n help='Full path to python configuration file',\n ...
[ "0.8138782", "0.79517275", "0.78769577", "0.78217745", "0.779941", "0.779941", "0.7774491", "0.77692086", "0.7760826", "0.773166", "0.7715235", "0.77124196", "0.7626294", "0.7610812", "0.75815564", "0.7573426", "0.7565669", "0.7555788", "0.7530112", "0.7528781", "0.7527054", ...
0.0
-1
A call to /subtract/a/b yields a b, for a > b
def test_subtract_positive_result(self): a = random.randint(10000, 100000) b = random.randint(100, 1000) path = "/subtract/{}/{}".format(a, b) response = self.get_response(path) self.assertEqual(200, response.getcode()) self.assertIn(str(a - b).encode(), response.read...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtract(a, b):\n return a - b", "def subtract(a, b):\n return a - b", "def subtraction(a, b):\n return a - b", "def minus(self, a, b):\n return a - b", "def subtract(a, b):\n print(\"SUBTRACTING %d - %d\" % (a, b))\n return a - b", "def subtract(first, second):\n return first - ...
[ "0.7999072", "0.7999072", "0.7927289", "0.7712253", "0.7707467", "0.7671813", "0.76046544", "0.75884175", "0.7552992", "0.74034053", "0.7398838", "0.7336967", "0.73361933", "0.73342633", "0.73342633", "0.73342633", "0.73329455", "0.73226595", "0.7249103", "0.7249103", "0.7249...
0.704409
30