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
Return a ConfusionMatrix with the tags from ``gold`` as the reference values, with the predictions from ``tag_sents`` as the predicted values. >>> from nltk.tag import PerceptronTagger >>> from nltk.corpus import treebank >>> tagger = PerceptronTagger()
def confusion(self, gold): return self._confusion_cached(tuple(tuple(sent) for sent in gold))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _confusion_cached(self, gold):\n\n tagged_sents = self.tag_sents(untag(sent) for sent in gold)\n gold_tokens = [token for _word, token in chain.from_iterable(gold)]\n test_tokens = [token for _word, token in chain.from_iterable(tagged_sents)]\n return ConfusionMatrix(gold_tokens, te...
[ "0.6705044", "0.6106656", "0.5749428", "0.56271595", "0.55416024", "0.5485092", "0.53537416", "0.5342051", "0.5337895", "0.5322043", "0.51936746", "0.5165712", "0.51370734", "0.5132021", "0.5130306", "0.5099205", "0.50683236", "0.5064493", "0.5054829", "0.5042956", "0.5036374...
0.59878755
2
Adds an edge to the graph.
def add_edge(self, id1: int, id2: int, weight: float) -> bool: # check if key exists in dictionary by checking if get() returned default value if self.Edges[id1].get(id2, -1) == -1: self.Edges[id1][id2]=weight self.Edges_In[id2][id1]=weight self.edgeSize += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(self, edge):\n if(self.has_edge(edge) == 0):\n self.__graph_dict[edge[0]].append(edge[1])", "def addEdge(self, edge: Edge):\n self.edges.append(edge)", "def add_edge(self, edge):\n assert edge not in self.edges\n self.edges.append(edge)", "def add_edge(self...
[ "0.841144", "0.83919084", "0.8347221", "0.8330175", "0.82800245", "0.8196861", "0.81965816", "0.81554943", "0.806904", "0.7990693", "0.79418606", "0.79395586", "0.79385245", "0.7935002", "0.7914147", "0.7814346", "0.77845144", "0.7768525", "0.7742754", "0.7682856", "0.7616938...
0.0
-1
Reads a YAML file. Examples
def read_yaml(location, if_error=None): try: if re.search("^https?://", location): with urllib.request.urlopen(location) as f: return yaml.load(f, Loader=yaml.SafeLoader) else: with open(location) as f: return yaml.load(f, Loader=yaml.SafeLoade...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_yaml(file):\n with open(file, mode='r') as stream:\n out = yaml.load(stream)\n\n return out", "def read_yaml(yaml_path):\n with open(yaml_path) as f:\n yaml_data = yaml.load(f, Loader=yaml.FullLoader)\n\n return yaml_data", "def read_yaml_file(yaml_file):\n with open(yaml_...
[ "0.7368391", "0.7336687", "0.72869647", "0.7233259", "0.721641", "0.71738344", "0.7150293", "0.7141619", "0.7124852", "0.7083603", "0.7008239", "0.7002558", "0.6988494", "0.69804615", "0.69646275", "0.69440055", "0.69250774", "0.692094", "0.68819803", "0.68428636", "0.6839737...
0.61964697
100
Examples >>> process_requirements(None) [] >>> process_requirements(["foo"]) ['foo']
def process_requirements(requirements, version=None): if requirements is None: return [] if isinstance(requirements, list): return requirements if isinstance(requirements, dict): # The version "dev" should always compare as greater than any exisiting versions. dev_numeric =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_requirements(requirements):\n for req in pyrequirements.parse(requirements):\n yield req", "def parse_requirements(reqs):\n for req in reqs:\n req = req.strip()\n if \"\\n\" in req:\n for inner_req in parse_requirements(req.split(\"\\n\")):\n yield i...
[ "0.6594176", "0.6511795", "0.6047884", "0.5982591", "0.5940681", "0.5888991", "0.5874352", "0.5842278", "0.5830393", "0.5804191", "0.579634", "0.5791352", "0.578967", "0.5757648", "0.5751132", "0.57439536", "0.5738021", "0.57328737", "0.5731723", "0.5726487", "0.5722624", "...
0.7094473
0
Close this client resource.
def close(self): raise NotImplementedError( u"%s: Method not implemented", self.__class__.__name__)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n if self.client:\n self.client.connection.close()\n self.client = None", "async def close(self) -> None:\n\n if self._client:\n await self._client.__aexit__()", "def close(self):\n self._client.close()\n self._transport.close()", ...
[ "0.7978371", "0.79245055", "0.78381556", "0.78232247", "0.7772043", "0.7708881", "0.7535372", "0.743786", "0.7378729", "0.7300469", "0.7250622", "0.7215064", "0.717303", "0.71642464", "0.7138131", "0.707966", "0.707966", "0.7060232", "0.7042651", "0.7042651", "0.70019954", ...
0.0
-1
Configures client to use api_key authentication. The api_key is added to every query parameter sent.
def set_api_key(self, host, api_key, param_name=u'api_key'): raise NotImplementedError( u"%s: Method not implemented", self.__class__.__name__)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_api_key(self, api_key):\n self.api_key = api_key\n self.session.auth = (\"api\", api_key)", "def SetAPIKey(self, api_key):\n self._api_key = api_key", "def SetAPIKey(self, api_key):\n self._api_key = api_key", "def configure(api_key=None):\n configuration = {'api_key': api_key}...
[ "0.7638409", "0.7305971", "0.7305971", "0.7115174", "0.7086437", "0.7035266", "0.70325583", "0.7020185", "0.7014573", "0.67969006", "0.6651723", "0.66265374", "0.6572356", "0.6543761", "0.6512369", "0.6511101", "0.6499828", "0.6495279", "0.64864576", "0.6483278", "0.64710915"...
0.6788396
10
Calls the API with request_params and waits till timeout.
def wait(self, timeout): raise NotImplementedError( u"%s: Method not implemented", self.__class__.__name__)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait(self, timeout):\n log.info(u\"%s %s(%r)\", self.request_params['method'],\n self.request_params['url'],\n self.request_params['params'])\n req = requests.Request(**self.request_params)\n self.apply_authentication(req)\n return self.session.send(s...
[ "0.66316235", "0.66229224", "0.64865553", "0.6471346", "0.6471346", "0.6471346", "0.6471346", "0.6471346", "0.6471346", "0.6471346", "0.6471346", "0.6471346", "0.6471346", "0.6471346", "0.6471346", "0.6471346", "0.6471346", "0.6471346", "0.6471346", "0.6471346", "0.6471346", ...
0.0
-1
This method computes the log of the density of probability of a normal law centered. Each line corresponds to a point from points.
def _log_normal_matrix(points, means, cov): n_points, dim = points.shape n_components, _ = means.shape precisions_chol = _compute_precisions_chol(cov) log_det_chol = np.log(np.linalg.det(precisions_chol)) log_prob = np.empty((n_points, n_components)) for k, (mu, prec_chol) in enumerate(zip(means...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_likelihood(self, points):\n\t\tpoint_set = list(points)\n\t\tlog_probabilities = [np.log(self.density(point)) for point in point_set]\n\t\treturn sum(log_probabilities)", "def logpdf(self, X) -> np.ndarray:\n if not isinstance(X, np.ndarray):\n X = np.array(X)\n H = 0.5 * ((X - s...
[ "0.74238485", "0.6979943", "0.6968016", "0.69620633", "0.6939952", "0.6937652", "0.6908795", "0.6783364", "0.6781709", "0.6737649", "0.67370564", "0.67283744", "0.6724403", "0.6700878", "0.6690077", "0.66355795", "0.65738076", "0.6539119", "0.65346044", "0.6517782", "0.651775...
0.65745527
16
Retrieves player's current score
def get_current_score(self, game_id: int, player_id: int) -> int: with self.eng.session_mgr() as session: return session.query( func.sum(TablePlayerRound.score) ).filter(and_( TablePlayerRound.player_key == player_id, TableP...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_score(self):\n\n # Return the player's current turn score\n return self._current_score", "def get_score(self, player):\n if player in self.player_scores:\n return self.player_scores[player]\n else:\n raise Exception(\"Player not in score list\")",...
[ "0.83930844", "0.8121457", "0.78798014", "0.7770708", "0.7770708", "0.7770708", "0.77555895", "0.7664867", "0.76373386", "0.76373386", "0.76373386", "0.7590059", "0.7522338", "0.7479266", "0.7478165", "0.74462664", "0.7418862", "0.72637314", "0.72512645", "0.72470546", "0.718...
0.7634825
11
Create a weighted sampler using test weights.
def create_weighted_sampler(local_df, test_label = 'protease_stability'): all_label_ids = torch.tensor([x for x in local_df[test_label]], dtype=torch.long) labels_unique, counts = np.unique(local_df[test_label], return_counts=True) print(labels_unique) class_weights = [sum(counts)/c for c in counts] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_class_imbalance_sampler(self):\n count = [0] * len(self.classes)\n for item in self.train_data.imgs:\n count[item[1]] += 1\n \n weight_per_class = [0.] * len(self.classes)\n for i in range(len(self.classes)):\n weight_per_class[i] = float(sum(coun...
[ "0.6572374", "0.65645593", "0.65042996", "0.6406271", "0.639694", "0.62627", "0.6234835", "0.6230706", "0.62216735", "0.6136247", "0.60779095", "0.6056467", "0.6025776", "0.6014856", "0.59842086", "0.59823376", "0.59790635", "0.59682584", "0.59508836", "0.5927173", "0.5897803...
0.7523989
0
Get Configuration record. Get Configuration record.
def get( self, resource_group_name, # type: str resource_name, # type: str **kwargs # type: Any ): # type: (...) -> "models.MaintenanceConfiguration" cls = kwargs.pop('cls', None) # type: ClsType["models.MaintenanceConfiguration"] error_map = {404: Resourc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config() -> Config:\n return get_or_set('config', build_configuration)", "def get_config(self):\n if self.allow_reco():\n return self.chs_config()\n else:\n return self.get_config_j(self.id)", "def get_configuration(self) -> dict:\n return self.config", "...
[ "0.6948001", "0.68675506", "0.68347746", "0.6790804", "0.6680103", "0.6636846", "0.6636846", "0.6636846", "0.6636846", "0.6636846", "0.6636846", "0.6636846", "0.6636846", "0.6636846", "0.6636846", "0.6636846", "0.6636846", "0.6636846", "0.6636846", "0.6636846", "0.6636846", ...
0.0
-1
calculates the absolute distance between two tensor
def abs_distance(tensors, K=K): return K.abs(tensors[0] - tensors[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dist(a, b):\n return torch.pow(a - b, 2).sum(-1)", "def euclidean_distance(tensor1, tensor2):\n tensor1 = tf.convert_to_tensor(tensor1)\n tensor2 = tf.convert_to_tensor(tensor2)\n\n distance = tf.sqrt(tf.reduce_sum(tf.square(tensor1 - tensor2), axis=-1))\n\n return distance", "def compu...
[ "0.7454606", "0.7350807", "0.71120024", "0.70631915", "0.69904214", "0.69492936", "0.6897787", "0.6858797", "0.68188334", "0.6773303", "0.67623967", "0.6744559", "0.6732613", "0.67262423", "0.6715024", "0.6707391", "0.6696215", "0.6679618", "0.6663612", "0.6663612", "0.664663...
0.7463849
0
Creates and saves a User with the given username, email and password.
def _create_user(self, job_num, email, password, **extra_fields): if not job_num: raise ValueError('The given job_num must be set') email = self.normalize_email(email) user = self.model(job_num=job_num, email=email, **extra_fields) user.set_password(password) us...
{ "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.86018157", "0.84706366", "0.8462776", "0.8417308", "0.8413365", "0.839183", "0.8346418", "0.83453476", "0.8314481", "0.8306914", "0.8288764", "0.827679", "0.8270353", "0.82577944", "0.8213095", "0.81978804", "0.8175898", "0.81719273", "0.8164025", "0.8162915", "0.8138058",...
0.0
-1
Figures out which k should be used, since it differs for prograde and retrograde modes. Returns the second order approximation.
def g_modes(m, k, q, ecc=0, chi=0): # if type(m) != int or type(k) != int or type(q) != int: # raise TypeError("Input parameters should be given as integers") # Figure out pro/retro; q=0 case does not matter since the s terms drop if q*m < 0: # prograde s = k - 1. else: # retrograde ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_k(self):\n\t\n\tself.k = -np.array([self.sth*self.cphi, self.sth*self.sphi, self.cth])\n\n\treturn", "def superobl_p(k):\n if k%2==0:\n return 1/2 + 1/(2*(k+1))\n else:\n return 1/2 + 1/(2*k)", "def Sk(self, x, k):\n self._check(x, k)\n\n from math import atan, pi, lo...
[ "0.6610566", "0.65630597", "0.6550348", "0.65290296", "0.63094944", "0.6307009", "0.6288942", "0.6252815", "0.6236831", "0.62133104", "0.62078494", "0.61721635", "0.6155763", "0.6155763", "0.6155763", "0.6125252", "0.61250913", "0.6110209", "0.6094326", "0.6074639", "0.606437...
0.6095592
18
Returns the number of qubits in this circuit.
def num_qubits(self) -> int: return super().num_qubits
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_qubits(self) -> int:\n return self._circuit.num_qubits", "def num_qubits(self) -> int:\n raise NotImplementedError()", "def _num_qubits(self) -> int:\n try:\n return self.__experiment_metadata[\"num_qubits\"]\n except (TypeError, KeyError):\n # Ignore e...
[ "0.91651946", "0.86077106", "0.7778159", "0.74567425", "0.74475235", "0.7227885", "0.718025", "0.71301055", "0.70526373", "0.70332205", "0.7023782", "0.702149", "0.7011129", "0.6982632", "0.6969492", "0.6920238", "0.69108975", "0.69093496", "0.6832518", "0.6818841", "0.680609...
0.8355639
2
Plot a white airplane
def PlotSphere(): sphere = vtkInterface.PolyData(spherefile) sphere.Plot()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PlotAirplane():\n airplane = vtkInterface.PolyData(planefile)\n airplane.Plot()", "def PlotAntsPlane():\n\n # load and shrink airplane\n airplane = vtkInterface.PolyData(planefile)\n airplane.points /= 10\n # pts = airplane.GetNumpyPoints() # gets pointer to array\n # pts /= 10 # shrink...
[ "0.75220877", "0.67231596", "0.6163475", "0.6049206", "0.60037285", "0.5991692", "0.5905354", "0.5898456", "0.5872719", "0.58012325", "0.57644194", "0.57280743", "0.5692424", "0.5669899", "0.5657078", "0.56543756", "0.5651566", "0.5638888", "0.5595325", "0.55572385", "0.55511...
0.0
-1
Plot a white airplane
def PlotAirplane(): airplane = vtkInterface.PolyData(planefile) airplane.Plot()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PlotAntsPlane():\n\n # load and shrink airplane\n airplane = vtkInterface.PolyData(planefile)\n airplane.points /= 10\n # pts = airplane.GetNumpyPoints() # gets pointer to array\n # pts /= 10 # shrink\n\n # rotate and translate ant so it is on the plane\n ant = vtkInterface.PolyData(antfi...
[ "0.6723627", "0.61646223", "0.6048717", "0.6004093", "0.59917575", "0.59036696", "0.5898317", "0.5873797", "0.5800849", "0.57643867", "0.572756", "0.56935495", "0.5669727", "0.5656969", "0.5654315", "0.5651694", "0.5640442", "0.5596311", "0.5556367", "0.55522776", "0.5546163"...
0.75223255
0
function to display the landing page with all recipes
def index(): return render_template('index.html', recipes=mongo.db.recipes.find())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def landingPage():\n # Query all listings from the database and pass to landing page.\n return render_template(\"landing.html\")", "def show_recipe_results():\n if not g.user:\n flash(\"Please login to view.\",\"warning\")\n return redirect('/login')\n\n data = search_recipes(request)\n...
[ "0.7314686", "0.7266865", "0.69650185", "0.6716088", "0.66692865", "0.66657776", "0.6661303", "0.6563301", "0.65298384", "0.64973503", "0.6489821", "0.64700973", "0.6461229", "0.6445384", "0.64428", "0.6440049", "0.64274627", "0.6423696", "0.64151746", "0.64131016", "0.639158...
0.6851238
3
function to display the about page
def about(): return render_template('about.html', title="About")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def about():\n\n\treturn render_template(\"about.html\")", "def about():\n\n return render_template('about_page.html', title='About')", "def about():\n return render_template('about.html', title='About')", "def about():\n\n\treturn render_template('about.html', title='About',\n\t\t\t\t\t\t year=d...
[ "0.8369054", "0.82862175", "0.8284642", "0.822984", "0.82120216", "0.8180665", "0.81556284", "0.8141926", "0.8141926", "0.8141926", "0.8141926", "0.8141926", "0.8141926", "0.8141926", "0.8141926", "0.8141926", "0.8141926", "0.8141926", "0.8141926", "0.8141926", "0.8132594", ...
0.80852807
24
Calculate the number of days between two dates
def days_between(self, d1, d2): self.is_not_used() try: d1 = self.format_date(d1) d2 = self.format_date(d2) d1 = datetime.strptime(d1, '%Y-%m-%d') d2 = datetime.strptime(d2, '%Y-%m-%d') return abs((d2 - d1).days) except Exception as e: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_days(start: date, end: date) -> int:\n delta = end - start\n return delta.days + 1", "def diff_dates(date1, date2):\n\n return abs(date2 - date1).days", "def DAYS(end_date, start_date):\n return (_make_datetime(end_date) - _make_datetime(start_date)).days", "def _get_number_of_days(self...
[ "0.8316377", "0.8256349", "0.81084895", "0.8027462", "0.7934948", "0.7928577", "0.7913538", "0.78716224", "0.78364664", "0.7715086", "0.763351", "0.76085633", "0.76033497", "0.75717187", "0.7535571", "0.75248504", "0.7438112", "0.7424266", "0.73249054", "0.72953665", "0.71202...
0.8001075
4
Decorator to redirect the user to '/' if they are not logged in
def login_required(func): @wraps(func) def f(*args, **kwargs): if g.user is None: app.logger.info('redirecting not logged in user') return redirect(url_for('index')) elif not g.user.initialized and f.__name__ not in ['profile_create','logout']: return redirect...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login_required(f):\n @wraps(f)\n def decorated_function(*args, **kwargs):\n if session.get(\"user_id\") is None:\n return redirect(\"/\")\n return f(*args, **kwargs)\n return decorated_function", "def login_required(f):\n @wraps(f)\n def decorated_function(*args, **kwa...
[ "0.7854771", "0.7854771", "0.7850112", "0.779627", "0.7691401", "0.7687098", "0.76462716", "0.7545185", "0.7447549", "0.74179256", "0.7402129", "0.7394061", "0.7394061", "0.7394061", "0.7394061", "0.7394061", "0.7394061", "0.7394061", "0.7394061", "0.7394061", "0.7394061", ...
0.75115454
8
Check that the given user belongs to the course. Defaults to g.user. Aborts with a 403 on error.
def check_course_membership(course, user=None): if user is None: user = g.user if isinstance(course, Course): course_id = course.id else: course_id = course if user.courses.filter(Course.id == course_id).count() == 0: abort(403)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def access_validation(self, request, *args, **kwargs):\n course_id = self.kwargs.get('course_id')\n user = self.request.user\n user_role_id = getattr(user, user.role).id\n course_role_dict = {\n 'teacher': Course.objects.filter(Q(teachers__id=user_role_id) & Q(id=course_id)),...
[ "0.6755262", "0.65608084", "0.64302677", "0.622072", "0.62131727", "0.6189878", "0.61552185", "0.61450666", "0.6108422", "0.6096303", "0.6054943", "0.6054943", "0.6054943", "0.6050466", "0.6049754", "0.6045199", "0.6045199", "0.6002668", "0.59936094", "0.5981631", "0.5966834"...
0.7448646
0
Seconds since epoch (Jan 1, 1970)
def epoch_time(when): if not when: return 0 epoch = datetime.utcfromtimestamp(0) delta = when - epoch return int(delta.total_seconds())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _current_epoch_secs():\n now = datetime.datetime.utcnow()\n epoch = datetime.datetime(1970, 1, 1)\n return (now - epoch).total_seconds()", "def epoch():\n\treturn time.time()", "def epoch_time_now():\n return int(time.time())", "def epoch_seconds(date):\r\n td = date - epoch\r\n return td.day...
[ "0.80446315", "0.7737984", "0.76553446", "0.7645437", "0.76165485", "0.76165485", "0.75624394", "0.7537382", "0.749675", "0.7473205", "0.7304839", "0.7282719", "0.7121488", "0.7019377", "0.6946101", "0.6940019", "0.68166095", "0.6795637", "0.67544186", "0.6717486", "0.6673287...
0.7438002
10
'timestamp' represents a halfhour segement of time in the day. It is represented as seconds since midnight. Here we return a tuple of both the timestamp and a string with the equivalent time.
def time_from_timestamp(timestamp): hour = (timestamp // HOUR) or 12 if hour > 12: hour = hour - 12 meridian = ["AM", "PM"][timestamp >= NOON] minutes = ["30", "00"][timestamp % HOUR == 0 or timestamp == 0] timestr = "%s:%s%s" % (hour, minutes, meridian) return timestamp, timestr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_timestamp():\n now, s=get_date()\n return (now, \"%s%s%s%s\" % (s, str(now.hour).zfill(2), str(now.minute).zfill(2), str(now.second).zfill(2)))", "def conv_time(stamp):\n value = datetime.fromtimestamp(stamp)\n return value.strftime('%Y-%m-%d %H:%M:%S')", "def get_timestamp():\n retu...
[ "0.730948", "0.68321145", "0.6829955", "0.67418516", "0.67272997", "0.6646309", "0.6611379", "0.66055626", "0.65668964", "0.65516174", "0.65122014", "0.65040064", "0.64852124", "0.6459023", "0.64140093", "0.6410804", "0.6349925", "0.6329173", "0.6310089", "0.6264889", "0.6246...
0.658689
8
Returns the value at the top without modifying the stack, raises an exception otherwise
def peek(self): if not self.is_empty(): return self.top.value raise Exception("Cannot peek an empty Stack")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top(stack):\n if empty_stack(stack):\n raise IndexError(\"Stack is empty!\")\n else:\n return stack.top.value", "def peek(self):\n if not self.top:\n raise AttributeError(\"Can't peek top from an empty stack\")\n return self.top.value\n # try:\n # ...
[ "0.8105011", "0.7782362", "0.77735305", "0.7619751", "0.7543057", "0.7392956", "0.739288", "0.7330028", "0.7320574", "0.72987", "0.7296294", "0.7295798", "0.7275108", "0.7254495", "0.7216521", "0.7216521", "0.72091967", "0.710055", "0.70833", "0.6995098", "0.6991737", "0.69...
0.75163215
5
Build a list of (weights, biases) tuples, one for each layer in the net. Either initialize weights with input params or randomly (using layer_sizes and scale)
def __init__(self, params = None, layer_sizes = None, scale = 0.1, rs=npr.RandomState(0)): self.layer_sizes = layer_sizes if params is not None: self.param = params else: if layer_sizes is None: raise Exception("Please provide the layer sizes") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, sizes: list):\n self.num_layers = len(sizes)\n self.sizes = sizes\n self.biases = [np.random.randn(y, 1) for y in sizes[1:]]\n self.weights = [np.random.randn(y, x) for x, y in zip(sizes[:-1], sizes[1:])]", "def __init__(self, sizes):\r\n self.num_layers = le...
[ "0.7739462", "0.7721741", "0.7694322", "0.7676679", "0.7666837", "0.76000726", "0.7338092", "0.73009", "0.72838986", "0.72328246", "0.72157764", "0.71919274", "0.70494694", "0.7023459", "0.69813937", "0.6977329", "0.6973018", "0.69642484", "0.69501925", "0.6937778", "0.692262...
0.6513711
41
Check for any bullets that hit aliens if so get rid of bullet and alien
def _check_bullet_alien_collision(self): collision = pygame.sprite.groupcollide(self.bullets, self.aliens, True, True) if not self.aliens: self.bullets.empty() self._create_fleet() print(len(self.bullets))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_bullet_alien_collisions(self):\n collisions = pygame.sprite.groupcollide(\n self.bullets, self.aliens, True, True,\n )\n if not self.aliens:\n self.bullets.empty()\n self._create_fleet()", "def _check_bullet_alien_collision(self):\n # ch...
[ "0.7020206", "0.69135386", "0.68622345", "0.68548906", "0.67957217", "0.6764122", "0.6757469", "0.67430484", "0.67208403", "0.6707324", "0.66767406", "0.6608685", "0.6583489", "0.6531725", "0.6531018", "0.65078807", "0.6502442", "0.64450294", "0.6421317", "0.6417459", "0.6412...
0.65353674
13
!Clear the current bar and draw a new one.
def redraw(self): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateBar(self):\n pass", "def _clear(self):\n self._calculate_bar_width()\n # sys.stdout.write(\"\\033[K\")\n # to fix bug when logging to console\n print(\" \" * self._tw, end='\\r')\n # sys.stdout.write(\"\\033[K\")", "def on_bar(self, bar: BarData):\n se...
[ "0.71008873", "0.69752026", "0.6874584", "0.6826696", "0.67903465", "0.67863184", "0.66715044", "0.66269577", "0.6533932", "0.6520792", "0.6445535", "0.6334779", "0.6204982", "0.6183982", "0.61211455", "0.6096881", "0.608486", "0.60717064", "0.6067525", "0.60483867", "0.60303...
0.0
-1
!Clear the current bar and draw a new one.
def redraw(self): # enough to go to front, don't need to clear the line sys.stderr.write(self._FRONT) self.draw()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateBar(self):\n pass", "def _clear(self):\n self._calculate_bar_width()\n # sys.stdout.write(\"\\033[K\")\n # to fix bug when logging to console\n print(\" \" * self._tw, end='\\r')\n # sys.stdout.write(\"\\033[K\")", "def on_bar(self, bar: BarData):\n se...
[ "0.71008873", "0.69752026", "0.6874584", "0.6826696", "0.67903465", "0.67863184", "0.66715044", "0.66269577", "0.6533932", "0.6520792", "0.6445535", "0.6334779", "0.6204982", "0.6183982", "0.61211455", "0.6096881", "0.608486", "0.60717064", "0.6067525", "0.60483867", "0.60303...
0.555776
63
!Write msg to `sys.stderr`.
def write(self, msg): if _activeBar is not None: # The c++ logger sends spurious empty lines, # just gobble them up. if msg.strip(): _activeBar.write(msg) else: sys.stderr.write(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_to_stderr(msg):\n sys.stderr.write(msg)", "def write(self, msg):\n sys.stderr.write(msg)", "def write(self, msg):\n\n sys.stderr.write(msg)", "def printerr(msg):\n print(msg, file=sys.stderr)", "def print_err(msg):\n print(msg, file=sys.stderr)", "def warn(msg):\n sys....
[ "0.86017793", "0.852037", "0.8408688", "0.83381015", "0.8316376", "0.78182214", "0.78124285", "0.7766476", "0.77620935", "0.76754975", "0.765387", "0.765387", "0.765387", "0.765387", "0.765387", "0.765387", "0.765387", "0.765387", "0.765387", "0.765387", "0.765387", "0.7653...
0.0
-1
Yield successive nsized chunks from lst.
def chunks(lst, n): for i in range(0, len(lst), n): yield lst[i:i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunks(self, lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]", "def chunks(lst: list, n: int):\n for i in range(0, len(lst), n):\n yield lst[i : i + n]", "def chunks(lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]", "de...
[ "0.8307071", "0.8193703", "0.8190772", "0.8190772", "0.81899244", "0.81263477", "0.81215096", "0.81215096", "0.80769324", "0.8052258", "0.8052258", "0.8052258", "0.8052258", "0.8052258", "0.8003821", "0.7870944", "0.78455555", "0.7828231", "0.78274894", "0.78142494", "0.78016...
0.80529666
17
Initialize the GloBI dataset.
def __init__( self, random_state: TorchRandomHint = 0, **kwargs, ): super().__init__( url=URL, random_state=random_state, read_csv_kwargs=dict( usecols=["sourceTaxonId", "interactionTypeName", "targetTaxonId"], ), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init(*args):\n global dataset\n dataset = args[0]", "def __init__(self):\n self.__dataset = None", "def __init__(self, dataset):\n self._dataset = dataset", "def __init__(self, dataset: Dataset):\n self.dataset = dataset", "def _init_al_dataset(self):\n\n self._init_da...
[ "0.6958595", "0.6797498", "0.6586611", "0.64996773", "0.6428963", "0.63522077", "0.6158004", "0.6068557", "0.6063687", "0.60524863", "0.60031086", "0.60031086", "0.5975034", "0.5957728", "0.5949429", "0.5930178", "0.5922474", "0.5910568", "0.58930105", "0.58568275", "0.584067...
0.0
-1
Normalize the value to the lower bound and upper bound by the max & min
def __normalize(self, value, lower_bound, upper_bound): min_max_diff = self.max - self.min bound_diff = upper_bound - lower_bound return (value - self.min) / min_max_diff * bound_diff + lower_bound
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minmax_normalize(X):\n # X -= X.min()\n # X /= X.max()\n # X -= 0.5\n X = (X-X.min()) / (X.max() - X.min())\n return X", "def normalize(x, x_max, x_min):\n return (x - x_min) / (x_max - x_min)", "def normalize(vals):\n min_val = torch.min(vals)\n max_val = torch.max(vals)\n retur...
[ "0.77865136", "0.7733495", "0.76886857", "0.7633776", "0.76054263", "0.755081", "0.7537792", "0.74486303", "0.7409928", "0.7395475", "0.73715216", "0.7361083", "0.73077935", "0.72944593", "0.72944593", "0.72837174", "0.7276139", "0.7269681", "0.7259161", "0.72285426", "0.7220...
0.8829696
0
Converts a list of BeautifulSoup objects into a list of CollectionElement objects, which are designed to make the mining of data and storage in the database easier.
def get_info_from_collections(self, element_soups): collections = [] # Loop through each soup, make CollectionElement, store in collections for element_soup in element_soups: collections.append(CollectionElement(element_soup)) # Return list of CollectionElements retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mine(self):\n collections = []\n # Getting HTML snapshot with selenium, storing a soup object in .data\n self.scrape()\n # Returns only the parts of the soup that surround each collection\n collection_elements = self.get_collection_elements()\n # Turns each soup elemen...
[ "0.6535009", "0.61355644", "0.60075057", "0.57353747", "0.570216", "0.564703", "0.564703", "0.55713135", "0.55592173", "0.55510736", "0.5485374", "0.5363327", "0.5353005", "0.5302042", "0.5295401", "0.52930695", "0.529198", "0.52833676", "0.52809525", "0.5276436", "0.5224194"...
0.7772842
0
Return a list of zero or more entries of the used model.
async def get_many(self, **query): return [await self._expand(obj) for obj in await self.db.get_many(**query)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peak_all_models(self) -> List:\n models = list(self.meta.name)\n print(models)\n return models", "def availablemodels(self):\n return self.__models.keys()", "def GetObjects(self): \r\n return self.model.GetObjects()", "def models(self):\r\n return self.get...
[ "0.6960155", "0.68627894", "0.65713096", "0.6486108", "0.6486108", "0.63719445", "0.63643956", "0.63316506", "0.63140285", "0.63000065", "0.62963927", "0.62860054", "0.6276113", "0.62605846", "0.6249391", "0.62033594", "0.6151635", "0.61494064", "0.61427474", "0.6129314", "0....
0.0
-1
Deletes all matching entries of the used model.
async def delete_many(self, **query): try: for result in await self.db.get_many(**query): await result.delete() except IntegrityError: raise ConflictException( f"At least one {self.db_model_name} cannot be deleted since it is actively used" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_all(self, Model):\n ndb.delete_multi(\n Model.query().fetch(keys_only=True)\n )", "def delete_all(cls):\n cls.dbm().modelclass_deleteall(cls)", "def deleteAll(self):\n self.db.execute(\"DELETE FROM MATCH;\", ())", "def tearDown(self):\n for model in MO...
[ "0.79316384", "0.747822", "0.73304355", "0.731096", "0.731096", "0.731096", "0.7256927", "0.71217406", "0.71072507", "0.70530224", "0.704655", "0.7021193", "0.69556373", "0.68680143", "0.68509346", "0.6788714", "0.6711613", "0.6699838", "0.6674768", "0.6674525", "0.6674525", ...
0.66337246
23
returns dataframe with doji candle column
def doji(ohlc_df): df = ohlc_df.copy() avg_candle_size = abs(df["close"] - df["open"]).median() df["doji"] = abs(df["close"] - df["open"]) <= (0.05 * avg_candle_size) return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doji(ohlc_df):\n df = ohlc_df.copy()\n avg_candle_size = abs(df['close']-df['open']).median()#abs(df[\"close\"]- df[\"open\"]).median()\n df[\"doji\"] = abs(df[\"close\"] - df[\"open\"]) <= (0.05 * avg_candle_size)\n return df", "def get_data_from_disc(symbol, usecols=['Date', 'Close', 'Open', '...
[ "0.7065447", "0.6178326", "0.6167088", "0.6163571", "0.6136083", "0.6031488", "0.59001696", "0.5836809", "0.5827897", "0.58204365", "0.57954866", "0.57765883", "0.57706517", "0.57485175", "0.57079005", "0.5699437", "0.5693936", "0.5690844", "0.56764406", "0.56718814", "0.5669...
0.71763915
0
p, n = planeFit(points) Given an array, points, of shape (d,...) representing points in ddimensional space, fit an ddimensional plane to the points. Return a point, p, on the plane (the pointcloud centroid), and the normal, n.
def planeFit(self, points): pointsP = points points = np.array(points).transpose() points = np.reshape(points, (np.shape(points)[0], -1)) # Collapse trialing dimensions ctr = points.mean(axis=1) if points.shape[0] > points.shape[1]: return list(ctr), self.verticalAxis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def planeFit(points):\n import numpy as np\n from numpy.linalg import svd\n points = np.reshape(points, (np.shape(points)[0], -1)) # Collapse trialing dimensions\n assert points.shape[0] <= points.shape[1], \"There are only {} points in {} dimensions.\".format(points.shape[1], points.shape[0])\n ctr...
[ "0.7483006", "0.7457725", "0.74262375", "0.73495394", "0.7333393", "0.69935244", "0.67295706", "0.67295706", "0.6547574", "0.6474864", "0.6440873", "0.6407886", "0.63599175", "0.6328961", "0.62663", "0.62663", "0.6262328", "0.61549735", "0.61207235", "0.61138093", "0.60978335...
0.7147933
5
Returns the number of elements in this collection. If the collection contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE
def size(self, *args): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self):\n return len(self._elements)", "def num_elements(self):\n return self.subset.num_elements()", "def elements_count(self):\n return self.__elements_count", "def size(self):\n return self._collection.size()", "def __len__(self):\n\n if self.is_finite_set:\n ...
[ "0.762323", "0.7569818", "0.74972486", "0.7370406", "0.7312372", "0.730621", "0.7302958", "0.7190693", "0.7051998", "0.7039034", "0.7039034", "0.7039034", "0.7039034", "0.7039034", "0.7036961", "0.7034114", "0.7030153", "0.7030136", "0.70000076", "0.69917053", "0.69915813", ...
0.0
-1
Convert straight monomial coefficients to chebychev coefficients.
def poly2cheby(cin): # 2009-07-07 09:41 IJC: Created from scipy.special import poly1d, chebyt cin = poly1d(cin) cout = [] ord = cin.order for ii in range(ord+1): chebyii = chebyt(ord-ii) cout.append(cin.coeffs[0]/chebyii.coeffs[0]) cin -= chebyii*cout[ii] retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cheby_coeff2(m,s):\r\n c = np.zeros(m+1)\r\n for j in range(m+1):\r\n c[j] = 2*np.exp(-s)*j1(-s)\r\n \r\n return c", "def c_coefficients(x1,x2,x3,y1,y2,y3,initial_slope,final_slope):\n\tC = c_matrix(x1,x2,x3)\n\ty = y_vector(x1,x2,x3,y1,y2,y3,initial_slope,final_slope)\n\tCCoef...
[ "0.5779223", "0.55534357", "0.5521701", "0.5486293", "0.5471919", "0.5423588", "0.5422214", "0.5404516", "0.53913367", "0.5347309", "0.53239906", "0.5213067", "0.52057517", "0.5197759", "0.5143162", "0.5101653", "0.50791734", "0.50745595", "0.5074476", "0.50537616", "0.504013...
0.5682247
1
Compute a 2D gaussian distribution at the points x, y.
def gaussian2d(p, x, y): #2010-06-08 20:00 IJC: Created #2013-04-19 23:49 IJMC: Improved documentation, per BACM's request. x = array(x, dtype=float).copy() y = array(y, dtype=float).copy() p = array(p).copy() if len(p)==4: p = concatenate((p, [0])) z = p[4] + p[0]/(2*pi*p[1]*...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian2d(x, y, A, sigma, x0):\n Z = A * np.exp(-( (x-x0[0])**2/(2*sigma[0]**2) + (y-x0[1])**2/(2*sigma[1]**2)))\n return Z", "def gauss2d(param, x, y):\n #2010-01-11 22:46 IJC: Created\n from numpy import array, abs, concatenate, exp\n x = array(x, dtype=float).copy()\n y = array(y, dtype...
[ "0.7597244", "0.71917886", "0.6959933", "0.6937362", "0.6909312", "0.67215645", "0.6706854", "0.66962326", "0.66955197", "0.6639664", "0.6600054", "0.6600054", "0.6600054", "0.6590154", "0.6585759", "0.6568661", "0.655548", "0.65126544", "0.65015477", "0.64891577", "0.6451195...
0.7879337
0
Return start and end indices for consecutive sequences of integervalued indices.
def getblocks(vec): # 2010-08-18 17:01 IJC: Created # 2010-11-15 23:26 IJC: Added numpy imports from numpy import sort, diff, nonzero vec = sort(vec) starts = [vec[0]] ends = [] dvec = diff(vec) start_inds = nonzero(dvec>1)[0] for ind in start_inds: starts.append(vec[ind+1]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_positions(start_idx, end_idx, length):\n return list(range(-start_idx, 0)) + [0] * (end_idx - start_idx + 1) + \\\n list(range(1, length - end_idx))", "def _get_marker_indices(marker, line):\n indices = [i for i, ltr in enumerate(line) if ltr == marker]\n start = indices[0:-1:2]\n e...
[ "0.66182333", "0.66015", "0.656251", "0.6405137", "0.63192606", "0.630825", "0.6286917", "0.6126003", "0.61137736", "0.61005205", "0.6088744", "0.60789084", "0.60304", "0.60260385", "0.60140777", "0.6013813", "0.598106", "0.5979989", "0.5978599", "0.5966376", "0.59564704", ...
0.0
-1
Pads input matrix to size specified.
def pad(inp, npix_rows, npix_cols=None): #2008-10-18 12:50 IJC: Converted from Matlab function # 2010-10-29 09:35 IJC: Moved from nsdata.py to analysis.py from numpy import imag, zeros, complex128 inp = array(inp, copy=True) if len(inp.shape)==0: inp = inp.reshape((1,1)) elif len(inp.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pad(A, N):\n n, _ = A.shape\n if n >= N:\n return A\n else:\n if issparse(A):\n # thrown if we try to np.concatenate sparse matrices\n side = sps.csr_matrix((n, N - n))\n bottom = sps.csr_matrix((N - n, N))\n A_pad = sps.hstack([A, side])\n ...
[ "0.68564194", "0.6779707", "0.64658725", "0.63514197", "0.6306951", "0.62215483", "0.6202659", "0.6175899", "0.5987106", "0.5942791", "0.5928784", "0.59229916", "0.5901995", "0.5879175", "0.58500546", "0.58386594", "0.58142346", "0.57848173", "0.5744818", "0.5715087", "0.5702...
0.0
-1
Filter the URL to return it in it's correct form. Removing things like hyperlink on a different section of a page
def getFilteredUrl(self, url): url = url.split('#')[0] if url.startswith('/wiki'): return ('https://en.wikipedia.org' + url) if 'en.wikipedia.org/wiki/' not in url: return ('https://en.wikipedia.org/wiki' + url) return url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clean_url(self, url):\n return \"\".join(url.split(\"?\")[:1])", "def scrub_url(self, url):\n return self.__url_scrubber(url)", "def normalize_url(self, url):\n pass", "def clean_url(self, url):\n if self.is_blacklisted(url):\n return None\n\n # If the URL was u...
[ "0.73594606", "0.6815482", "0.6753932", "0.66633797", "0.65668815", "0.65590215", "0.65562195", "0.654868", "0.6495394", "0.6421636", "0.62951404", "0.62817454", "0.627704", "0.6256426", "0.6249113", "0.62464523", "0.6240439", "0.62250876", "0.6224539", "0.6224539", "0.622453...
0.7613516
0
Brightness of this light between 0..255.
def brightness(self): return self.get_value('bri')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def brightness(self):\n return brightness_from_percentage(self._brightness_pct)", "def brightness(self) -> float:\n # http://alienryderflex.com/hsp.html\n r, g, b = self.r, self.g, self.b\n return sqrt(0.299*r**2 + 0.587*g**2 + 0.114*b**2)/255", "def brightness(self):\n retur...
[ "0.8099711", "0.8093499", "0.79592705", "0.79592705", "0.79592705", "0.79592705", "0.79592705", "0.79592705", "0.79592705", "0.79592705", "0.79592705", "0.79592705", "0.79592705", "0.79592705", "0.7958437", "0.77826744", "0.7753005", "0.764744", "0.75622994", "0.74681056", "0...
0.78729075
15
Extract the combinations of all contexts
def extract_all_combinations_and_negations_from_contexts(contexts: List[LTL]) \ -> Tuple[List[List[LTL]], List[List[LTL]]]: combs_all_contexts: List[List[LTL]] = [] """Extract the combinations of all contexts with negations""" combs_all_contexts_neg: List[List[LTL]] = [] for i in range(0, len(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_contexts(self):\n params = self._get_configurational_params()\n builds = self._get_builds()\n\n ctx_params = itertools.product(builds, *params.values())\n ctxs = []\n for cp in ctx_params:\n build = cp[0]\n kwargs = dict(zip(params.keys(), cp[1:]))\n...
[ "0.690896", "0.672108", "0.666438", "0.6409844", "0.6396769", "0.6393994", "0.62298656", "0.6206844", "0.607877", "0.5991345", "0.5944054", "0.58736414", "0.5868549", "0.58453536", "0.58220977", "0.58156", "0.58120614", "0.58027965", "0.5793993", "0.57778937", "0.5715825", ...
0.6569709
3
Generate a dict to turn punctuation into a token.
def token_lookup(): Tokenize = {'.': '||Period||', '.': '||Period||', ',': '||Comma||', '"': '||Quotation_Mark||', ';': '||Semicolon||', '!': '||Exclamation_mark||', '?': '||Question_mark||', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token_lookup():\n token_dict = {}\n token_dict['.'] = \"||Period||\"\n token_dict[','] = \"||Comma||\"\n token_dict['\"'] = \"||Quotation_Mark||\"\n token_dict[';'] = \"||Semicolon||\"\n token_dict['!'] = \"||Exclamation_Mark||\"\n token_dict['?'] = \"||Question_Mark||\"\n token_dict['(...
[ "0.6736538", "0.66179246", "0.6473263", "0.63673395", "0.63541335", "0.6195351", "0.6170302", "0.61027676", "0.61009026", "0.6056571", "0.583608", "0.580536", "0.57960415", "0.5735746", "0.5717652", "0.5713248", "0.5703686", "0.56706595", "0.56492156", "0.56279296", "0.562042...
0.6318267
5
Create TF Placeholders for input, targets, and learning rate.
def get_inputs(): inputs = tf.placeholder(tf.int32, [None,None], name='input') targets = tf.placeholder(tf.int32, [None, None], name='targets') lr = tf.placeholder(tf.float32, name='learning_rate') return (inputs, targets, lr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_placeholders(self):\n\n\t\twith tf.name_scope(\"input_data\"):\n\t\t\tself.input_words=tf.placeholder(shape=(None,self.look_back), dtype=tf.int32,name='input_tokens')\n\t\twith tf.name_scope(\"output_data\"):\t\n\t\t\tself.output_words=tf.placeholder(shape=(None,self.look_back),dtype=tf.int32,name='out...
[ "0.7744293", "0.7662721", "0.7621616", "0.76179385", "0.75356156", "0.75137645", "0.7418147", "0.7405449", "0.7404622", "0.73941994", "0.73695993", "0.73649645", "0.7349455", "0.73242545", "0.72866756", "0.72504604", "0.7224488", "0.72090685", "0.7191729", "0.71353704", "0.71...
0.62401825
50
Create an RNN Cell and initialize it.
def get_init_cell(batch_size, rnn_size): cell = tf.contrib.rnn.BasicLSTMCell(rnn_size) #?????????????????cell_hidden_size = state_size #cell = tf.contrib.run.DropoutWrapper(cell, output_keep_prob=keep_prob) num_of_layers = 3 cell = tf.contrib.rnn.MultiRNNCell([cell for _ in range(num_of_layers)]) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, rnn_cell, batch_size,\n input_size, num_outputs):\n super().__init__(name='RNNCellStateModel')\n self._rnn_cell = rnn_cell\n self._batch_size = batch_size\n self._input_size = input_size\n self._num_outputs = num_outputs", "def constructCell():\n\t\tself.weightGene...
[ "0.7133991", "0.6899508", "0.65649766", "0.650937", "0.6454866", "0.6427891", "0.6406703", "0.63733774", "0.6356385", "0.6349089", "0.62881285", "0.62487924", "0.6245261", "0.6237009", "0.6202856", "0.6177044", "0.61625576", "0.6157899", "0.60706264", "0.5992742", "0.5963139"...
0.67048925
2
Get input, initial state, final state, and probabilities tensor from
def get_tensors(loaded_graph): g = loaded_graph InputTensor = g.get_tensor_by_name("input:0") InitialStateTensor = g.get_tensor_by_name("initial_state:0") FinalStateTensor = g.get_tensor_by_name("final_state:0") ProbsTensor = g.get_tensor_by_name("probs:0") return InputTensor, InitialState...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_input(self):\n n_input = tf.placeholder(tf.int32, [None, None], name='n_input')\n t_input = tf.placeholder(tf.int32, [None, None], name='t_input')\n n_target = tf.placeholder(tf.int32, [None, None], name='n_target')\n t_target = tf.placeholder(tf.int32, [None, None], name='t_t...
[ "0.69212705", "0.66203946", "0.6486955", "0.6456793", "0.64271617", "0.642399", "0.63323855", "0.62982005", "0.62882364", "0.6263209", "0.6244324", "0.62275106", "0.62267786", "0.62062126", "0.6135696", "0.6115243", "0.60874015", "0.60845417", "0.60647595", "0.60595", "0.6035...
0.65106094
2
Return an iterable of attriubtes as (name, value) tuples.
def get_attribs(self, attribs: List[str]) -> Iterable[Tuple[str, str]]: binfo = self.build_info for attrib in attribs: try: val = self._get_attrib(attrib, binfo) except Exception as e: logger.error(f'could not get attribute {attrib}: {e}') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def values(self):\n return [getattr(self, a.name) for a in self.__attrs_attrs__]", "def __iter__(self) -> Tuple[str, Any]:\n for attr_name, attr_val in self.__dict__.items():\n yield attr_name, attr_val", "def values(self):\n return self.attrs.values()", "def get_attrs(self):\...
[ "0.773597", "0.74874634", "0.73996794", "0.732483", "0.7140857", "0.70480174", "0.70255715", "0.70011246", "0.69714093", "0.69371563", "0.69167036", "0.6914892", "0.68991315", "0.6860263", "0.6832531", "0.6829296", "0.68281513", "0.6810868", "0.6810868", "0.67561615", "0.6742...
0.7022214
7
Return a set key attributes as a dict where keys are ``attribs``.
def get_attrib_dict(self, attribs: Tuple[str]) -> Dict[str, str]: attrs = self.get_attribs(attribs) attrs = tuple(map(lambda a: (a[0][1:], a[1]), attrs)) return dict(attrs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_attributes(self):\n \n retdict = {}\n retdict['s'] = str(self.s)\n if self.t != None:\n retdict['t'] = str(self.t)\n retdict['a'] = str(self.a)\n retdict['b'] = str(self.b)\n retdict['c'] = str(self.c)\n retdict['d'] = str(self.d)\n retu...
[ "0.69908285", "0.6880784", "0.68653125", "0.68219274", "0.6713393", "0.66827047", "0.6642121", "0.66261566", "0.6611085", "0.6572647", "0.6572647", "0.6572647", "0.6528268", "0.64147127", "0.64089507", "0.6403476", "0.6386348", "0.63189113", "0.631076", "0.6283674", "0.627181...
0.712542
0
Returns the name of the mapping.
def get_mapping_type_name(cls): return 'comments_comment'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mapping_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"mapping_name\")", "def mapping_name(self) -> Optional[str]:\n return self.get(\"/TM\")", "def connector_mapping_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"connector_mapping_name\")", "de...
[ "0.81983757", "0.7417838", "0.7209594", "0.7022241", "0.68276817", "0.6780296", "0.67579865", "0.6692519", "0.6652465", "0.6639802", "0.66277", "0.6615691", "0.6607458", "0.65981376", "0.659248", "0.659248", "0.65482044", "0.65482044", "0.65405947", "0.6536378", "0.6531363", ...
0.0
-1
Loads an unprocessed color image extracted from the raw dataset.
def read_color_image(path): with open(path, 'rb') as f: img = Image.fromarray(read_ppm(f), mode='RGB') img = tf.keras.preprocessing.image.img_to_array(img, dtype=int) img = tf.convert_to_tensor(img) return img
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_image(filename):\n rgb = imread(filename)\n return UncertainImage(rgb)", "def load_image(filename, color=True):\n img = skimage.img_as_float(skimage.io.imread(filename, as_grey=not color)).astype(np.float32)\n if img.ndim == 2:\n img = img[:, :, np.newaxis]\n if color:\n ...
[ "0.6671882", "0.6505075", "0.6430076", "0.6422551", "0.6422551", "0.63021415", "0.6255431", "0.6225158", "0.6214892", "0.620447", "0.6180732", "0.6170475", "0.61516196", "0.61427224", "0.61265653", "0.61126", "0.60793775", "0.6078887", "0.6070254", "0.6068006", "0.60473335", ...
0.6207074
9
Reads a PGM file from a buffer. Returns a numpy array of the appropiate size and dtype.
def read_pgm(pgm_file): # First line contains some image meta-info p5, width, height, depth = pgm_file.readline().split() # Ensure we're actually reading a P5 file assert p5 == b'P5' assert depth == b'65535', "Only 16-bit PGM files are supported" width, height = int(width), int(height) d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_pgm(filename, byteorder='>'):\r\n with open(filename, 'rb') as f:\r\n buffer = f.read()\r\n try:\r\n header, width, height, maxval = re.search(\r\n b\"(^P5\\s(?:\\s*#.*[\\r\\n])*\"\r\n b\"(\\d+)\\s(?:\\s*#.*[\\r\\n])*\"\r\n b\"(\\d+)\\s(?:\\s*#.*[\\r\\n...
[ "0.7882815", "0.78302854", "0.78165174", "0.7815141", "0.7680888", "0.6566936", "0.6272488", "0.5984253", "0.5881808", "0.5876467", "0.5760798", "0.5740723", "0.5701374", "0.56762946", "0.56726205", "0.5660868", "0.56574863", "0.56346875", "0.56280553", "0.56280553", "0.56077...
0.715021
5
Reads a PPM file from a buffer. Returns a numpy array of the appropiate size and dtype.
def read_ppm(ppm_file): p6, width, height, depth = ppm_file.readline().split() assert p6 == b'P6' assert depth == b'255', "Only 8-bit PPM files are supported" width, height = int(width), int(height) data = np.fromfile(ppm_file, dtype=np.uint8, count=width * height * 3) return data.reshape(h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self) -> np.array:\n return self._stream.read(self._frame_size)", "def read_pgm(filename, byteorder='>'):\r\n with open(filename, 'rb') as f:\r\n buffer = f.read()\r\n try:\r\n header, width, height, maxval = re.search(\r\n b\"(^P5\\s(?:\\s*#.*[\\r\\n])*\"\r\n ...
[ "0.61755115", "0.61528605", "0.6139092", "0.6081763", "0.60789406", "0.6051144", "0.604864", "0.6045761", "0.59491885", "0.58857787", "0.58505267", "0.58324033", "0.5755417", "0.57511765", "0.57399076", "0.5726785", "0.56785226", "0.5640779", "0.56272167", "0.5597772", "0.558...
0.6603281
0
Closes the output writer object.
def Close(self): return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n self.output.close()", "def close(self):\n self.out_file.close()", "def close(self):\r\n if self.__writer is not None:\r\n self.__writer.close()", "def close(self):\n self.file_out.close()", "def close(self):\n self._closed = True\n sel...
[ "0.7876922", "0.76582605", "0.76430863", "0.76274985", "0.74859744", "0.73995525", "0.73909664", "0.7373782", "0.72184306", "0.7055909", "0.7055909", "0.70288664", "0.6933643", "0.67121214", "0.6678854", "0.6668728", "0.6644544", "0.6644544", "0.6644544", "0.66031075", "0.655...
0.0
-1
Return the potential energy.
def get_energy(system, positions, vecs): integrator = ommtoolsints.LangevinIntegrator(293.15 * kelvin, 1./picoseconds, 2. * femtoseconds) platform = mm.Platform.getPlatformByName('CPU') #platform = mm.Platform.getPlatformByName('CUDA') #properties = {"CudaPrecision": "mixed","DeterministicForces": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_energy(self):\n return self.momentum*self.momentum/(2*self.mass)", "def potentialEnergy(self):\n return 0.5*(pdist(self.positions)**2).sum()", "def energy(self):\n return self._energy", "def getEnergy(self):\n if not hasattr(self,\"energy\"):\n self.energy = self.calcEner...
[ "0.82961226", "0.82369137", "0.81954014", "0.81777704", "0.8151151", "0.8098764", "0.8058423", "0.78822935", "0.78822935", "0.7867067", "0.77782136", "0.7755857", "0.7683", "0.7651369", "0.7646459", "0.7643782", "0.762068", "0.75591534", "0.7538006", "0.7522285", "0.751813", ...
0.65472907
79
Return the potential energy.
def get_energy_vac(system, positions): integrator = ommtoolsints.LangevinIntegrator(293.15 * kelvin, 1./picoseconds, 1.5 * femtoseconds) platform = mm.Platform.getPlatformByName('CPU') #platform = mm.Platform.getPlatformByName('CUDA') #properties = {"CudaPrecision": "mixed","DeterministicForces": "true...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_energy(self):\n return self.momentum*self.momentum/(2*self.mass)", "def potentialEnergy(self):\n return 0.5*(pdist(self.positions)**2).sum()", "def energy(self):\n return self._energy", "def getEnergy(self):\n if not hasattr(self,\"energy\"):\n self.energy = self.calcEner...
[ "0.82961226", "0.82369137", "0.81954014", "0.81777704", "0.8151151", "0.8098764", "0.8058423", "0.78822935", "0.78822935", "0.7867067", "0.77782136", "0.7755857", "0.7683", "0.7651369", "0.7646459", "0.7643782", "0.762068", "0.75591534", "0.7538006", "0.7522285", "0.751813", ...
0.0
-1
Return all intermediate classes in the OO hierarchy between a base class and a child class.
def get_intermediate_classes(cls, baseclass): classes = inspect.getmro(cls) classes = [c for c in classes if issubclass(c, baseclass)] return classes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inheritors(cls):\n subclasses = set()\n work = [cls]\n while work:\n parent = work.pop()\n for child in parent.__subclasses__():\n if child not in subclasses:\n subclasses.add(child)\n work.append(child)\n return subclasses", "def get_flatten...
[ "0.7109746", "0.69800186", "0.6968653", "0.69393426", "0.688384", "0.6852891", "0.68512887", "0.6729698", "0.672655", "0.672655", "0.6705842", "0.6689559", "0.66292167", "0.66153485", "0.65970963", "0.65906024", "0.6576864", "0.6543348", "0.6526739", "0.6444503", "0.6393157",...
0.80265903
0
Force the dtype of a Numpy array.
def enforce_dtype(arr, dtype, msg=""): if isinstance(arr, np.ndarray): if arr.dtype is not np.dtype(dtype): log_debug("enforcing dtype for array %s %s" % (str(arr.dtype), msg)) return np.array(arr, dtype) return arr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_correct_dtype(obj: ndarray, required_dtype: dtype) -> ndarray:\n if obj.dtype != required_dtype:\n return obj.astype(required_dtype)\n return obj", "def astype(self, dtype):\n return NoneArray", "def _align_np_datatype_for_array(array):\n return np.asarray(...
[ "0.734198", "0.7236896", "0.68527764", "0.6731046", "0.67098457", "0.66050994", "0.6594981", "0.65857", "0.65223205", "0.649347", "0.64351606", "0.63843495", "0.63548666", "0.62604666", "0.62512547", "0.6219558", "0.6175291", "0.61296684", "0.61294705", "0.6113247", "0.611181...
0.80169976
0
Returns the existing activities in the dataset
def get_activity_names(self) -> np.ndarray: return self.activity_names
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_activities():\n pass", "def activities(self):\n return self._activities", "def activities_list(self):\n self.__load_activities_from_file_into_memory()\n return self._activities_list", "def get_activities(cls):\n objs = cls.objects\n return objs", "def get_all_a...
[ "0.68924093", "0.6727489", "0.6584638", "0.6583916", "0.6479117", "0.6453023", "0.63524395", "0.63281494", "0.6162515", "0.61385804", "0.61243606", "0.60838455", "0.603094", "0.6007442", "0.59912026", "0.5989472", "0.5970199", "0.5914953", "0.59073955", "0.588997", "0.588997"...
0.5460391
45
Gets all annotations in the dataset for person_id.
def get_annotations_for_person(self, person_id: int) -> np.ndarray: return self._get_annotations_for_person_or_pose(person_id, np.array(['personAIK']))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_annotations(self, img_id):\n return self._img_id2annotations.get(img_id, [])", "def get_annotations_for_pose(self, person_id: int) -> np.ndarray:\n return self._get_annotations_for_person_or_pose(person_id, np.array(['poseAIK']))", "def _get_annotations_for_person_or_pose(self, person_id:...
[ "0.7283473", "0.6931183", "0.60483617", "0.5919022", "0.59092623", "0.5863266", "0.582435", "0.5730702", "0.57007235", "0.5689479", "0.5593741", "0.5568821", "0.55031407", "0.5500018", "0.5488362", "0.5390084", "0.5380493", "0.53783077", "0.53763396", "0.5351678", "0.5323104"...
0.79616636
0
Gets all annotations in the dataset for object_id.
def get_annotations_for_static_object(self, object_id: int) -> np.ndarray: obj_types = np.array(['boxAIK', 'cylinderAIK']) return self._get_annotations_for_object(object_id, obj_types, 'oid', self.objects)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_annotations(self, img_id):\n return self._img_id2annotations.get(img_id, [])", "def get_annotations(self, table_name: str, annotation_ids: List[int]) -> List[dict]:\n schema_type, AnnotationModel = self._load_model(table_name)\n\n annotations = (\n self.db.cached_session.q...
[ "0.7204596", "0.62409747", "0.6171715", "0.60870063", "0.60335135", "0.60151005", "0.5966823", "0.5937761", "0.59073126", "0.5886071", "0.5885667", "0.5789478", "0.57882005", "0.57396215", "0.55897474", "0.5585669", "0.5580272", "0.55516505", "0.54900205", "0.5445665", "0.537...
0.65862995
1
Given a tensor `events`, returns a tensor of shape `events.shape + [t]` representing the events distributed over a number of days given geometric waiting times with rate `1exp(ratedelta_t)`
def distribute_geom(events, rate, delta_t=1.0): events = tf.convert_to_tensor(events) rate = tf.convert_to_tensor(rate, dtype=events.dtype) accum = tf.TensorArray(events.dtype, size=0, dynamic_size=True) prob = 1.0 - tf.exp(-rate * delta_t) def body(i, events_, accum_): rv = tfd.Binomial(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_events(events, m, t, x, x_star):\n x = _maybe_expand_dims(x)\n indices = tf.stack([m, t, x], axis=-1)\n return tf.tensor_scatter_nd_add(events, indices, x_star)", "def impute_previous_cases(events, rate, delta_t=1.0):\n prev_case_distn = distribute_geom(events, rate, delta_t)\n prev_cases...
[ "0.6078214", "0.57174695", "0.56239456", "0.56107354", "0.5519008", "0.54515976", "0.5427955", "0.542372", "0.5394646", "0.5381155", "0.5363696", "0.5335728", "0.5330652", "0.52554613", "0.5235844", "0.5168141", "0.5163216", "0.51197255", "0.5118513", "0.51020485", "0.5089668...
0.7406817
0
Return the value of the item at the given zerobased index.
def value_for_index(self, index): return self[self.keyOrder[index]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getvalue(self, index):\n self._checkIndex(index)\n return self._items[index].value", "def get_value_by_index(self, index):\n return self['value'][index]", "def __getitem__(self, index):\n return self._value_at(index)", "def __getitem__(self, index):\n return self._value...
[ "0.73438966", "0.7281908", "0.72488445", "0.72488445", "0.7071867", "0.695808", "0.6907054", "0.6864854", "0.6856327", "0.684803", "0.6821447", "0.6814487", "0.6814487", "0.679285", "0.672452", "0.6719746", "0.6697979", "0.66781926", "0.66781926", "0.6617415", "0.65809214", ...
0.7477075
0
Insert the key, value pair before the item with the given index.
def insert(self, index, key, value): if key in self.keyOrder: n = self.keyOrder.index(key) del self.keyOrder[n] if n < index: index -= 1 self.keyOrder.insert(index, key) super(OrderedDict, self).__setitem__(key, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, index, key, value):\n if key in self:\n # FIXME: efficiency?\n del self[key]\n self._sequence.insert(index, key)\n dict.__setitem__(self, key, value)", "def insert(self, index, item):\n if index > len(self):\n raise IndexError\n ...
[ "0.69674695", "0.6943475", "0.6937621", "0.6772289", "0.6730931", "0.670674", "0.66812706", "0.66451156", "0.6634304", "0.65667045", "0.65272844", "0.65228355", "0.6520801", "0.65146816", "0.64908504", "0.6486916", "0.6427265", "0.6421421", "0.6381325", "0.6378343", "0.635956...
0.7027692
0
Return a copy of this object.
def copy(self): # This way of initializing the copy means it works for subclasses, too. obj = self.__class__(self) obj.keyOrder = self.keyOrder[:] return obj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n return self.__copy__()", "def copy(self):\n return self.__copy__()", "def copy(self):\n return self.__copy__()", "def copy(self):\n return self.__copy__()", "def copy(self):\n return copy(self)", "def copy(self):\n return copy(self)", "def __c...
[ "0.9166268", "0.9166268", "0.9166268", "0.9166268", "0.9104144", "0.9104144", "0.9066833", "0.9055192", "0.9055192", "0.9055192", "0.9055192", "0.9055192", "0.9055192", "0.9055192", "0.9055192", "0.9055192", "0.9055192", "0.9055192", "0.9055192", "0.9055192", "0.9055192", "...
0.0
-1
Return the number of combinations possable by choosing two of m elements without replacement and without considering ordering.
def _two_of_m(m): return (m * (m - 1) / 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combination(num_m: int, num_n: int) -> int:\n if num_m < num_n:\n return 0\n\n tmp_m = 1\n tmp_n = 1\n tmp_cnt = 0\n for i in range(num_n, 0, -1):\n tmp_n *= i\n tmp_m *= num_m - tmp_cnt\n tmp_cnt += 1\n\n return tmp_m / tmp_n", "def count_pairs(assignments, v1, ...
[ "0.69126", "0.6602199", "0.65106493", "0.6497087", "0.6265915", "0.61492527", "0.60328764", "0.6028228", "0.60239863", "0.5964268", "0.59460795", "0.59346706", "0.5905678", "0.5899173", "0.58940184", "0.5851157", "0.5827089", "0.58136874", "0.58136755", "0.57756853", "0.57280...
0.0
-1
Create a Flask application instance. Initializes the database, app routes, and extensions.
def create_app(db_uri: str="sqlite://"): app = Flask('featuresreq') # Intialize the datbase engine = create_engine(db_uri) session_factory.configure(bind=engine) session = flask_scoped_session(session_factory, app) app.session = session # Register blueprints app.register_blueprint(bp) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app() -> Flask:\r\n app = Flask(__name__.split('.')[0])\r\n init_config(app)\r\n app.register_blueprint(observer)\r\n app.teardown_appcontext(close_db)\r\n app.cli.add_command(init_db)\r\n\r\n return app", "def create_app():\n app = Flask(__name__, instance_relative_config=False)\...
[ "0.8864816", "0.87129503", "0.86492044", "0.86349326", "0.8504186", "0.8496298", "0.8484657", "0.8420806", "0.84205586", "0.8353178", "0.83314204", "0.8323793", "0.8321447", "0.83187675", "0.8311512", "0.8302713", "0.8298307", "0.82818073", "0.8230951", "0.8229181", "0.820392...
0.74890566
91
Apply Tensorflow 2 non max suppression to input bounding boxes
def apply_tf_nms(boxes, pred_conf): return tf.image.combined_non_max_suppression( boxes=tf.reshape(boxes, (tf.shape(boxes)[0], -1, 1, 4)), scores=tf.reshape( pred_conf, (tf.shape(pred_conf)[0], -1, tf.shape(pred_conf)[-1])), max_output_size_per_class=50, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yolo_non_max_suppression(scores, boxes, classes, max_boxes=10, iou_threshold=0.5):\r\n\r\n # max_boxes_tensor = tf.Variable(max_boxes, dtype=tf.int32) # tensor to be used in tf.image.non_max_suppression()\r\n # tf.InteractiveSession().run(tf.variables_initializer([max_boxes_tensor])) # initialize varia...
[ "0.74641895", "0.71254975", "0.70750093", "0.69527495", "0.67119867", "0.6696494", "0.65992266", "0.6566002", "0.6534063", "0.64163065", "0.6383682", "0.6353099", "0.6342272", "0.6326537", "0.63184595", "0.6262337", "0.6221877", "0.62161654", "0.6189106", "0.617225", "0.61629...
0.72928864
1
This should be overridden by children classes to return the filename to use to read movies.
def movies_filename(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getfilename(self):\n pass", "def get_filename(self) -> str:\n return self._filename", "def get_filename(self):\n return self.filename", "def get_file_name(self):\n\n return \"%s - %s\" % (self.get_tags()[\"artist\"], self.get_tags()[\"title\"])", "def get_filename(self):\n ...
[ "0.7398745", "0.73790425", "0.73643404", "0.72513485", "0.72301406", "0.7203764", "0.71937746", "0.71651876", "0.71456903", "0.71153426", "0.7090417", "0.7077128", "0.70428646", "0.70395607", "0.7005871", "0.69998777", "0.69702506", "0.69543505", "0.6937576", "0.6910285", "0....
0.83931077
0
This should be overridden by children classes to return the filename to use to read ratings.
def ratings_filename(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getfilename(self):\n pass", "def get_filename(self):\n return self.filename", "def get_filename(self) -> str:\n return self._filename", "def get_filename(self):\n return self.__filename", "def get_filename(self):\n return self._filename", "def get_file_name(self):\...
[ "0.7192776", "0.71556866", "0.7154176", "0.7025814", "0.6998298", "0.6915408", "0.6903019", "0.68891543", "0.68750715", "0.6872113", "0.68404776", "0.6812383", "0.6788013", "0.67480314", "0.6724658", "0.6724658", "0.6724658", "0.6724658", "0.67213297", "0.66860366", "0.667575...
0.8725029
0
This should be overridden by children classes to parse a movie from a line and return it.
def parse_movie(self, line): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_movie(self, res):\n url = res.css(SELECTORS['MOVIE_URL'])\n obj = {\n 'id': int(url.re_first(r'[/]([0-9]{1,})[/]')),\n 'title': SelectHelper.get(res, SELECTORS['MOVIE_TITLE']),\n 'description': SelectHelper.get(res, SELECTORS['MOVIE_DESCRIPTION'])[12:-10],\n...
[ "0.6387435", "0.6120936", "0.61202943", "0.60389423", "0.60172844", "0.6012354", "0.5943656", "0.59023505", "0.5879923", "0.5878867", "0.5870217", "0.5848541", "0.5848541", "0.5848541", "0.5848541", "0.5794223", "0.57505584", "0.57185733", "0.563105", "0.55872154", "0.5573334...
0.8592133
0
Initializer for node pool. Does not open the pool, only retains input parameters.
def __init__(self, name: str, genesis_txn_path: str) -> None: self._name = name self._genesis_txn_path = genesis_txn_path self._handle = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, pool_size: float = 10):\n self.pool_size = pool_size", "def __init__(self, pool_size):\n \n self.pool_size=pool_size;", "def __init__(self, pool_size=2, stride=None):\n super().__init__()\n self.pool_size = pool_size\n self.stride = stride\n if se...
[ "0.7567512", "0.7553433", "0.6896879", "0.6885336", "0.68584174", "0.6829333", "0.6774752", "0.67606515", "0.6744467", "0.6739918", "0.66863745", "0.6611018", "0.64783436", "0.64189196", "0.6410254", "0.6361048", "0.6354997", "0.6338873", "0.63126683", "0.6308491", "0.6303226...
0.0
-1
Accessor for pool name
def name(self) -> str: return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def NodePoolName(name: str) -> str:\n # GKE (or k8s?) requires nodepools use alphanumerics and hyphens\n # AKS requires full alphanumeric\n # PKB likes to use underscores strip them out.\n return name.replace('_', '')", "def pool(self):\n return self._properties.get('pool')", "def pool_id ( self ):\...
[ "0.7230252", "0.713655", "0.71272075", "0.6785171", "0.6658147", "0.6654709", "0.6631888", "0.6601361", "0.65984225", "0.6591371", "0.6591371", "0.6547778", "0.6547778", "0.6547778", "0.6547778", "0.6545763", "0.65368193", "0.6535247", "0.6535247", "0.6535247", "0.6531866", ...
0.0
-1
Return representation for current object.
def __repr__(self) -> str: return 'NodePool({}, {})'.format(self.name, self.genesis_txn_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_representation(self) -> str:\n raise NotImplementedError()", "def __repr__(self) -> str:\n\n return self.current_obj.__repr__()", "def __repr__(self):\n return json.dumps(self.__dict__)", "def __repr__(self):\n return str(self.__dict__)", "def __repr__(self):\n ret...
[ "0.80542994", "0.8040967", "0.79252005", "0.79175144", "0.79175144", "0.79175144", "0.79175144", "0.79175144", "0.79071766", "0.79002875", "0.7868935", "0.77954245", "0.7734382", "0.7710775", "0.7710775", "0.7710775", "0.7710775", "0.7710775", "0.7710775", "0.7710775", "0.771...
0.0
-1
Accessor for wallet name
def wallet_name(self) -> str: return self._wallet_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_wallet(self, name):\n\t\treturn self.wallets[name]", "def get_name():\n\n return character['Name']", "def name(self) -> str:\n return self.data['name']", "def account_name(self) -> str:\n return pulumi.get(self, \"account_name\")", "def account_name(self) -> str:\n return pu...
[ "0.77427226", "0.6718226", "0.6708497", "0.6689303", "0.6689303", "0.6688701", "0.6655749", "0.66505826", "0.6643012", "0.6643012", "0.6643012", "0.66425145", "0.6638093", "0.6629078", "0.6629078", "0.6629078", "0.6629078", "0.6629078", "0.6599864", "0.6599864", "0.6599864", ...
0.8419409
0
Accessor for wallet handle
def wallet_handle(self) -> int: return self._wallet_handle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def walletlock(self):\n return self.proxy.walletlock()", "def get_wallet(self, walletId):\n return", "def get_wallet(self, name):\n\t\treturn self.wallets[name]", "def wallet_name(self) -> str:\n\n return self._wallet_name", "def wallet_config(self) -> str:\n\n return self._wall...
[ "0.69949424", "0.6845608", "0.6421383", "0.596003", "0.5641318", "0.5636758", "0.55355173", "0.54145604", "0.54145604", "0.54145604", "0.54093844", "0.53792095", "0.53165895", "0.5312714", "0.5310474", "0.5305216", "0.53036296", "0.53033197", "0.5299107", "0.5282296", "0.5275...
0.80446714
0
Accessor for wallet config json
def wallet_config(self) -> str: return self._wallet_config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config_on_json(self):\n # load section CONFIG from data\n try:\n return self.json_data[\"CONFIG\"]\n except:\n constant.get_error(constant.ERROR_004)", "def getConfig(self, config):\n\n with open('./config.json', 'r') as json_file:\n try:\n ...
[ "0.6896499", "0.6693275", "0.6680588", "0.65594125", "0.6555666", "0.6531256", "0.65311146", "0.6518176", "0.6294957", "0.62885386", "0.628787", "0.628787", "0.628787", "0.628787", "0.628787", "0.628787", "0.628787", "0.628787", "0.628787", "0.628787", "0.628787", "0.628787...
0.72276586
0
Explicit entry. Opens wallet and stores agent DID in it. For use when keeping agent open across multiple calls.
async def open(self) -> 'BaseAgent': try: await wallet.create_wallet( pool_name=self.pool.name, name=self.wallet_name, xtype=None, config=self.wallet_config, credentials=None) except IndyError as e: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wallet_open(name):\r\n return make_request({\"method\": \"wallet_open\",\r\n \"params\": [name],\r\n \"jsonrpc\": \"2.0\",\r\n \"id\": 0, })", "def create_wallet(self):\n\n child = pexpect.spawn('node createKeystore', cwd='../s...
[ "0.6271924", "0.54222405", "0.5420585", "0.5410245", "0.53995264", "0.51367325", "0.51290125", "0.50276726", "0.49604082", "0.49499637", "0.4935299", "0.49343544", "0.49130282", "0.47957247", "0.47585753", "0.47352773", "0.47265455", "0.47110498", "0.46962783", "0.46903977", ...
0.6725488
0
Return representation for current object.
def __repr__(self) -> str: return 'BaseAgent({}, {}, {}, {})'.format( repr(self.pool), '[SEED]', self.wallet_name, self.wallet_config)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_representation(self) -> str:\n raise NotImplementedError()", "def __repr__(self) -> str:\n\n return self.current_obj.__repr__()", "def __repr__(self):\n return json.dumps(self.__dict__)", "def __repr__(self):\n return str(self.__dict__)", "def __repr__(self):\n ret...
[ "0.80542994", "0.8040967", "0.79252005", "0.79175144", "0.79175144", "0.79175144", "0.79175144", "0.79175144", "0.79071766", "0.79002875", "0.7868935", "0.77954245", "0.7734382", "0.7710775", "0.7710775", "0.7710775", "0.7710775", "0.7710775", "0.7710775", "0.7710775", "0.771...
0.0
-1
Return representation for current object.
def __repr__(self) -> str: return 'ListeningAgent({}, {}, {}, {}, {}, {})'.format( repr(self.pool), '[SEED]', self.wallet_name, self.wallet_config, self.host, self.port)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_representation(self) -> str:\n raise NotImplementedError()", "def __repr__(self) -> str:\n\n return self.current_obj.__repr__()", "def __repr__(self):\n return json.dumps(self.__dict__)", "def __repr__(self):\n return str(self.__dict__)", "def __repr__(self):\n ret...
[ "0.80542994", "0.8040967", "0.79252005", "0.79175144", "0.79175144", "0.79175144", "0.79175144", "0.79175144", "0.79071766", "0.79002875", "0.7868935", "0.77954245", "0.7734382", "0.7710775", "0.7710775", "0.7710775", "0.7710775", "0.7710775", "0.7710775", "0.7710775", "0.771...
0.0
-1
Returns the mean and scale of the process evaluated at x_t
def mean_scale(self, x: torch.Tensor): return self._mean_scale(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mean_scale(self, x: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]:\n\n return self.f(x, *self.theta_vals), self.g(x, *self.theta_vals)", "def call(self, x, s):\n \n x = self.base(x)\n \n disp = self.disp_layer(x)\n mean = self.mean_layer(x)\n mean = self...
[ "0.70516026", "0.649264", "0.6477257", "0.6312108", "0.623467", "0.61698043", "0.6156751", "0.6137195", "0.6115943", "0.61023885", "0.60908645", "0.6078424", "0.60747623", "0.60681087", "0.60525423", "0.6043662", "0.59880596", "0.5979855", "0.5931117", "0.5907981", "0.5891152...
0.6867915
1
Returns the Frobenius reciprocal of an element. As a remainder, the Frobenius automorphism is `a > a^q` where `q` is the characteristic of the field. In prime fields, it is the identity.
def frobenius_reciprocal(self, a: 'PFElement') -> 'PFElement': assert a in self return a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reciprocal(self):\n return Rational(self.denominator, self.numerator)", "def reciprocal(self):\r\n s, e = self.share\r\n s = 0.5*(1/s) # TODO: no normalization for 1/s as 1/2<=abs(s)<=1 (s<0 test still needed)\r\n return type(self)((s, 1-e))", "def basis(A):\n if A.is_cuda:\n ...
[ "0.6770539", "0.65622467", "0.65508735", "0.6356076", "0.63482386", "0.62424356", "0.6203062", "0.61736226", "0.61703086", "0.6116172", "0.6089416", "0.60502076", "0.5923548", "0.5922275", "0.59153455", "0.5875363", "0.58497953", "0.57106465", "0.5702368", "0.56644934", "0.56...
0.7797848
0
Return the nth power of an element
def pow(self, a: 'PFElement', n: int) -> 'PFElement': res = power(a, n) if not isinstance(res, PFElement): return self.element(res) else: return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ipow__(self,n):\r\n\t\t\r\n\t\treturn self.power(n)", "def power(x, n):\n power = 1\n for i in range(abs(n)):\n power = multiply(power, x) \n return power", "def __pow__(self,n):\r\n\t\t\r\n\t\t# take power\r\n\t\tp = self.power(n)\r\n\t\t\r\n\t\treturn p", "def _pow_(self, n):\n ...
[ "0.7919603", "0.758965", "0.7519912", "0.7519835", "0.751193", "0.7511862", "0.7401777", "0.7365514", "0.73583704", "0.7314706", "0.7217489", "0.7191074", "0.7191074", "0.7126871", "0.712552", "0.7123431", "0.7120525", "0.7109957", "0.70600134", "0.7029073", "0.6969186", "0...
0.7510821
6
Function to instantiate, configure, and return a flask app
def create_app(register_blueprints=True): app = Flask(__name__, instance_relative_config=True) app.config.from_object('app.default_config') # default config # app.config.from_pyfile('application.cfg.py') # server config file, do not include in versioning db.init_app(app) api = Api(app) api.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app():\n return create_app()", "def app(self):\n\n ## set flask specific things that are non-optional\n error = lambda k: 'Fatal: You need to specify a \"flask\" section ' + \\\n 'with an entry like \"'+k+'=...\" in your .ini file'\n try: app_name = self['flask.app']\n...
[ "0.827247", "0.826697", "0.82615703", "0.82501507", "0.81916094", "0.8161381", "0.8141996", "0.8127513", "0.8081894", "0.80553764", "0.8051946", "0.80443096", "0.80312896", "0.8028822", "0.80127865", "0.79866976", "0.79858017", "0.79766065", "0.7956358", "0.7953329", "0.79357...
0.7563493
76
Shortcut for right interpolation along last axis.
def right(arg0, out=None): basis = arg0.domain.bases[-1] return basis.Interpolate(arg0, 'right', out=out)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _increment_dims_right(self, axis: int = None):\n if axis is None:\n axis = self.last_used\n self.set_current_step(axis, self.current_step[axis] + 1)", "def interpolate(self):\n interp = (\n self._get_ticks() - self._last_update\n ) / self._tick_step / self.di...
[ "0.5709109", "0.5521624", "0.55132407", "0.5472422", "0.53939563", "0.53863585", "0.5334659", "0.5334624", "0.5294647", "0.5246538", "0.52454853", "0.5233195", "0.52330446", "0.52305794", "0.5211962", "0.518633", "0.5175911", "0.5098987", "0.5082492", "0.5081406", "0.5073751"...
0.7089297
0
Toggle comment approval Takes a comment, returns nothing. If input comment was unapproved, approve it (and vice versa). If auto_approve is enabled in Blog config and comment is approved, also add user to ApprovedCommentors, (or remove if unapproving).
def toggle_approval(comment): config = Blog.objects.first() auto_approve = config.auto_approve_previous_commentors if auto_approve: if comment.approved: # Toggling state for an approved comment, so we now remove commenter from ApprovedCommentors ApprovedCommentor.objects.fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_comment_approval(email, authenticated):\n\n config = Blog.objects.first()\n auto_approve = config.auto_approve_previous_commentors\n\n if authenticated or (auto_approve and ApprovedCommentor.objects.filter(email=email).exists()):\n return True\n else:\n return False", "def chang...
[ "0.64231104", "0.6205045", "0.6117601", "0.60638225", "0.5995413", "0.5849445", "0.58385134", "0.5685325", "0.562881", "0.5619963", "0.55937886", "0.55708194", "0.5557461", "0.5527482", "0.5521601", "0.5447916", "0.5435343", "0.540066", "0.5296182", "0.52908134", "0.5287771",...
0.8723851
0
sum over the first and last dimension
def sum_ft(tensor): return tensor.sum(dim=0).sum(dim=-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Sum2d(a):\n return(np.sum(np.sum(a,-1),-1))", "def sum(tensor, axis=None):\n raise NotImplementedError", "def acumsum (a,dimension=None):\r\n if dimension == None:\r\n a = N.ravel(a)\r\n dimension = 0\r\n if type(dimension) in [ListType, TupleType, N.ndarray]:\r\n dimen...
[ "0.68710095", "0.6797941", "0.67974305", "0.6642877", "0.6605728", "0.6571645", "0.6556174", "0.653974", "0.64990526", "0.6478147", "0.6469402", "0.64415735", "0.6398542", "0.6373295", "0.6370194", "0.6359853", "0.6337787", "0.6327468", "0.63148034", "0.63135606", "0.63009125...
0.6242158
23
Get dataset and split.
def get_dataset(test_envs, args, hparams, algorithm_class=None): is_mnist = "MNIST" in args.dataset dataset = vars(datasets)[args.dataset](args.data_dir, test_envs) # if not isinstance(dataset, MultipleEnvironmentImageFolder): # raise ValueError("SMALL image datasets are not implemented (corrupted...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split(self):\n return self.dataset_split", "def split_dataset(dataset):\n sequence = dataset.split()\n return sequence", "def split_dataset(dataset):\n sequence = dataset.split()\n return sequence", "def get_dataset(name, split, data_dir=\"~/tensorflow_datasets\"):\n assert split in...
[ "0.72593427", "0.71736807", "0.71736807", "0.7157121", "0.71311355", "0.70118904", "0.69803184", "0.69788635", "0.69257057", "0.68136704", "0.67288136", "0.671695", "0.6702674", "0.6687212", "0.6677986", "0.6677607", "0.66766286", "0.6627313", "0.6618925", "0.6607096", "0.657...
0.0
-1
Route to display homepage.
def show_homepage(): return flask.redirect("products.show_product_manager")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home_page():\n return redirect(url_for(_DEFAULT_ROUTE, _external=True))", "def homepage():\n return redirect('index.html')", "def home():\n logging.info('Entering route: HOME')\n\n logging.info('Rendering template: main.html')\n return render_template('main.html')", "def go_home(request):\...
[ "0.7695963", "0.757465", "0.7505735", "0.7478521", "0.7476132", "0.74183697", "0.7388712", "0.73708856", "0.7343081", "0.73186195", "0.73158234", "0.72681725", "0.72517675", "0.7218834", "0.7210733", "0.7210733", "0.7202022", "0.71813005", "0.71811754", "0.7176553", "0.717655...
0.0
-1
Get a random element from the collection.
def getRandom(self): return random.choice(self.vec)
{ "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.70404017", "0.7034526", "0.6959262", "0.69563407", "0.68719393", "0.68376184", "0.6797525", "0.670551", "0.6697882", "0.6692588", "0.6692588", "0.6692588", "0.6692588", "0.66815263", "0.66744214", "0.6673934", "0.66513956", "0.663908...
0.7044879
3
Returns a list of vertices on a grid of given size.
def grid(x, y): return product(xrange(1, x+1), xrange(1, y+1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vertices(size):\n return set(range(size))", "def create_grid(size):\n grid = []\n for i in range(size):\n row = ['0']*size\n grid.append(row)\n\n return grid", "def visualize(grid, board_size=16):\n visual_grid = []\n for i in range(board_size):\n row = []\n ...
[ "0.71124107", "0.6467387", "0.6334947", "0.632873", "0.63075143", "0.61781114", "0.614026", "0.6082376", "0.6079558", "0.6040731", "0.6022116", "0.6004428", "0.59677744", "0.5920226", "0.59015906", "0.59015906", "0.5873325", "0.58693814", "0.585959", "0.584969", "0.5838022", ...
0.0
-1
Construct a mask based on a PAD value.
def MakeMask(shape, masked_value=0, dtype=K.floatx(), name=None): def instantiate(x): if dtype is None: return layers.Lambda(lambda t: K.not_equal(x, masked_value), output_shape=shape, name=name)(x) else: retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_mask(data, pad):\n\n def subsequent_mask(size):\n \"\"\" helper function for creating the masks. \"\"\"\n attn_shape = (1, size, size)\n subsequent_mask = np.triu(np.ones(attn_shape), k=1).astype('uint8')\n return torch.from_numpy(subsequent_mask) == 0\n\...
[ "0.7099266", "0.70417815", "0.7022491", "0.65509915", "0.65141535", "0.6222334", "0.61554277", "0.61527115", "0.6124022", "0.59762055", "0.5941126", "0.5937045", "0.59208125", "0.59202766", "0.5912979", "0.5900908", "0.5778635", "0.5760395", "0.5737923", "0.57202756", "0.5710...
0.0
-1
Sample from a parameterised Gaussian.
def SampleFromGaussian(shape, noise_mean=0., noise_std=1., name='gaussian-sample'): def instantiate(args): mean, log_var = args return layers.Lambda(gaussian_noise(noise_mean=noise_mean, noise_std=noise_std), output_shape=shape, name=name)([m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussianOneSample(self, mu=0., sig=1., size=1):\n\n thisSample = np.random.normal(mu, sig, size)\n\n return thisSample", "def sample(self, like_params):\n\t\tassert len(like_params) == 1, f\"SphericalGaussianLikelihood only takes\"\\\n\t\t\t\t+ f\" a single parameter. Found {len(like_params)}.\...
[ "0.73114735", "0.7183519", "0.71437925", "0.7106215", "0.7059015", "0.7046213", "0.70200986", "0.68565154", "0.6846352", "0.6757162", "0.67570096", "0.6701206", "0.6687641", "0.6678025", "0.66675407", "0.6666644", "0.66191584", "0.6616942", "0.661104", "0.6589958", "0.6588056...
0.68975866
7
Constructs a Gaussian prior compatible with a certain shape.
def GaussianPrior(shape, fit_mean, fit_var, name='GaussianPrior'): units = shape[1] def instantiate(z): if fit_mean: # (B, M, dz) zero_mean = layers.Lambda(lambda t: K.zeros_like(t) + 0.001, output_shape=shape, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian_prior(self):\n self.prior = sps.multivariate_normal(self.m0,self.S0)", "def _prior_gaussian(self, x_start):\n batch_size = x_start.shape[0]\n t = torch.tensor([self.num_timesteps - 1] * batch_size, device=x_start.device)\n qt_mean, _, qt_log_variance = self.gaussian_q_mea...
[ "0.7171024", "0.6478126", "0.6150516", "0.61248827", "0.6102012", "0.6094694", "0.6052273", "0.6024488", "0.5947084", "0.5909421", "0.5880445", "0.5862553", "0.58507365", "0.5788119", "0.57820195", "0.57761735", "0.57751375", "0.5768134", "0.5762176", "0.57420564", "0.5702731...
0.6798445
1
Retrieve the game.js file for
def static(self, game_id, filename): #Get the game game = games.GAME_DICT[game_id] #Find the path to load path = os.path.join(game.static_folder, filename) #Check we are not going outside the static_folder prefix = os.path.commonprefix([path, game.static_folder]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_js_file(self):\n return 'placeholder'", "def newGame(self) -> None:\n self.save_location = f\"{DEFAULT_SAVE_LOCATION}/{DEFAULT_SAVE_NAME}\"\n\n with open(SAVE_TEMPLATE, \"r\") as f:\n return json.load(f)", "def path(self):\n return os.path.join(FLOWJS_PATH, self.f...
[ "0.59703255", "0.5895789", "0.5874125", "0.58686376", "0.58012676", "0.5795238", "0.5758818", "0.56823146", "0.5677972", "0.56740165", "0.5632275", "0.5614311", "0.5604094", "0.55745727", "0.55670005", "0.55670005", "0.55670005", "0.55513555", "0.5550584", "0.55473465", "0.55...
0.550705
22
Test whether input is array of strings.
def _is_string(data): return len(data) and isinstance(_to_ndarray(data).flat[0], str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_string_array(self):\n return self.type == Property.PropertyType.stringArray", "def is_tuple_consists_of_strings(an_array):\n return isinstance(an_array, tuple) and is_array_type(an_array, str)", "def _is_unicode(arr):\n if (isinstance(arr, str) or\n issubclass(numpy.asarray(arr)....
[ "0.7782466", "0.71527207", "0.7118267", "0.6953814", "0.6834709", "0.67807615", "0.6680941", "0.66704804", "0.6605762", "0.66032755", "0.6557859", "0.6551229", "0.65245986", "0.64705783", "0.6435208", "0.64306885", "0.64166236", "0.6381036", "0.6338534", "0.63199204", "0.6254...
0.74610054
1
Apply horizontal or vertical lines.
def _apply_plot(self, *args, cmap=None, values=None, **kwargs): # Deprecated functionality if cmap is not None: warnings._warn_proplot( 'Drawing "parametric" plots with ax.plot(x, y, values=values, cmap=cmap) ' 'is deprecated and will be removed in the next major release. Please ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_lines(self):\n self.center_lines()\n self.space_lines()", "def drawLines(self):\n\t\tintersections = [[], []]\n\t\tfor l in self.lines:\n\t\t\tif l.direction == 'v':\n\t\t\t\tif l.rtc:\n\t\t\t\t\tposition = l.coordinate + int((self.width - 1) / 2)\n\t\t\t\telse:\n\t\t\t\t\tposition = int(...
[ "0.67151994", "0.66699624", "0.65784156", "0.6463921", "0.62493426", "0.6233077", "0.62194836", "0.62175", "0.614987", "0.6148551", "0.6135928", "0.6100671", "0.60925776", "0.599403", "0.5976272", "0.597047", "0.59628004", "0.59613055", "0.5950573", "0.5922151", "0.59186125",...
0.0
-1