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
Updates the attribute updated_at with the current datetime
def save(self): self.updated_at = datetime.today() models.storage.save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at", "def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at", "def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at", "def save(...
[ "0.8296416", "0.8296416", "0.8296416", "0.77210957", "0.76277566", "0.76277566", "0.76277566", "0.76277566", "0.76277566", "0.76277566", "0.76277566", "0.76277566", "0.76277566", "0.76277566", "0.7403463", "0.7403463", "0.7403463", "0.72503334", "0.7243401", "0.712834", "0.70...
0.6322648
55
Returns a dictionary containing all keys/values of __dict__ of the instance
def to_dict(self): obj_dict = self.__dict__.copy() obj_dict['__class__'] = self.__class__.__name__ if "created_at" in obj_dict: obj_dict['created_at'] = obj_dict['created_at'].strftime(time) if "updated_at" in obj_dict: obj_dict['updated_at'] = obj_dict['updated_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_dict(self):\n return {k: v for k, v in vars(self).items()}", "def dict(cls):\n if cls._dict is None:\n cls._dict = {attr: getattr(cls, attr) for attr in cls.keys()}\n return cls._dict", "def dict(self):\n return self.__dict__", "def dict(self):\n return se...
[ "0.81226015", "0.80440646", "0.80298525", "0.80298525", "0.80298525", "0.80298525", "0.80298525", "0.80298525", "0.80298525", "0.8000097", "0.79895", "0.7900744", "0.7894605", "0.78834677", "0.7827142", "0.78186625", "0.7810879", "0.7778907", "0.7746202", "0.7722997", "0.7717...
0.0
-1
new_weight_variable(shape) > Tensorflow variable of the given shape Call this function instead of making the variable yourself so it gets tracked for model saving/loading. Uses Xavier initialization times 0.2, to make nearidentity transforms in residual blocks.
def new_weight_variable(self, shape): self.total_parameters += np.product(shape) # Scale down regular Xavier initialization because we're residual. stddev = 0.2 * (2.0 / np.product(shape[:-1]))**0.5 var = tf.Variable(tf.truncated_normal(shape, stddev=stddev)) self.parameters.appe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_weight_variable(shape):\n\n\tinitial = tf.truncated_normal(shape, stddev=0.1)\n\treturn tf.Variable(initial)", "def weight_variable(shape):\n initial = tf.truncated_normal(shape)\n return tf.Variable(initial)", "def weight_variable(shape):\r\n initial = tf.truncated_normal(shape, stddev=0.1)\r\n ...
[ "0.8203951", "0.8032488", "0.7994736", "0.7994736", "0.7994736", "0.79678893", "0.79634714", "0.796197", "0.7960938", "0.7960938", "0.7960938", "0.7960938", "0.7960938", "0.7960938", "0.7960938", "0.7960938", "0.7960938", "0.7960938", "0.7850183", "0.77009714", "0.76663965", ...
0.8515648
0
new_bias_variable(shape) > Tensorflow variable of the given shape See new_weight_variable's doc string.
def new_bias_variable(self, shape): self.total_parameters += np.product(shape) var = tf.Variable(tf.constant(0.0, shape=shape)) self.parameters.append(var) return var
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_bias_variable(shape):\n\tinitial = tf.constant(0.1, shape=shape)\n\treturn tf.Variable(initial)", "def bias_variable(shape):\r\n initial = tf.constant(0.1, shape=shape)\r\n return tf.Variable(initial)", "def bias_variable(shape):\r\n initial = tf.constant(0.1, shape=shape)\r\n return tf.Variable...
[ "0.8350253", "0.8140928", "0.8140928", "0.8140928", "0.8129761", "0.81218415", "0.81146175", "0.81146175", "0.81146175", "0.81146175", "0.81146175", "0.81146175", "0.81146175", "0.81146175", "0.81146175", "0.81146175", "0.8099164", "0.80975", "0.8061959", "0.8048311", "0.8030...
0.8096518
18
stack_nonlinearity() Update self.flow with the currently configured nonlinearity.
def stack_nonlinearity(self): self.flow = self.NONLINEARITY[0](self.flow)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_nonlinearity(self):\n # reproducible arbitrariness\n np.random.seed(1)\n\n N1 = 5\n N2 = 4\n N = 3\n\n dt = 1.0\n nsteps = 10\n tmax = nsteps*dt\n\n nonlin = lambda v: np.tanh(v)\n\n G1 = SimpleNeurons(N1)\n G2 = SimpleNeurons(N2)\n\n G1pattern = 1 + 2*np.random.randn(N...
[ "0.54182434", "0.52753675", "0.5014358", "0.5010284", "0.49993876", "0.49957225", "0.49200794", "0.49059096", "0.48781466", "0.486477", "0.47963938", "0.478261", "0.4767325", "0.4766994", "0.47378692", "0.47308987", "0.47159183", "0.4714516", "0.47101575", "0.4679491", "0.466...
0.85404706
0
Access a page that does not exist
def test_404_not_found(app, client): response = client.get("/notexistpage") assert response.status_code == 404 assert "404 Not Found" in str(response.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_such_page(self):\n path = '/no/such/page'\n with self.app.test_client() as client:\n client.get(path)\n self.assertContext('current_page', self.app.get_page(path))", "def page_not_found(e):\n return 'Sorry, Nothing at this URL.', 404", "def page_not_found(e):\n ...
[ "0.7534046", "0.7478333", "0.7478333", "0.7478333", "0.7478333", "0.7478333", "0.7478333", "0.7478333", "0.7478333", "0.7449267", "0.74483955", "0.74483955", "0.74483955", "0.74483955", "0.74483955", "0.74483955", "0.74483955", "0.7405953", "0.73512465", "0.7348351", "0.73423...
0.0
-1
Initialize the data set.
def __init__(self, model_inputs: list, model_outputs: list, **activations): assert all([type(input_seq) in (Tensor, np.ndarray) for input_seq in model_inputs]), "input_seqs has to be list of pytorch tensors" assert all([type(timestep) in (Tensor, np.ndarray) for activation_list in activations.values() f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.__dataset = None", "def __init__(self):\n self.data_set = []\n self.finalized_data = LogData()", "def _init_data(self, data):\n assert type(data) is dict, \"dict expected: %r\" % type(data)\n assert len(data) is 1, \"size of dict should be 1: %r\" %...
[ "0.7246609", "0.7137691", "0.7058578", "0.70542413", "0.69983727", "0.69341785", "0.69255835", "0.6914268", "0.68257856", "0.6786231", "0.67773956", "0.6771895", "0.6770875", "0.673227", "0.6675077", "0.6669931", "0.6640959", "0.66032535", "0.6598419", "0.65950245", "0.659502...
0.0
-1
set up the cell.
def __init__(self, num_units, input_size=None, nonlinearity=tf.nn.tanh, W_init=tf.random_normal_initializer(stddev=0.15), b_init=tf.constant_initializer(0.0, dtype=tf.float32), weightnorm=False): self._num_units = num_units self._input_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.cell = Cell()\n self.livingCell = Cell(True)\n self.deadCell = Cell(False)", "def setUp(self):\n self.gameBoard = Grid((100, 100), Cell)", "def constructCell():\n\t\tself.weightGenerate()", "def setUp(self):\r\n self.matrix = array(\r\n [[...
[ "0.7308226", "0.676752", "0.6632224", "0.65267813", "0.64325315", "0.6396964", "0.63474303", "0.6300818", "0.6227101", "0.6180828", "0.616189", "0.6097996", "0.6097996", "0.60465354", "0.60346377", "0.60346377", "0.602997", "0.6025616", "0.60184234", "0.599613", "0.59906274",...
0.0
-1
A residual network of n inputs and m outputs
def res_net(*inputs, **kwargs): inp_shapes = kwargs['inp_shapes'] out_shapes = kwargs['out_shapes'] params = kwargs['params'] layer_width = kwargs['layer_width'] nblocks = kwargs['nblocks'] block_size = kwargs['block_size'] output_args = kwargs['output_args'] ninputs = len(inp_shapes) noutputs = len(o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def residual(n_filters, input):\n shape = input.shape\n _, h, w, d = shape\n l1 = Conv2D(n_filters, (5, 5), padding='valid', activation='elu')(input)\n l2 = Conv2D(n_filters, (1, 1), padding='valid', activation='linear')(l1)\n l3 = Cropping2D(cropping=2)(input)\n added = Add()([l2, l3])\n retu...
[ "0.652352", "0.63960725", "0.63544977", "0.6305939", "0.63055587", "0.62190336", "0.62009865", "0.5987517", "0.5945513", "0.5939205", "0.588968", "0.58650285", "0.58614606", "0.5860717", "0.5857361", "0.58434176", "0.5825535", "0.5823314", "0.58177376", "0.5752803", "0.573166...
0.63786733
2
PNG representation of the image object for IPython. Returns In memory binary stream containing a PNG matplotlib image.
def _plt_to_png(self): import matplotlib.pyplot as plt from io import BytesIO with BytesIO() as file_obj: plt.savefig(file_obj, format='png') plt.close() # supress plot output file_obj.seek(0) png = file_obj.read() return png
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _repr_png_(self):\n mol = self.owner.mol\n keku = IPythonConsole.kekulizeStructures\n size = IPythonConsole.molSize\n opts = IPythonConsole.drawOptions\n return Draw._moltoimg(\n mol, size, self.aix, \"\", returnPNG=True, drawOptions=opts,\n kekulize=kek...
[ "0.76063955", "0.76063955", "0.72024304", "0.6839963", "0.67931193", "0.66697204", "0.6665794", "0.6601448", "0.6480137", "0.64575285", "0.64387643", "0.6420609", "0.64002985", "0.6397437", "0.63453823", "0.6312009", "0.62771016", "0.62767845", "0.6261737", "0.62594944", "0.6...
0.71542364
3
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion matrix") else: print('Confusion matrix, without normalization') plt.imshow(cm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8194862", "0.80949175", "0.8029915", "0.8019153", "0.79941195", "0.7991258", "0.7980955", "0.7976606", "0.79610753", "0.79590565", "0.79378676", "0.7934962", "0.7934504", "0.79313844", "0.7926313", "0.7924577", "0.79241234", "0.7923211", "0.7923023", "0.7921931", "0.791787...
0.78157204
90
Get user's home directory
def home_directory(self): out = self._call("GETHOMEDIRECTORY") return out.json()["Path"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_homedir():\n return os.path.expanduser(\"~\")", "def get_home_directory():\n \n try:\n directory=os.path.expanduser(\"~\")\n except EnvironmentError:\n directory=None\n \n return directory", "def _get_home():\n from os.path import expanduser\n home = expan...
[ "0.88848305", "0.88338107", "0.8777055", "0.8703801", "0.8641333", "0.85045415", "0.844312", "0.844312", "0.8367658", "0.83538747", "0.8352525", "0.8324852", "0.8210724", "0.81417465", "0.81253844", "0.78870016", "0.77941823", "0.7764308", "0.76718944", "0.73236984", "0.71853...
0.7685942
18
Requires an authenticated User to be logged in. Returns and redirects the client to blog/urls.py post_detail namespace route if a Post Model object data is located in the database using the primary key argument and the HTTP request is type post. Otherwise, returns the http request passed as an argument and blog/comment...
def add_comment_to_post(request, pk): post = get_object_or_404(Post, pk=pk) if request.method == 'POST': form = CommentForm(request.POST) if form.is_valid(): comment = form.save(commit=False) comment.post = post comment.save() return redirect('post...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, post_id):\n if not self.user:\n self.redirect(\"/login\")\n return", "def post(self, request, pk):\n\n post = Blog.objects.get(pk=int(pk))\n user_id = self.request.session.get('USER_ID')\n\n try:\n user = User.objects.get(pk=user_id)\n ...
[ "0.7207535", "0.69991153", "0.698315", "0.69428104", "0.67448294", "0.652649", "0.6462363", "0.6410865", "0.6410125", "0.6402617", "0.63764405", "0.6341394", "0.632828", "0.6301832", "0.6272302", "0.62517333", "0.615384", "0.61209065", "0.6118385", "0.6118213", "0.6118201", ...
0.5584956
85
Requires an authenticated User to be logged in. Returns and redirects the client to blog/urls.py post_detail namespace route after running the Comment class's approve function if a Comment Model object data is located in the database using the primary key argument.
def comment_approve(request, pk): comment = get_object_or_404(Comment, pk=pk) comment.approve() return redirect('post_detail', pk=comment.post.pk)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self):\n post_id = int(self.request.get('post_id'))\n post = Posts.get_by_id(post_id)\n comment = self.request.get('comment')\n submitter_id = self.get_active_user().key().id()\n\n if submitter_id:\n comment = Comments(post_id=post_id, content=comment,\n ...
[ "0.69840616", "0.69826704", "0.693177", "0.6726221", "0.6691116", "0.6506047", "0.6444186", "0.6382295", "0.63590306", "0.6339495", "0.6264761", "0.624302", "0.62418306", "0.6219866", "0.61213666", "0.605616", "0.60560226", "0.60325664", "0.6032038", "0.5987916", "0.59518987"...
0.7245028
0
Requires an authenticated User to be logged in. Returns and redirects the client to blog/urls.py post_detail namespace route using the instantiated Comment Model's Post Model primary key after running the Comment class's delete function if a Comment Model object data is located in the database using the primary key arg...
def comment_remove(request, pk): comment = get_object_or_404(Comment, pk=pk) post_pk = comment.post.pk comment.delete() return redirect('post_detail', pk=post_pk)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self):\n comment_id = int(self.request.get('comment_id'))\n post_id = self.request.get('post_id')\n comment = Comments.get_by_id(comment_id)\n if comment.submitter_id == self.get_active_user().key().id():\n comment.delete()\n else:\n error(403)\n\n ...
[ "0.73576534", "0.7224971", "0.7090542", "0.69870394", "0.68021595", "0.6777405", "0.67201716", "0.6683294", "0.66761184", "0.65762895", "0.6574789", "0.652644", "0.65202594", "0.65099466", "0.65032953", "0.6467067", "0.64184093", "0.63843405", "0.6360592", "0.63506943", "0.63...
0.69095355
4
write svg image to file.
def writeToFile(self, outfile): self.finalizePlot() kk = self.mElements.keys() kk.sort() kk.reverse() ## make sure the image size is ok min_x, min_y, max_x, max_y = 0, 0, 0, 0 for k in kk: for e in self.mElements[k]: for x in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_svg(string, file_name):\n file_handle = file(file_name, \"w\")\n file_handle.write(string)\n file_handle.close()", "def save(filename, canvas):\n data = write_svg.to_string(canvas).encode('utf-8')\n with gzip.open(filename, 'wb') as f:\n f.write(data)", "def save_as_svg(file_name...
[ "0.7582571", "0.74299157", "0.7339477", "0.7324265", "0.7196023", "0.6955805", "0.6924028", "0.69170725", "0.6837827", "0.6797053", "0.6786539", "0.6734499", "0.67318106", "0.6618196", "0.65872353", "0.6563173", "0.65619725", "0.652626", "0.650355", "0.6480696", "0.64463663",...
0.6736362
11
Retrieve current values of the RAMSTKCondition data model attributes.
def get_attributes(self): _attributes = { 'condition_id': self.condition_id, 'description': self.description, 'condition_type': self.cond_type } return _attributes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_state_attributes(self):\n if self.airly.data_available:\n if self.type == ATTR_CAQI_DESCRIPTION:\n self._attrs[ATTR_CAQI_ADVICE] = (self.airly.data\n [ATTR_CAQI_ADVICE])\n if self.type == ATTR_CAQI:\n self._attrs[ATTR_CAQI...
[ "0.6386308", "0.62919486", "0.618649", "0.5791889", "0.5778499", "0.57663786", "0.57146996", "0.5657344", "0.5657344", "0.5654857", "0.5643091", "0.5637182", "0.557624", "0.5530247", "0.55266535", "0.5516283", "0.5512417", "0.5508254", "0.55056083", "0.5504807", "0.54875106",...
0.5532082
13
Test that we get None if the peer did not exist.
def test_nonexistant_peer_status(self): status = self.pybird.get_peer_status("HAMSTER") self.assertEquals(status, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_peers_peerid_get(self):\n pass", "def test_peers_get(self):\n pass", "def test_get_peer_finished(self):\n server, client = loopback()\n\n assert server.get_peer_finished() is not None\n assert len(server.get_peer_finished()) > 0", "def peer(self) -> Optional[Microb...
[ "0.6992142", "0.6722471", "0.6348456", "0.6336912", "0.63149285", "0.61800516", "0.6118443", "0.60864395", "0.6052176", "0.60412437", "0.59487545", "0.5923891", "0.589042", "0.5803551", "0.58015877", "0.5766616", "0.5737624", "0.57334256", "0.57176846", "0.5652942", "0.563424...
0.74413157
0
Test that improper characters are removed from the peer_name field before it is sent to BIRD.
def test_cleans_peer_name(self): ps1_status = self.pybird.get_peer_status("PS1{\"'}") self.assertFalse(ps1_status['up'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_validate_party_info_name_is_empty_string(self):\n self.party_test_data[\"name\"] = \"\"\n response = validate_party_info(self.party_test_data)\n self.assertDictEqual(\n response, {\"message\": \"name can not be an empty string\", \"code\": 400})", "def test__check_invalid...
[ "0.58738524", "0.5852198", "0.5825089", "0.5814362", "0.56998473", "0.56782395", "0.56404686", "0.5633754", "0.56220657", "0.5603528", "0.5590778", "0.5590188", "0.5574394", "0.5566225", "0.5553455", "0.5526239", "0.5521892", "0.55050325", "0.549068", "0.54869825", "0.5471463...
0.7141904
0
Plot a scatter plot where each dot is a team with the team's 3 letter label written right next to the dot
def plot_team_scatter(df, xstat, ystat, title='None'): fig, ax = plt.subplots() ax.scatter(df[xstat], df[ystat]) for i, txt in enumerate(df['Tm']): ax.annotate(txt, (df[xstat][i], df[ystat][i])) if title != "None": plt.title(title) plt.xlabel(xstat) plt.ylabel(ystat) plt.sh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scatter_stats(league, title='', xlabel='', ylabel='', teams=None,\n get_x_stat=None, get_y_stat=None, annotate_teams=None):\n if teams is None:\n teams = league.teams\n if annotate_teams is None:\n annotate_teams = league.teams\n\n plot.title(title)\n plot.xlabel(xlab...
[ "0.6812625", "0.6743105", "0.6531064", "0.64944744", "0.6415196", "0.63348967", "0.6196487", "0.61582124", "0.61198574", "0.61119634", "0.60986495", "0.6062248", "0.60458124", "0.6023736", "0.5950862", "0.5949963", "0.58933526", "0.58924043", "0.5869602", "0.5867772", "0.5867...
0.76526475
0
Plot the scatter plot across all years for two stats
def plot_scatter_across_years(xstat, ystat, df): years_to_use = list(df) for curr_year in years_to_use[1:]: a = df[str(curr_year)][xstat].tolist() b = df[str(curr_year)][ystat].tolist() plt.scatter(a, b) plt.xlabel(xstat) plt.ylabel(ystat) plt.legend(years_to_use[1:]) plt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_plot(self):\n years = sorted(set(self.prediction_df_without_covid19['Year']))\n predict_without_covid_country = self.prediction_df_without_covid19[\n self.prediction_df_without_covid19['Country'].isin([self.country])].sort_values(['Year'],\n ...
[ "0.66461515", "0.6438722", "0.6437078", "0.6405757", "0.627282", "0.62554306", "0.61248636", "0.6069393", "0.60035396", "0.5929137", "0.59220064", "0.59144014", "0.58671606", "0.5847337", "0.58392614", "0.58094466", "0.5798916", "0.5792154", "0.5766323", "0.57558006", "0.5743...
0.83430797
0
This function plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues, save_tag=False): if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion matrix") else: print('Confusion matrix, withou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes,\n normalize=False,\n title='Confusion matrix',\n cmap=plt.cm.Blues):\n if normalize:\n #cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n cm = cm.astype('float') / np.sum(cm.ra...
[ "0.8256267", "0.82472974", "0.822455", "0.8177322", "0.8174471", "0.81567466", "0.8148295", "0.81454587", "0.8145165", "0.8141885", "0.8138667", "0.81362265", "0.8131238", "0.8126612", "0.81131643", "0.811115", "0.8105378", "0.81041294", "0.81027037", "0.810214", "0.8097235",...
0.0
-1
Return true if we should restore the controller parameters when moving around, false if not.
def restoreControllerParams(self): return not self._dontRestoreControllerParamsButton.IsSelected()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasMoved(self):\r\n if BLENDER_MODE == 'BGE':\r\n world_tranform = self.obj.worldTransform.copy()\r\n elif BLENDER_MODE == 'BPY':\r\n world_tranform = self.obj.matrix_world.copy()\r\n\r\n # if objed has not yet been checked\r\n if not self.old_worldTransform:\r...
[ "0.6366284", "0.59544945", "0.58794546", "0.5719422", "0.57073194", "0.5622991", "0.5621149", "0.5579589", "0.55767065", "0.5539895", "0.55398655", "0.5537871", "0.5507574", "0.55026066", "0.54981565", "0.54584724", "0.5435959", "0.5435064", "0.5413223", "0.5413074", "0.53998...
0.77243865
0
Connects to a given room If it does not exist it is created
def join_room(self, room_name): logging.debug('Joining room {ro}'.format(ro=room_name)) for room in self.rooms: if room.name == room_name: room.add_user(self) self._rooms[room_name] = room room.welcome(self) break ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self):\n logging.warning(\n \"IRC back-end does not support explicit creation, joining room \"\n \"instead to ensure it exists.\"\n )\n self.join()", "def create_room(self, roomName, client):\n if self.verify_chat_room_duplicate(roomName):\n ...
[ "0.7117074", "0.6697676", "0.665407", "0.6583649", "0.64713836", "0.6376527", "0.6329616", "0.6292388", "0.62888587", "0.6262977", "0.6257078", "0.6239324", "0.6222163", "0.61841077", "0.617656", "0.612379", "0.60993665", "0.6075479", "0.6015822", "0.6000852", "0.59890705", ...
0.63153857
7
View function for home page of site.
def index(request): # Generate counts of some of the main objects num_scores = Score.objects.all().count() num_gymnasts = Gymnast.objects.all().count() num_meets = Meet.objects.all().count() # If the form has been sumitted result = "" to_search = request.GET.get('to_search', False) # Search for a gymnast wit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(request):\n\treturn render(request, \"compta/home.html\")", "def home_page(request):\r\n return render(request, 'ez_main/home_page.html')", "def home(request):\r\n return render(request, 'home.html')", "def homepage(request):\n\treturn render(request, 'core/homepage.html')", "def homepage(req...
[ "0.8493426", "0.84268916", "0.83415145", "0.83306193", "0.82976943", "0.8295291", "0.8276345", "0.82545686", "0.82155704", "0.8132563", "0.81246215", "0.81224865", "0.8121264", "0.81049734", "0.8098485", "0.80935514", "0.80935514", "0.80935514", "0.80935514", "0.80935514", "0...
0.0
-1
View function for the About Us page.
def about_us(request): return render(request, 'about_us.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aboutus(request):\r\n\treturn render(request, 'aboutus.html')", "def about_us():\n\n return render_template('about_us.html')", "def about_page(request):\r\n return render(request, 'ez_main/about_page.html')", "def about_us():\r\n return render_template(\"about_us.html\")", "def about(request):\...
[ "0.88133746", "0.83975744", "0.8360016", "0.8350322", "0.8344725", "0.8341269", "0.8277018", "0.82615334", "0.82107615", "0.82085145", "0.8195455", "0.817416", "0.8169813", "0.81694794", "0.8148666", "0.8137287", "0.8133385", "0.812693", "0.8117471", "0.81136423", "0.8107338"...
0.8833261
0
Get the installed Dockercompose version info.
def get_compose_version() -> Union[version.LegacyVersion, version.Version]: output = subprocess.check_output( ["docker-compose", "version", "--short"], stderr=subprocess.DEVNULL, ) return version.parse(output.decode("utf8"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_docker_version() -> Union[version.LegacyVersion, version.Version]:\n output = subprocess.check_output(\n [\"docker\", \"version\", \"--format\", \"{{json .Client.Version }}\"],\n stderr=subprocess.DEVNULL,\n ).strip()\n return version.parse(output.strip(b'\"').decode(\"utf8\"))", "...
[ "0.6547908", "0.63790524", "0.63257056", "0.63220805", "0.63094187", "0.6301949", "0.626381", "0.61997867", "0.6195077", "0.6161262", "0.6121535", "0.60736066", "0.60734075", "0.6043213", "0.60423404", "0.60043657", "0.5963923", "0.59423757", "0.59282947", "0.5918141", "0.591...
0.7797596
0
Format python datetime types into strings
def format_datetime(value, format="datetime"): if format == "datetime": render_as = value.strftime("%d/%m/%Y %H:%M") elif format == "date": render_as = value.strftime("%d/%m/%Y") elif format == "time": render_as = value.strftime("%H:%M"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime_to_str(obj):\n return obj.strftime(\"%Y-%m-%d %H:%M:%S\")", "def date2str(datetime_object):\n if datetime_object is None:\n return 'None'\n return datetime_object.strftime('%Y-%m-%dT%H:%M:%S.%f')[0:-3]", "def date_to_str(obj: \"date\") -> str:\n return obj.isoformat(...
[ "0.72319007", "0.71678126", "0.7163447", "0.7126769", "0.71248275", "0.70787", "0.7075033", "0.7036151", "0.7026195", "0.70185643", "0.7005258", "0.7005258", "0.69901127", "0.6980623", "0.69399226", "0.6927468", "0.6892985", "0.68890756", "0.6833074", "0.6830153", "0.6830153"...
0.6793237
30
Format string literal timestamp into datetime values
def format_timestamp(value, format="datetime"): timestamp_pattern = "^(\d+)-(\d+)-(\d+)\s(\d+):(\d+).+$" m = re.search(timestamp_pattern, value) if format == "datetime": render_as = ( m.group(3) + "/" + m....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_datetime(timestamp):\n return f\"<!date^{int(timestamp)}^{{date_pretty}} at {{time}}| >\"", "def _convert_timestamp(timestamp):\n extract_time = re.match('(.*?\\+\\d{2}):(.*)', timestamp)\n formated = datetime.strptime('{}{}'.format(extract_time.group(1), extract_time.group(2)),\n ...
[ "0.73031723", "0.7269004", "0.7170645", "0.6980602", "0.69419897", "0.68628234", "0.6769738", "0.67527574", "0.67003655", "0.6676172", "0.66553104", "0.6647345", "0.6636271", "0.6629217", "0.65824103", "0.6572976", "0.6567703", "0.65479636", "0.654339", "0.654339", "0.654339"...
0.64816
23
Get all actions currently in the replay memory, ordered by time where they were taken.
def actions(self): return self._actions.getSlice(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_action_results(self,last_states,actions,time_i):\n return [],actions", "def actions(self) -> list:\n if self.debug: print(f\"AState.actions()\")\n if not self._examined:\n if self.debug: print(f\"\\tExamining...\")\n self._actions = self._generate_actions()\n ...
[ "0.67301214", "0.671101", "0.66853327", "0.6539089", "0.6326977", "0.6298561", "0.6248274", "0.6192698", "0.6170987", "0.613359", "0.6054944", "0.60507286", "0.60369116", "0.5973971", "0.59412193", "0.5917242", "0.5917242", "0.5917242", "0.5801654", "0.57904476", "0.574095", ...
0.6431041
4
Return corresponding states, actions, rewards, terminal status, and next_states for size randomly chosen transitions. Note that if terminal[i] == True, then next_states[s][i] == np.zeros_like(states[s][i]) for each subject s.
def randomBatch(self, size, use_priority): if (self._max_history_size - 1 >= self.n_elems): raise SliceError( "Not enough elements in the dataset to create a " "complete state. {} elements in dataset; requires {}" .format(self.n_elems, self._max_histo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_transitions(self) -> np.ndarray:\n return self.random_state.dirichlet(np.ones(self.n_states), size=self.n_states)", "def predict_next_state_gt(self, states, actions):\n # TODO: write your code here\n\n # return [self.env.get_nxt_state(states[i], actions) for i in range(self.num_pa...
[ "0.65251094", "0.6458037", "0.63135207", "0.6249557", "0.60649306", "0.599178", "0.5957742", "0.594834", "0.5907577", "0.58728576", "0.58723307", "0.58642846", "0.5863562", "0.58612037", "0.5859078", "0.58024526", "0.58008707", "0.57993567", "0.5778364", "0.5756351", "0.57427...
0.54313916
45
take 1D float array of rewards and compute discounted reward
def discount_rewards(self, r, epEnd): res = np.zeros_like(r) running_add = 0.0 assert (len(r)-1) in epEnd, 'simple sanity check: the last reward must be the episode end' assert isinstance(r, list) for t in reversed(xrange(len(r))): if t in epEnd: running_add = 0.0 # r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discount_rewards(rewards):\r\n discounted_r = np.zeros_like(rewards)\r\n running_add = 0\r\n for t in reversed(range(0, len(rewards))): \r\n running_add = running_add * reward_discount + rewards[t]\r\n discounted_r[t] = running_add\r\n return discounted_r", "def discoun...
[ "0.8100923", "0.78397125", "0.7792625", "0.7742053", "0.7653779", "0.75987715", "0.7583268", "0.75820553", "0.7579539", "0.7536054", "0.7519005", "0.75047183", "0.7467692", "0.7456702", "0.7433794", "0.7426565", "0.74062765", "0.73950297", "0.7370545", "0.73564714", "0.732851...
0.66732097
35
Return cleaned text with stopwords removed, no punctuation, and lemmatized.
def clean(text): lower_proper = src.utils.nlp.lower_with_proper(text) lemmas = src.utils.nlp.lemmatize(lower_proper) cleaned = src.utils.nlp.clean_stopwords_punctuation(lemmas) return cleaned
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_the_text(text):\n \n #Replace non-word characters with empty space\n text = re.sub('[^A-Za-z0-9\\s]', ' ', text)\n \n #Remove punctuation\n text = ''.join([word for word in text if word not in string.punctuation])\n \n #Bring text to lower case\n ...
[ "0.82906497", "0.8155066", "0.81481826", "0.77597165", "0.77013576", "0.76723295", "0.7657104", "0.7606486", "0.7593968", "0.7539862", "0.74192697", "0.74133056", "0.7370383", "0.7370383", "0.73591465", "0.7352032", "0.73072344", "0.7247446", "0.72407454", "0.7236175", "0.718...
0.83327425
0
Group the numpy array results relating to the same tensor, in the same list. Essentially, if feed_and_return was called with a list of 3 tensors, b times, then result_list is a [b, 3] list of lists. This operation transposes that list of list to have the shape [3, b]. Additionally, if one of the tensors was something l...
def _transpose(self, result_list): first_result = result_list[0] # The case where op is a list or tuple of tensors, [b, 3] -> [3, b] if isinstance(first_result, (list, tuple)): # A list of lists, where each inner list corresponds to one of the tensors transposed_results ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_all_tensors(result: torch.Tensor, group: Optional[Any]=None) ->List[torch.Tensor]:\n if group is not None:\n raise ValueError('Horovod does not support allgather using a subcommunicator at this time. Unset `group`.')\n if _HVD is None or not _HVD.is_initialized():\n return [result]\n...
[ "0.60758424", "0.5996549", "0.55972064", "0.55329734", "0.54506767", "0.5406099", "0.53996986", "0.5362867", "0.53429246", "0.5341959", "0.52300006", "0.5152496", "0.5103904", "0.5100453", "0.50907034", "0.50890607", "0.50183403", "0.50126004", "0.4996337", "0.49776542", "0.4...
0.645166
0
home page for UnicornLog_REST
def index(request): return render(request, 'std/index.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def homepage_log():\n\n return render_template('home_log.html')", "def index():\n response.view_title = myconf.get('app.name') + ' Home Page'\n return dict(message='')", "def home():\n return(\n f\"Available Routes: <br/>\"\n\n f\"For Precipitation: /api/v1.0/precipitation<br/>\"\n ...
[ "0.71488595", "0.6863423", "0.661118", "0.65864056", "0.6573406", "0.6532395", "0.6505301", "0.65031904", "0.64614654", "0.6436561", "0.6429586", "0.6424708", "0.6419765", "0.64185673", "0.64166856", "0.64075", "0.63949937", "0.6370557", "0.63512135", "0.63386685", "0.6327910...
0.0
-1
reactance of inductor Args ==== f (float) frequency in Hz L (float) inductance in H Returns ======= (complex)
def Xind(L, f): nu = 2*pi*f return 0+1j*nu*L
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reactance_to_component(reactance, freq):\n logger.debug(\"reactance_to_component: reactance= %8.3f\", reactance)\n factor = 2*pi*freq\n if reactance < 0:\n # compute capacitance\n return -1/(factor*reactance), \"F\"\n else:\n # compute inductance\n return reactance/factor, \"H\"", "def hetero...
[ "0.64730424", "0.6231963", "0.61042935", "0.6099254", "0.6087586", "0.60156703", "0.5909744", "0.59024256", "0.5894063", "0.5887246", "0.58476037", "0.5845882", "0.5840806", "0.58114547", "0.5772043", "0.5731248", "0.57271713", "0.57271713", "0.5723993", "0.57079846", "0.5705...
0.0
-1
Converts given string to given encoding. If no encoding is specified, it is determined from terminal settings or, if none, from system settings.
def _encode(line, output_file, encoding=None): # Convert string to Unicode if not isinstance(line, text_type): try: line = text_type(line) except UnicodeDecodeError: line = b(line).decode('utf-8') # Choose output encoding if not encoding: # choose between...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def EncodeString(string, encoding=None):\r\n if not encoding:\r\n encoding = DEFAULT_ENCODING\r\n\r\n if txtutils.IsUnicode(string):\r\n try:\r\n rtxt = string.encode(encoding)\r\n except LookupError:\r\n rtxt = string\r\n return rtxt\r\n else:\r\n ...
[ "0.69010156", "0.667522", "0.66090107", "0.65620023", "0.64595217", "0.6398251", "0.63357705", "0.6291808", "0.62562346", "0.6251527", "0.61868715", "0.6140761", "0.6138416", "0.6093647", "0.60694253", "0.6056297", "0.60423815", "0.5936086", "0.5863182", "0.5863182", "0.58527...
0.597977
17
Asks user to specify a city, month, and day to analyze.
def get_filters(): print('Hello! Let\'s look at some US bikeshare data!') # I want to get user input for the city choice using a while loop to handle inputs that are not part of CITY_DATA. # I want to get user input for the city choice using a while loop to handle inputs that are not part of CITY_DATA. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)", "def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f...
[ "0.66714007", "0.65354675", "0.64593667", "0.6374057", "0.6348314", "0.63097656", "0.62868035", "0.6259136", "0.62316", "0.62130964", "0.62050414", "0.6181105", "0.6171822", "0.61686903", "0.6158568", "0.61582303", "0.61532456", "0.61444426", "0.6131269", "0.610484", "0.61025...
0.0
-1
Loads data for the specified city and filters by month and day if applicable.
def load_data(city, month, day): # I upload the data from the file for the city chosen by the user into the dataframe. df = pd.read_csv(CITY_DATA[city]) # To handle the data with pandas, I need to convert 'Start Time' to datetime. Afterwards, I create seperate columns for month, weekday, and start hour ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ...
[ "0.81320685", "0.8108889", "0.8045821", "0.8042514", "0.80090284", "0.80071104", "0.79991937", "0.7998333", "0.7988789", "0.797905", "0.79737365", "0.79610896", "0.7956163", "0.7947432", "0.79463065", "0.7908287", "0.7908229", "0.7904569", "0.7900715", "0.78930074", "0.788921...
0.78244984
29
Displays statistics on the most frequent times of travel.
def time_stats(df): print('\nCalculating The Most Frequent Times of Travel...\n') start_time = time.time() # display the most common month using 'mode' popular_month = df['month'].mode()[0] print('The most popular month: ', popular_month) # display the most common day of week popular_day ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\...
[ "0.80247396", "0.80233026", "0.7915788", "0.78266186", "0.7822246", "0.78143597", "0.77659196", "0.7740343", "0.773628", "0.77344066", "0.76867086", "0.7668633", "0.7651731", "0.7644636", "0.76367253", "0.7625196", "0.7623158", "0.7612803", "0.76002145", "0.7583438", "0.75797...
0.76399267
14
Displays statistics on the most popular stations and trip.
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip...\n') start_time = time.time() # display most commonly used start station popular_start_station = df['Start Station'].mode()[0] print('The most popular start station: ', popular_start_station) # display most commo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m...
[ "0.7815675", "0.7662213", "0.7553417", "0.74914914", "0.74748665", "0.7446617", "0.7428588", "0.74237514", "0.74177027", "0.7400495", "0.7387161", "0.7385634", "0.73647535", "0.735934", "0.73566747", "0.73548365", "0.7351854", "0.7351274", "0.735057", "0.73421645", "0.7340198...
0.7337384
21
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print('\nCalculating Trip Duration...\n') start_time = time.time() # display total travel time as the sum of the 'Trip Duration' column, given the filters. The time is given in seconds and therefore divided by 60 to transform it to minutes. total_travel_time = df['Trip Du...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri...
[ "0.814274", "0.8025143", "0.80041367", "0.79496753", "0.7937415", "0.79312176", "0.7926815", "0.7915187", "0.79142886", "0.7908032", "0.79055744", "0.7900715", "0.7891682", "0.78894734", "0.7886722", "0.78851086", "0.7884266", "0.7882474", "0.78738385", "0.78686154", "0.78664...
0.7686329
73
Remove all handlers of logger
def close_logger(logger): for x in list(logger.handlers): logger.removeHandler(x) x.flush() x.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown_log(self, logger):\n for handler in logger.handlers[:]:\n logger.removeHandler(handler)\n handler.close()", "def shut_down_logger(self):\n handlers = self.logger.handlers[:]\n for handler in handlers:\n handler.close()\n self.logger.re...
[ "0.8562081", "0.82160723", "0.8197727", "0.8152634", "0.7999888", "0.7999888", "0.7939653", "0.778233", "0.76902187", "0.76153237", "0.7506614", "0.7498315", "0.7494978", "0.7455884", "0.7233171", "0.7084099", "0.698838", "0.69801086", "0.69801086", "0.6903495", "0.68966806",...
0.7586058
10
Gets the trips of this TripResponse.
def trips(self) -> List[TripResponseTrips]: return self._trips
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_trips(self) -> Tuple[Trip]:\n ...", "def trios(self):\n return self._trios", "def trips(self, min_id=-1):\n if self.username == None or self.password == None:\n raise LogoutException()\n\n station_ids = {s.name: s.id for s in self.stations()}\n if len(stati...
[ "0.70890206", "0.67183363", "0.6395498", "0.6373147", "0.63185453", "0.6140131", "0.6059936", "0.60099715", "0.5944456", "0.5844512", "0.5822781", "0.58081", "0.57542026", "0.5744656", "0.57327014", "0.5704386", "0.5665986", "0.5662136", "0.56436294", "0.5606473", "0.5554601"...
0.8821469
0
Tests the API endpoint to query sub account futures asset transfer history
def test_sub_account_futures_asset_transfer_history(): params = {"email": "alice@test.com", "futuresType": 1} client = Client(key, secret) response = client.sub_account_futures_asset_transfer_history(**params) response.should.equal(mock_item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sub_account_futures_asset_transfer_history_without_futurestype():\n\n param = {\"email\": \"alice@test.com\", \"futuresType\": \"\"}\n client = Client(key, secret)\n client.sub_account_futures_asset_transfer_history.when.called_with(\n **param\n ).should.throw(ParameterRequiredError)", ...
[ "0.73908156", "0.69204336", "0.6439332", "0.61491287", "0.6113373", "0.59740716", "0.59640366", "0.5939768", "0.59198904", "0.5905998", "0.5839146", "0.58111984", "0.5808582", "0.5802422", "0.5783174", "0.57718706", "0.57671577", "0.57619196", "0.57380724", "0.57181734", "0.5...
0.8228993
0
For a date 'date' returns the start and end date for the month of 'date'.
def get_month_day_range(date): first_day = date.replace(day = 1) last_day = date.replace(day = calendar.monthrange(date.year, date.month)[1]) return first_day, last_day
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_start_and_end_dates_of_month(year, month):\n date_start = datetime.date(year, month, 1)\n date_end = add_months_to_date(date_start, 1) - datetime.timedelta(days=1)\n return date_start, date_end", "def ceil_start_month(date):\n if date.month == 12:\n date = datetime(date.year + 1, 1, 1)...
[ "0.7652795", "0.74699664", "0.74156183", "0.7262988", "0.7005817", "0.6990498", "0.69779325", "0.69227564", "0.69091576", "0.6878791", "0.67561233", "0.6744813", "0.6729026", "0.66840976", "0.65939677", "0.6558879", "0.654681", "0.64500266", "0.6435676", "0.64053106", "0.6336...
0.8069912
0
Remove extraneous characters from URL.
def clean_url(url): if url is None: return None if '??' in url: url = url.split('??')[0] if url.endswith('?'): url = url[:-1] if '`' in url: url = url.replace('`', '') return url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clean_url(self, url):\n return \"\".join(url.split(\"?\")[:1])", "def clean_url(url):\r\n s = url\r\n url = url.encode('utf8')\r\n url = ''.join([urllib.quote(c) if ord(c) >= 127 else c for c in url])\r\n return url", "def clean_url(url):\n scheme, netloc, path, query, fragment = url...
[ "0.8083749", "0.79100424", "0.7585762", "0.75374883", "0.7449228", "0.7404763", "0.7362396", "0.7202365", "0.71856475", "0.71691597", "0.71430457", "0.7099976", "0.70984113", "0.7070281", "0.7042066", "0.6963562", "0.69309103", "0.6914217", "0.68943375", "0.68910265", "0.6890...
0.7344963
7
Determine if two strings are similar.
def similar_string(first_string, second_string): score = score_match(first_string, second_string) if score >= SCORE_THRESHOLD_NORMAL: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def similar_strings(s1, s2):\n w1 = set(re.split(r'\\W+', s1))\n w2 = set(re.split(r'\\W+', s2))\n threshold = len(w1) // 2 + 1\n return len(w1 & w2) >= threshold", "def similar_string_fast(first_string, second_string):\n partial_score = fuzz.ratio(first_string, second_string)\n token_score = f...
[ "0.79029274", "0.77392685", "0.77359974", "0.76873827", "0.7512138", "0.7308992", "0.72716784", "0.7256925", "0.7167219", "0.71221983", "0.71163607", "0.70902514", "0.7083313", "0.7056112", "0.70488167", "0.7029185", "0.6981539", "0.69615114", "0.6931717", "0.68618613", "0.68...
0.8005426
0
Determine if two strings are similar (using two most effective methods).
def similar_string_fast(first_string, second_string): partial_score = fuzz.ratio(first_string, second_string) token_score = fuzz.token_set_ratio(first_string, second_string) if max(partial_score, token_score) >= SCORE_THRESHOLD_FAST: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def similar_string(first_string, second_string):\n score = score_match(first_string, second_string)\n\n if score >= SCORE_THRESHOLD_NORMAL:\n return True\n\n return False", "def similar_strings(s1, s2):\n w1 = set(re.split(r'\\W+', s1))\n w2 = set(re.split(r'\\W+', s2))\n threshold = len...
[ "0.8060857", "0.78667307", "0.7606839", "0.7597272", "0.7414688", "0.73731047", "0.73516196", "0.7250899", "0.72500485", "0.7241512", "0.7199489", "0.71607584", "0.71150386", "0.70900667", "0.7073903", "0.7047483", "0.70394033", "0.6976393", "0.6934789", "0.6911663", "0.68641...
0.7984265
1
Return the currently active collection.
def activeCollection(): col = bpy.context.view_layer.active_layer_collection if col: # If the selected collection is the master scene collection # it cannot be queried directly since it's of type # LayerCollection. # In this case get the wrapped collection which then can ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current(self):\n\n return self._collection", "def collection(self):\n return self._collection", "def _get_collection(self):\n db = self._get_db()\n return getattr(db, global_settings.MONGODB_COLLECTION)", "def get_collection(self, collection):\n return self.database[col...
[ "0.7956852", "0.741677", "0.7261663", "0.72269917", "0.7074865", "0.70587885", "0.6936677", "0.68022", "0.6795597", "0.66598463", "0.665978", "0.6527214", "0.6513115", "0.6448291", "0.63134867", "0.63089424", "0.6284218", "0.6227759", "0.6209465", "0.6198381", "0.61914384", ...
0.86446846
0
Return the builtin images path for studio light world HDRIs. Since this path depends on the current system it's procedurally retrieved through the location of the application binary file.
def environmentImagesPath(): # A recursion counter to make sure that the loop ends. count = 0 # Get the path to the Blender executable. filePath = os.path.dirname(bpy.app.binary_path) # Find the lowest path level which contains Blender. while "blender" not in os.path.basename(filePath).lower(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetSystemImageDir(sys_dir=None):\n if sys_dir:\n return _GetFilePath(sys_dir)\n return _GetFilePath(FLAGS.system_image_dir)", "def get_default_data_image_path():\n misc_path = pkg_resources.resource_filename('sst', 'misc/')\n return os.path.abspath(os.path.join(misc_path, \"um_000000.png\"))", "...
[ "0.67263955", "0.66902685", "0.6683574", "0.6681743", "0.6512482", "0.64395505", "0.6391001", "0.6381985", "0.63340354", "0.6313963", "0.6301816", "0.6258233", "0.623085", "0.62240785", "0.62149644", "0.6116855", "0.60321116", "0.6027896", "0.600327", "0.59789807", "0.5964832...
0.68692356
0
Return the SpaceView3D to be able to access the current viewing camera.
def get3dView(): for area in bpy.context.screen.areas: if area.type == 'VIEW_3D': return bpy.types.SpaceView3D(area.spaces[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_first_view3d():\n areas = [a for a in bpy.context.screen.areas if a.type == \"VIEW_3D\"]\n assert len(areas) > 0\n area = areas[0]\n region = sorted(\n [r for r in area.regions if r.type == \"WINDOW\"],\n key=lambda x: x.width,\n reverse=True,\n )[0]\n spaces = [s fo...
[ "0.6517837", "0.6327059", "0.63032657", "0.6277825", "0.6237324", "0.61826503", "0.61782604", "0.61782604", "0.6120114", "0.5917895", "0.58204854", "0.58064395", "0.5804778", "0.5685697", "0.5620787", "0.5620787", "0.5620787", "0.56143016", "0.5605276", "0.5604279", "0.560279...
0.8283899
0
This function returns the min of a list and its index L is np.array
def min_indice(L): min_l = min(L) return [min_l,np.where(L==min_l)[0][0]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_minimum_value_from_list(self, list_):\r\n return min(list_)", "def min(l):\n if l:\n s_list = sorted(l)\n return s_list[0]\n else:\n raise ValueError(\"list empty\")", "def __idx_of_minimum(cls, lst: list) -> int:\n\t\treturn lst.index(min(lst))", "def find_min(list)...
[ "0.76791316", "0.7671087", "0.75475186", "0.7320828", "0.72402906", "0.72288704", "0.7188843", "0.7062959", "0.7062959", "0.6946639", "0.6858886", "0.68058985", "0.67964303", "0.67202157", "0.6681586", "0.66472715", "0.6638085", "0.66225743", "0.661499", "0.66136265", "0.6595...
0.79356325
0
Given equal sized arrays of points, returns True if the polygonal contour vertices represented by x and y are ordered in the clockwise direction.
def ispolycw(x, y): l = len(x) if l < 3: raise ValueError("ispolycw::X length is less than 3") if len(y) < 3: raise ValueError("ispolycw::Y length is less than 3") if l != len(y): raise ValueError("ispolycw::Non-equal sized arrays") s = 0.0 for k in range(0, l): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iscoplanar(coords):\n coords = np.array(coords, ndmin=1)\n if np.shape(coords)[0] < 3:\n raise Exception('At least 3 input pores are required')\n\n Px = coords[:, 0]\n Py = coords[:, 1]\n Pz = coords[:, 2]\n\n # Do easy check first, for common coordinate\n if np.shape(np.unique(Px))...
[ "0.67318374", "0.6692457", "0.6664548", "0.6570368", "0.65393496", "0.651461", "0.651461", "0.64759827", "0.6469661", "0.64569044", "0.64341104", "0.6366998", "0.6363508", "0.63616353", "0.6317713", "0.6272744", "0.62083554", "0.6195377", "0.61358273", "0.6122888", "0.6088497...
0.59221625
27
Given a generating list that generates a group H, this function returns a possibly smaller generating set for the same group H (but certainly not larger). The resulting generating set will contain less than n^2 permutations, when the permutations are on n elements. (Set =1 or 2 to see what is going on exactly.)
def reduce(generators: [Permutation], wordy=0) -> [Permutation]: if wordy >= 1: print(" Reducing. Input length:", len(generators)) if not generators: return generators n = generators[0].n output_generators = [] todo = generators while todo: element = find_non_trivial_or...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_all_holds(hand):\n ans_set = set([()])\n\n for dummy_idx in range(len(hand)):\n temp_set = set([()])\n for seq in ans_set:\n for item in hand:\n new_seq = list(seq)\n if hand.count(item) > new_seq.count(item):\n new_seq.append(...
[ "0.6580512", "0.65190554", "0.6468828", "0.6334636", "0.6304367", "0.62992", "0.6250159", "0.62221575", "0.6216637", "0.61963284", "0.6190778", "0.618871", "0.6186086", "0.6182302", "0.6175184", "0.6166101", "0.61541575", "0.61454177", "0.61375546", "0.61289376", "0.61273795"...
0.0
-1
Creates empty grey placeholder component which shall be later substituted with diagram. The given height determines the height of the placeholder.
def get_empty_figure(height: int): fig = { 'data': [], 'layout': go.Layout( height=height, paper_bgcolor='#eaeaea', plot_bgcolor='#eaeaea', xaxis={ 'showticklabels': False, 'ticks': '', 'showgrid': False...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_placeholder(fig: Figure) -> None:\n fig.add_artist(FancyBboxPatch(\n xy = (0.35, 0.45),\n width = 0.3,\n height = 0.1,\n boxstyle = 'Round, pad=0.015',\n linewidth = 3,\n edgecolor = 'red',\n facecolor = 'lightpink',\n alpha = 0.5\n ))\n fig...
[ "0.6035847", "0.5975701", "0.5882777", "0.5865656", "0.56691927", "0.548919", "0.54182553", "0.5294708", "0.528158", "0.5149186", "0.5130743", "0.51022553", "0.50052655", "0.49686137", "0.49523664", "0.49490002", "0.4937415", "0.4919564", "0.49022248", "0.48541886", "0.484967...
0.5571926
5
r""" Calculates a closedform solution for the `mu` parameters of negativebinomial GLMs.
def closedform_nb_glm_logmu( X: xr.DataArray, design_loc, constraints_loc, size_factors=None, link_fn=np.log ): return closedform_glm_mean( X=X, dmat=design_loc, constraints=constraints_loc, size_factors=size_factors, weights=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _solve(self, mu=None):\n pass", "def GL(mu, wid, x, m = 0.5): \n return m * gaussian(mu, wid, x) + (1 - m) * lorentzian(mu, wid, x)", "def negative_binomial(mat, depths, kappa=1):\n\n # check matrix and ensure\n # data is proportions\n mat = input_matrix_validation(mat, depths)\n ...
[ "0.5790456", "0.55582917", "0.538891", "0.5350196", "0.52965236", "0.5259169", "0.5255389", "0.5185485", "0.51824015", "0.51477665", "0.5143468", "0.513032", "0.5125261", "0.51250374", "0.5123107", "0.50969505", "0.508588", "0.50724715", "0.50709146", "0.5044387", "0.50410885...
0.0
-1
Instantiate a FockBackend object.
def __init__(self): super().__init__() self._supported["mixed_states"] = True self._short_name = "fock"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, backend: Optional[str] = None, /, **kwargs: Any) -> None:\n if not backend:\n try:\n backend = self.__default_backend__\n except AttributeError:\n raise ValueError(\n \"You must specify which backend to use as first po...
[ "0.6743768", "0.60469586", "0.5989197", "0.5817922", "0.5737783", "0.5737783", "0.57028794", "0.5643175", "0.56242037", "0.5576989", "0.5574962", "0.5554551", "0.55469555", "0.5536037", "0.5535658", "0.55144095", "0.5496958", "0.5422664", "0.5421122", "0.5416889", "0.5415982"...
0.0
-1
Check to see if `containerIP` is a valid container id
def validateId(shortId): return shortId in [DockerUtil.getShortId(container) for container in DOCKER_CLIENT.containers.list()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_any_valid_docker_container_id(string: str) -> bool:\n return re.fullmatch(\"^[0-9a-f]{64}$\", string) is not None", "def is_valid_ip(ip):\n ...", "def validateIP():\n try:\n s = socket.inet_aton(args.target)\n except socket.error:\n print(\"\")\n prin...
[ "0.7155968", "0.666977", "0.62525916", "0.6216923", "0.6179204", "0.6016821", "0.60090774", "0.5998264", "0.5986765", "0.5972389", "0.5935419", "0.5918966", "0.5906688", "0.58984", "0.5895571", "0.58601815", "0.5848308", "0.58269507", "0.5816884", "0.58000463", "0.579772", ...
0.69439656
1
function to test write/read equivalence for an obj which has __eq__ defined
def read_write(self,obj): rf.write(self.pickle_file,obj) self.assertEqual(rf.read(self.pickle_file), obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, obj):\r\n return assert_(self.obj == obj, '%r != %r' % (self.obj, obj))", "def equals(self, obj: object) -> bool:\n ...", "def __eq__(self, obj):\n if not obj:\n return False\n\n return str(self.key()) == str(obj.key())", "def __eq__(self: _TT, other: o...
[ "0.745454", "0.73404336", "0.6781833", "0.6745465", "0.67111135", "0.6689699", "0.6635548", "0.6635548", "0.6635548", "0.6635548", "0.6635548", "0.6635548", "0.6635548", "0.6635548", "0.6635548", "0.6635548", "0.6635548", "0.6635548", "0.6635548", "0.6635548", "0.6635548", ...
0.6556084
27
Tests if comments are parsed correctly with get_comment_variables() method.
def test_touchstone_get_comment_variables(self): given = {'p1': ('.03', ''), 'p2': ('0.03', ''), 'p3': ('100', ''), 'p4': ('2.5', 'um')} actual = Touchstone(self.ntwk_comments_file).get_comment_variables() self.assertEqual(given, actual)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_comments(self):\n\n comment_str = \"# This is a comment\\n# This is another comment\"\n doc = parser.parse(comment_str)\n\n self.assertEqual(len(doc.children()), 2)", "def _comment_check():\n for comment_row in unused_list:\n ddi_index = views_index[comment_row[15]...
[ "0.6684429", "0.6498663", "0.6388638", "0.6378898", "0.63370323", "0.628094", "0.62401694", "0.62011665", "0.61215764", "0.60346746", "0.60233617", "0.6014836", "0.6010995", "0.6008527", "0.5995042", "0.598071", "0.5963045", "0.5958331", "0.5939851", "0.59199095", "0.59169275...
0.6737163
0
Make sure arr is a 1D array of integers. Returns an error if the elements of ``arr`` aren't an integer type or if ``arr`` has more than one nonsingleton dimension.
def _as_1d_ints(arr, n=None, xp=None): if xp is None: xp, on_gpu = get_array_module(arr) arr = xp.atleast_1d(xp.squeeze(arr)) if arr.ndim > 1: raise ValueError("arr must be scalar or 1d") if not issubclass(arr.dtype.type, np.integer): # float only OK if values are integers ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def really1d(arr):\n if np.ndim(arr) != 1:\n return False\n # Empty list or array\n if len(arr) == 0:\n return True\n if np.any(np.vectorize(np.ndim)(arr)):\n return False\n return True", "def check_array(arr: Arrayable) -> np.ndarray:\n if isinstance(arr, np.ndarray):\n ...
[ "0.6642992", "0.64455414", "0.643867", "0.61569244", "0.60495275", "0.5888986", "0.57377046", "0.5724065", "0.5642835", "0.55241615", "0.55193704", "0.5486636", "0.54853344", "0.5465045", "0.5401011", "0.53988886", "0.5395306", "0.53805393", "0.5352357", "0.5338182", "0.52776...
0.7023006
0
This function renders the main page
def main_page(): return render_template("main_page.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_page():\n return render_template(\"index.html\")", "def home():\n return render_template('Main_Page.html')", "def main():\n return render_template(\"main.html\")", "def main():\n return render_template(\"main.html\")", "def main():\n\n return render_template(\"index.html\", title=\"...
[ "0.8322627", "0.793691", "0.7913725", "0.7913725", "0.7885429", "0.7832612", "0.77718717", "0.7741127", "0.7731492", "0.77223694", "0.7655714", "0.7652967", "0.765215", "0.7609745", "0.7609745", "0.75270504", "0.74935806", "0.74935806", "0.7483145", "0.7474603", "0.7474603", ...
0.8500139
0
Computes the forward pass for an affine (fullyconnected) layer. The input x has shape (N, d_1, ..., d_k) and contains a minibatch of N examples, where each example x[i] has shape (d_1, ..., d_k). We will reshape each input into a vector of dimension D = d_1 ... d_k, and then transform it to an output vector of dimensio...
def affine_forward(x, w, b): out = None # reshape the input into (N, d_1 *...* d_k) input_shape = x.shape prod = 1 for i in range(1,len(input_shape)): prod *= input_shape[i] a = x.reshape(x.shape[0],prod) out = np.dot(a,w) + b cache = (x, w, b) return out, cache
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, x):\n\n x = F.max_pool2d(F.relu(self.batch_norm1(self.conv1(x))), 3, stride=2, padding=1)\n x = F.max_pool2d(F.relu(self.batch_norm2(self.conv2(x))), 3, stride=2, padding=1)\n x = F.max_pool2d(F.relu(self.batch_norm3_b(self.conv3_b(F.relu(self.batch_norm3_a(self.conv3_a(x)))))), 3, strid...
[ "0.68831134", "0.66885334", "0.65112114", "0.6506512", "0.64589113", "0.6448202", "0.64140195", "0.64074594", "0.6357362", "0.6356064", "0.63492495", "0.6345332", "0.6335407", "0.6323006", "0.6307874", "0.63043493", "0.6299398", "0.6297389", "0.6297314", "0.629169", "0.628821...
0.6997871
0
Computes the backward pass for an affine layer.
def affine_backward(dout, cache): x, w, b = cache dx, dw, db = None, None, None dx = dout.dot(w.T) dx = dx.reshape(x.shape) input_shape = x.shape prod = 1 for i in range(1,len(input_shape)): prod *= input_shape[i] x_reshaped = x.reshape(x.shape[0], prod) dw = (x_res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def affine_relu_backward(dout, cache):\n fc_cache, relu_cache = cache\n da = layers.relu_backward(dout, relu_cache)\n dx, dw, db = layers.affine_backward(da, fc_cache)\n return dx, dw, db", "def affine_backward(dout, cache):\n x, w, b = cache\n dx, dw, db = None, None, None\n ###############...
[ "0.7518896", "0.751513", "0.7310849", "0.73015374", "0.73015374", "0.73015374", "0.73015374", "0.7243401", "0.7177609", "0.7174102", "0.7173503", "0.71661735", "0.71319", "0.7106919", "0.70978165", "0.708432", "0.7068546", "0.70449376", "0.70409757", "0.6986414", "0.6983679",...
0.6993727
19
Computes the backward pass for a layer of logistic sigmoid function.
def sigmoid_backward(dout, cache): dx, x = None, cache f = lambda x: 1/(1 + np.exp(-x)) # activation function (sigmoid) fun = f(x) dx = np.multiply(fun, (1-fun)) dx = np.multiply(dx,dout) return dx
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid_backward(dA, Z):\r\n dsig = sigmoid(Z) * (1 - sigmoid(Z))\r\n return dA * dsig", "def backward_pass(self):\r\n # the gradient of cross-entropy on top of softmax is (t-y)\r\n back_output = (self.targets - self.y) / self.y.shape[0]\r\n\r\n for layer in reversed(self.layers):...
[ "0.72898245", "0.7251295", "0.7204519", "0.7179389", "0.7162605", "0.712203", "0.7068586", "0.7059047", "0.70575905", "0.7056281", "0.70492476", "0.70444787", "0.69950897", "0.6986096", "0.6986045", "0.6946393", "0.6916062", "0.6894457", "0.6871485", "0.6867077", "0.6866261",...
0.7572509
0
Convenience layer that perorms an affine transform followed by a sigmoid
def affine_sigmoid_forward(x, w, b): a, fc_cache = affine_forward(x, w, b) out, sigmoid_cache = sigmoid_forward(a) cache = (fc_cache, sigmoid_cache) return out, cache
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_layer_activation(x):\n return x", "def sigmoid(X,W,b):\n preActivation = np.dot(X, W) + b\n return (1.0)/(1.0 + np.exp(-preActivation))", "def sigmoid_activation(x):\n return 1.0 / (1 + np.exp(-x))", "def affine_sigmoid(xin, m= 10, c= 3):\n if type(xin) != np.ndarray:\n x = n...
[ "0.6987919", "0.68480325", "0.68326443", "0.6823527", "0.68216205", "0.6812473", "0.67426056", "0.666208", "0.6659212", "0.6645308", "0.6588696", "0.6588696", "0.65827596", "0.6579933", "0.6547947", "0.6539903", "0.6539903", "0.6539903", "0.6539903", "0.6539903", "0.6539903",...
0.7292897
0
Returns the files instructions from the absolute instructions list.
def _make_file_instructions_from_absolutes( split2shard_props: Dict, absolute_instructions: ReadInstruction, ) -> Tuple[List[int], List[Dict]]: file_instructions: List[Dict] = [] num_examples_per_shard = [] for abs_instr in absolute_instructions: shard_filenames, shard_lengths = split2shard_props[abs_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_instructions(file_input: TextIO) -> List[str]:\n instructions = []\n for instruction in file_input:\n instruction = instruction.strip()\n instructions.append(instruction)\n\n return instructions", "def GetFileOperations():\n values = __get_current_values()\n to_return = []\n ...
[ "0.6148031", "0.5898083", "0.5657519", "0.5587604", "0.5587604", "0.5587604", "0.5576874", "0.54202294", "0.5417266", "0.5377404", "0.5355677", "0.5328657", "0.5310547", "0.53068405", "0.5261649", "0.5229113", "0.52286893", "0.5211607", "0.51889044", "0.51633394", "0.5160124"...
0.5303998
14
Plots bar graphs of average adoption speed for ages available in dataset. The plots are divided between dogs and cats. The adoption speed scale is 04 where 0 means immediate adoption and 4 means no adoption after 91 days at the shelter.
def age_avg_adopt(): import numpy as np import pandas as pd import matplotlib.pyplot as plt train = pd.read_csv('./data/train.csv') # Convert age from months to years train.loc[train['Age'] > -1, 'Age'] = (train['Age']//12) # Divide by dog (Type = 1) and cat (Type = 2) do...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def age_avg_adopt():\n \n import numpy as np\n import pandas as pd\n import matplotlib.pyplot as plt\n\n train = pd.read_csv('./data/train.csv')\n \n train_12_months = train.loc[train['Age'] < 13, ['State','Type', 'Age', 'AdoptionSpeed']]\n \n dog_df = train_12_months.loc[train_12_months...
[ "0.7662977", "0.56974465", "0.55396694", "0.548597", "0.5422956", "0.5421991", "0.5403253", "0.5340519", "0.53164953", "0.52908766", "0.52848315", "0.52035683", "0.5189145", "0.51705015", "0.5168364", "0.5160512", "0.51555115", "0.515418", "0.5127617", "0.51032525", "0.510228...
0.72738457
1
Plots bar graphs of average adoption speed for every month in the first 12 months of the pet's life. The plots are divided between dogs and cats. The adoption speed scale is 04 where 0 means immediate adoption and 4 means no adoption after 91 days at the shelter.
def age_avg_adopt(): import numpy as np import pandas as pd import matplotlib.pyplot as plt train = pd.read_csv('./data/train.csv') train_12_months = train.loc[train['Age'] < 13, ['State','Type', 'Age', 'AdoptionSpeed']] dog_df = train_12_months.loc[train_12_months['Type'] == 1, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_bar_plot():\n # Copy and modify data for monthly bar plot\n \n df_bar = df.copy()\n\n # Draw bar plot\n leglab = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"]\n labels = [2016, 2017, 2018...
[ "0.64338595", "0.6335123", "0.6169855", "0.61543477", "0.6030495", "0.5977759", "0.5826969", "0.57547635", "0.5716767", "0.5696655", "0.56303304", "0.5616894", "0.56035185", "0.556477", "0.551954", "0.5473504", "0.54443264", "0.54386526", "0.542967", "0.54267067", "0.54011875...
0.67714953
0
Splits the sentences in a dataframe's column into a list of the separate words.
def word_splitter(df): #Create column, split and make strings lowercase. df['Split Tweets'] = df['Tweets'].str.lower().str.split() return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_splitter(df):\n result = []\n l1 = df['Tweets']\n for tweet in l1:\n result.append(tweet.lower().split(' '))\n df['Split Tweets'] = result\n return df", "def word_splitter(df):\n df['Split Tweets'] = [i.lower().split() for i in df['Tweets']]\n return df", "def word_splitter...
[ "0.7669734", "0.7588457", "0.7277383", "0.7106168", "0.7048508", "0.6907862", "0.6873786", "0.68376553", "0.68316835", "0.6717478", "0.66340524", "0.66340524", "0.6603729", "0.65878886", "0.6584361", "0.6554645", "0.65175956", "0.6493134", "0.6451709", "0.640864", "0.63579243...
0.7173178
3
Test a default `cif_cell_contents` calculation.
def test_cif_cell_contents_standard(aiida_profile_clean, fixture_localhost, fixture_calc_job_node, generate_parser): entry_point_calc_job = 'codtools.cif_cell_contents' entry_point_parser = 'codtools.cif_cell_contents' node = fixture_calc_job_node(entry_point_calc_job, fixture_localhost, 'default') par...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_solo_cell():\n cell = c6.Cell(loc=[1, 1])\n for i in range(10):\n cell.step()", "def test_get_cell_info(self):\n expected = { 'Experiment': \"20220101_EGS1_12345AA\",\n 'Cell': '12345AA0018/20220101_1234_1-A1-A1_AAA66666_deadbeef',\n 'Pool': '1...
[ "0.58573437", "0.57191473", "0.55048025", "0.5358148", "0.53429013", "0.52921504", "0.5276433", "0.52458316", "0.5242151", "0.52205575", "0.51903653", "0.5156349", "0.5088263", "0.50859916", "0.50836164", "0.5078765", "0.5069685", "0.50684625", "0.5066117", "0.49831873", "0.4...
0.6756194
0
Apply kernel regularization to keras model
def set_kernel_reg(model, lambdal1 = 0, lambdal2 = 0): for layer in model.layers: if hasattr(layer, 'kernel_regularizer'): layer.kernel_regularizer = l1_l2(l1 = lambdal1, l2 = lambdal2) return model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_regularizer(self, regularizer = regularizers.l1(0.1)):\n # for layer in self.layers:\n # layer.kernel_regularizer = regularizer\n self.list_cnn[-1].kernel_regularizer = regularizer", "def add_regularization(self, regularizer):\n for layer in self.prenet_layers:\n ...
[ "0.7065853", "0.5998704", "0.58855665", "0.5794729", "0.5781218", "0.56473464", "0.5636786", "0.56342834", "0.56247187", "0.5613548", "0.5508538", "0.5464103", "0.5446757", "0.5433872", "0.5421158", "0.539804", "0.5394628", "0.5348915", "0.5344816", "0.5338986", "0.53257155",...
0.72197354
0
Inserts this instance to database.
def add(self): db.session.add(self) db.session.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self):\n db.session.add(self)\n db.session.commit()", "def insert(self):\n db.session.add(self)\n db.session.commit()", "def insert(self):\n db.session.add(self)\n db.session.commit()", "def insert(self):\n self.getDbRecord().insert()\n\n ret...
[ "0.83785105", "0.83785105", "0.83785105", "0.830998", "0.7947764", "0.7260452", "0.7260452", "0.7260452", "0.7260452", "0.724192", "0.71791655", "0.7151454", "0.7109492", "0.6973766", "0.69692475", "0.68963945", "0.6871551", "0.68689597", "0.68553793", "0.68277264", "0.682772...
0.6610873
43
preprocess a string (tokens, stopwords, lowercase, lemma & stemming) returns the cleaned result
def clean_text(corpus, model): new_doc = [] doc = model(corpus) for word in doc: if not word.is_stop and word.is_alpha: new_doc.append(word.lemma_.lower()) cleaned_string = ", ".join(new_doc) # putting the strings back into one string return cleaned_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_sent(sent):\n #tokenized = word_tokenize(sent.lower())\n tokenizer = Tok()\n tokenized = tokenizer.tokenize(sent.lower())\n return tokenized", "def preprocess_tweet(tweet):\n clean_tweet = tp.clean(tweet)\n\n # perform lemmatization\n tokenizer = TweetTokenizer()\n tweet_to...
[ "0.7444161", "0.73020416", "0.7254363", "0.7232578", "0.7229561", "0.721284", "0.71997184", "0.71308845", "0.71047986", "0.7081035", "0.70776826", "0.7002863", "0.70012844", "0.6980777", "0.69784296", "0.69668424", "0.6965386", "0.69406086", "0.6923059", "0.69066405", "0.6900...
0.0
-1
This class method returns the current region based on the current request and is used in
def get_current_region(cls, request): # if rendered url is edit_region, the region slug originates from the region form. if ( not hasattr(request, "resolver_match") or request.resolver_match.url_name == "edit_region" ): return None region_slug = reques...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def region(self):\n return self._get(\"region\")", "def region(self):\n return self.config.region", "def region(self) -> str:\n return pulumi.get(self, \"region\")", "def region(self) -> str:\n return pulumi.get(self, \"region\")", "def region(self) -> str:\n return pulum...
[ "0.795351", "0.7910223", "0.79029274", "0.79029274", "0.79029274", "0.79029274", "0.79029274", "0.79029274", "0.76762587", "0.7663308", "0.7663308", "0.7663308", "0.7663308", "0.76339567", "0.7585374", "0.7585374", "0.7585374", "0.7585374", "0.7585374", "0.7585374", "0.756366...
0.7621527
14
Return True, if moveRecursive() is available (see comments there).
def supportRecursiveMove(self, destPath): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def canMove(self):\n\n if self.index == len(self.path):\n self.move = False\n return self.move", "def move(self) -> bool:\n pass", "def move_valid(move):\n return True", "def can_move(self,direction):\r\n if direction in self.current_room.return_directions():\r\n ...
[ "0.7099811", "0.67302436", "0.6334083", "0.6326165", "0.61713946", "0.6166266", "0.6111921", "0.6097203", "0.60935026", "0.6035517", "0.59928036", "0.5966303", "0.59603006", "0.59422207", "0.5936211", "0.59279317", "0.59224826", "0.59131634", "0.5861932", "0.58336323", "0.581...
0.7578219
0
Return True, if moveRecursive() is available (see comments there).
def supportRecursiveMove(self, destPath): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def canMove(self):\n\n if self.index == len(self.path):\n self.move = False\n return self.move", "def move(self) -> bool:\n pass", "def move_valid(move):\n return True", "def can_move(self,direction):\r\n if direction in self.current_room.return_directions():\r\n ...
[ "0.7099811", "0.67302436", "0.6334083", "0.6326165", "0.61713946", "0.6166266", "0.6111921", "0.6097203", "0.60935026", "0.6035517", "0.59928036", "0.5966303", "0.59603006", "0.59422207", "0.5936211", "0.59279317", "0.59224826", "0.59131634", "0.5861932", "0.58336323", "0.581...
0.7578219
1
Gets the JSON of a post. This can be used as and API for external clients.
def api_get_post(request, post_id): post = get_object_or_404(Post, id=post_id) json = serializers.serialize("json", [post], fields=( "pub_time", "_text_rendered", "title", "text", "image", "image_width", "image_height", "replies", "tags" )) return HttpResponse(content=json)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_json(self) -> dict:\n\n try:\n html = get(self.url, sessionid=self.sessionid)\n except HTTPError:\n raise PostIdNotFound(self.post_id)\n parser = Parser()\n parser.feed(html)\n info = parser.Data\n return info", "def view_post():\n\n retu...
[ "0.7076283", "0.6952924", "0.66784614", "0.664313", "0.6534593", "0.64066476", "0.637505", "0.63443494", "0.6219911", "0.6159269", "0.6087693", "0.60754", "0.60515904", "0.6038488", "0.59993875", "0.5995848", "0.5982333", "0.5935236", "0.59154564", "0.5895733", "0.58654135", ...
0.76298827
0
kills 50% of the population based off of a distribution
def cull(self): num = 0 stat = 1 i = 0 while num < self.num // 2: if random.random() < stat and self.genepool[0][i%self.num] != None: num += 1 self.genepool[0][i%self.num] = None self.genepool[1][i%self.num] = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _remove_small_probabilities(pool):\n keys_to_remove = [key for key, value in pool.items() if value < 1e-8]\n for key in keys_to_remove:\n pool.pop(key)", "def die(world, percentage):\n\n \n infected = np.sum((world >= 1) & (world <= 10))\n to_die = percentage * infected\n if to_die < 1:\n ...
[ "0.6458456", "0.6144221", "0.58850217", "0.58705866", "0.5734875", "0.5694499", "0.5694387", "0.56832254", "0.5681185", "0.56788296", "0.5667026", "0.5638565", "0.56341934", "0.56326133", "0.5624285", "0.56234115", "0.56143916", "0.559", "0.5581722", "0.5571457", "0.55683905"...
0.55031216
27
kills 50% of the population based off of a distribution
def cull(self): num = 0 stat = 1 i = 0 while num < self.num // 2: if random.random() < stat and self.genepool[0][i%self.num] != None: num += 1 self.genepool[0][i%self.num] = None self.genepool[1][i%self.num] = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _remove_small_probabilities(pool):\n keys_to_remove = [key for key, value in pool.items() if value < 1e-8]\n for key in keys_to_remove:\n pool.pop(key)", "def die(world, percentage):\n\n \n infected = np.sum((world >= 1) & (world <= 10))\n to_die = percentage * infected\n if to_die < 1:\n ...
[ "0.6458456", "0.6144221", "0.58850217", "0.58705866", "0.5734875", "0.5694499", "0.5694387", "0.56832254", "0.5681185", "0.56788296", "0.5667026", "0.5638565", "0.56341934", "0.56326133", "0.5624285", "0.56234115", "0.56143916", "0.559", "0.5581722", "0.5571457", "0.55683905"...
0.55031216
28
Creates word_to_idx and idx_to_word dictionaries for a list of sequences.
def sequences_to_dicts(sequences): # A bit of Python-magic to flatten a nested list flatten = lambda l: [item for sublist in l for item in sublist] # Flatten the dataset all_words = flatten(sequences) # Count number of word occurences word_count = defaultdict(int) for word in flatt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_indexer(word_lst):\n unique_words = list(set(word_lst))\n word_index = {}\n for i in range(len(unique_words)):\n word_index[unique_words[i].lower()] = i + 4\n word_index['<PAD>'] = 0\n word_index['<START>'] = 1\n word_index['<UNK>'] = 2\n word_index['<UNUSED>'] = 3\n return ...
[ "0.6763164", "0.6557199", "0.6528885", "0.64524484", "0.64126396", "0.6305663", "0.6277611", "0.62634957", "0.6193047", "0.61657494", "0.6140419", "0.6128495", "0.612039", "0.6092059", "0.6077096", "0.60748893", "0.60254186", "0.60251117", "0.60124534", "0.6010433", "0.598301...
0.7530003
0
Onehot encodes a single word given its index and the size of the vocabulary.
def one_hot_encode(idx, vocab_size): # Initialize the encoded array one_hot = np.zeros(vocab_size) # Set the appropriate element to one one_hot[idx] = 1.0 return one_hot
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_enc(self, word):\n word = self.text_to_int(word)\n word = Variable(torch.tensor(word))\n word = torch.nn.functional.one_hot(word, len(self.index_map))\n return word.transpose(0, 1)", "def one_hot(list_of_index, vocab_size=None, pad=False, max_len=None):\n if vocab_s...
[ "0.8003631", "0.7823819", "0.77854127", "0.76996183", "0.7695894", "0.7653764", "0.72822165", "0.7253616", "0.72524536", "0.71602964", "0.714817", "0.71339893", "0.71081656", "0.71050984", "0.70815146", "0.7064262", "0.7052255", "0.70176786", "0.7003591", "0.6973858", "0.6950...
0.8517694
0
Onehot encodes a sequence of words given a fixed vocabulary size.
def one_hot_encode_sequence(sequence, vocab_size): # Encode each word in the sentence encoding = np.array([one_hot_encode(word_to_idx[word], vocab_size) for word in sequence]) # Reshape encoding s.t. it has shape (num words, vocab size, 1) encoding = encoding.reshape(encoding.shape[0], encoding.shape[1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_encode(idx, vocab_size):\n # Initialize the encoded array\n one_hot = np.zeros(vocab_size)\n \n # Set the appropriate element to one\n one_hot[idx] = 1.0\n\n return one_hot", "def one_hot(list_of_index, vocab_size=None, pad=False, max_len=None):\n if vocab_size is None:\n ...
[ "0.8067221", "0.79106784", "0.77462083", "0.76335406", "0.75745505", "0.7528644", "0.7427693", "0.7352159", "0.7323996", "0.72812915", "0.7232939", "0.7214444", "0.7211265", "0.719449", "0.717862", "0.7166959", "0.7151919", "0.7145496", "0.71255714", "0.7106656", "0.7061875",...
0.79370177
1
Loads our saved deep learning pre_trained_model from loaded_state.
def load_pre_trained_model_state(saved_state_file_name): saved_state_file_name = saved_state_file_name if saved_state_file_name else "my_checkpoint.pth" loaded_state = torch.load(saved_state_file_name) pre_trained_model = models.vgg16(pretrained=True) pre_trained_model.name = "vgg16" for param in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadModel(self):\n self.model.load_state_dict(torch.load(os.path.join(self.model_save_dir, '{}_trained.pt'.format(self.model_name)), map_location=torch.device(device)))\n return self.model", "def load_checkpoint(self, model):\n print(f\"load model {self.save_model_path}\")\n model...
[ "0.8077184", "0.77234274", "0.7683849", "0.7667268", "0.75915927", "0.7524329", "0.7518931", "0.74985963", "0.7457842", "0.7385532", "0.7383041", "0.7335793", "0.7287341", "0.7200805", "0.71371704", "0.71371704", "0.71371555", "0.7125249", "0.7123435", "0.7107675", "0.70958",...
0.81128615
0
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix',saveas='cm', cmap=plt.cm.Blues): if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion matrix") else: print('Confusion matrix, without normalization') pri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8194862", "0.8029915", "0.8019153", "0.79941195", "0.7991258", "0.7980955", "0.7976606", "0.79610753", "0.79590565", "0.79378676", "0.7934962", "0.7934504", "0.79313844", "0.7926313", "0.7924577", "0.79241234", "0.7923211", "0.7923023", "0.7921931", "0.7917871", "0.7916092...
0.80949175
1
Constructor to initialize the deque
def __init__(self): self.deque = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._deque = []", "def __init__(self):\n \n self.elements = deque()", "def __init__(self):\r\n self.deque = deque()", "def __init__(self):\n self.container = collections.deque()", "def __init__(self):\n self.q = deque()", "def __init__(self...
[ "0.8499815", "0.83815527", "0.8365499", "0.8330171", "0.8105382", "0.7980081", "0.79654586", "0.79342777", "0.79342777", "0.79342777", "0.79342777", "0.78924894", "0.7884013", "0.77948165", "0.77598447", "0.7733141", "0.7692219", "0.7686718", "0.7529789", "0.74916697", "0.747...
0.84410775
1
Adds an element to the front of the deque
def add_first(self, data): self.deque.insert(0, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_front(self, e):\n if(self.size_ >= self.capacity_):#If our Deque is full we need to resize it first\n self.resize_front()\n self.data_[self.front_]= e#New Front\n self.size_+=1\n # print(\"Case 1\")\n elif(self.front_ == -1 and self.size_ ==0) :#If ...
[ "0.77549994", "0.75094783", "0.74801326", "0.74712056", "0.72849756", "0.7086032", "0.7032474", "0.7022156", "0.69790226", "0.6960295", "0.69151664", "0.69117135", "0.68907404", "0.68743676", "0.68214196", "0.67882174", "0.6771705", "0.6739565", "0.6715338", "0.66907316", "0....
0.7404988
4
Returns the first element in the deque
def first(self): return self.deque[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first(self):\n\t\tif self.is_empty():\n\t\t\traise Empty('Queue is empty')\n\t\treturn self._head._element", "def first(self):\r\n if self.is_empty():\r\n raise Empty(\"Queue is empty\")\r\n return self._head._element", "def first(self):\n if self.is_empty():\n ra...
[ "0.80593354", "0.80204725", "0.80053365", "0.8004414", "0.80032796", "0.793118", "0.7776589", "0.774455", "0.76118034", "0.76104987", "0.7552577", "0.7538736", "0.7434305", "0.73956317", "0.7380033", "0.73644245", "0.73642164", "0.73421144", "0.73411995", "0.73394734", "0.733...
0.867356
0
Returns the last element in the deque
def last(self): return self.deque[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last(self):\n if self.is_empty():\n raise Empty(\"Deque is empty\")\n return self._trailer._prev._element #real item just before trailer", "def last(iterable):\n d = deque(iterable, maxlen=1)\n try:\n return d.pop()\n except IndexError:\n raise ValueError(\...
[ "0.83619404", "0.81361616", "0.8125678", "0.8021724", "0.7877072", "0.7858371", "0.76965547", "0.75110203", "0.7472543", "0.7425174", "0.7407207", "0.7387161", "0.738661", "0.7381577", "0.73597956", "0.7323023", "0.72963166", "0.72594285", "0.7224552", "0.72160715", "0.721107...
0.88577557
0
Returns True if deque is empty, False otherwise
def is_empty(self): return len(self.deque) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty(self) -> bool:\n return len(self._deque) == 0", "def empty(self) -> bool:\n return self.que == []", "def is_empty(self):\n return self.queue == []", "def is_empty(self) -> bool:\n return self.peek(1) == []", "def is_empty(self):\n if self.front:\n ret...
[ "0.8537911", "0.824748", "0.8027504", "0.80102396", "0.79565465", "0.7901459", "0.7897757", "0.78972703", "0.7870137", "0.7870137", "0.78655297", "0.7865324", "0.7851997", "0.7831357", "0.7802382", "0.77911174", "0.77904", "0.7769068", "0.776647", "0.77621317", "0.77555513", ...
0.87929404
0
Instantiate the system actors.
def __init__( self, plant_parameter, cofire_parameter, supply_chain_potential, price, farm_parameter, transport_parameter, mining_parameter, emission_factor, ): self.plant = PowerPlant(plant_parameter, emission_factor) self.cofi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, concurrency = 1):\n warnings.warn(\"We're phasing out the Actor class, so as to get rid of\"\n \"the coros module. If you use Actor, please speak up on \"\n \"eventletdev@lists.secondlife.com, and we'll come up with a \"\n \"transitio...
[ "0.63393766", "0.6244451", "0.6038264", "0.6008568", "0.5929268", "0.5920251", "0.5890671", "0.5777727", "0.57585657", "0.57538205", "0.57364464", "0.5717696", "0.5663087", "0.5594261", "0.5591269", "0.5572086", "0.55700237", "0.5568734", "0.5563875", "0.5553691", "0.5543729"...
0.0
-1
The actual container name.
def container_name(self): prefix = get_service_prefix('core' if self.core else 'service') return f'{prefix}{self.data.get("name")}'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def container_name(self):\n pass", "def container_name(self):\n if self._container_name:\n return self._container_name\n else:\n return self.image.split(u'/').pop()", "def _get_container_name(self) -> str:\n dirname = os.path.basename(os.getcwd())\n defa...
[ "0.92294514", "0.89489174", "0.83954614", "0.8391197", "0.83595866", "0.83327043", "0.83327043", "0.79558134", "0.76143986", "0.75063074", "0.74708873", "0.7468279", "0.745296", "0.7422435", "0.7397043", "0.7371972", "0.72507155", "0.71832085", "0.7168389", "0.70871323", "0.7...
0.86036
2
Converts the given timestamp to UTC in ms.
def datetime_to_utc(timestamp): epoch = datetime.utcfromtimestamp(0) delta = timestamp-epoch return long(delta.total_seconds() * 1000)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def utc_millisecond_timestamp():\n return __date_to_millisecond_ts(utc())", "def to_unix(cls, timestamp):\n if not isinstance(timestamp, datetime.datetime):\n raise TypeError(\"Time.milliseconds expects a datetime object\")\n return timestamp.timestamp()", "def to_unix_milli(self):\...
[ "0.7090142", "0.6899361", "0.6824753", "0.67304724", "0.6622396", "0.658677", "0.6586293", "0.6555091", "0.65275544", "0.64966196", "0.6485975", "0.6364696", "0.63555795", "0.6323576", "0.6287337", "0.6263435", "0.62520576", "0.622443", "0.61472976", "0.6140285", "0.61374617"...
0.76610994
0
Split the data into n number of windows
def split_to_windows(self, data): return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk_windows(windows, num_chunks):\n if num_chunks <= 0 or int(num_chunks) != num_chunks:\n raise ValueError(\"Number of chunks must be an integer > 0\")\n num_chunks = min(len(windows) - 1, num_chunks)\n splits = np.array_split(windows[:-1], num_chunks)\n chunks = []\n...
[ "0.73843104", "0.7181842", "0.6972581", "0.6967457", "0.6923357", "0.6899833", "0.6893151", "0.685313", "0.68199116", "0.6775044", "0.6735774", "0.66875696", "0.6670692", "0.6668986", "0.6638037", "0.6573508", "0.65368426", "0.65212566", "0.64964896", "0.6486942", "0.64383376...
0.7103899
2
Returns whether a number even or odd.
def even_odd(number): if number % 2 == 0: return 'even' else: return 'odd'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __odd_or_even(number):\n if(number % 2) == 0:\n return 0\n else:\n return 1", "def is_even(num):\n return num % 2 == 0", "def is_odd(number):\r\n return number % 2 != 0", "def is_even(number):\n return (number%2)==0", "def is_odd(number):\n return (number%2)==1", "def ...
[ "0.8773141", "0.8652858", "0.8618801", "0.8612913", "0.8608754", "0.8597059", "0.85251707", "0.85062665", "0.8498232", "0.8481834", "0.8439649", "0.8425389", "0.8389287", "0.83437073", "0.82812417", "0.82783157", "0.82269406", "0.821224", "0.81797224", "0.81760025", "0.816378...
0.78512853
30
Transformed target column of the training set.
def y_train_transformed(self): return self.train_transformed[self.target_param]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target_transform(target, classes, df_Y):\n target = int(classes[target])\n return df_Y.loc[target].target", "def backtransform_target(self, data):\n # print(data)\n # print(self.target_max)\n #data = FloatTensor(data)\n data *= self.target_max\n data += self.target_mi...
[ "0.7430735", "0.682454", "0.6596098", "0.6399546", "0.6246716", "0.60922945", "0.6076955", "0.6069151", "0.60529286", "0.5987275", "0.5965441", "0.59632826", "0.5945149", "0.5930683", "0.5923317", "0.5917745", "0.58594507", "0.58571947", "0.5840558", "0.58130753", "0.5803776"...
0.6851177
1
Create a link to wikiword word relative to baseWord. If downwardOnly is False, the link may contain parts to go to parents or siblings in path (in this wiki language, ".." are used for this). If downwardOnly is True, the function may return None if a relative link can't be constructed.
def createRelativeLinkFromWikiWord(word, baseWord, downwardOnly=True): wordPath = word.split(u"/") baseWordPath = baseWord.split(u"/") if downwardOnly: if len(baseWordPath) >= len(wordPath): return None if baseWordPath != wordPath[:len(ba...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createLinkFromWikiWord(word, wikiPage): # normalizeWikiWord\r\n return \"\"", "def extractWikiWordFromLink(word, wikiDocument=None, basePage=None): # TODO Problems with subpages?\r\n return None", "def test_getLinkrelToUncle(self):\n linkrel = self.builder.getLinkrel(FilePath(\"/fo...
[ "0.603494", "0.56156427", "0.526519", "0.51552457", "0.5107878", "0.50663745", "0.4715814", "0.47104707", "0.4678181", "0.46188635", "0.45861417", "0.4570237", "0.4566748", "0.45596468", "0.45180365", "0.44419533", "0.44241178", "0.43862557", "0.43843037", "0.43725365", "0.43...
0.8459139
0
Build an attribute from key and value.
def createAttributeFromComponents(key, value, wikiPage=None): return ""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def build_key(self, attribute, value, record_id='*'):\n self.key = '{var1}:{var2}:{var3}:{var4}:{var5}'.format(var1=record_id, var2=self.industry, var3=self.merchant,\n var4=attribute, var5=value)", "def add_attribute(self, key, value):\n...
[ "0.6881229", "0.6525174", "0.6477995", "0.62150484", "0.6162136", "0.60774153", "0.60202587", "0.5947892", "0.5898615", "0.586439", "0.5834325", "0.58248746", "0.580927", "0.580927", "0.580927", "0.58012486", "0.5771141", "0.5733398", "0.5728786", "0.5705113", "0.56837344", ...
0.68675005
1
Load an item from dict representation.
def from_dict(cls, name, data): item = cls(name) item.description = data.get("description", "") item.difficulty = data.get("difficulty", 0) item.prerequisites = data.get("prerequisites", {}) item.prerequisites["items"] = to_list(item.prerequisites.get("items")) item.pre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadFromDict(self, d):\n self._data = d\n self._doDefaults()", "def load_dict(self, dct):\n pass", "def from_dict(cls, dikt) -> 'ProductionFlowItem':\n return util.deserialize_model(dikt, cls)", "def from_dict(cls, dikt: dict) -> 'LabeledItemRef':\n return util.deserial...
[ "0.6744647", "0.66992635", "0.6483175", "0.63947576", "0.6271019", "0.6226842", "0.61250454", "0.6095903", "0.60774404", "0.6033618", "0.6033618", "0.6033618", "0.6033618", "0.6033618", "0.6033618", "0.6011749", "0.5973894", "0.5973894", "0.5956535", "0.5895595", "0.58810747"...
0.57625246
76