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 external energy of the snake. The external energy is computed via the provided ExternalEnergy subclass object. The external energy is the sum of the external energies at each control point which get multiplied by the inverse of the number of control points.
def externalEnergy(self, controlpoints): # compute the factor the energy of each control points get's weighed with external = 0.0 if len(self.controlpoints) > 0: factor = float(1)/len(self.controlpoints) else: factor = 1 # check if the given contr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def energy(self):\n return self.mc.energy(self.chain)", "def getEnergy(self):\n if not hasattr(self,\"energy\"):\n self.energy = self.calcEnergy()\n return self.energy", "def E(self):\n return self.generic_getter(get_energy, \"E\", \"convert_energy\")", "def KineticEnergy(self):\n ...
[ "0.6440535", "0.6354821", "0.63449776", "0.6264083", "0.61748064", "0.6103495", "0.60872054", "0.60872054", "0.6078869", "0.60188574", "0.6012361", "0.59411526", "0.5899463", "0.5817837", "0.57772756", "0.57533556", "0.57495403", "0.5735712", "0.57135314", "0.56892604", "0.56...
0.6103102
6
Checks if the priority queue is empty
def is_empty(self): return len(self) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.priority_queue) == 0", "def is_empty(self):\n return self.queue == []", "def is_empty(self):\n return len(self.the_queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return len(self.queue) == 0",...
[ "0.8808334", "0.8068953", "0.79964715", "0.7991973", "0.7991973", "0.7919884", "0.78870326", "0.7833711", "0.78051496", "0.77755535", "0.7770533", "0.77371067", "0.77360874", "0.7720101", "0.7705574", "0.7686946", "0.7686946", "0.7654498", "0.7635054", "0.7558732", "0.7543402...
0.0
-1
Returns minimum item in the form of a tuple
def min(self): if self.is_empty(): return None t = (self._data[0]._key, self._data[0]._value) return t
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min(self):\n p = self._find_min()\n item = p.element()\n return (item._key, item._value)", "def find_min(self):\n if self.is_empty():\n return None\n else:\n p = self.first()\n return (p.key(), p.value())", "def min(self):\n if self.is_empty():\n ...
[ "0.78829014", "0.740515", "0.73494077", "0.73041123", "0.73041123", "0.7193763", "0.712665", "0.7117007", "0.7105118", "0.70120853", "0.7010575", "0.6909707", "0.6895533", "0.68852603", "0.6854779", "0.6845468", "0.6826304", "0.67945486", "0.6767135", "0.6744884", "0.67245466...
0.7216957
5
Close the happybase connection.
def close(self) -> None: self.real_conn.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n self._connection.close()", "def close_connection(self):\n self.conn.close()", "def close_connection(self) -> None:\n self.conn.close()", "def close_connection(self):\n self._conn.close()", "def close(self): \n self.connection.close()", "def close_connecti...
[ "0.79916227", "0.78213465", "0.7813551", "0.77950585", "0.77862394", "0.77458835", "0.77411985", "0.7738954", "0.7738954", "0.7738954", "0.77326614", "0.77326614", "0.77274203", "0.76888466", "0.76772666", "0.7673579", "0.7671117", "0.7671117", "0.7671117", "0.7671117", "0.76...
0.76711786
16
Computes a gaussian pyramid for an input image
def compute_gaussian_pyramid(img, level = 5): image_pyramid = list(pyramid_gaussian(img, max_layer = level)) image_pyramid.reverse() return image_pyramid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cs4243_gauss_pyramid(image, n=3):\n kernel = cs4243_gaussian_kernel(7, 1)\n pyramid = []\n ## your code here####\n\n pyramid = [image]\n for i in range(n):\n gpyr_image = cs4243_filter_faster(pyramid[i], kernel)\n gpyr_image = cs4243_downsample(gpyr_image, 2)\n pyramid.appen...
[ "0.72078294", "0.7160451", "0.7004107", "0.68300813", "0.6759211", "0.66889745", "0.6619591", "0.65370846", "0.653064", "0.6460172", "0.60098743", "0.5983682", "0.59755254", "0.597127", "0.5963547", "0.5955024", "0.59330815", "0.59312946", "0.59301037", "0.5922019", "0.590096...
0.7812754
0
Convert unicode strings in JSON object to byte strings
def byteify(input): if isinstance(input, dict): return {byteify(key): byteify(value) for key, value in input.items()} elif isinstance(input, list): return [byteify(element) for element in input] elif isinstance(input, unicode): return input.encode("utf-8") else: return in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_json_bytes(obj, dumps=json.dumps):\n result = dumps(obj)\n if isinstance(result, text_type):\n return result.encode('utf-8')\n return result", "def _chinese(source):\n return json.dumps(source, ensure_ascii=False)", "def _json_txt_to_binary(self, json_text):\n message = self....
[ "0.71287656", "0.6898229", "0.67282796", "0.6651127", "0.6646716", "0.66234213", "0.6570793", "0.65239626", "0.65135884", "0.648325", "0.64821357", "0.64820534", "0.64238274", "0.64228797", "0.6404878", "0.6377354", "0.6371671", "0.63629043", "0.631347", "0.628966", "0.628889...
0.6631976
5
Returns a JSON figure representation for the specified file Plotly uniquely identifies figures with a 'file_owner'/'file_id' pair. Since each file is given a corresponding unique url, you may also simply pass a valid plotly url as the first argument.
def get_figure(file_owner_or_url, file_id=None, raw=False): import plotly.tools plotly_rest_url = get_config()["plotly_domain"] if file_id is None: # assume we're using a url url = file_owner_or_url if url[: len(plotly_rest_url)] != plotly_rest_url: raise _plotly_utils.exceptio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotlyfromjson(fpath):\n with open(fpath, 'r') as f:\n v = json.loads(f.read().encode().decode())\n\n fig = go.Figure(data=v['data'], layout=v['layout'])\n return fig\n # iplot(fig, show_link=False)", "def create_figure_file():\n\n # Any plotly compliant dict or list that can be convert...
[ "0.6201225", "0.58051383", "0.55810076", "0.5529109", "0.544995", "0.52864736", "0.51116204", "0.5072611", "0.5001298", "0.5000963", "0.4995678", "0.49639544", "0.49576038", "0.49263456", "0.49240315", "0.48255748", "0.48229688", "0.47934148", "0.4782595", "0.47803304", "0.47...
0.75329757
0
Return a static image of the plot described by `figure_or_data`.
def get(figure_or_data, format="png", width=None, height=None, scale=None): # TODO: format is a built-in name... we shouldn't really use it import plotly.tools figure = plotly.tools.return_figure_from_figure_or_data(figure_or_data, True) if format not in ["png", "svg", "jpeg", "pdf", "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(data, interactive=False):\n if interactive:\n plt.ion()\n fig = plt.figure()\n fig.canvas.draw()\n image = call_imshow(data)\n else:\n fig = plt.figure()\n image = call_imshow(data)\n plt.show()\n return fig, image", "def save_figure(self, data):...
[ "0.6683185", "0.6486511", "0.64548653", "0.63635045", "0.6334618", "0.6182145", "0.60533667", "0.6050799", "0.5991241", "0.59169155", "0.5857147", "0.5823233", "0.5817258", "0.5796308", "0.57525367", "0.57513285", "0.5700331", "0.5681536", "0.56767875", "0.56585234", "0.56585...
0.646978
2
Display a static image of the plot described by `figure_or_data` in an IPython Notebook.
def ishow(cls, figure_or_data, format="png", width=None, height=None, scale=None): if format == "pdf": raise _plotly_utils.exceptions.PlotlyError( "Aw, snap! " "It's not currently possible to embed a pdf into " "an IPython notebook. You can save the pd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(data, interactive=False):\n if interactive:\n plt.ion()\n fig = plt.figure()\n fig.canvas.draw()\n image = call_imshow(data)\n else:\n fig = plt.figure()\n image = call_imshow(data)\n plt.show()\n return fig, image", "def iplot(figure_or_data, **...
[ "0.7266314", "0.70956904", "0.67559046", "0.6501911", "0.6487926", "0.6376092", "0.61677873", "0.6130594", "0.6120668", "0.6101515", "0.60979176", "0.60885453", "0.6067559", "0.6052893", "0.6052893", "0.6052893", "0.6011241", "0.59689766", "0.5952869", "0.5939876", "0.5936720...
0.6874484
2
Return campaigns that have not been marked as deleted.
def visible(self, **kwargs): return self.filter(is_deleted=False, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_not_contacted(self, seller_id):\n return self.contactcampaignstatus_set.filter(seller_id=seller_id, status__in=[1, 3])", "def to_be_deleted(self):\n return self.filter(start__lte=timezone.now() - datetime.timedelta(days=1))", "def get_expired_campaign(self):\n kwargs = {}\n ...
[ "0.59876066", "0.5964393", "0.58784187", "0.5866484", "0.581731", "0.56766254", "0.5648982", "0.56252515", "0.56014967", "0.55676496", "0.5481052", "0.53891283", "0.5374961", "0.5356471", "0.5351363", "0.5335835", "0.5324106", "0.53224206", "0.52535504", "0.52466375", "0.5245...
0.51392394
28
Return true if this campaign has not been approved or has not yet started AND no contributions are associated with it. In all other cases, an admin needs to review the campaign before it may be deleted.
def is_deletable(self): # Deletion functionality is currently under discussion. # For now, delete requests are emailed to the admin. return False #return (not self.is_approved or self.start_date > now) and (not self.amount_raised) and (not self.is_deleted)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n from .delivery import Delivery\n return Delivery.objects.filter(deadline__assignment_group=self).count() == 0", "def available(self):\n existing_url = self.context.get_personal_fundraising_campaign_url()\n same = existing_url == self.context.absolute_url()\n ...
[ "0.65984696", "0.6162966", "0.6141656", "0.6131104", "0.6130167", "0.6102289", "0.60798293", "0.6004878", "0.59252405", "0.58954984", "0.58919406", "0.588413", "0.5877901", "0.58376265", "0.58272123", "0.58170944", "0.58153945", "0.5807906", "0.579944", "0.5790465", "0.577757...
0.630697
1
Return the total amount raised (online + tickets) to date by this campaign.
def amount_raised(self): return self.stats.amount_raised
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def amount_raised_by_tickets(self):\r\n return self.stats.amount_raised_by_tickets", "def amount_raised_online(self):\r\n return self.stats.amount_raised_online", "def total_raised(self):\n return self.total_donated() + (self.community_contribution or 0)", "def total_earnings(self):\n ...
[ "0.7630368", "0.7474192", "0.70505553", "0.68948686", "0.6558963", "0.6448289", "0.64084613", "0.619895", "0.6127036", "0.60888475", "0.6073956", "0.6016463", "0.60155123", "0.60035944", "0.59825575", "0.5981024", "0.5970821", "0.5960501", "0.5947542", "0.594348", "0.59205407...
0.67866254
4
Return the amount raised online to date by this campaign (excluding tickets).
def amount_raised_online(self): return self.stats.amount_raised_online
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def amount_raised_by_tickets(self):\r\n return self.stats.amount_raised_by_tickets", "def online_quota(self):\r\n return self.max_contributions - self.num_tickets_total", "def total_earnings(self):\n return self.total_balance - self.net_invested", "def unused_daily_balance(self):\n ...
[ "0.6648538", "0.65222704", "0.6517339", "0.62456536", "0.6216171", "0.6207917", "0.6100024", "0.6017811", "0.58511364", "0.58508337", "0.5834497", "0.5765602", "0.5745018", "0.57433647", "0.5703548", "0.5685412", "0.56764346", "0.56647485", "0.56386673", "0.5617618", "0.56143...
0.7680387
0
Return the amount raised online to date by this campaign (excluding tickets).
def amount_raised_by_tickets(self): return self.stats.amount_raised_by_tickets
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def amount_raised_online(self):\r\n return self.stats.amount_raised_online", "def online_quota(self):\r\n return self.max_contributions - self.num_tickets_total", "def total_earnings(self):\n return self.total_balance - self.net_invested", "def unused_daily_balance(self):\n curren...
[ "0.76792353", "0.6520958", "0.65152824", "0.62454665", "0.621647", "0.62060404", "0.61002696", "0.6016582", "0.5852542", "0.5847458", "0.5835288", "0.5765441", "0.5743976", "0.57388186", "0.57017225", "0.56852645", "0.5676207", "0.56661224", "0.5640928", "0.56180817", "0.5614...
0.66476005
1
Return number of tickets left unredeemed.
def num_tickets_left(self): return self._contributions_left[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_assigned(self):\n return FlicketTicket.query.filter_by(assigned=self.user).count()", "def get_number_of_non_exhausted_votes(self):\n return (\n len(self._ballots) * self._number_of_votes_pr_voter\n - self._number_of_blank_votes\n )", "def count_dead_node(self)...
[ "0.6493252", "0.6428032", "0.6175619", "0.61656725", "0.61582017", "0.6120342", "0.60774404", "0.6042892", "0.6042448", "0.5973437", "0.5968522", "0.59675795", "0.5950691", "0.5931682", "0.5920631", "0.5914511", "0.5914287", "0.5904884", "0.5904233", "0.5885647", "0.5863499",...
0.701578
0
Return number of online and ticket contributions made to this campaign.
def num_contributions(self): return self.stats.num_online_contributions + self.stats.num_tickets_redeemed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_attendees(self):\r\n n = sum([c.qty for c in self.contribution_set.all()])\r\n return n", "def get_num_contributions(self, project):\n return project.observations.exclude(\n status='draft').exclude(status='pending').count()", "def _contributions_left(self):\r\n if...
[ "0.6976142", "0.6615978", "0.6504466", "0.6337855", "0.62272394", "0.6158342", "0.6111951", "0.60996264", "0.6082669", "0.6033576", "0.6031653", "0.6028697", "0.5957099", "0.59200794", "0.5905668", "0.588132", "0.58618236", "0.58588386", "0.58588386", "0.58567053", "0.5841208...
0.8378922
0
Return end date of the campaign; used when this campaign behaves like an event.
def event_date(self): return self.end_date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_date(self):\n return self.__end_date", "def end_date(self):\n return self._end_date", "def end_date(self):\n return self._end_date", "def end_date(self):\n return self._end_date", "def end_date(self) -> str:\n return self._end_date", "def end_date(self) -> str:\...
[ "0.83100796", "0.8256867", "0.8256867", "0.8256867", "0.8217568", "0.8148739", "0.8148739", "0.7762649", "0.7762649", "0.76239663", "0.7421777", "0.74168694", "0.73484606", "0.72717685", "0.72662055", "0.72091925", "0.71444035", "0.7121332", "0.71095306", "0.70932186", "0.708...
0.78822595
7
Return the number of online contributions accepted excluding tickets.
def online_quota(self): return self.max_contributions - self.num_tickets_total
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_contributions(self):\r\n return self.stats.num_online_contributions + self.stats.num_tickets_redeemed", "def _contributions_left(self):\r\n if self.is_complete:\r\n return 0, 0\r\n online_left = self.online_quota - self.stats.num_online_contributions\r\n if online_l...
[ "0.7680878", "0.68704367", "0.67946506", "0.67775667", "0.66226083", "0.65727556", "0.62992626", "0.6272155", "0.5835012", "0.57726115", "0.57014626", "0.56466216", "0.5588915", "0.55851907", "0.55542594", "0.5546944", "0.5543755", "0.5502432", "0.5480795", "0.5479391", "0.54...
0.68959504
1
Return HTML fragment to display badge image.
def image_preview(self): h = '<img src="%s" alt="Campaign badge"/>' % self.image.url return mark_safe(h)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_preview(self):\r\n h = '<img src=\"%s\" alt=\"%s\"/>' % (self.image_resized_url, self.title)\r\n return mark_safe(h)", "def avatar_preview(self):\r\n h = '<img src=\"%s\" alt=\"%s\"/>' % (self.image_avatar_url, self.title)\r\n return mark_safe(h)", "def img(self, obj):\n ...
[ "0.65032226", "0.63238186", "0.6238921", "0.6182968", "0.6120444", "0.6027751", "0.5957812", "0.59428513", "0.5906134", "0.58768463", "0.5873083", "0.58691084", "0.58234966", "0.5822494", "0.5817191", "0.58008146", "0.57927096", "0.5779642", "0.57480925", "0.56906426", "0.565...
0.8229253
0
Return a userfriendly version of the ticket code in the format AAABBBCCCC.
def code_display(self): return u'%s-%s-%s' % (self.code[:3], self.code[3:6], self.code[6:])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_ticket_code(prefix, code_dict):\r\n while (True): # continue until we find a unique code\r\n letters = random.sample(_CHAR_LIST, 4) # generate 4 random letters\r\n code = prefix + ''.join(letters) # turn letters to string\r\n if not code_dict.has_key(code): # code is unique\r\n ...
[ "0.6595918", "0.6372422", "0.6350186", "0.6275939", "0.62750477", "0.6203088", "0.619837", "0.5990963", "0.5935194", "0.59275705", "0.59174114", "0.5891635", "0.5859422", "0.58105373", "0.5809429", "0.5787439", "0.57846373", "0.5770695", "0.5770517", "0.57554734", "0.5737908"...
0.7020354
0
When a ``Contribution`` or ``Ticket`` object is saved, schedule a recomputation of the campaign's statistics.
def recompute_campaign_stats(sender, instance, **kwargs): if isinstance(instance, (Contribution, Ticket)): ActionItem.objects.q_campaign_action(instance.campaign, 'recompute-campaign')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_contribution(self):\n contributions = [v for v in self.action_register if v['action'] == 'contribution']\n for contribution in contributions:\n self.model.schedule.agents_by_type['Customer'][contribution['unique_id']].hour_wallet -= contribution['value']\n self.model...
[ "0.6043927", "0.56969786", "0.5672916", "0.56659484", "0.56136096", "0.545843", "0.5456702", "0.53531253", "0.53505385", "0.5321189", "0.52938175", "0.52388984", "0.51704293", "0.51602507", "0.51519763", "0.5143518", "0.51280487", "0.51014", "0.51009095", "0.5099541", "0.5083...
0.7159458
0
Opens a file in the Windows explorer (or equivalent).
def open_in_explorer(file): webbrowser.open(os.path.dirname(p['paths'][file]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_file_browser(path):\n if sys.platform == 'win32':\n #subprocess.Popen(['start', path], shell=True)\n os.startfile(path)\n\n elif sys.platform == 'darwin':\n subprocess.Popen(['open', path])\n\n else:\n try:\n subprocess.Popen(['xdg-open', path])\n exc...
[ "0.78888535", "0.7886586", "0.75610894", "0.72731686", "0.72630876", "0.71721107", "0.7157188", "0.7046568", "0.69904256", "0.69589436", "0.6947861", "0.6946041", "0.69299746", "0.6867009", "0.6840836", "0.6695129", "0.66920954", "0.6644093", "0.6509257", "0.6484421", "0.6483...
0.7954632
0
return reward by given states and action, int
def get_reward( self, current_state, action, next_state ): if self.__env.is_goal_state(next_state): return 0 else: return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self, action):\n res = self.reward_table.get(self.curr_state, action)\n\n self.curr_state = res['result']\n\n return res", "def get_reward(self, state, action, next_state):\n assert action in self.get_possible_actions(\n state), \"cannot do action %s from state %s\" % (action,...
[ "0.7784248", "0.7647302", "0.74507815", "0.74464077", "0.73857564", "0.7353268", "0.7311232", "0.73034924", "0.729429", "0.72918487", "0.7206298", "0.71789294", "0.7168078", "0.71667105", "0.7133709", "0.71108484", "0.70563465", "0.70400053", "0.7011071", "0.6977345", "0.6955...
0.7224208
10
return reward by given states and action, int
def get_reward( self, current_state, action, next_state ): if self.__env.is_goal_state(next_state): return 1 else: return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self, action):\n res = self.reward_table.get(self.curr_state, action)\n\n self.curr_state = res['result']\n\n return res", "def get_reward(self, state, action, next_state):\n assert action in self.get_possible_actions(\n state), \"cannot do action %s from state %s\" % (action,...
[ "0.77840394", "0.76465356", "0.7449264", "0.7445409", "0.73868966", "0.7353187", "0.73110396", "0.73030144", "0.729337", "0.72914207", "0.72227204", "0.7205519", "0.71784055", "0.71686685", "0.71662515", "0.7133114", "0.7111013", "0.7056227", "0.70411074", "0.69765913", "0.69...
0.70097053
19
Used by walls and posts to check if the obj has access right or not
def check_access_rights(access_obj, thing): from apps.users.models import Dept, Subdept, Page if hasattr(thing, "person"): # Allow all user walls to be accessible by everyone return 1 if isinstance(access_obj, User): erp_profile = access_obj.erp_profile erp_coords = erp_profile.coord...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_object_permission(self, request, view, obj):\n # if the user is trying to retrieve to create a item.. it will return true\n if request.method in permissions.SAFE_METHODS:\n return True\n # check if the user is trying to don't do a SAFE_METHODS, put,patch,delete and if the fe...
[ "0.78731155", "0.76566803", "0.7574213", "0.7505925", "0.74852383", "0.74852383", "0.7450351", "0.7431208", "0.74274325", "0.7408801", "0.7387677", "0.7382034", "0.7358666", "0.7354922", "0.73333967", "0.7323322", "0.7317642", "0.73099405", "0.730365", "0.73019105", "0.727142...
0.72223866
28
Split dataset into train and test sets
def split_dataset(dataset, test_size): train_data = dataset.skip(test_size).shuffle(SHUFFLE_BUFFER_SIZE) train_data = train_data.padded_batch(BATCH_SIZE) test_data = dataset.take(test_size) test_data = test_data.padded_batch(BATCH_SIZE) return train_data, test_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __split_dataset(self):\n self.train, self.valid, _, _ = train_test_split(self.data, self.data, test_size=0.2)\n self.valid, self.test, _, _ = train_test_split(self.valid, self.valid, test_size=0.5)", "def split_data_into_train_and_test(raw_training_data):\n train_set, test_set = train_test_s...
[ "0.8617501", "0.8584065", "0.82917434", "0.81249624", "0.8105712", "0.8009486", "0.7884736", "0.7842689", "0.783094", "0.78279555", "0.7802652", "0.7779635", "0.77695936", "0.7769015", "0.77501905", "0.7722257", "0.771371", "0.7698815", "0.7692052", "0.7691124", "0.7685488", ...
0.7879296
7
Overwrites the nil_slot (first row) of the input Tensor with zeros. The nil_slot is a dummy slot and should not be trained and influence the training algorithm.
def zero_nil_slot(t, name=None): with tf.name_scope(name, "zero_nil_slot", [t]) as name: t = tf.convert_to_tensor(t, name="t") s = tf.shape(t)[1] z = tf.zeros(tf.stack([1, s])) return tf.concat(axis=0, values=[z, tf.slice(t, [1, 0], [-1, -1])], name=name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zero_nil_slot(t, name=None):\n\twith tf.name_scope(name, \"zero_nil_slot\", [t]) as name:\n\t\tt = tf.convert_to_tensor(t, name=\"t\")\n\t\ts = tf.shape(t)[1]\n\t\tz = tf.zeros(tf.pack([1, s]))\n\t\treturn tf.concat(0, [z, tf.slice(t, [1, 0], [-1, -1])], name=name)", "def zero_nil_slot(t, name=None):\n wi...
[ "0.78309005", "0.7585748", "0.74005955", "0.65641546", "0.6203455", "0.6191431", "0.6104243", "0.60961765", "0.60934246", "0.6091892", "0.602161", "0.5920386", "0.5919561", "0.5905201", "0.5901274", "0.58469564", "0.58254486", "0.58201325", "0.5778825", "0.57560945", "0.57375...
0.77145684
1
Predicts answers as onehot encoding.
def predict(self, stories, queries): feed_dict = {self._stories: stories, self._queries: queries} return self._sess.run(self.predict_op, feed_dict=feed_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_encoding(labels, num_classes=10):\n num_labels = labels.shape[0]\n encoded = np.zeros((num_labels, num_classes))\n encoded[np.arange(num_labels), labels[np.arange(num_labels)]] = 1\n \n return encoded", "def one_hot_encoding(data):\r\n encoder = LabelEncoder()\r\n y = encoder.fit...
[ "0.73097706", "0.72380114", "0.7203448", "0.7167696", "0.71570367", "0.71362305", "0.7084296", "0.7066906", "0.7024248", "0.7024248", "0.6995486", "0.69870776", "0.69763374", "0.69596153", "0.6957978", "0.69162124", "0.6912667", "0.68752885", "0.6870979", "0.6868211", "0.6863...
0.0
-1
Initialize name and age attributes.
def __init__(self, name, age): self.name = name self.age = age
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, name, age):\n\t\tself.name = name\n\t\tself.age = age", "def __init__(self, name, age):\n\t\tself.name = name\n\t\tself.age = age", "def __init__(self, name, age):\n\t\tself.name = name\n\t\tself.age = age", "def __init__(self, first_name, last_name, age):\n\n self.first_name = firs...
[ "0.77159995", "0.77159995", "0.77159995", "0.7641757", "0.7606769", "0.7606769", "0.7606769", "0.7606769", "0.7606769", "0.7606769", "0.7606769", "0.7606769", "0.7504553", "0.7349212", "0.724779", "0.72424275", "0.71994966", "0.7137731", "0.69129884", "0.6792457", "0.67457414...
0.7506191
14
Builds the dataloader based on input params. Returns a tuple (train_dl, validation_dl).
def build(self, train_mode: bool, max_items: int, validation_ratio=0.0): # check validation_ratio if validation_ratio < 0 or validation_ratio > 1: raise ValueError("validation_ratio must be in [0,1] interval") # check type of dataloader required if train_mode: se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataloader(self):\n\n # load / split data\n train_data = self.data.get_train_data()\n if self.args.use_dev:\n train_data, dev_data = self.data.split_data(train_data)\n test_data = self.data.get_test_data()\n\n #print(train_data[0])\n #print(dev_data[0])\n ...
[ "0.7604848", "0.7502306", "0.7385591", "0.7344805", "0.7296502", "0.7248106", "0.7211502", "0.70992357", "0.7090084", "0.69722074", "0.69659674", "0.6941678", "0.69137573", "0.68905264", "0.6865357", "0.68648815", "0.6864441", "0.6818865", "0.67762184", "0.6744316", "0.673761...
0.6697478
21
Whether the origin is inside the hull formed by the points. If not, they must all be on one hemisphere. We do not try to construct a reference frame based on the locations of such a problematic distribution of points.
def is_origin_inside(points): # SciPy requires the array of points to have indices [point, axis] # so we have to transpose our arrays hull = scipy.spatial.Delaunay(points.T) return numpy.all(hull.find_simplex(origin().T) >= 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_inside(self, points):\n points = np.atleast_2d(points) - self.centroid\n return np.logical_and(\n np.linalg.norm(points, axis=-1) <= self.radius,\n # At present circles are not orientable, so the z position must\n # match exactly.\n np.isclose(points...
[ "0.6979389", "0.6672889", "0.65810275", "0.6550029", "0.6505384", "0.64974886", "0.6457747", "0.6413353", "0.63747317", "0.6372016", "0.631495", "0.63140607", "0.62676966", "0.62370855", "0.6229541", "0.6211103", "0.6172395", "0.6153061", "0.6151926", "0.613876", "0.61223644"...
0.7826114
0
Area of a spherical triangle.
def triangle_area(triangle): # sides of the triangle a = great_circle_distance(triangle[0], triangle[1]) b = great_circle_distance(triangle[0], triangle[2]) c = great_circle_distance(triangle[1], triangle[2]) # it may happen that the triangle is degenerate # for the rare case where a fourth gen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area_triangle(w, h):\n return w * h / 2", "def triangle_area(side1: number, side2: number, side3: number) -> number:\n s = (side1+side2+side3)/2\n area = sqrt(s*(s-side1)*(s-side2)*(s-side3))\n return sqrt(s*(s-side1)*(s-side2)*(s-side3))", "def areaOfTriangle(triangle):\n a = np.linalg.norm...
[ "0.7483566", "0.7476309", "0.7371156", "0.7358916", "0.7273443", "0.72675914", "0.72439116", "0.7144872", "0.71112204", "0.7095793", "0.7088404", "0.7021179", "0.6968845", "0.6960981", "0.69425887", "0.69096375", "0.6900818", "0.6884549", "0.6831978", "0.6791188", "0.67693007...
0.7407778
2
The area of the polygon on the surface of the unit sphere formed by points.
def polygon_area(points): def area(triangles): """ Area of a spherical triangle. Vectorized version of :func:`triangle_area`. """ # sides of the triangle sides = great_circle_distance(triangles, numpy.roll(triangles, 1, axis=1)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self):\n if len(self.exterior) < 3:\n raise Exception(\"Cannot compute the polygon's area because it contains less than three points.\")\n poly = self.to_shapely_polygon()\n return poly.area", "def _get_area_polygon(points_x, points_z):\n area = 0\n j = len(...
[ "0.8161267", "0.7771358", "0.7526702", "0.7516967", "0.7491069", "0.74622905", "0.7385302", "0.7376176", "0.7265697", "0.7249031", "0.72211623", "0.7197891", "0.71893305", "0.71780336", "0.7173488", "0.7169627", "0.7169627", "0.71451944", "0.7136546", "0.7131657", "0.71258885...
0.7618879
2
Area of a spherical triangle. Vectorized version of
def area(triangles): # sides of the triangle sides = great_circle_distance(triangles, numpy.roll(triangles, 1, axis=1)) assert numpy.all(sides >= 0.) # s = (a + b + c) / 2. s = (numpy.sum(sides, axis=1) / 2.) # tan(s / 2) * tan((s ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def areaOfTriangle(triangle):\n a = np.linalg.norm(triangle[..., 0, :] - triangle[..., 1, :])\n b = np.linalg.norm(triangle[..., 1, :] - triangle[..., 2, :])\n c = np.linalg.norm(triangle[..., 2, :] - triangle[..., 0, :])\n s = (a+b+c)/2\n # Herons formula\n return np.sqrt(s*(s-a)*(s-b)*(s-c))", ...
[ "0.7628877", "0.75684655", "0.7464666", "0.743782", "0.74032724", "0.7401987", "0.73759526", "0.7360038", "0.7168495", "0.7142045", "0.7136769", "0.70044446", "0.69161654", "0.68413365", "0.68359244", "0.6826652", "0.6817193", "0.6777027", "0.6753502", "0.6752417", "0.67012",...
0.72108924
8
Area of an individual triangle.
def individual(prod): try: return 4. * arctan(sqrt(prod)) except FloatingPointError: return 0.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area_triangle(triangle):\n return 0.5 * length_vector(normal_triangle(triangle, False))", "def area_triangle(w, h):\n return w * h / 2", "def triangle_area(base, height): # Compute the area of a triangle\n area = (1.0 / 2) * base * height\n return area", "def triangle_area(base, he...
[ "0.85250574", "0.8342409", "0.8313032", "0.82943344", "0.81999505", "0.81915104", "0.81385595", "0.8096164", "0.7912132", "0.7795598", "0.77606374", "0.77399766", "0.7735665", "0.7692194", "0.76676965", "0.76151216", "0.7612882", "0.7588053", "0.7586277", "0.753021", "0.75165...
0.0
-1
Initialize the weights specific to the BERT Model. This overrides the default initializations depending on the specified arguments. 1. If normal_init_linear_weights is set then weights of linear layer will be initialized using the normal distribution and bais will be set to the specified value. 2. If normal_init_embed_...
def init_bert_params(module): if isinstance(module, nn.Linear): module.weight.data.normal_(mean=0.0, std=0.02) if module.bias is not None: module.bias.data.zero_() if isinstance(module, nn.Embedding): module.weight.data.normal_(mean=0.0, std=0.02) if module.padding_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weights(self) -> None:\n nn.init.kaiming_normal_(self._U)\n nn.init.kaiming_normal_(self._W)\n nn.init.kaiming_normal_(self._V)\n\n nn.init.normal_(self._b)", "def _weight_initializer(self):\n for m in self.modules():\n if isinstance(m, nn.Conv2d):\n ...
[ "0.77195024", "0.76963615", "0.76581746", "0.7657839", "0.7646313", "0.7646313", "0.7646313", "0.7646313", "0.7566213", "0.7559697", "0.75364864", "0.75344884", "0.752954", "0.75010264", "0.7444066", "0.7413718", "0.73886645", "0.73864084", "0.7367358", "0.73563504", "0.73521...
0.67990863
65
Ends the thread associated with this scheduler. All remaining work in the scheduler queue is abandoned.
def dispose(self) -> None: with self._condition: if not self._is_disposed: self._is_disposed = True self._condition.notify()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self) -> None:\n self.event_queue.put(self._SHUTDOWN_SIGNAL)\n self.logger.warning('Stopping Scheduler.')\n\n if self.executor:\n self.executor.join(self.timeout_interval.total_seconds())\n\n if self.is_running:\n self.logger.error(f'Timeout exceeded while...
[ "0.72263944", "0.7073435", "0.6956972", "0.6787734", "0.67304295", "0.6700066", "0.6698206", "0.6675045", "0.66703165", "0.66703165", "0.6662836", "0.66594595", "0.66327274", "0.6621435", "0.661491", "0.6613179", "0.6612532", "0.6607717", "0.6599196", "0.655751", "0.655358", ...
0.0
-1
Create and return a `User` with an email, username and password.
def create_user(self, password=None, **data): user = self.model(**data) user.set_password(password) user.is_active = False user.save() return user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_user(self, email=None, password=None, **extra_fields):\n if not email:\n raise ValueError('The given email must be set')\n email = self.normalize_email(email)\n user = self.model(email=email, username=email, **extra_fields)\n user.set_password(password)\n u...
[ "0.8711828", "0.86917835", "0.8683678", "0.86736417", "0.86486745", "0.86486745", "0.8618047", "0.8614819", "0.86066765", "0.8605765", "0.8605765", "0.8605765", "0.8605765", "0.8605765", "0.8605765", "0.8605765", "0.8605765", "0.85976475", "0.8597028", "0.8596434", "0.8593557...
0.0
-1
Create and return a `User` with superuser powers. Superuser powers means that this use is an admin that can do anything they want.
def create_superuser(self, username, email, password): if password is None: raise TypeError('Superusers must have a password.') id_number = self.create_id_number() user = self.create_user( username=username, email=email, password=password, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user_as_admin(self, *args, **kwargs):\n profile = self.create_user(*args, **kwargs)\n profile.make_administrator()\n return profile", "def create_superuser(self, username, major, password):\r\n user = self.create_user(username, major, password=password,)\r\n user.is_admi...
[ "0.74250114", "0.73518306", "0.7330265", "0.73248947", "0.73197466", "0.7267141", "0.7265804", "0.7260273", "0.72446865", "0.72152406", "0.7190953", "0.7179229", "0.7175211", "0.7161783", "0.714761", "0.71412617", "0.71252704", "0.7116206", "0.71146005", "0.71044284", "0.7102...
0.6789379
85
Sends a message via slack.
def send_message(self, message: str): self.client.chat_postMessage( channel=f"@{self.username}", text=message, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_slack(self, message):\n self.slack_client.api_call('chat.postMessage', channel=self.slack_channel, text=message, username=self.username, icon_emoji=self.slack_icon_emoji)\n print(\"Slack Notification sent\")", "def send_message(channel, message):\n slack_client = get_client()\n slack...
[ "0.8438318", "0.7846754", "0.77701837", "0.75128984", "0.74844927", "0.7431097", "0.7362141", "0.73283106", "0.7324978", "0.72902596", "0.72473115", "0.7111263", "0.7081036", "0.7074857", "0.7055605", "0.7039744", "0.70205283", "0.6989841", "0.6951224", "0.69435513", "0.69279...
0.66010004
37
Output the vocabulary to json file.
def voc2json(): hyou_lesson = hyou_reader() mina1_lesson = mina1_reader() mina2_lesson = mina2_reader() lesson_list = hyou_lesson + mina1_lesson + mina2_lesson json_file = open(OUT_PATH, 'w') json_file.write(json.dumps(lesson_list, encoding='utf-8', ensure_ascii=False, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vocab_to_json(vocab: Mapping, path: str):\n with open(path, \"w\") as out:\n json.dump(vocab, out, indent=4, ensure_ascii=False)\n logger.info('Vocabulary saved to \"%s\"', path)", "def write_vocabulary():\n with open('../data/vocabulary.txt', 'w') as vocabulary_file:\n vocabulary ...
[ "0.74042374", "0.73631066", "0.7020417", "0.68447953", "0.66741705", "0.66688913", "0.65687704", "0.6564157", "0.6543154", "0.64661026", "0.63839054", "0.63608855", "0.63242173", "0.62929857", "0.61782324", "0.61731356", "0.61550665", "0.60923743", "0.6078099", "0.6073033", "...
0.6537376
9
Configures the learning rate.
def _configure_learning_rate(num_samples_per_epoch, global_step): decay_steps = int(num_samples_per_epoch / FLAGS.batch_size * FLAGS.num_epochs_per_decay) if FLAGS.sync_replicas: decay_steps /= FLAGS.replicas_to_aggregate if FLAGS.learning_rate_decay_type == 'exponential': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_learning_rate(self, rate):\n self.SGD.set_learning_rate(rate)", "def adjust_lr(self):\n learning_rate = self.params.base_lr * (1 - float(self.epoch) / self.params.num_epoch) ** self.params.power\n for param_group in self.opt.param_groups:\n param_group['lr'] = learning_rat...
[ "0.78593874", "0.75907296", "0.742758", "0.7406107", "0.739691", "0.7320627", "0.7320627", "0.72974896", "0.7253351", "0.7229305", "0.721023", "0.72072744", "0.71990186", "0.71936136", "0.7180078", "0.7170698", "0.7169669", "0.7165654", "0.71405464", "0.71101654", "0.71101654...
0.0
-1
Returns a string usable for lambdifying.
def lambdarepr(expr, **settings): return LambdaPrinter(settings).doprint(expr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n names = [self.name]\n names += [_callable_name(transform) for transform in self.transforms]\n return ' | '.join(names) + f' -> {self.shape} {self.dtype}'", "def expression(self):\n\n result = u\"{}({}\".format(self.function.lower(),\n ...
[ "0.595262", "0.5826555", "0.57832825", "0.57720155", "0.56565857", "0.56236696", "0.5618103", "0.5592923", "0.5571303", "0.55488133", "0.5536845", "0.55026376", "0.5499025", "0.5492451", "0.5413251", "0.5371463", "0.5345338", "0.533052", "0.5319168", "0.53166324", "0.52988034...
0.6419241
0
Returns a list of variabels to restore for the specified list method. It is supposed that variable name starts with the method's scope (a prefix returned by _method_scope function.)
def variabels_to_restore(scope=None, strip_scope=False): if scope: variable_map = {} variables_to_restore = slim.get_variables_to_restore(include=[scope]) for var in variables_to_restore: if strip_scope: var_name = var.op.name[len(scope) + 1:] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_variables(self):\n return [self.item]", "def get_all_variables(self):\n return []", "def get_variables_to_restore():\n# checkpoint_exclude_scopes=[\"distance-module\", \"InceptionV4/Logits\"]\n checkpoint_exclude_scopes=[\"DeInceptionV4\"]\n exclusions = [scope.strip() for s...
[ "0.60258776", "0.6006314", "0.59230494", "0.5592203", "0.5555549", "0.55382496", "0.55180925", "0.5517383", "0.5485563", "0.5485563", "0.5485563", "0.5480257", "0.5478412", "0.5476064", "0.54620343", "0.54337436", "0.5365489", "0.5339208", "0.5336621", "0.5335185", "0.5325799...
0.6136607
0
Return if pairs are equal. >>> Pair('A', 'B') == Pair('B', 'A') True >>> Pair('A', 'B') == Pair('A', 'A') False
def __eq__(self, other: 'Pair') -> bool: return self.names == other.names
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_equal(self, codon_pair: 'CodonPair') -> bool:\n return self.sequence == codon_pair.sequence", "def __eq__(self, other: 'PairwiseInfo') -> bool:\n\n return (\n self.their_did == other.their_did and\n self.their_verkey == other.their_verkey and\n self.my_did ==...
[ "0.7250911", "0.69399416", "0.6566681", "0.6540947", "0.6491572", "0.64901346", "0.648855", "0.6461358", "0.6317612", "0.63122255", "0.6292389", "0.6234777", "0.62025297", "0.61583334", "0.6155708", "0.61519843", "0.61383545", "0.61297846", "0.6116349", "0.6087816", "0.607251...
0.75284827
0
Return if a current pair is before other pair. >>> Pair('A', 'B') >> Pair('B', 'B') < Pair('A', 'C') False
def __lt__(self, other: 'Pair') -> bool: return self.names < other.names
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __lt__(self, secondPoint):\n return self.value < secondPoint.value", "def __lt__(self, other):\n return self.__le__(other) and self.__ne__(other)", "def lt(self, x, y):\n return self.le(x,y) and x != y", "def __lt__(self, other):\n selfList = sorted(list([self.start, self....
[ "0.63696724", "0.6363717", "0.6354985", "0.633129", "0.63007474", "0.6297404", "0.62679976", "0.62563485", "0.62158", "0.61886114", "0.6167188", "0.6164004", "0.61614245", "0.6158149", "0.6157265", "0.6147101", "0.61470485", "0.61470485", "0.6146412", "0.61447775", "0.6129172...
0.7353058
0
Return the literal of a pair. >>> repr(Pair('A', 'B')) "Pair('A', 'B')"
def __repr__(self) -> str: return 'Pair({!r}, {!r})'.format(*self.names)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_pair(pair):\n logger.info('format pair...')\n formatted_pair = pair[0] + ', ' + pair[1] + '\\n'\n logger.debug('formatted_pair: ' + formatted_pair)\n return formatted_pair", "def tuple_to_string(letter_word_pair):\n letter, word = letter_word_pair\n return '{letter}: {word}'....
[ "0.63724804", "0.62095463", "0.58915025", "0.5874253", "0.57802963", "0.56206805", "0.56206805", "0.5592388", "0.55742466", "0.55693716", "0.55169034", "0.55080456", "0.5485911", "0.5480038", "0.5469646", "0.5444116", "0.5442278", "0.54416555", "0.5436006", "0.5420553", "0.54...
0.7832186
0
Get WebDriver Instance based on the browser configuration
def getWebDriverInstance(self): #baseURL = "https://qa-test.avenuecode.com/" if self.device == "ios_mobile": self.driver = appiumdriver.Remote('http://localhost:4723/wd/hub', self.capabilities) self.driver.implicitly_wait(10) #return driver #driver.get(bas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_webdriver_instance():\n return selenium._current_browser()\n # return PageBase.get_selenium2library_instance()._current_browser()", "def get_instance(driver_info: DriverInfo) -> webdriver:\n if driver_info.get_driver_type() == \"chrome\":\n options = webdriver.ChromeOption...
[ "0.80602616", "0.77521074", "0.76748437", "0.75982445", "0.7462003", "0.71285415", "0.7035448", "0.6954848", "0.6950162", "0.68926364", "0.68895584", "0.68115294", "0.6806767", "0.67666084", "0.67464846", "0.6675362", "0.6666601", "0.6663796", "0.665917", "0.6624525", "0.6597...
0.712765
6
Returns the number of seconds from the epoch to date.
def epoch_seconds(date): td = date - epoch return td.days * 86400 + td.seconds + (float(td.microseconds) / 1000000)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def epoch_seconds(date):\r\n td = date - epoch\r\n return td.days * 86400 + td.seconds + (float(td.microseconds) / 1000000)", "def seconds_since_epoch(date_time, epoch=None):\n return microseconds_since_epoch(date_time) / 10.0**6", "def _current_epoch_secs():\n now = datetime.datetime.utcnow()\n epo...
[ "0.83518755", "0.80817693", "0.7497906", "0.70659727", "0.6931502", "0.6926723", "0.68587184", "0.68165326", "0.68096346", "0.6807531", "0.6745652", "0.6745652", "0.67439824", "0.67392236", "0.66537803", "0.6598786", "0.653397", "0.65287244", "0.6505542", "0.6488842", "0.6436...
0.8317224
2
splits a list into a list of smaller lists
def chunkify(list,size): for i in range (0, len(list), size): yield list[i:i+size]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_list(list_in,number_of_pieces):\n output_length = len(list_in) / number_of_pieces\n output = []\n piece = []\n counter = 0\n for list_item in list_in:\n counter += 1\n piece.append(list_item)\n if counter >= output_length:\n output.append(piece)\n ...
[ "0.7650407", "0.76430386", "0.751456", "0.7372963", "0.7360637", "0.73501885", "0.7316249", "0.72931767", "0.7151028", "0.7146376", "0.7102827", "0.70866424", "0.707408", "0.7016894", "0.70077163", "0.6992714", "0.69837546", "0.69662946", "0.69186676", "0.6883406", "0.6874468...
0.6510708
49
Loop through the board and find position where there is empty square (0 = empty) and return position
def find_empty_squares(board): for i in range(len(board)): for j in range(len(board[0])): if board[i][j] == 0: return (i,j) #row , column #if there are no blank squres return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_empty(self):\n num_rows = len(self.board)\n num_cols = len(self.board[0])\n\n for i in range(num_rows):\n for j in range(num_cols):\n if self.board[i][j] == 0:\n return (i, j)", "def findEmpty(grid):\n for x in range(len(grid.board)):\n for y in range(len(grid.boa...
[ "0.82490176", "0.79800963", "0.7958425", "0.78399754", "0.78382415", "0.7802007", "0.7783275", "0.76683545", "0.7661243", "0.758047", "0.7540548", "0.74784946", "0.7398503", "0.7355691", "0.73444676", "0.7339144", "0.7170152", "0.7149667", "0.7123986", "0.7098115", "0.7083824...
0.8234963
1
From pkl to Pytorch Geometric data object. Apply to both train/test.
def get_data(pkl_fname, label, sample, replicate, incl_curvature=False, load_attn1=None, load_attn2=None, modelpkl_fname1=None, modelpkl_fname2=None, preloadn2v=False, out_channels=8, heads=8, negative_slope=0.2, dropout=0.4, verbose=True)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data_pkl(self):\n pkl_name = '{}/data/mini-imagenet-cache-{}.pkl'.format(self.root_dir, self.split)\n print('Loading pkl dataset: {} '.format(pkl_name))\n\n try:\n with open(pkl_name, \"rb\") as f:\n data = pkl.load(f, encoding='bytes')\n image_d...
[ "0.57522", "0.56354976", "0.5600668", "0.5519163", "0.54569966", "0.5378434", "0.53473073", "0.5345796", "0.5262078", "0.5237828", "0.5207238", "0.5172002", "0.5168588", "0.51627046", "0.5157687", "0.5148591", "0.5078726", "0.5068341", "0.50632584", "0.5057885", "0.5033007", ...
0.5128631
16
Splits a sequence into n, rest parts.
def just(n, seq): it = iter(seq) for _ in range(n - 1): yield next(it, None) yield tuple(it)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_by_n(seq, n):\n while seq:\n yield seq[:n]\n seq = seq[n:]", "def split_by_n( seq, n ):\n while seq:\n yield seq[:n]\n seq = seq[n:]", "def split(self, n: Optional[int] = None) -> List[\"Sequence\"]:\n if n is None:\n n = self._size\n\n ...
[ "0.8332672", "0.8214511", "0.77115256", "0.76877445", "0.7528274", "0.7262953", "0.72250265", "0.71357185", "0.7105642", "0.7104745", "0.7104008", "0.70958114", "0.7084247", "0.70595324", "0.7048371", "0.7037082", "0.6997547", "0.69730604", "0.6964928", "0.69627583", "0.69528...
0.0
-1
Iterates over a sequence, splitting each item into n, rest parts.
def just2(n, seq): for inner_seq in seq: yield tuple(just(n, inner_seq))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_by_n( seq, n ):\n while seq:\n yield seq[:n]\n seq = seq[n:]", "def split_by_n(seq, n):\n while seq:\n yield seq[:n]\n seq = seq[n:]", "def chunks(seq: Sequence[T], n: int) -> Iterator[Sequence[T]]:\n for i in range(0, len(seq), n):\n yield seq[...
[ "0.8275109", "0.82731783", "0.7613014", "0.7569458", "0.7540378", "0.7495592", "0.7417853", "0.74165726", "0.7384573", "0.72644836", "0.7263949", "0.7259646", "0.7255896", "0.72489077", "0.7246913", "0.7246913", "0.7245492", "0.72364527", "0.72245836", "0.7189775", "0.7187282...
0.0
-1
Splits a line of text by whitespace
def split_whitespace_tokens(line): in_quote = False token = "" token_start = 0 for i, char in enumerate(line): if char == ' ': if len(token) > 0: yield (token_start, token) token = "" else: if len(token) == 0: token_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splitLine(text):\r\n sp = text.split(\" \")\r\n try:\r\n a = sp[0]\r\n b = \" \".join(sp[1:])\r\n except:\r\n a = text\r\n b = \"\"\r\n return a, b", "def splitline (self, line):\n\t\treturn line.split('\\t')", "def chunks(text):\n lines = []\n for line in text...
[ "0.7274361", "0.7108683", "0.6893651", "0.6875034", "0.6712784", "0.6697598", "0.6690229", "0.6689724", "0.66789424", "0.6631158", "0.6603243", "0.65912807", "0.6575334", "0.65586406", "0.65450513", "0.65450513", "0.65450513", "0.6508846", "0.6502125", "0.64980966", "0.642758...
0.6802766
4
Tests the case that we have multiple space as sparator between our domain end its prefix.
def tests_multiple_spaces(self): for domain in self.domains: expected = domain data = f"0.0.0.0 {domain}" actual = File(data).get_converted() self.assertEqual(expected, actual) for domain in self.domains: expected = domain ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testLeadingSpaces(self):\n self.assertEqual([\"http://tomtom.foobar.org/\"], grab(' http://tomtom.foobar.org/', self.needScheme))\n self.assertEqual([\"http://www.foobi.org/saatoimia\"], grab(' http://www.foobi.org/saatoimia', self.needScheme))", "def testTrailingSpaces(self):\n ...
[ "0.6160518", "0.6118312", "0.60383373", "0.5934921", "0.59026897", "0.5889135", "0.5877281", "0.58551514", "0.5844301", "0.58125246", "0.5741223", "0.5693972", "0.56578445", "0.5644912", "0.5638032", "0.561847", "0.56051934", "0.559284", "0.55835885", "0.5526262", "0.5518055"...
0.6070626
2
Return batch_dir & project_dir, which must be the same for all rows.
def extract_batch_info(worklist): batch_dirs = set(r.batch for r in worklist) project_dirs = set(r.hgsc_xfer_subdir for r in worklist) assert len(batch_dirs) == 1, ( 'batch must be the same for all BAMs in worklist' ) assert len(project_dirs) == 1, ( 'hgsc_xfer_subdir must be the sam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_project_dir(self):\n return os.path.expanduser(\n self.sqlfluff_config.get_section(\n (self.templater_selector, self.name, \"project_dir\")\n )\n or os.getcwd()\n )", "def getBatchDir(self):\n return self.batch_subjects", "def _get_d...
[ "0.6306784", "0.6090127", "0.56369096", "0.5613657", "0.5565796", "0.5543564", "0.5527856", "0.5489418", "0.5488515", "0.5447049", "0.5419612", "0.5388157", "0.5352392", "0.5341177", "0.5279018", "0.5260714", "0.523097", "0.5213747", "0.5176594", "0.5175597", "0.5171077", "...
0.624977
1
For each deployed package service, collect its local variables (e.g. network addresses) and Chef attributes. Return it all as a flat dictionary.
def build_dp_variables(dp): v = {} for dps in dp.deployedpackageservice_set.all(): # 1st pass: build network variables if dps.address: for net in json.loads(dps.address): for nn in net: # net name for a in net[nn]: # address ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def env_dicts(self, package_name):\n ret = {}\n ret_multi = {}\n # First process the global variables\n for package, pairs in self._sorted_data:\n for name, value in pairs.items():\n if package is None:\n if isinstance(value, list):\n ...
[ "0.63497144", "0.6161984", "0.5963506", "0.58469063", "0.5801466", "0.5736059", "0.5721944", "0.57171506", "0.5698449", "0.5690832", "0.5675632", "0.561076", "0.55895954", "0.55868036", "0.55722237", "0.55650455", "0.5563132", "0.55273116", "0.5524288", "0.5512308", "0.550187...
0.73809713
0
Clean up path remove repeated and trailing separators.
def _cleanpath(self, path): slashes = self.remotepathsep*2 while slashes in path: path = path.replace(slashes,self.remotepathsep) if path.endswith(self.remotepathsep): path = path[:-1] return path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cleanup_path(path):\n return string.join(filter(None, string.split(path, '/')), '/')", "def _trim_path(path):\n if path.endswith(\"/\"):\n path = path[:-1] # remove / at the end\n \n return path", "def clean_path(path: str) -> str:\n previous_path = \"\"\n next_path = path\n whil...
[ "0.7981345", "0.7315837", "0.730054", "0.7190368", "0.71864", "0.71373034", "0.70536107", "0.7036191", "0.703579", "0.6994601", "0.6941104", "0.6900043", "0.68013865", "0.67445815", "0.67303747", "0.6725442", "0.66509145", "0.661992", "0.6524637", "0.65012586", "0.64987904", ...
0.76014835
1
The name of the account.
def account_name(self) -> pulumi.Input[str]: return pulumi.get(self, "account_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_name(self) -> str:\n return pulumi.get(self, \"account_name\")", "def account_name(self) -> str:\n return pulumi.get(self, \"account_name\")", "def account_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"account_name\")", "def account_name(self) -> Opti...
[ "0.93672127", "0.93672127", "0.8380181", "0.8380181", "0.8209886", "0.7942903", "0.7942903", "0.77882177", "0.7780345", "0.77758217", "0.77013725", "0.76193964", "0.74234724", "0.74198335", "0.7294379", "0.71565515", "0.715423", "0.7146116", "0.7146116", "0.7138259", "0.71382...
0.8561575
4
The resource group name.
def resource_group_name(self) -> pulumi.Input[str]: return pulumi.get(self, "resource_group_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_group_name(self) -> str:\n return pulumi.get(self, \"resource_group_name\")", "def resource_group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"resource_group_name\")", "def resource_group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"resource_g...
[ "0.9029376", "0.8728543", "0.8728543", "0.8728543", "0.8728543", "0.8728543", "0.8728543", "0.8728543", "0.8728543", "0.8728543", "0.8728543", "0.8728543", "0.8728543", "0.8571382", "0.8531195", "0.84228975", "0.8322666", "0.82459366", "0.82459366", "0.82459366", "0.82459366"...
0.83838797
47
The event hub type.
def event_hub_type(self) -> Optional[pulumi.Input[Union[str, 'EventHubType']]]: return pulumi.get(self, "event_hub_type")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_hub_type(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"event_hub_type\")", "def get_type(self):\n return self.event_type", "def type(self) -> str:\n return self._event.get('type')", "def event_type(self) -> int:\n return self.data[\"args\"][\"eventTy...
[ "0.8826724", "0.78366536", "0.77429354", "0.7308451", "0.70576334", "0.70576334", "0.69872296", "0.6939999", "0.69243646", "0.6844996", "0.6731586", "0.6699463", "0.66621345", "0.6596711", "0.6580311", "0.65459967", "0.6535486", "0.65285516", "0.65057313", "0.650167", "0.6491...
0.8569165
1
The kafka configuration name.
def kafka_configuration_name(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "kafka_configuration_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._config_name", "def get_config_name(self): # pragma: no cover\n pass", "def name(self):\n return self._config.get(CONF_NAME)", "def _getConfigName(self):\n pass", "def name(self) -> str:\n name = self._config[\"name\"]\n assert isinst...
[ "0.7919919", "0.7714666", "0.76922506", "0.73530555", "0.72745216", "0.7196145", "0.7175958", "0.7033129", "0.6942212", "0.6897144", "0.6859585", "0.68502206", "0.6828225", "0.67710125", "0.67710125", "0.6764214", "0.6727961", "0.66964835", "0.6688361", "0.6686322", "0.667769...
0.8920289
0
Get an existing KafkaConfiguration resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None) -> 'KafkaConfiguration': opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) __props__ = KafkaConfigurationArgs.__new__(KafkaConfigurationArgs) __props...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n access_configuration_id: Optional[pulumi.Input[str]] = None,\n access_configuration_name: Optional[pulumi.Input[str]] = None,\n description: Optional[pulumi...
[ "0.571254", "0.56839645", "0.5649045", "0.5545997", "0.5395561", "0.53015316", "0.5293933", "0.5233086", "0.5203887", "0.5176693", "0.51328343", "0.51226187", "0.5111622", "0.50390947", "0.50277454", "0.5009167", "0.5006863", "0.49989566", "0.498836", "0.4985318", "0.49810046...
0.6991278
0
The event hub type.
def event_hub_type(self) -> pulumi.Output[Optional[str]]: return pulumi.get(self, "event_hub_type")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_hub_type(self) -> Optional[pulumi.Input[Union[str, 'EventHubType']]]:\n return pulumi.get(self, \"event_hub_type\")", "def get_type(self):\n return self.event_type", "def type(self) -> str:\n return self._event.get('type')", "def event_type(self) -> int:\n return self.da...
[ "0.8569165", "0.78366536", "0.77429354", "0.7308451", "0.70576334", "0.70576334", "0.69872296", "0.6939999", "0.69243646", "0.6844996", "0.6731586", "0.6699463", "0.66621345", "0.6596711", "0.6580311", "0.65459967", "0.6535486", "0.65285516", "0.65057313", "0.650167", "0.6491...
0.8826724
0
Gets or sets the name.
def name(self) -> pulumi.Output[str]: return pulumi.get(self, "name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name(self) -> str:\n return self.name", "def get_name(self) -> str:\n return self.name", "def get_name(self) -> str:\n return self.name", "def get_name(self) -> str:\r\n return self.name", "def get_name(self) -> str:\n return self._name", "def get_name(self) -> ...
[ "0.84682375", "0.84682375", "0.84682375", "0.8446795", "0.84359616", "0.84359616", "0.8410739", "0.8410739", "0.8382522", "0.83573955", "0.8354863", "0.8354863", "0.8354863", "0.834061", "0.834061", "0.8333269", "0.8333269", "0.8333269", "0.8333269", "0.8333269", "0.8333269",...
0.0
-1
Gets or sets the type.
def type(self) -> pulumi.Output[str]: return pulumi.get(self, "type")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_type(self):\n return self.type", "def get_type(self):\n return self.type", "def get_type(self):\n return self._type", "def get_type(self):\n return self._type", "def type(self):\n return self._getValue('type')", "def get_type(self):\n return self._TYPE", ...
[ "0.8533302", "0.8533302", "0.844054", "0.844054", "0.8312111", "0.827963", "0.8276462", "0.82763165", "0.81963736", "0.8196329", "0.8196329", "0.8196329", "0.8196329", "0.8196329", "0.8196329", "0.8196329", "0.8196329", "0.8196329", "0.8196329", "0.8196329", "0.8196329", "0...
0.0
-1
Removes None values and calculates total.
def _prepare_for_stats(self): clean = self._discard_value(None) total = float(clean.total()) return clean, total
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_null(self):\n null = 0\n for x in range(0, self.tot_col):\n for y in range(1, self.tot_rows + 1):\n if self.file_list[y][x].lower() == 'null':\n null += 1\n print('Total number of null fields: ' + str(null))\n results.append('Total n...
[ "0.643967", "0.630446", "0.623857", "0.61401653", "0.59882325", "0.58802366", "0.5832534", "0.5767215", "0.575754", "0.5726268", "0.5712807", "0.5709221", "0.57032585", "0.5702384", "0.5674893", "0.5673708", "0.5661226", "0.5661226", "0.56470007", "0.561502", "0.56132275", ...
0.6093626
4
Maximum observed value with nonzero count.
def max(self, include_zero=False): for key, value in reversed(self.items()): if value > 0 or include_zero: return key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maximum(x):\n return np.maximum(x, 0)", "def get_max_value(self):\n max_value = max(self.values)\n return max_value", "def max_counts(self):\n\n return np.nanmax(self.pre_proc_data)", "def max(self):\n # skipna == True\n return self._summarize(lambda c: c.max)", "d...
[ "0.72339207", "0.7153924", "0.70750475", "0.7005094", "0.6883958", "0.68582416", "0.6855111", "0.68431324", "0.6789454", "0.677143", "0.6757401", "0.6757401", "0.6755451", "0.6726537", "0.6688307", "0.668016", "0.66791415", "0.6676345", "0.66664433", "0.66657513", "0.66624486...
0.6301381
54
Return a function that returns the quantile values for this histogram.
def _quantile_function(self, alpha=0.5, smallest_count=None): clean, total = self._prepare_for_stats() if not total: return lambda q: None smallest_observed_count = min(clean.values()) if smallest_count is None: smallest_count = smallest_observed_count el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quantile_func(q):\n def f(x):\n return np.quantile(x, q)\n\n return f", "def quantiles(self):\n return self._quantiles", "def quantile(self, hypercube):\n raise NotImplementedError()", "def quantiles(self, q: int):\n return self.dist.quantiles(q)", "def get_percentile(...
[ "0.80293787", "0.7256257", "0.7218652", "0.68410724", "0.68255293", "0.68255293", "0.68155265", "0.6805426", "0.67468756", "0.6687718", "0.65817505", "0.6576673", "0.6563499", "0.641699", "0.6394667", "0.63919884", "0.63881975", "0.63867414", "0.63764435", "0.63764435", "0.63...
0.7093726
3
Get the Predicted Sentiment Score and use it to predict the movie rating from a review statement. >>> predict_movie_rating(2.8) 3 >>> predict_movie_rating(1.2) 1
def predict_movie_rating(pss_score: float)->int: return int(round(pss_score))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predictRating(self, movieID):\n\t\t\n\t\treturn movieID", "def __predict_ratings(self, user_and_movie_RDD):\n predicted_RDD = self.model.predictAll(user_and_movie_RDD)\n predicted_rating_RDD = predicted_RDD.map(lambda x: (x.product, x.rating))\n predicted_rating_title_and_count_RDD = \\\...
[ "0.72985923", "0.6987882", "0.6894928", "0.6873646", "0.6873504", "0.67712915", "0.67529976", "0.67254555", "0.6649325", "0.66354156", "0.6469183", "0.64388216", "0.64029366", "0.639634", "0.63705754", "0.63488793", "0.63068867", "0.6302692", "0.62275255", "0.6227454", "0.622...
0.6336712
16
Return a boolean indicating whether given items are in sorted order.
def is_sorted(items): # TODO: Check that all adjacent items are in order, return early if so for x in range(len(items)): if x < len(items)-1: if items[x+1] < items[x]: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_sorted(items):\n # TODO: Running time: ??? Why and under what conditions?\n # TODO: Memory usage: ??? Why and under what conditions?\"\"\"\n # Check that all adjacent items are in order, return early if not\n # for i in range(len(items) - 1):\n # if items[i] > items[i + 1]:\n # ...
[ "0.8218438", "0.82054013", "0.7429284", "0.73970175", "0.7260254", "0.71971154", "0.7079509", "0.70403665", "0.69723743", "0.6970533", "0.69469947", "0.69445795", "0.69440234", "0.68967813", "0.68493915", "0.6838795", "0.6747174", "0.6713568", "0.6712401", "0.6677618", "0.659...
0.8400566
0
Return the name of color nearest (red, green, blue)
def nearest(self, red, green, blue): # BAW: should we use Voronoi diagrams, Delaunay triangulation, or # octree for speeding up the locating of nearest point? Exhaustive # search is inefficient, but seems fast enough. nearest = -1 nearest_name = '' for name, aliases in s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_nearest_color(color):\n\n result = color_re.match(color)\n if result is not None and len(result.groups()) == 5:\n color_red = int(result.groups()[1])\n color_green = int(result.groups()[2])\n color_blue = int(result.groups()[3])\n color_actual = np.array([color_red, color_...
[ "0.72678334", "0.7190744", "0.68474764", "0.68275344", "0.66425115", "0.6497939", "0.62284756", "0.62250465", "0.6168186", "0.6138532", "0.609768", "0.60545886", "0.6016377", "0.6004818", "0.5997986", "0.5997986", "0.5997986", "0.5997986", "0.59737235", "0.5970706", "0.595265...
0.76609373
0
Pi = inital P guess, default is 1 R = Rk, estimate o fthe covariance of the observation noise Q = Qk, process variance
def kalmanFilter(data, R=.001, Pi=1, Q=1e-5): # allocate space for arrays n = len(data) # length of data, size of array xhat=numpy.zeros(n) # a posteri estimate of x P=numpy.zeros(n) # a posteri error estimate xhatminus=numpy.zeros(n) # a priori estimate of x Pminus=numpy.zeros(n) # a priori error estimate ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Pvar(magnitude, error):\n\n #magnitude = data[0]\n #error = data[1]\n\n# print(magnitude)\n \n# print(error)\n \n mean_mag = np.mean(magnitude)\n nepochs = float(len(magnitude))\n\n chi = np.sum((magnitude - mean_mag)**2. / error**2.)\n p_chi = chi2.cdf(chi, (nepochs-1))\n\n ...
[ "0.6300771", "0.6188772", "0.6102053", "0.6030487", "0.59192693", "0.58256674", "0.5789539", "0.57696795", "0.57350904", "0.57142544", "0.5701306", "0.5685996", "0.56137735", "0.56062406", "0.5596753", "0.5588853", "0.55483705", "0.5547888", "0.5537384", "0.5536567", "0.55336...
0.0
-1
forward calculation y = f(XW^T) ( is dot calculation)
def forward(W,X): return activation_func(np.dot(add_bias(X),W))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f(t,y):\n return (lam*y)", "def forward(self, x):\n #print(\"full frwd x shape:\",x.shape)\n y=np.zeros((x.shape[0],self.W.shape[0]))\n y=np.dot(x,np.transpose(self.W))+self.b\n self.x=np.copy(x)\n return y", "def forward(self):\n self.iteration_number += 1\n ...
[ "0.6725919", "0.66577226", "0.6639155", "0.65898526", "0.65378845", "0.649657", "0.64800054", "0.64467686", "0.64314675", "0.6386233", "0.6332034", "0.6331523", "0.6320647", "0.631009", "0.6289636", "0.6281411", "0.6267605", "0.62455386", "0.6214789", "0.62100095", "0.6202062...
0.62065077
20
Get single comment object.
def get(self, request, id=None, format=None): comment_object = self.get_object(id) response = self.serializer_class(comment_object) return Response(response.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_comment(self, object_id):\n return self.get_object(\"comment\", object_id)", "def get_object(self, id):\n try:\n return Comment.objects.get(id=id)\n except Comment.DoesNotExist:\n raise Http404", "def get_comment(self, comment_id):\n # Implemented from ...
[ "0.77895993", "0.76242495", "0.7579107", "0.7341131", "0.7299526", "0.7256564", "0.71464556", "0.7142716", "0.7120583", "0.70872205", "0.7013045", "0.6915504", "0.6903105", "0.6840177", "0.6778121", "0.66668844", "0.6615914", "0.6615914", "0.6598788", "0.659172", "0.65709716"...
0.6247972
31
Get list of post on user wall.
def get(self, request, id, limit=20): post = ((Post.objects.filter( user=User.objects.get(id=id), target_type=ContentType.objects.get(model='user') ) | Post.objects.filter( target_id=id, target_type=ContentType.objects.get(model='user') ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def posts_for_feed():\n user_id = session.get('user_id')\n friend_posts = Post.query.join(Friend, db.and_(Post.user_id == Friend.user_2,\n Friend.active == True)).outerjoin(Comment, db.and_(Comment.post_id == Post.post_id,\n Comment.active == True...
[ "0.6937483", "0.6712776", "0.65800095", "0.65489364", "0.652871", "0.65155303", "0.65067804", "0.650433", "0.6501426", "0.6470095", "0.6432693", "0.63773805", "0.6315783", "0.6301193", "0.6254875", "0.6248521", "0.62245506", "0.6192592", "0.6190737", "0.6178532", "0.6171247",...
0.0
-1
Define the receiver queryset.
def define_receiver(post_id): rec = set() for i in Comment.objects.filter(post=post_id): rec.add(i.user.id) rec.add(Post.objects.get(id=post_id).user.id) if Post.objects.get( id=post_id ).target_type == ContentType.objects.get(model='user'): rec.add(Post.objects.g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n if self.queryset is not None:\n queryset = self.queryset\n if hasattr(queryset, '_clone'):\n queryset = queryset._clone()\n elif self.model is not None:\n queryset = self.model._default_manager.all()\n else:\n ...
[ "0.702221", "0.7011914", "0.69471616", "0.6886518", "0.6886518", "0.6876594", "0.68659717", "0.6835139", "0.6781283", "0.67741716", "0.6745474", "0.6722135", "0.67013574", "0.6527999", "0.6514393", "0.6450692", "0.6437798", "0.63605016", "0.63409716", "0.6329197", "0.6314765"...
0.0
-1
Returns True if 'list1' and 'list2' have at least 1 element in common, False otherwise
def __listsCommon(list1, list2) : for i in range(len(list1)) : for j in range(len(list2)) : if (list1[i]==list2[j]) : return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nonempty_intersection(list1, list2):\n return len(list(set(list1) & set(list2))) > 0", "def common_member(lst1, lst2):\n for i in lst1:\n for j in lst2:\n if i == j:\n return True\n return False", "def all_in_list (list1, list2):\n return all(map(lambda c: c in li...
[ "0.7992433", "0.7926499", "0.7657093", "0.7554909", "0.7383712", "0.7340888", "0.7207706", "0.71978486", "0.7155412", "0.7120226", "0.7117233", "0.71061814", "0.7007421", "0.6948971", "0.6937587", "0.69196266", "0.69033265", "0.6890824", "0.6881718", "0.6868015", "0.6854923",...
0.85858804
0
Returns True if 'theList' contains lists that have at least 1 element in common
def __unlinkedJoints(theList) : for i in range(len(theList)) : for j in range(i+1, len(theList)) : if (__listsCommon(theList[i], theList[j])) : return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_if_duplicates_list(list_of_elems):\n set_of_elems = set()\n for elem in list_of_elems:\n if elem in set_of_elems:\n return True\n else:\n set_of_elems.add(elem)\n return False", "def is_superlist(self, list_of_setlists, compared_setlist):\n matches = ...
[ "0.68542576", "0.67728347", "0.6663181", "0.65460765", "0.6490951", "0.6427063", "0.6423759", "0.64092374", "0.6401112", "0.6388167", "0.63820976", "0.63018334", "0.62606055", "0.6225878", "0.6222811", "0.6217621", "0.6199564", "0.61939126", "0.61794883", "0.6162255", "0.6141...
0.64312077
5
Converts a list of strings to a string by concatenating all elements of the list
def collapse(L): output = "" for s in L: output = output + s return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stringer(list):\n\tstring = \"\"\n\tfor x in list:\n\t\tstring = string + str(x)\n\treturn string", "def list2string(a_list):\n\n the_string = ''\n for elem in a_list:\n the_string += str(elem)\n return the_string", "def list_to_str(list_to_convert):\n return ' '.join(to_str(item) for it...
[ "0.845377", "0.7836319", "0.7773371", "0.7705512", "0.7661951", "0.7658474", "0.7595569", "0.7587454", "0.7479857", "0.7459654", "0.74586385", "0.7406689", "0.7406689", "0.7394045", "0.7386286", "0.7349678", "0.7333463", "0.733121", "0.7291625", "0.7260772", "0.71728444", "...
0.652098
55
Tests homepage properly renders
def test_homepage_render(self): result = self.client.get("/") self.assertIn("<h1 class=\"title\">Bark Park!</h1>", result.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_homepage_view(self):\n response = self.client.get(url_for('home'))\n self.assertEqual(response.status_code, 200)", "def test_homepage_view(self):\n response = self.client.get(url_for('home'))\n self.assertEqual(response.status_code, 200)", "def test_home(self):\n\t\trespons...
[ "0.8286543", "0.8286543", "0.80288696", "0.80261856", "0.8022295", "0.79548097", "0.79130465", "0.7811535", "0.77317524", "0.7719305", "0.771608", "0.77036077", "0.76768106", "0.7669529", "0.76621985", "0.76119643", "0.7584721", "0.75810295", "0.75592273", "0.7525854", "0.752...
0.8676804
0
Test adding new photo
def test_add_new_photo(self): result = self.client.post("/add_new_photo/2", data={"park_id": "2", "user_id": 25, "description": "Taurus having a great time!", "photo": "http://s3-media3.fl.yelpcdn.com/bphoto/ZUhteyc0UWdWbgM-4VbZhw/o.jpg"}, fol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_images_add(self):\n response = self.client.get('/images/photos/add')\n self.assertEqual(response.status_code, 200)", "def test_create(self):\n data = {\n 'image': images.load_image()\n }\n photo = Photo.objects.create(**data)\n self.assertTrue(photo.p...
[ "0.8101235", "0.8026537", "0.7981487", "0.7825003", "0.7615926", "0.75143087", "0.74651533", "0.7336449", "0.7290538", "0.7287154", "0.72751683", "0.7270891", "0.7228573", "0.7217122", "0.7203814", "0.717076", "0.7156646", "0.7147599", "0.7129838", "0.7117978", "0.70968175", ...
0.8562085
0
METADATA.json fonts propery only should have uniq values
def test_metadata_fonts_no_dupes(self): fonts = {} for x in self.metadata.get('fonts', None): self.assertFalse(x.get('fullName', '') in fonts) fonts[x.get('fullName', '')] = x self.assertEqual(len(set(fonts.keys())), len(self.metadata.get('fonts'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_metadata_fonts_items_dicts(self):\n for x in self.metadata.get('fonts', None):\n self.assertEqual(type(x), type({}), msg=\"type(%s) is not dict\" % x)", "def test_metadata_fonts_key_list(self):\n self.assertEqual(type(self.metadata.get('fonts', '')), type([]))", "def test_meta...
[ "0.7148735", "0.7148274", "0.68586934", "0.68324167", "0.6508626", "0.6315923", "0.6147427", "0.61141056", "0.59751123", "0.5967416", "0.587476", "0.58441174", "0.5834785", "0.5795578", "0.5712134", "0.5657229", "0.5657099", "0.56292534", "0.5613162", "0.56095904", "0.5574174...
0.7460132
0
METADATA.json font key should be list
def test_metadata_fonts_key_list(self): self.assertEqual(type(self.metadata.get('fonts', '')), type([]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_metadata_fonts_items_dicts(self):\n for x in self.metadata.get('fonts', None):\n self.assertEqual(type(x), type({}), msg=\"type(%s) is not dict\" % x)", "def test_metadata_fonts_fields_have_fontname(self):\n for x in self.metadata.fonts:\n font = Font.get_ttfont_from_...
[ "0.7041857", "0.63672256", "0.6113491", "0.5998007", "0.59016675", "0.59016675", "0.59016675", "0.5668828", "0.5668607", "0.56112456", "0.5580641", "0.55714065", "0.5561082", "0.55486125", "0.550653", "0.5462129", "0.5424566", "0.54121506", "0.54065496", "0.53918576", "0.5384...
0.7776431
0
METADATA.json subsets should have at least 'menu' and 'latin'
def test_metadata_atleast_latin_menu_subsets_exist(self): self.assertIn('menu', self.metadata.get('subsets', []), msg="Subsets missing menu") self.assertIn('latin', self.metadata.get('subsets', []), msg="Subsets missing latin")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_metadata_subsets_key_list(self):\n self.assertEqual(type(self.metadata.get('subsets', '')), type([]))", "def test_metadata_fonts_items_dicts(self):\n for x in self.metadata.get('fonts', None):\n self.assertEqual(type(x), type({}), msg=\"type(%s) is not dict\" % x)", "def test_...
[ "0.6309181", "0.58442897", "0.57330245", "0.5654883", "0.56103677", "0.5445936", "0.5444328", "0.5162038", "0.51150095", "0.50701636", "0.5030377", "0.5029047", "0.49769622", "0.49525937", "0.4951524", "0.4943614", "0.4925639", "0.49054593", "0.4902613", "0.48843136", "0.4879...
0.7498523
0
Check metadata.json font.style `italic` matches font internal
def test_check_italic_style_matches_names(self): contents = self.read_metadata_contents() family = Metadata.get_family_metadata(contents) for font_metadata in family.fonts: if font_metadata.style != 'italic': continue font = Font.get_ttfont_from_metadata...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_canonical_styles(self):\n contents = self.read_metadata_contents()\n fm = Metadata.get_family_metadata(contents)\n for font_metadata in fm.fonts:\n self.assertIn(font_metadata.style, self.CANONICAL_STYLE_VALUES)\n if self.is_italic(font_metadata):\n ...
[ "0.7558341", "0.73380977", "0.6939594", "0.67242837", "0.67035174", "0.6615761", "0.64679974", "0.63273317", "0.6287998", "0.61372036", "0.6129144", "0.6017762", "0.5974976", "0.5882355", "0.58799505", "0.5876883", "0.58353376", "0.57994324", "0.57427514", "0.564695", "0.5559...
0.8031599
0
Check metadata.json font.style `italic` matches font internal
def test_check_normal_style_matches_names(self): contents = self.read_metadata_contents() family = Metadata.get_family_metadata(contents) for font_metadata in family.fonts: if font_metadata.style != 'normal': continue font = Font.get_ttfont_from_metadata...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_italic_style_matches_names(self):\n contents = self.read_metadata_contents()\n family = Metadata.get_family_metadata(contents)\n\n for font_metadata in family.fonts:\n if font_metadata.style != 'italic':\n continue\n\n font = Font.get_ttfont_...
[ "0.8031599", "0.7558341", "0.6939594", "0.67242837", "0.67035174", "0.6615761", "0.64679974", "0.63273317", "0.6287998", "0.61372036", "0.6129144", "0.6017762", "0.5974976", "0.5882355", "0.58799505", "0.5876883", "0.58353376", "0.57994324", "0.57427514", "0.564695", "0.55593...
0.73380977
2
Test If font styles are canonical
def test_check_canonical_styles(self): contents = self.read_metadata_contents() fm = Metadata.get_family_metadata(contents) for font_metadata in fm.fonts: self.assertIn(font_metadata.style, self.CANONICAL_STYLE_VALUES) if self.is_italic(font_metadata): if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_normal_style_matches_names(self):\n contents = self.read_metadata_contents()\n family = Metadata.get_family_metadata(contents)\n\n for font_metadata in family.fonts:\n if font_metadata.style != 'normal':\n continue\n\n font = Font.get_ttfont_...
[ "0.7248282", "0.6935411", "0.6680462", "0.6253085", "0.62378496", "0.62230104", "0.606966", "0.6040576", "0.60307646", "0.59415674", "0.59023315", "0.5703632", "0.5693834", "0.56794", "0.5653981", "0.55639493", "0.5533116", "0.5526273", "0.5525132", "0.5478395", "0.54339075",...
0.7875416
0
Test If filename is canonical
def test_check_canonical_filenames(self): contents = self.read_metadata_contents() family_metadata = Metadata.get_family_metadata(contents) for font_metadata in family_metadata.fonts: canonical_filename = self.create_canonical_filename(font_metadata) if canonical_filename...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def canonic(filename):\r\n if filename is None:\r\n return ''\r\n\r\n if filename == (\"<\" + filename[1:-1] + \">\"):\r\n return filename\r\n canonic_ = os.path.realpath(filename)\r\n canonic_ = os.path.normcase(canonic_)\r\n return canonic_", "def canonical_filename(filename):\n i...
[ "0.66859955", "0.6648033", "0.64460415", "0.64346355", "0.6421668", "0.6241108", "0.60469574", "0.6042017", "0.6038499", "0.6029806", "0.60270005", "0.6008632", "0.6005622", "0.59906447", "0.5974498", "0.5968066", "0.59679115", "0.5967139", "0.59447575", "0.5929974", "0.59103...
0.70434004
0
Compute mask loss. Each proposal (out of `max_num_proposals`) predictes `num_classes` masks of shape [mask_height, mask_width]. However, only the one corresponding to the groundtruth class label `k` will be "selected" and contribute to the loss.
def _compute_mask_loss(model, mask_predictions, batch_cls_targets, batch_msk_targets, batch_msk_weights, padding_indicator, proposal_boxlist_list): (batch_num_proposals, num_classe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postprocess_masks(mask_predictions, frcnn_detection_dict):\n # [batch_size, max_num_proposals] e.g. 1, 300\n detection_classes = frcnn_detection_dict['classes']\n # e.g 300, 90, 33, 33 \n _, num_classes, mask_height, mask_width = mask_predictions.shape.as_list()\n batch_size, max_detection = detection_cla...
[ "0.67618287", "0.6542938", "0.6495758", "0.63780904", "0.63696027", "0.6329117", "0.6237516", "0.61294407", "0.5989295", "0.59697896", "0.59415644", "0.5940343", "0.59046674", "0.5888546", "0.58790874", "0.5876182", "0.5835143", "0.583081", "0.58214194", "0.58172345", "0.5802...
0.7792567
0
Test that good requests give a 200 response code.
def test_good_requests_give_200(self): # 200 codes cause the result to be parsed instead of returning the code self.assertNot( isinstance( self._request( self._make_dummy_notification([DEVICE_ACCEPTED, DEVICE_REJECTED]) ), i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_response_200_on_get(self):\n pass", "def test_status_code(self):\n self.assertEquals(self.response.status_code, 200)", "def test_site_get_status_200_code(api_client):\n r = api_client.get(path=\"/\")\n assert r.status_code == 200", "def test_1():\n\tassert api_call().status_code ...
[ "0.8366052", "0.8109574", "0.80699474", "0.8015894", "0.8006835", "0.7980883", "0.7931863", "0.7882258", "0.7840906", "0.78161216", "0.7730852", "0.77084374", "0.77072483", "0.77072483", "0.77072483", "0.77072483", "0.77072483", "0.77072483", "0.77072483", "0.77072483", "0.77...
0.81243604
1
A strategy that maximizes the expected difference between my final score and my opponent's.
def max_diffs(state): return best_action(state, pig_actions, Q_pig, win_diff)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def final_strategy(score, opponent_score):\r\n free, k = opponent_score // 10 + 1, 1\r\n winning = score > opponent_score\r\n ratio = (goal - score) / (goal - opponent_score)\r\n mean = make_mean_strategy(3)(score, opponent_score)\r\n if goal - score <= free: return 0\r\n while k < 4:\r\n ...
[ "0.73199487", "0.7241234", "0.7205493", "0.70890564", "0.69605625", "0.6887661", "0.68855035", "0.6813677", "0.6810658", "0.6727644", "0.6717349", "0.6703362", "0.66935116", "0.6692651", "0.6670782", "0.66647583", "0.6661858", "0.66548085", "0.6629679", "0.6616435", "0.656910...
0.64628565
31
Plot scatter points with colorbar
def mw_scatter(self, x, y, c, **kwargs): x, y = self.xy_unit_check(x, y) self.initialize_mwplot() # decide whether we need colorbar or not if isinstance(c, list): color = c[0] cbar_label = c[1] self.cbar_flag = True if type(color) == u.qua...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scatterPlot2():\n N = 100\n x = np.random.rand(N)\n y = np.random.rand(N)\n colors = np.random.rand(N)\n\n plt.scatter(x, y, c=colors, alpha=0.5)\n plt.show()", "def plot_scatter(dataframe, colx, coly, xlabel='', \n ylabel='', \n xlim=[0,15], ylim=[0,15], den...
[ "0.6957231", "0.68189776", "0.6781912", "0.6725077", "0.667742", "0.64773524", "0.64616114", "0.64443624", "0.64385337", "0.63356435", "0.6334097", "0.6324725", "0.62319404", "0.6228918", "0.62105215", "0.61905533", "0.6189272", "0.6186147", "0.61778843", "0.6163995", "0.6151...
0.6978989
0
Plot scatter points with colorbar
def mw_scatter(self, ra, dec, c, **kwargs): ra, dec = self.radec_unit_check(ra, dec) self.initialize_mwplot() # decide whether we need colorbar or not if isinstance(c, list): color = c[0] cbar_label = c[1] self.cbar_flag = True if type(col...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mw_scatter(self, x, y, c, **kwargs):\n x, y = self.xy_unit_check(x, y)\n self.initialize_mwplot()\n\n # decide whether we need colorbar or not\n if isinstance(c, list):\n color = c[0]\n cbar_label = c[1]\n self.cbar_flag = True\n if type(c...
[ "0.6979321", "0.695779", "0.6818265", "0.67816675", "0.6724479", "0.66787285", "0.6477698", "0.64616954", "0.64452255", "0.64392376", "0.6335047", "0.63250786", "0.6232152", "0.62288815", "0.6211692", "0.6191022", "0.6189807", "0.61871344", "0.6178614", "0.6164259", "0.615260...
0.6336193
10
Test omitting default values on a perattribute basis.
def test_nodefs_generated_unstructuring(cl_and_vals): converter = Converter() cl, vals = cl_and_vals attr_is_default = False for attr, val in zip(cl.__attrs_attrs__, vals): if attr.default is not NOTHING: fn = make_dict_unstructure_fn( cl, converter, **{attr.name: ov...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_attributes_with_default_values(self, cls: Type) -> None:\n def matches(value_node: yaml.Node, default: Any) -> bool:\n if value_node.tag == 'tag:yaml.org,2002:null':\n return default is None\n\n if value_node.tag == 'tag:yaml.org,2002:int':\n re...
[ "0.64822626", "0.63734543", "0.62709045", "0.61568123", "0.61450404", "0.6132429", "0.6123386", "0.6118186", "0.61147857", "0.61058146", "0.6087637", "0.6021508", "0.597629", "0.5975809", "0.59272707", "0.59240204", "0.58996683", "0.5897114", "0.5894513", "0.5894513", "0.5856...
0.58933437
20
initialize the density matrix from a mixture of states
def __init__(self, probabilities, states): dim = np.shape(states[0])[0] #length of the state vector matrix_representation = np.zeros((dim, dim)) #build empty matrix for (prob, state) in zip(probabilities, states): matrix_representation += prob * state @ np.conjugate(state).T ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_density_matrix(states=None, dimensions=None):\n if states is None:\n tdim = np.prod(dimensions)\n dmtotal0 = np.eye(tdim) / tdim\n\n return dmtotal0\n\n dmtotal0 = np.eye(1, dtype=np.complex128)\n\n for i, s in enumerate(states):\n\n if not hasattr(s, \"__len__\"):\n ...
[ "0.7075864", "0.6731913", "0.65987694", "0.64078385", "0.62692213", "0.62429947", "0.62405705", "0.62290657", "0.6053602", "0.6002356", "0.59961176", "0.59932816", "0.59572536", "0.59527314", "0.59521174", "0.5900468", "0.58799344", "0.586277", "0.58547384", "0.581713", "0.58...
0.6157623
8
Returns the record ID of this record.
def get_record_id(self): subdomain, record_id = self.key().name().split(':', 1) return record_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_recordId(self):\n return self.metadata['recordId']", "def get_recordId(self):\n return self.metadata['recordId']", "def id(self):\n\t\tif self._record is not None:\n\t\t return self._record.id\n\t\telse:\n\t\t return \"NO_ID_ASSIGNED\"", "def id(self, record):\r\n return re...
[ "0.90767133", "0.90767133", "0.8112223", "0.80626", "0.7980828", "0.778776", "0.778776", "0.778776", "0.778776", "0.778776", "0.778776", "0.7763725", "0.77412313", "0.7713623", "0.7700579", "0.7700579", "0.7693393", "0.7693393", "0.7684333", "0.7667591", "0.7667591", "0.766...
0.80693847
3
Returns True if this record was created in this repository.
def is_original(self): return is_original(self.subdomain, self.record_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def created(self) -> bool:\n return self._created", "def is_created(self):\n return self._tag == 'created'", "def is_created(self) -> bool:\n return self.state == Order.OrderState.CREATED.choice_value", "def created(self):\n return self._created", "def created(self):\n re...
[ "0.7842449", "0.7440019", "0.72720444", "0.7012648", "0.7012648", "0.7012648", "0.7012648", "0.7012648", "0.696357", "0.68221915", "0.6810907", "0.6745725", "0.66951156", "0.6673736", "0.6614014", "0.657334", "0.6494026", "0.64759755", "0.64759755", "0.6410897", "0.64019424",...
0.0
-1
Returns True if this record was copied from another repository.
def is_clone(self): return not self.is_original()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_clone(subdomain, record_id):\n return not is_original(subdomain, record_id)", "def __eq__(self, other):\n if not isinstance(other, BlogAuthorCloneRequestVNext):\n return False\n\n return self.to_dict() == other.to_dict()", "def is_original(self):\n return is_original(s...
[ "0.6556766", "0.6091322", "0.6068405", "0.6007544", "0.5956192", "0.59438497", "0.58938015", "0.58595747", "0.5846363", "0.5781687", "0.5763227", "0.5747814", "0.57412183", "0.5724109", "0.5717058", "0.56910574", "0.5673016", "0.5662498", "0.56571317", "0.5656993", "0.5655955...
0.6484457
1