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
Format a 2D Numpy array into a NRRD optional matrix string Function converts a 2D Numpy array into a string using the NRRD matrix format. For any rows of the matrix that contain all NaNs for each element, the row will be replaced with a 'none' indicating the row has no vector.
def format_optional_matrix(x): return ' '.join([format_optional_vector(y) for y in x])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_optional_matrix(x):\n\n # Split input by spaces to get each row and convert into a vector. The row can be 'none', in which case it will\n # return None\n matrix = [parse_optional_vector(x, dtype=float) for x in x.split()]\n\n # Get the size of each row vector, 0 if None\n sizes = np.array(...
[ "0.622035", "0.5954527", "0.5928205", "0.5912855", "0.5727499", "0.57008296", "0.56179947", "0.5614566", "0.55843174", "0.54149926", "0.53773344", "0.53477156", "0.532382", "0.53015757", "0.5123682", "0.511336", "0.5099299", "0.5092014", "0.5065899", "0.5063694", "0.5053405",...
0.72085553
0
Format a 1D Numpy array into NRRD number list. Function converts a 1D Numpy array into a string using NRRD number list format.
def format_number_list(x): return ' '.join([format_number(y) for y in x])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_narray(narray, fmt = '%16s', delimiter = \",\"):\n narray = np.array(narray)\n len1 = len(narray.shape)\n\n if len1 == 1:\n return [format_list(narray, fmt, delimiter)]\n elif len1 == 2:\n strlist = []\n rownum = narray.shape[0]\n for i in range(rownum):\n ...
[ "0.686501", "0.62243104", "0.61535454", "0.61421543", "0.6059983", "0.60590684", "0.6055084", "0.59325016", "0.58198637", "0.57788", "0.57686704", "0.5677016", "0.55862576", "0.5585505", "0.5558441", "0.5533447", "0.5497891", "0.5480171", "0.54751545", "0.54410905", "0.542361...
0.5995008
7
For NRRD files, the first four characters are always "NRRD", and remaining characters give information about the file format version >>> _validate_magic_line('NRRD0005') 8 >>> _validate_magic_line('NRRD0006')
def _validate_magic_line(line): if not line.startswith('NRRD'): raise NrrdError('Missing magic "NRRD" word. Is this an NRRD file?') try: if int(line[4:]) > 5: raise NrrdError('NRRD file version too new for this library.') except ValueError: raise NrrdError('Invalid NRRD m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_header(self, cleartext_header, decrypted_header):\n import struct\n\n magic_number1 = struct.unpack(\"!I\", decrypted_header[:4])[0]\n # file_version = struct.unpack(\"!I\", decrypted_header[4:8])[0]\n # key_stretches = struct.unpack(\"!I\", decrypted_header[8:12])[0]\n ...
[ "0.569201", "0.56090045", "0.5599128", "0.5566738", "0.55418366", "0.5524839", "0.55238646", "0.5521166", "0.54416674", "0.5324497", "0.5295214", "0.5292996", "0.5256851", "0.5239331", "0.52130955", "0.52078396", "0.52056634", "0.5189201", "0.5186579", "0.5170318", "0.5164074...
0.8453927
0
Render index.html. Initialization is performed asynchronously in initialize() function
def landing(): return render_template('index.html', token=webview.token)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n return render_template('index.html')", "def main():\n return render_template('index.html')", "def index():\n # Render template\n return render_template('index.html')", "def index():\r\n return render_template('index.html')", "def index(self):\n return render_temp...
[ "0.7591317", "0.7591317", "0.75896853", "0.75501835", "0.7542187", "0.7540321", "0.75173515", "0.7512761", "0.7512761", "0.7493453", "0.7493453", "0.7480306", "0.7462847", "0.7462278", "0.7447789", "0.7439562", "0.7439562", "0.7439562", "0.7439562", "0.7439562", "0.7439562", ...
0.0
-1
Explode a GeoJSON geometry's coordinates object and yield coordinate tuples. As long as the input is conforming, the type of the geometry doesn't matter.
def explode(coords): for e in coords: if isinstance(e, (float, int, long)): yield coords break else: for f in explode(e): yield f
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geomFromInteriorPoints(coords):\n if isinstance(coords, numpy.ndarray):\n coords = coords.tolist()\n geomDict = {'type':'MultiPoint', 'coordinates':coords}\n geomPoints = ogr.CreateGeometryFromJson(repr(geomDict))\n return geomPoints", "def getCoords(geom):\n geomDict = eval(geom.Export...
[ "0.6310954", "0.6286501", "0.6224508", "0.61245656", "0.61227405", "0.61075085", "0.58908945", "0.5888281", "0.5884113", "0.58764863", "0.58513206", "0.5839912", "0.5814071", "0.57629925", "0.5734253", "0.5729233", "0.56301165", "0.560742", "0.55914867", "0.55578196", "0.5543...
0.6802374
0
Submit a new comment.
def comments_new(): comment = { "title": request.form.get("title"), "content": request.form.get("content"), "playlist_id": ObjectId(request.form.get("playlist._id")), } print(comment) comment_id = db.comments.insert_one(comment).inserted_id return redirect( url_for("p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_comment(self):\n self.post_question()\n return self.client.post(\"api/v2/1/comments\", headers={\"Authorization\": \"{}\".format(self.token())}, data=json.dumps(self.comment), content_type='application/json')", "def post(self):\n post_id = int(self.request.get('post_id'))\n p...
[ "0.7297798", "0.69898343", "0.6864198", "0.68514276", "0.67083836", "0.668532", "0.6682932", "0.666236", "0.66497433", "0.662015", "0.6584421", "0.6577321", "0.65517324", "0.6512225", "0.65074533", "0.64814925", "0.64590675", "0.6453132", "0.6443592", "0.64327055", "0.6431085...
0.6187039
36
Creates a sprite that, when the player collides with it, will prompt the user to exit.
def __init__(self, width, height): super().__init__() self.image = pygame.Surface([width, height]) self.image.fill(constants.BLUE) door = pygame.image.load('Graphics/Door.png') self.image.blit(door, door.get_rect()) self.image.set_colorkey(constants.BLUE) self.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_collide(self): # New for Rev2.0\r\n self.x = random.randrange(games.screen.width)\r\n self.y = random.randrange(games.screen.height)\r\n Sound.play()", "def __init__(self, BG_WIDTH,BG_HEIGHT):\r\n pygame.sprite.Sprite.__init__(self)\r\n self.image = p...
[ "0.61719465", "0.60282546", "0.6028132", "0.5920436", "0.5864075", "0.5774956", "0.5742993", "0.5742993", "0.5742993", "0.57380384", "0.57255703", "0.5717211", "0.57102424", "0.5681366", "0.5670776", "0.5657477", "0.5657432", "0.56347543", "0.56325614", "0.56220084", "0.56085...
0.0
-1
Return system database instance
def get_system_database() -> StandardDatabase: client = get_arango_client() return client.db("_system", username=ARANGO_USER, password=ARANGO_PASSWORD)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_database(self):\n return self.database", "def get_database(self, instance, name):\n return instance.get_database(name)", "def get_database(self, database, instance=None):\n return self._get(_database.Database, database)", "def db(self) -> Database:\n return self.impl.db", ...
[ "0.7939189", "0.7920433", "0.78951895", "0.78404564", "0.7790942", "0.7776532", "0.7736766", "0.77303636", "0.76975584", "0.76906294", "0.76341784", "0.7610511", "0.7609939", "0.7582774", "0.7582774", "0.756159", "0.75452924", "0.74812025", "0.74715596", "0.7459757", "0.74288...
0.8008464
0
Return buddhanexus database instance
def get_database() -> StandardDatabase: client = get_arango_client() return client.db(DB_NAME, username=ARANGO_USER, password=ARANGO_PASSWORD)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_db():\n # this is a bit of a hack, since it assumes all the models talk to the same\n # db. that said a lot of our code relies on that assumption.\n # this import is here because of annoying dependencies\n return Database(settings.COUCH_DATABASE)", "def db(self) -> Database:\n return ...
[ "0.7504944", "0.73750067", "0.7339674", "0.7225183", "0.71974593", "0.71942425", "0.7148886", "0.70750517", "0.7070916", "0.7062201", "0.7046365", "0.70364183", "0.7035892", "0.70356107", "0.70356107", "0.70334214", "0.702936", "0.7020423", "0.70172554", "0.70089877", "0.7001...
0.6680306
85
Return the current player.
def player(self): return self.players[self.tictactoe.turn]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_player(self) :\n return self.current_player", "def get_current_player(self):\n return self.current_player", "def getCurrentPlayer(self):\r\n return self.currentPlayer", "def get_current_player(self):\n\n # Return the current player\n return self._current_pla...
[ "0.93282586", "0.929401", "0.9215122", "0.913688", "0.9102611", "0.89838165", "0.897016", "0.88548744", "0.8829041", "0.87268007", "0.87268007", "0.86650807", "0.85642856", "0.8556092", "0.84805095", "0.84269875", "0.8318831", "0.8256911", "0.80736005", "0.78696734", "0.78440...
0.75655884
23
Test that correct users may create Cavatica projects
def test_create_project_mutation( db, clients, mock_cavatica_api, user_group, allowed ): study = StudyFactory(kf_id="SD_00000000") study.save() client = clients.get(user_group) kf_id = to_global_id("StudyNode", "SD_00000000") variables = { "input": {"workflowType": "rsem", "study": kf_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_project(self):\n pass", "def test_create_project(self):\n pass", "def test_create_project(self):\n pass", "def test_user_can_create_a_project(self):\n self.assertEqual(project_model.Project.objects.get(user=self.test_user).pk, self.test_project.pk)", "def test_cr...
[ "0.784348", "0.784348", "0.784348", "0.7746186", "0.77352273", "0.7699514", "0.7556866", "0.7270996", "0.7232274", "0.7211973", "0.72028965", "0.7162585", "0.713959", "0.71366113", "0.7112341", "0.7087111", "0.7062536", "0.7035972", "0.7028445", "0.70074105", "0.69981164", ...
0.71139944
14
Test that multiple projects with the same workflow may not be created for the same study.
def test_create_project_no_duplicate_workflows(db, clients, mock_cavatica_api): client = clients.get("Administrators") study = StudyFactory(kf_id="SD_00000000") study.save() kf_id = to_global_id("StudyNode", "SD_00000000") variables = { "input": {"workflowType": "rsem", "study": kf_id, "pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_project_invalid_workflows(db, clients, mock_cavatica_api):\n client = clients.get(\"Administrators\")\n\n study = StudyFactory(kf_id=\"SD_00000000\")\n study.save()\n\n kf_id = to_global_id(\"StudyNode\", \"SD_00000000\")\n variables = {\n \"input\": {\n \"workflowT...
[ "0.7134573", "0.66505384", "0.6468209", "0.6388659", "0.62340355", "0.6145839", "0.612046", "0.61085075", "0.61085075", "0.60835934", "0.6079471", "0.60697186", "0.6042777", "0.6040249", "0.6036487", "0.60094327", "0.5988171", "0.59810096", "0.5971545", "0.596354", "0.5962919...
0.74672663
0
Test that research projects with invalid workflow input may not be created.
def test_create_project_invalid_workflows(db, clients, mock_cavatica_api): client = clients.get("Administrators") study = StudyFactory(kf_id="SD_00000000") study.save() kf_id = to_global_id("StudyNode", "SD_00000000") variables = { "input": { "workflowType": "invalid@workflow*i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_for_unacceptable_matches_projects(\n student_names, project_names, supervisor_names, capacities, seed, clean\n):\n\n *_, game = make_game(\n student_names, project_names, supervisor_names, capacities, seed, clean\n )\n game.solve()\n\n project = game.projects[0]\n student = ...
[ "0.7055492", "0.69701475", "0.6939135", "0.69033504", "0.6789375", "0.67686033", "0.6768363", "0.6751658", "0.6729493", "0.67239165", "0.67095023", "0.66931164", "0.66392416", "0.66254085", "0.6609532", "0.6505268", "0.64722306", "0.64369893", "0.64119256", "0.64098793", "0.6...
0.7960564
0
Sets up a temp dir for each test.
def setUp(self): # Generates directory names self.tempdir = tempfile.mkdtemp() self.subdir = os.path.join(self.tempdir, "dir") self.emptydir = os.path.join(self.tempdir, "empty") # Populates directories os.makedirs(self.subdir) os.makedirs(self.emptydir) #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.tmp = TemporaryDirectory()", "def setUp(self):\n chdir(mkdtemp())", "def setUp(self):\n chdir(mkdtemp())", "def setUp(self):\n self.tmpdir = mkdtemp()", "def setUp(self):\n self._dir = tempfile.mkdtemp(prefix=f\"miniwdl_test_{self.id()}_\")", "de...
[ "0.826158", "0.8176917", "0.8176917", "0.8143828", "0.81345826", "0.801594", "0.7868184", "0.76964504", "0.7638751", "0.7592907", "0.7592907", "0.7592907", "0.7592907", "0.7592907", "0.7592907", "0.7592907", "0.75182325", "0.7501411", "0.7501411", "0.7485169", "0.746291", "...
0.75500166
16
Returns the unique ID of this document
def provider_id(self): return self.get('_id')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doc_id(self):\n return self._id", "def get_doc_id(self):\n return self.__doc_id", "def identifier(self) -> str:\n return self.doc['id']", "def unique_id(self):\n return self._id", "def unique_id(self):\n return self._id", "def doc_id(self):\n return self.prop...
[ "0.8280916", "0.81764466", "0.8117715", "0.7955348", "0.7955348", "0.788048", "0.7716234", "0.7716234", "0.7716234", "0.7716234", "0.7716234", "0.7716234", "0.7715426", "0.76716936", "0.7669201", "0.76648706", "0.76648706", "0.76297355", "0.75981677", "0.75981677", "0.7598167...
0.0
-1
Return the dictionary representation of this object.
def to_dict(self): result = super(Provider, self).to_dict() result['provider_class'] = self.provider_class.value return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_dict(self):\n return self.__dict__", "def to_dict(self):\n return dict(self)", "def to_dict(self):\n return to_dict(self.__dict__)", "def dict(self):\n return self.__dict__", "def dict(self):\n return self.__dict__", "def dict(self):\n return self.__dict__...
[ "0.87623477", "0.8750051", "0.8720296", "0.87060523", "0.87060523", "0.87060523", "0.87060523", "0.87060523", "0.87060523", "0.87060523", "0.8691401", "0.8691401", "0.8691401", "0.8691401", "0.8691401", "0.8691401", "0.86906916", "0.86867994", "0.86864716", "0.86722887", "0.8...
0.0
-1
Purpose Center filter. Synopsis y = center(f, b=None) Input
def center(f, b=None): if b is None: b = secross() y = f diff = 0 while not diff: aux = y beta1 = asf(y,'COC',b,1) beta2 = asf(y,'OCO',b,1) y = union(intersec(y,beta1),beta2) diff = isequal(aux,y) return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fd_center(f, h, x0):\n return (f(x0 + h) - 2*f(x0) + f(x0 - h))/(h**2)", "def Center(self, *args):\n return _Bnd.Bnd_Sphere_Center(self, *args)", "def center(x):\n return x - x.mean()", "def center(self):\n return np.array([0,0,1/self.C+self.pos()])", "def center_of_flux(self, LF, n...
[ "0.6362392", "0.60890687", "0.6059413", "0.60569865", "0.6014868", "0.59663165", "0.5898244", "0.58954257", "0.5855407", "0.58440626", "0.58334535", "0.57709855", "0.5746369", "0.5724208", "0.57143396", "0.5699061", "0.56946635", "0.569103", "0.56903344", "0.56831795", "0.567...
0.7412997
0
Purpose Create a line structuring element. Synopsis B = seline(l=3, theta=0) Input
def seline(l=3, theta=0): import numpy from numpy import pi, tan, cos, sin, sign, floor, arange, transpose, array, ones theta = pi*theta//180 if abs(tan(theta)) <= 1: s = sign(cos(theta)) x0 = arange(0, l * cos(theta)-(s*0.5),s) x1 = floor(x0 * tan(theta) + 0.5) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line(l, color='k', **kwargs):\n ax.plot(wfl(nth(l, 0)), hfl(nth(l, 1)), color=color, **kwargs)", "def createLineSegment(self):\n return _libsbml.Curve_createLineSegment(self)", "def getLine(self, **kwargs):\n return Line(self.p1, self.angle, **kwargs)", "def create_line(uniform = Tru...
[ "0.62474877", "0.6006988", "0.58282876", "0.5787256", "0.5750338", "0.56996584", "0.5695907", "0.5674978", "0.5670235", "0.5636259", "0.56338775", "0.55811584", "0.55447286", "0.5528125", "0.5523192", "0.5521161", "0.5507543", "0.5501937", "0.5496593", "0.5456718", "0.5447206...
0.74614924
0
Purpose Returns the maximum value associated to an image datatype Synopsis max = maxleveltype(TYPE='uint8') Input
def maxleveltype(TYPE='uint8'): max = 0 if TYPE == 'uint8' : max=255 elif TYPE == 'binary' : max=1 elif TYPE == 'uint16' : max=65535 elif TYPE == 'int32' : max=2147483647 else: assert 0, 'does not support this data type:'+TYPE return max
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_level(data: np.ndarray) -> int:\n shape = data.shape[1:] # exclude channel dimension\n return min(shape).bit_length() - 1", "def max_level(self):\n return self.__max", "def _maximum(self) -> float:\n if self._type == \"power\":\n return 5.0\n elif self._type == \"...
[ "0.664823", "0.6647606", "0.6606293", "0.6573356", "0.65679485", "0.65679485", "0.6517624", "0.644482", "0.64230394", "0.64144516", "0.64096117", "0.6396367", "0.63958275", "0.6321711", "0.6287342", "0.626718", "0.62576795", "0.62556404", "0.62458754", "0.62254846", "0.622512...
0.8170591
0
The quantiles corresponding to the features
def quantiles(self): return self._quantiles
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quantiles(self, q: int):\n return self.dist.quantiles(q)", "def quantile(feature, bins):\n t = feature.sort_values().values\n w = round(len(t)/bins)\n return [t[w*i-1] for i in range(1, bins)]", "def quantile(self, hypercube):\n raise NotImplementedError()", "def test_profiled_quan...
[ "0.7665638", "0.76528394", "0.71875024", "0.70389974", "0.70126265", "0.69704837", "0.69322085", "0.6846064", "0.6841902", "0.68319213", "0.67076045", "0.6676857", "0.6661948", "0.6650516", "0.66478264", "0.66478264", "0.66478264", "0.6621563", "0.6536564", "0.6535335", "0.65...
0.8084947
0
The quantiles corresponding to the features
def quantiles(self, value): self._quantiles = pandas.DataFrame(value, dtype=float)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quantiles(self):\n return self._quantiles", "def quantiles(self, q: int):\n return self.dist.quantiles(q)", "def quantile(feature, bins):\n t = feature.sort_values().values\n w = round(len(t)/bins)\n return [t[w*i-1] for i in range(1, bins)]", "def quantile(self, hypercube):\n ...
[ "0.8084947", "0.7665638", "0.76528394", "0.71875024", "0.70389974", "0.70126265", "0.69704837", "0.69322085", "0.6846064", "0.6841902", "0.67076045", "0.6676857", "0.6661948", "0.6650516", "0.66478264", "0.66478264", "0.66478264", "0.6621563", "0.6536564", "0.6535335", "0.653...
0.68319213
10
Generates the quantiles for each feature in X. The quantiles for one feature are computed such that the area between quantiles is the same throughout. The default quantiles are computed at the following
def make_quantiles(self, X, n_quantiles=9): if n_quantiles < 1: raise FeatureImpactError("n_quantiles must be at least one.") X = pandas.DataFrame(X) probs = numpy.linspace(0.0, 1.0, n_quantiles + 2)[1:-1] self._quantiles = pandas.DataFrame(dtype=float) for col in X: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quantiles(x, qlist=[2.5, 25, 50, 75, 97.5]):\n # Make a copy of trace\n x = x.copy()\n\n # For multivariate node\n if x.ndim > 1:\n # Transpose first, then sort, then transpose back\n sx = np.transpose(np.sort(np.transpose(x)))\n else:\n # Sort univariate node\n sx = ...
[ "0.70554554", "0.6961914", "0.6935193", "0.68663985", "0.6722963", "0.6685941", "0.65833944", "0.65438044", "0.6502006", "0.6346135", "0.6340859", "0.6323469", "0.63208634", "0.6201339", "0.61836976", "0.61179936", "0.61027896", "0.61023414", "0.6099939", "0.60567063", "0.604...
0.69860053
1
Compute the Euclidean distance between two ndimensional objects.
def euclidean_distance(s1,s2): tmpsum = 0 for index,value in enumerate(s1): tmpsum += (s1[index]-s2[index])**2 return math.sqrt(tmpsum)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _object_distance(self, object1, object2):\n return np.linalg.norm(np.array(object1) - np.array(object2))", "def euclidean(x,y):\n\tassert (isinstance(x, BayesNet) and isinstance(y, BayesNet)), 'Must pass in BayesNet objects.'\n\tassert (x==y), 'Passed-in BayesNet objects are not structurally equal.'\n...
[ "0.78630954", "0.75014645", "0.72984904", "0.7252056", "0.7198011", "0.7175983", "0.71631706", "0.7146378", "0.7120438", "0.70882535", "0.7087155", "0.70861405", "0.708451", "0.706804", "0.70471025", "0.70345724", "0.70338404", "0.70252156", "0.70200783", "0.70191354", "0.701...
0.0
-1
Drop the maximum dose and related response values.
def drop_dose(self): for fld in ("doses", "ns", "means", "stdevs"): arr = getattr(self, fld)[:-1] setattr(self, fld, arr) self._validate()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop_dose(self):\n individual_doses = np.array(self.individual_doses)\n responses = np.array(self.responses)\n\n mask = individual_doses != individual_doses.max()\n doses = individual_doses[mask].tolist()\n responses = responses[mask].tolist()\n\n summary_data = self._...
[ "0.7200658", "0.62198234", "0.5772812", "0.5744219", "0.56280816", "0.55736995", "0.5513809", "0.54918855", "0.54886866", "0.54837", "0.5429068", "0.5419061", "0.53948057", "0.53888166", "0.53503466", "0.5337019", "0.53281724", "0.5226603", "0.5226471", "0.5201941", "0.519972...
0.64605606
1
Drop the maximum dose and related response values.
def drop_dose(self): individual_doses = np.array(self.individual_doses) responses = np.array(self.responses) mask = individual_doses != individual_doses.max() doses = individual_doses[mask].tolist() responses = responses[mask].tolist() summary_data = self._prepare_summa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop_dose(self):\n for fld in (\"doses\", \"ns\", \"means\", \"stdevs\"):\n arr = getattr(self, fld)[:-1]\n setattr(self, fld, arr)\n self._validate()", "def del_max(self):\r\n maxVal = self.find_max()\r\n if maxVal is not None:\r\n self.items[1] =...
[ "0.64582723", "0.622028", "0.5770182", "0.5745489", "0.5629807", "0.5575314", "0.5513428", "0.5490371", "0.54876935", "0.5482849", "0.543109", "0.54207766", "0.5394414", "0.53877926", "0.5351516", "0.53369254", "0.5329014", "0.52281237", "0.5226602", "0.5202013", "0.5201195",...
0.7198417
0
Get a named environment variable.
def GetEnvVariable(name): return os.environ.get(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_environment_variable(name):\n\n variable = None\n try:\n variable = os.environ[name]\n except KeyError:\n pass\n \n return variable", "def get_var(var_name: str):\n return os.environ[var_name]", "def get_env_variable(var_name):\n try:\n return os.environ[var_na...
[ "0.87718797", "0.8226911", "0.79157805", "0.7888638", "0.7883775", "0.77977866", "0.77544516", "0.7713071", "0.77109146", "0.770913", "0.7647273", "0.7614183", "0.760763", "0.75793314", "0.7554774", "0.7553723", "0.7534137", "0.74628687", "0.7448695", "0.7385682", "0.737286",...
0.87937665
0
Test that multiple subscribers can wait for a notification. This test checks that the subscribers are awoken in the order they subscribed. This may or may not be guarenteed according to the implementations of both ChangeNotifier and the event loop. This test functions as a canary, given that our code may relies on this...
async def test_multiple_subscribers(count: int) -> None: subject = ChangeNotifier() results = [] async def _do_task_1() -> None: await subject.wait() results.append(1) async def _do_task_2() -> None: await subject.wait() results.append(2) async def _do_task_3() -> ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_single_subscriber() -> None:\n subject = ChangeNotifier()\n result = asyncio.create_task(subject.wait())\n\n # ensure that the wait actually waits by delaying and\n # checking that the task has not resolved\n await asyncio.sleep(0.1)\n assert result.done() is False\n\n asyncio.g...
[ "0.7654742", "0.6791694", "0.67711705", "0.6699863", "0.66720235", "0.6671149", "0.65840507", "0.6576444", "0.65402824", "0.65248865", "0.6514565", "0.64312106", "0.6329941", "0.62138104", "0.61673623", "0.61454916", "0.610082", "0.6076075", "0.6068079", "0.6021281", "0.60173...
0.79677045
0
Decide the position of characters to capitalize. Decides positions in a word to capitalize randomly.
def __capital_positions(self, word): capital_amount = int(len(word) * self.sponge_percentage / 100) positions = [] for i in range(0, capital_amount): capital_letter = self.__generate_position(word, positions) positions.append(capital_letter) return positions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __generate_position(cls, word, positions):\n capital_letter_pos = randrange(0, len(word))\n\n if capital_letter_pos not in positions:\n return capital_letter_pos\n else:\n return cls.__generate_position(word, positions)", "def __fCap__(self, word, position):\n ...
[ "0.70963705", "0.6508292", "0.638785", "0.6289683", "0.62466246", "0.62367964", "0.6230413", "0.6135915", "0.61242163", "0.6101123", "0.60882884", "0.60882884", "0.605548", "0.6048008", "0.6036323", "0.602291", "0.60042727", "0.6003932", "0.5982964", "0.5958503", "0.58701086"...
0.6403706
2
onehot encodes an array
def to_categorical(x, num_classes): return np.eye(num_classes, dtype='uint8')[x]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_encode(x):\n # TODO: Implement Function\n output = np.zeros((len(x), 10))\n \n for i, j in enumerate(x):\n output[i,j] = 1\n \n return output", "def one_hot_encode(self, arr, n_labels):\n one_hot = np.zeros((np.multiply(*arr.shape), n_labels), dtype=np.float32)\...
[ "0.8576771", "0.8545493", "0.8403242", "0.83911836", "0.8277237", "0.8139565", "0.81292146", "0.81211203", "0.80612904", "0.8027901", "0.79804116", "0.7977593", "0.79452986", "0.79127145", "0.78901577", "0.78901285", "0.78709936", "0.7869139", "0.78645533", "0.7858717", "0.78...
0.0
-1
Gets the access control policy on the specified Source.
def GetIamPolicy(self, request, context): context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_policy(self):\n try:\n LOG.debug(\"Searching for retention_policy in K2.\")\n return self.client.search(\"retention_policies\",\n name=\"Best_Effort_Retention\").hits[0]\n except Exception as ex:\n LOG.exception(\"Retention...
[ "0.6393413", "0.5957159", "0.5945247", "0.5911586", "0.58936405", "0.58229315", "0.5806834", "0.5760215", "0.5638382", "0.5604752", "0.55268115", "0.5494631", "0.5486191", "0.5475898", "0.54113775", "0.54113775", "0.53914684", "0.5362438", "0.53545266", "0.5309652", "0.530673...
0.0
-1
Sets the access control policy on the specified Source.
def SetIamPolicy(self, request, context): context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_access_policy( # pylint: disable=inconsistent-return-statements\n self,\n timeout: Optional[int] = None,\n lease_access_conditions: Optional[_models.LeaseAccessConditions] = None,\n share_acl: Optional[List[_models.SignedIdentifier]] = None,\n **kwargs: Any\n ) -> Non...
[ "0.590164", "0.568738", "0.56550294", "0.5582311", "0.5579302", "0.537496", "0.5364177", "0.5351427", "0.5315542", "0.5312642", "0.53022426", "0.5188839", "0.5165241", "0.51605785", "0.51604086", "0.51513314", "0.5137051", "0.5127089", "0.5115932", "0.5109599", "0.5108453", ...
0.45882952
79
Check whether relative paths are used within a module.
def check_relative_paths(ctx, stmt): path = stmt.arg if path[0] == "/": abspath = True else: abspath = False components = yangpath.split_paths(path) # consider the namespace in the first component # assumes that if the namespace matches the module namespace, then # relative path...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_relative_to(p1: Path, p2: Path) -> bool:\n # stolen from CPython's source\n try:\n p1.relative_to(p2)\n return True\n except ValueError:\n return False", "def testRelativeImport(self):\r\n self.buildTempDirs()\r\n expected = os.path.join(...
[ "0.6869687", "0.6536748", "0.64589703", "0.6399969", "0.6396609", "0.6358301", "0.6248277", "0.62355566", "0.6224298", "0.61984104", "0.6163366", "0.6139353", "0.60878813", "0.60558623", "0.6032954", "0.6031183", "0.6009926", "0.6003163", "0.5970523", "0.5964149", "0.59610105...
0.74338627
0
Returns the next power of two greater than or equal to `n`
def next_pow_two(n): i = 1 while i < n: i = i << 1 return i
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _next_power_of_two(self, n):\n if n == 0:\n return 1\n return int(2 ** math.ceil(math.log2(n)))", "def nextpow2(n):\n m_f = np.log2(n)\n m_i = np.ceil(m_f)\n return np.int(2 ** m_i)", "def nextPowerOf2(n):\n count = 0; \n \n # First n in the below \n # condition is for the \...
[ "0.8846374", "0.84687304", "0.841344", "0.81295115", "0.8119157", "0.80217546", "0.7982148", "0.7935714", "0.78664106", "0.7832619", "0.77918994", "0.77531743", "0.77531743", "0.7700856", "0.76726377", "0.76673084", "0.761716", "0.76112163", "0.751201", "0.7486262", "0.746107...
0.8760269
1
Find the minimum value of this probability distribution. Returns float
def max(self): if self._mesh.is_1d(): ind = 1 elif self._mesh.is_2d(): ind = 2 else: if self._logger: self._logger.error("mesh dimension not implemented") raise NotImplementedError("mesh dimension not implemented") def __ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min(self) -> float:\n return stats.min(self)", "def min_value(self) -> float:\n return DEFAULT_MIN_VALUE", "def minimum_value(self):\n return self._fitness[self._minidx]", "def native_min_value(self) -> float:\n return TEMP_MINIMUM", "def MinimumValue(self):\n return ...
[ "0.830633", "0.8093407", "0.79256004", "0.79039156", "0.7789286", "0.7601184", "0.75269556", "0.74669725", "0.7408763", "0.7358523", "0.7336871", "0.73309755", "0.7285753", "0.72768", "0.7253811", "0.72429985", "0.72309744", "0.7176928", "0.71497", "0.71497", "0.71177554", ...
0.0
-1
Find the minimum value of this probability distribution. Returns float
def min(self): if self._mesh.is_1d(): ind = 1 elif self._mesh.is_2d(): ind = 2 else: if self._logger: self._logger.error("mesh dimension not implemented") raise NotImplementedError("mesh dimension not implemented") def __ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min(self) -> float:\n return stats.min(self)", "def min_value(self) -> float:\n return DEFAULT_MIN_VALUE", "def minimum_value(self):\n return self._fitness[self._minidx]", "def native_min_value(self) -> float:\n return TEMP_MINIMUM", "def MinimumValue(self):\n return ...
[ "0.8306288", "0.8093641", "0.79255813", "0.79041344", "0.7789307", "0.76010853", "0.7527025", "0.7467089", "0.7408823", "0.73584664", "0.73366624", "0.733115", "0.72855824", "0.7276661", "0.7253727", "0.72432095", "0.7231134", "0.717682", "0.7149883", "0.7149883", "0.7117972"...
0.0
-1
view root page function that returns the index page and its data
def index(): current_news = get_news() print(current_news) title = "Welcome to the Best News Website for latest and current news" return render_template('index.html', title= title, current_news = current_news )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n\n return {\n 'page': 'index',\n }", "def main():\n page = get_page_arg()\n\n items = load_data(page)\n total_pages = get_total_pages()\n context = {\"current_page\": page,\n \"total_pages\": total_pages,\n \"items\": items}\n\n return render_...
[ "0.82565635", "0.8098345", "0.8021132", "0.7964447", "0.7913464", "0.7913464", "0.7913464", "0.7897068", "0.78894967", "0.78651595", "0.7844439", "0.78408384", "0.7820593", "0.7815564", "0.78104883", "0.78095865", "0.78062797", "0.77909493", "0.77909493", "0.77845234", "0.778...
0.0
-1
calculate the alpha DIRECTLY for the disparity filter
def _get_disparity_parameter(self, norm_weight, degree): return 1 - (degree - 1) * integrate.quad(lambda x: (1 - x)**(degree - 2), 0, norm_weight)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_alpha(color, F, B):\n return np.dot(color - B, F - B) / np.dot(F - B, F - B)", "def alpha(self) -> float:\n return self.intrinsic_matrix[0, 1]", "def alpha(self) -> float:\n return self._alpha", "def alpha_from_R(R):\n return 1-np.abs(R)**2", "def test_compute_alphas(self)...
[ "0.66736346", "0.6356342", "0.6308676", "0.6225196", "0.6191466", "0.61109656", "0.61109656", "0.61109656", "0.6106442", "0.60542166", "0.60495", "0.5983184", "0.59430313", "0.5911935", "0.5896451", "0.58829683", "0.585503", "0.58384377", "0.5834095", "0.58319455", "0.5827659...
0.0
-1
Reads source and target sequences from txt files.
def __init__(self, data_info, src_lang, mem_lang, domain_lang, slot_lang, tag_lang, args, split, ALL_SLOTS): self.ID = data_info['ID'] self.turn_id = data_info['turn_id'] self.dialog_history = data_info['dialog_history'] self.delex_dialog_history = data_info['delex_dialog_history'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_examples(source_file, target_file):\n sources = []\n targets = []\n\n with gfile.GFile(source_file, \"r\") as txt_file:\n for line in txt_file:\n sources.append(line.rstrip(\"\\n\"))\n\n with gfile.GFile(target_file, \"r\") as txt_file:\n for line in txt_file:\n targets.append(line.rst...
[ "0.7004346", "0.6208018", "0.61497456", "0.6132846", "0.6076196", "0.60475314", "0.6025892", "0.5775756", "0.56896174", "0.5674089", "0.5657116", "0.56105125", "0.5501782", "0.5494425", "0.5476749", "0.5456228", "0.54284465", "0.54284143", "0.5420703", "0.5415088", "0.5394724...
0.0
-1
Return the direction of the LSPE pointing axis at the given time. `time' is expressed in seconds. The result is a (latitude, longitude) pair in the LSPE coordinate system (z points toward the Zenith).
def pointing_pos_lspe (self, time): return (self.elevation, self.start_angle + time * self.omega_rot)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pointing_dir_lspe (self, time):\n\n return coord_to_pointing (self.pointing_pos_lspe (time))", "def lspe_coordinates (self, time):\n\n return (self.base_lat,\n self.base_long\n + time * 2 * np.pi * (1 + 1 / self.rev_days) / SECONDS_PER_DAY)", "def getDirection (s...
[ "0.70938075", "0.69791526", "0.68939024", "0.6795198", "0.6252546", "0.6250635", "0.61746335", "0.601992", "0.6003701", "0.57562494", "0.5663964", "0.5598658", "0.55148643", "0.5468612", "0.54618716", "0.5375528", "0.5349885", "0.53247106", "0.52398443", "0.5236297", "0.52313...
0.66604656
4
Return the pointing axis at the given time. `time' is expressed in seconds. The result is a 3D normalized vector in the LSPE coordinate system (z points toward the Zenith).
def pointing_dir_lspe (self, time): return coord_to_pointing (self.pointing_pos_lspe (time))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _P(time='now'):\n obstime = parse_time(time)\n\n # Define the frame where its Z axis is aligned with geocentric north\n geocentric = PrecessedGeocentric(equinox=obstime, obstime=obstime)\n\n return _sun_north_angle_to_z(geocentric)", "def pointing_pos_lspe (self, time):\n\n return (self.el...
[ "0.6433514", "0.64309686", "0.6389323", "0.6296026", "0.62352294", "0.6122941", "0.6073413", "0.59992754", "0.59911525", "0.58216655", "0.57996625", "0.56260103", "0.5584469", "0.5572924", "0.5554556", "0.55154806", "0.5493454", "0.54903036", "0.5326363", "0.5326363", "0.5281...
0.58437085
9
Return the pointing axis at the given time. `time' is expressed in seconds. The result is a 3D normalized vector in the Earth coordinate system (equatorial coordinates).
def pointing_dir_earth (self, time): return self.vect_from_lspe_to_earth (self.pointing_dir_lspe (time), time)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spin_axis_earth (self, time):\n\n return self.vect_from_lspe_to_earth (self.spin_axis_lspe (time),\n time)", "def _P(time='now'):\n obstime = parse_time(time)\n\n # Define the frame where its Z axis is aligned with geocentric north\n geocentric = Pr...
[ "0.7195893", "0.626813", "0.6265568", "0.6017088", "0.6016693", "0.59964687", "0.5989676", "0.5925973", "0.5901042", "0.58309186", "0.5752033", "0.56539387", "0.5561295", "0.5533267", "0.55301183", "0.5498682", "0.5498639", "0.5467805", "0.5411977", "0.53572595", "0.53317136"...
0.6909739
1
Return the coordinates of LSPE at the given time. The result is a (latitude, longitude) pair specifying where LSPE is at the given `time' (in seconds).
def lspe_coordinates (self, time): return (self.base_lat, self.base_long + time * 2 * np.pi * (1 + 1 / self.rev_days) / SECONDS_PER_DAY)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sunlongitude(time):\n B0 = 36000.7695\n C0 = 280.4659\n # fmt: off\n A = np.array([19147e-4, 200e-4, 48e-4, 20e-4, 18e-4, 18e-4, \\\n 15e-4, 13e-4, 7e-4, 7e-4, 7e-4, 6e-4, \\\n 5e-4, 5e-4, 4e-4, 4e-4])\n B = np.array([35999.050, 71998.1, 1934, 32964, 19, \\\n ...
[ "0.64156216", "0.62733424", "0.6054417", "0.59554416", "0.575077", "0.5719059", "0.569973", "0.56042564", "0.54053766", "0.53990406", "0.5355739", "0.5332108", "0.53242445", "0.5267854", "0.52543586", "0.5240149", "0.52363694", "0.52345276", "0.52316546", "0.5230655", "0.5202...
0.8144775
0
Return the LSPE spin axis at the given time. `time' is expressed in seconds. The result is a 3D normalized vector in the equatorial coordinate system.
def spin_axis_earth (self, time): return self.vect_from_lspe_to_earth (self.spin_axis_lspe (time), time)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vect_from_lspe_to_earth (self, vector, time):\n\n position_coord = self.lspe_coordinates (time)\n # The following code has been optimized:\n # position_vector = coord_to_pointing (position_coord)\n # angle = np.arccos (np.dot (self.spin_axis_lspe (time), position_vector))\n ...
[ "0.624724", "0.608877", "0.5773101", "0.5696111", "0.56890506", "0.5685792", "0.56773686", "0.56202793", "0.5601596", "0.5515599", "0.5491223", "0.54664624", "0.5454418", "0.53252333", "0.5323779", "0.52936375", "0.52904826", "0.52311695", "0.5209736", "0.5209331", "0.5205471...
0.7387977
0
Split a list into parts based on a set of indexes
def partition(alist, indices): return [alist[i:j] for i, j in zip([0]+indices, indices+[None])]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split(array, indexes):\n if isinstance(indexes, int):\n return list(array[0:indexes], array[indexes:])\n\n newarray = []\n offset = 0\n for idx in indexes:\n newarray.append(array[offset:idx])\n offset += idx\n if indexes[-1] < len(array):\n newarray.append(array[inde...
[ "0.69890213", "0.6807072", "0.677275", "0.677275", "0.6755652", "0.6721113", "0.6678109", "0.66106856", "0.6585786", "0.64385384", "0.6438394", "0.643007", "0.63700277", "0.6337263", "0.63080686", "0.6291404", "0.62714213", "0.6254273", "0.62111574", "0.6197336", "0.61953783"...
0.72672635
0
False if self.audit or self.audit_id is set, True otherwise.
def allow_map_to_audit(self): return self.audit_id is None and self.audit is None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def audit_only(self) -> bool:\n result = True\n for effect in self.allowed_effects:\n if effect not in [\"disabled\", \"audit\", \"auditifnotexists\"]:\n result = False\n return result", "def controlled(self):\n if self.crypt_private is not None and self.sign...
[ "0.683113", "0.6191331", "0.6014149", "0.5957627", "0.59350103", "0.5918815", "0.5918815", "0.5884331", "0.58457464", "0.57644427", "0.5666733", "0.5666299", "0.5661693", "0.56545955", "0.5641392", "0.5625657", "0.5624119", "0.5619391", "0.56157696", "0.56139696", "0.5597099"...
0.71672326
0
Create a copy of this Query, optionally with a different store instance than this query's self.store.
def copy(self, store: Optional[StoreInterface] = None) -> 'Query': query = Query(store=store or self.store) query.selected = {k: v.copy() for k, v in self.selected.items()} query.predicate = self.predicate.copy() query.orderings = deepcopy(self.orderings) query.limit_index = self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n return type(self)(*self.__queries, op=self.__op)", "def _clone(self):\n c = self.__class__(\n model=self.model,\n query=self.query.chain(),\n using=self._db,\n hints=self._hints,\n )\n c._sticky_filter = self._sticky_filter...
[ "0.7348373", "0.6757588", "0.67500645", "0.6685531", "0.6333551", "0.6175301", "0.61612636", "0.61032754", "0.59796643", "0.5944079", "0.5938738", "0.59329224", "0.5882597", "0.5845459", "0.5837441", "0.5806018", "0.5794587", "0.57779443", "0.57744503", "0.57643527", "0.57435...
0.8707415
0
Set the pagination "limit", as in the maximum number of records to return per "page."
def limit(self, limit: int) -> 'Query': self.limit_index = max(1, limit) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def limit(self, limit):\n self._limit = limit", "def limit(self, limit):\n self._limit = limit\n return self", "def per_page(self,limit):\n params = join_params(self.parameters,\n {\"per_page\": set_limit(limit),\n \"limit\": self._limit,...
[ "0.76834166", "0.7615425", "0.7607272", "0.75510806", "0.75510806", "0.75510806", "0.7528365", "0.7507847", "0.7503021", "0.7270429", "0.7229816", "0.71996254", "0.71189463", "0.7104942", "0.7061253", "0.70071185", "0.6994131", "0.69546235", "0.6927474", "0.6855342", "0.68012...
0.70080024
15
Make a scalar R>R function into a tensor one
def scalar(f): def g(X: tuple()): return Scalar(f(Scalar(X))) return g
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tensor(*args, **kwargs):\n return Tensor(*args, **kwargs)", "def xscalary_plus_z(scalar, x, y, activation=None):\n R = tf.add(tf.scalar_mul(scalar,x), y)\n if activation:\n return activation(R)\n else: \n return R", "def __call__(self, tensor): \n tensor = (tensor - 127.5) ...
[ "0.6278768", "0.6250319", "0.6036445", "0.60087484", "0.5967739", "0.5964352", "0.5888104", "0.5886529", "0.5856317", "0.5839871", "0.5832009", "0.5796428", "0.5748774", "0.57463694", "0.569091", "0.56640303", "0.56586426", "0.5650278", "0.5646189", "0.5639135", "0.56217676",...
0.59738374
4
Test the situation when scenario is not found.
def test_scenario_not_found(testdir, pytest_params): testdir.makefile( ".feature", not_found=textwrap.dedent( """\ Feature: Scenario is not found """ ), ) testdir.makepyfile( textwrap.dedent( """\ import re impo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_such_step(self):\n with self.assertRaises(Exception):\n self.run_step('FAKE-STEP.no-exists')", "def test_find_unit_notfound(self):\r\n url = \"i4x://MITx/999/chapter/notfound\"\r\n with self.assertRaises(tools.DashboardError):\r\n tools.find_unit(self.course...
[ "0.7552852", "0.724558", "0.71064776", "0.69101816", "0.6812769", "0.67679614", "0.67449826", "0.6726229", "0.658368", "0.6548276", "0.6542335", "0.65245664", "0.65075564", "0.65014774", "0.64789724", "0.6474327", "0.64591765", "0.6428042", "0.6419193", "0.6389983", "0.636883...
0.7472041
1
Return True if number is a power of two, supports n>1 and n<1.
def is_power_of_two(n: Union[int, float]): if n > 1: if n != int(n): return False n = int(n) return (n != 0) and (n & (n - 1) == 0) elif n == 1: return True elif n > 0: return is_power_of_two(1/n) else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isPowerOfTwo(self, n: int) -> bool:\n if n <= 0:\n return False\n return bin(n).count('1') == 1", "def is_power_of_two(n):\n if n < 0:\n return False\n else:\n return n & (n - 1) == 0", "def is_power_of_two(n):\n if n <= 0:\n return False\n else:\n ...
[ "0.8641741", "0.8559665", "0.853048", "0.8378766", "0.8378766", "0.8273397", "0.8103103", "0.80063003", "0.7962913", "0.7507049", "0.73038036", "0.7036625", "0.6923268", "0.69191253", "0.68892705", "0.6852972", "0.6748093", "0.67080873", "0.66790396", "0.66678953", "0.6577840...
0.84972197
3
We currently convert xarray Dataset input into a numpy structured array. Xarry Datasets appear to be rather slow in testing, I believe because they do some stuff under the hood with matching coordinates when you do basic operations. Also, you can't do any fancy indexing with xarray Dataset, at best you can use slice wi...
def _convert_dataset(self): allowed_vars = ['x', 'y', 'z', 'tvu', 'thu'] dtyp = [(varname, self.data[varname].dtype) for varname in allowed_vars if varname in self.data] empty_struct = np.empty(len(self.data['x']), dtype=dtyp) for varname, vartype in dtyp: empty_struct[varnam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sentinel_to_numpy(ds: xr.Dataset) -> np.ndarray:\n array = ds.transpose(\"lat\", \"lon\", \"band\").to_array().values\n\n return np.squeeze(array, 0)", "def to_xarray(self):\n\n xarray_object = xr.Dataset()\n for var, data in self.items(deep=True):\n xarray_object[var] ...
[ "0.6672121", "0.6504071", "0.64366394", "0.6436551", "0.6390116", "0.6316874", "0.62554896", "0.62541354", "0.6224573", "0.61783355", "0.61278087", "0.61178744", "0.61000365", "0.609082", "0.6057803", "0.60349447", "0.6032285", "0.60014206", "0.5989693", "0.598313", "0.597381...
0.5563167
73
Return a list of layer names based on what layers exist in the BaseSurface instance. Returns list
def return_layer_names(self): existing_layernames = [] if self.node_data is not []: for lyrname, lyr in self.layer_lookup.items(): if self.node_data[lyr].any(): existing_layernames.append(lyrname) return existing_layernames
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLayerNames(self):\n\t\treturn self._fileSystem.getLayerNames()", "def get_layers(self):\n layers = []\n\n for s in self.surfaces:\n n = self.miller_to_direction(s)\n r = np.dot(self.get_positions() - self.center, n).max()\n d = self.get_layer_distance(s, 2)\n...
[ "0.76468474", "0.7344719", "0.7263227", "0.723299", "0.7055118", "0.6845979", "0.6752388", "0.6735394", "0.67261845", "0.6679928", "0.6628666", "0.6517553", "0.6470188", "0.6391233", "0.63873905", "0.63852024", "0.6367763", "0.6298952", "0.6251205", "0.62266123", "0.6179383",...
0.7293472
2
Get the attribute corresponding to attr from all leaves
def get_leaves_attr(self, attr: str): return [getattr(q, attr) for q in self.leaves]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_attr(self, attr, root=None):\n with self._h5file('r') as h5file:\n if root is None:\n obj = h5file\n else:\n obj = h5file[root]\n return get_decoded(obj.attrs, attr)[attr]", "def _get_node_attr(self, node, attr):\n return self....
[ "0.69037783", "0.68113965", "0.68011683", "0.6742704", "0.66509706", "0.62171644", "0.6213443", "0.6208558", "0.6163948", "0.6148756", "0.60806924", "0.6068117", "0.6030441", "0.5967563", "0.59623355", "0.59315515", "0.59315515", "0.58916986", "0.58902794", "0.58779556", "0.5...
0.7731435
0
Return a list of all neighbors for this QuadTree (orthogonal) Returns list list of QuadTrees that are orthogonally adjacent to this QuadTree
def neighbours(self): neighbours = [] root = self.root if self == root: return neighbours ######################## # IMMEDIATELY ADJACENT # sizes = [self.maxs[0] - self.mins[0], self.maxs[1] - self.mins[1]] coords = [(self.mins[0] + sizes[0] / 2, sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbours(self):\n seen = set()\n return [l.other(self) for l in self.dovetails \\\n if id(l) not in seen and not seen.add(id(l))]", "def neighbours_L(self):\n seen = set()\n return [l.other(self) for l in self.dovetails_L \\\n if id(l) not in seen and not seen.add(id(l)...
[ "0.69070774", "0.6672059", "0.6541326", "0.6539021", "0.6521663", "0.6521663", "0.6507441", "0.64733523", "0.6458688", "0.6458688", "0.64416724", "0.6341816", "0.6302468", "0.62991655", "0.62931883", "0.6275906", "0.62652934", "0.62225336", "0.6208394", "0.6181248", "0.618098...
0.70649123
0
Return a list of all leaves for the tree, leaves being QuadTrees with no children Returns list list of QuadTrees
def leaves(self): return self.get_leaves()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_leaves(self):\n\n nodes = self._heads[:]\n leaves = []\n\n visited = set(nodes)\n\n while nodes:\n n = nodes.pop()\n\n if n.all_children:\n unvisited = [c for c in n.all_children if c not in visited]\n nodes.extend(unvisited)\n...
[ "0.7597788", "0.7445184", "0.7390554", "0.7359457", "0.7294599", "0.72522914", "0.7133439", "0.71092623", "0.709481", "0.69948804", "0.69900835", "0.69755894", "0.69286317", "0.6925147", "0.69246536", "0.6905016", "0.6859689", "0.6816301", "0.6789675", "0.6780764", "0.6756697...
0.6784422
19
Create a language model based on the Crepe model in Zhang et. al. Creates a model that uses only Convolutional Layers (max pooling in between), and dense layers for prediction tasks. For this model, the final output layer will predict the next character in the sequence.
def build_character_cnn(model_hyperparameters=None, verbose=None): if model_hyperparameters is None: model_hyperparameters = _dutils.load_dictionary('model_hyperparameters.json') ''' Load hyperparameter-specific values from JSON file. ''' #The size of the characater vocabulary ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_model():\n model = Sequential()\n\n model.add(Lambda(lambda x: x/127.5-1.0, input_shape=INPUT_SHAPE))\n\n # Now we are going to add some Convulation Layers identical to paper\n\n model.add(Conv2D(24, (5, 5), activation='elu', strides=(2, 2)))\n model.add(BatchNormalization()) \n mo...
[ "0.67907363", "0.67853427", "0.66978896", "0.6664061", "0.6596703", "0.6590391", "0.65843797", "0.6537042", "0.6521642", "0.65098804", "0.6504644", "0.64829683", "0.64660394", "0.64641047", "0.6429148", "0.64270455", "0.6405421", "0.6403719", "0.6393534", "0.6377966", "0.6366...
0.6983286
0
check if values in `df` are higher than those in `df2`.
def record_high(df, df2, agg='max'): if agg == 'max': return df[df['max'] > df2['max']].drop('mean', axis=1) elif agg == 'mean': return df[df['mean'] > df2['mean']].drop('max', axis=1) else: raise ValueError('unknown test')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isLessEqual(df1, df2):\n indices = list(set(df1.index).intersection(df2.index))\n dff1 = df1.loc[indices, :]\n dff2 = df2.loc[indices, :]\n df = dff1 - dff2\n df_tot = df.applymap(lambda v: v <= 0)\n result = df_tot.sum().sum() == df.size\n return result", "def eq(df1, df2, precision=0.5) -> bool:\n ...
[ "0.7089077", "0.65464246", "0.6446613", "0.6308537", "0.62558085", "0.62524134", "0.6236358", "0.616724", "0.61446786", "0.61343825", "0.6126738", "0.60659033", "0.60639274", "0.6008289", "0.59934646", "0.5992191", "0.5976035", "0.59452075", "0.59068024", "0.5898108", "0.5892...
0.66314673
1
Modifies a string to determine the correct case for each individual character in the string. A character will be uppercase if the bit representing it in the iteration value is set to 1. For example, the string "hello" with an iteration of 3 would be return "HEllo".
def case_iteration(header, iteration): if iteration <= 0: return header.lower() chars = [] removed = [] # First create lists of workable and unworkable characters for i, char in enumerate(header): if char not in string.ascii_letters: removed.append({"char": char, "pos":...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def case_i(string: str) -> str:\n return \"\".join(\"[\" + c.upper() + c.lower() + \"]\"\n if c.isalpha() else c for c in re.escape(string))", "def ReplaceCapitals(string):\n\n newString = \"\"\n for char in string:\n if char.isupper():\n newString += \"_%s\"%char.lo...
[ "0.72456825", "0.7035167", "0.6963037", "0.6683893", "0.6570315", "0.65661544", "0.6561868", "0.65565664", "0.65565664", "0.65565664", "0.65565664", "0.6546514", "0.6458094", "0.6431306", "0.6342048", "0.6290183", "0.6276903", "0.6270719", "0.625104", "0.6237894", "0.6229199"...
0.7466728
0
Return the GeoDataFrame geometry coordinates as list. >>> from shapely.geometry import LineString >>> geo_dataframe_to_list(gpd.GeoDataFrame(geometry=[LineString([(0, 0), (1, 1)])])) [[(0.0, 0.0), (1.0, 1.0)]]
def geo_dataframe_to_list(data_frame, polygon=False): to_return = [] for line in data_frame.geometry: lines = [] if polygon: for values in line.exterior.coords: lines.append(values) else: for values in line.coords: lines.append(valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geom_as_list(geometry):\n if geometry.geom_type == \"Polygon\":\n return [geometry]\n elif geometry.geom_type == \"MultiPolygon\":\n return geometry.geoms", "def _tolist(data, name='sources'):\n\tmsg = 'contains geometries that are not points'\n\tif isinstance(data, (list, tuple)):\n\t\ti...
[ "0.73027647", "0.67995375", "0.6595124", "0.6595124", "0.6595124", "0.65617627", "0.6501597", "0.6494119", "0.6448384", "0.639071", "0.6296989", "0.6264255", "0.6244541", "0.62118316", "0.6195807", "0.6195759", "0.6193018", "0.611168", "0.6107985", "0.6086046", "0.6048354", ...
0.8569541
0
Determine ratio to transform real units to pixels. >>> determine_real_to_pixel_ratio((155, 155), 0, 0, 100, 100) 1.55
def determine_real_to_pixel_ratio( image_shape: Tuple[int, int], min_x: float, min_y: float, max_x: float, max_y: float, ): image_x = image_shape[1] image_y = image_shape[0] diff_x = max_x - min_x diff_y = max_y - min_y resolution_x = image_x / diff_x resolution_y = image_y ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_meters_to_pixels_coefficient():\n return 1/get_pixels_to_meters_coefficient()", "def get_scaling_ratio(img):\n\n healthy_img_area = 4872 * 6496\n input_img_area = img.shape[0] * img.shape[1]\n ratio = input_img_area / healthy_img_area\n return ratio", "def pixel_size_ratio(self):\n ...
[ "0.57218885", "0.5695205", "0.56670064", "0.5639818", "0.5583204", "0.55717343", "0.54913086", "0.54902655", "0.5475159", "0.54592144", "0.5391389", "0.5386133", "0.5377819", "0.5377819", "0.5377819", "0.5377819", "0.5377819", "0.5377819", "0.5377819", "0.5377819", "0.5377819...
0.7477013
0
Return a binary matrix where 1s correspond to the coordinates in the dataframe. Slack determines how accurately the pixels in return array are turned into 1s. I.e. it is equivalent to a buffer around each trace. The higher abs(slack) the more "rounded" the areas. >>> from shapely.geometry import LineString, box >>> geo...
def geo_dataframe_to_binmat( data_frame: gpd.GeoDataFrame, dims, relative_geo_data: gpd.GeoDataFrame, slack: int = 0, ): def append_coord_list( coord_list: List[Tuple[int, int]], line_string: LineString, convert_x: Callable, convert_y: Callable, ): x_list...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _grid_points_to_binary_image(\n rows_in_object, columns_in_object, num_grid_rows, num_grid_columns):\n\n binary_image_matrix = numpy.full(\n (num_grid_rows, num_grid_columns), False, dtype=bool)\n binary_image_matrix[rows_in_object, columns_in_object] = True\n return binary_image_matrix"...
[ "0.5656183", "0.5549513", "0.52041864", "0.49339083", "0.492434", "0.49073893", "0.49058205", "0.49001232", "0.48872524", "0.4862354", "0.48543525", "0.48536086", "0.48409858", "0.4837322", "0.481904", "0.4791744", "0.4698955", "0.4665087", "0.4663252", "0.46290466", "0.46201...
0.74961513
0
Check if specified columns have the same base dtypes across both DataFrames.
def has_same_base_dtype(df_1, df_2, columns=None): if columns is None: if any(set(df_1.columns).symmetric_difference(set(df_2.columns))): print( "Cannot test all columns because they are not all shared across DataFrames" ) return False columns = df...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checktypestest(chosen_df):\n for i in chosen_df:\n if not chosen_df.dtypes[1] == chosen_df.dtypes[i]:\n raise ValueError('Types do not match')", "def _assert_dtypes(self, other: 'PlainFrame'):\n\n left_dtypes = {column.name: column.dtype\n for column in self....
[ "0.7408321", "0.71147156", "0.6641731", "0.65087014", "0.63816726", "0.6321202", "0.629999", "0.6283512", "0.6265409", "0.6262452", "0.6251955", "0.6239271", "0.6219968", "0.6186627", "0.6135912", "0.6122012", "0.61172754", "0.6110978", "0.60853505", "0.60832155", "0.6078434"...
0.8694105
0
Check columns of DataFrame inputs. This includes the checks on 1. whether the input columns exist in the input DataFrames. 2. whether the data types of col_user as well as col_item are matched in the two input DataFrames.
def check_column_dtypes(func): @wraps(func) def check_column_dtypes_wrapper( rating_true, rating_pred, col_user=DEFAULT_USER_COL, col_item=DEFAULT_ITEM_COL, col_rating=DEFAULT_RATING_COL, col_prediction=DEFAULT_PREDICTION_COL, *args, **kwargs ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkcolumnstest(chosen_columns, chosen_df):\n if not all([item in chosen_columns for item in chosen_df.columns]):\n raise ValueError('Columns do not match')", "def _check_columns(df: pd.DataFrame, names: typing.Sequence[str]) -> None:\n for expected in names:\n if expected not in df.colu...
[ "0.7297595", "0.7219656", "0.6985565", "0.6940473", "0.68711317", "0.67589295", "0.67561454", "0.6635416", "0.65715855", "0.6518252", "0.65078294", "0.6379187", "0.6378104", "0.63751537", "0.63514984", "0.6336134", "0.6325551", "0.62211627", "0.62177145", "0.6204443", "0.6203...
0.72755945
1
Check columns of DataFrame inputs.
def check_column_dtypes_wrapper( rating_true, rating_pred, col_user=DEFAULT_USER_COL, col_item=DEFAULT_ITEM_COL, col_rating=DEFAULT_RATING_COL, col_prediction=DEFAULT_PREDICTION_COL, *args, **kwargs ): if not has_columns(rating_true, [col_user,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_columns(df: pd.DataFrame, names: typing.Sequence[str]) -> None:\n for expected in names:\n if expected not in df.columns:\n raise ValueError(f\"'{expected}' column not found in input\")\n return", "def checkcolumnstest(chosen_columns, chosen_df):\n if not all([item in chosen...
[ "0.8138648", "0.8009004", "0.78570914", "0.7762899", "0.7692292", "0.74537516", "0.7437064", "0.7314041", "0.71670604", "0.7125938", "0.70786184", "0.7066877", "0.7007949", "0.699493", "0.69611573", "0.69052166", "0.68848443", "0.6850352", "0.6823604", "0.67768997", "0.675656...
0.0
-1
Calculate the AreaUnderCurve metric. Calculate the AreadUnderCurve metric for implicit feedback typed recommender, where rating is binary and prediction is float number ranging from 0 to 1.
def auc( rating_true, rating_pred, col_user=DEFAULT_USER_COL, col_item=DEFAULT_ITEM_COL, col_rating=DEFAULT_RATING_COL, col_prediction=DEFAULT_PREDICTION_COL, ): y_true, y_pred = merge_rating_true_pred( rating_true=rating_true, rating_pred=rating_pred, col_user=col_us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auc(y_true,y_pred):\n with tf.name_scope(\"RocAucScore\"):\n\n pos = tf.boolean_mask(y_pred, tf.cast(y_true, tf.bool))\n neg = tf.boolean_mask(y_pred, ~tf.cast(y_true, tf.bool))\n\n pos = tf.expand_dims(pos, 0)\n neg = tf.expand_dims(neg, 1)\n\n # original paper suggests p...
[ "0.634584", "0.63127875", "0.6220491", "0.62128216", "0.6148436", "0.61381024", "0.613065", "0.6032029", "0.59607893", "0.5954473", "0.5927012", "0.5906104", "0.58835906", "0.58814156", "0.5876876", "0.58675784", "0.58647805", "0.58647805", "0.5861427", "0.5840358", "0.575434...
0.603403
7
verifies whether the user password is correct
def verify_user_password(username: str, password: str) -> bool: session = Session() user: User = session.query(User).filter(User.username == username).first() pw_input = password.encode('utf-8') if user and bcrypt.checkpw(pw_input, user.password_hash.encode('utf-8')): session.refresh(user) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_password(self, password):\n return self.PASS == password", "def check_password(self, password):\n return self.password == password", "def verify_password(self, password):\n return self.PASSWORD == password", "def test_password_verification(self):\n self.user.password = ...
[ "0.79849017", "0.7920743", "0.7886876", "0.7811781", "0.7805611", "0.7786152", "0.77789557", "0.77745336", "0.77577746", "0.77044064", "0.76242536", "0.76149166", "0.75667053", "0.756621", "0.7538054", "0.7535364", "0.7525703", "0.75153124", "0.75075984", "0.75032437", "0.749...
0.0
-1
Looks up user by id.
def get_user_by_id(user_id: int) -> User: session = Session() # verify user_id exists vote_user: User = session.query(User).filter(User.id == user_id).first() session.close() if not vote_user: raise UserNotFoundException return vote_user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_by_id(self, id):\n\t\treturn self.users.get(id)", "def find_user_by_id(id: str) -> User:\n\n # Find the id user in the database, else return None\n return User.query.get(int(id))", "def get_single_user(self, id):\n for user in self.users:\n if user['id'] == id:\n ...
[ "0.84620047", "0.8195957", "0.8163513", "0.80844134", "0.8067835", "0.8066282", "0.79709303", "0.79524136", "0.79524136", "0.79524136", "0.79524136", "0.79498637", "0.79072964", "0.7903944", "0.79022855", "0.7881155", "0.78770703", "0.78700954", "0.78677875", "0.7862678", "0....
0.72641045
91
weight_variable generates a weight variable of a given shape.
def weight_variable(shape): #{{{ initial = tf.truncated_normal(shape, stddev=0.1) return tf.Variable(initial)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight_variable(shape):\n initial = tf.truncated_normal(shape, stddev=0.1)\n return tf.get_variable(\n 'weight', initializer=initial, regularizer=tf.nn.l2_loss)", "def weight_variable(shape):\n initial = tf.truncated_normal(shape)\n return tf.Variable(initial)", "def create_weight_variable(shape):...
[ "0.8268452", "0.8235441", "0.8159065", "0.81569624", "0.81399345", "0.81399345", "0.81399345", "0.8134774", "0.8134774", "0.8134774", "0.8134774", "0.8134774", "0.8134774", "0.8134774", "0.8134774", "0.8134774", "0.8134774", "0.81210643", "0.80650693", "0.79823756", "0.797880...
0.813776
7
conv2d returns a 2d convolution layer with full stride.
def conv2d(x, W): #{{{ #stride = [1,水平移动步长,竖直移动步长,1] #[0] 和[3]必须都是1 #padding 是和原图一样 return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_conv2d():\n img = np.array([\n [0.3, 0.5, 0.7, 0.9],\n [0.1, 0.3, 0.5, 0.7],\n [0.9, 0.7, 0.5, 0.3],\n ])\n template = np.array([\n [1, 0],\n [1, 0],\n ])\n template = np.flipud(np.fliplr(template))\n return fftconvolve(img, template, mode='valid')", ...
[ "0.7629538", "0.7627165", "0.7579147", "0.7463493", "0.74578935", "0.74578935", "0.7426121", "0.7426121", "0.7426121", "0.7426121", "0.7386576", "0.7337714", "0.7330282", "0.73295087", "0.7313963", "0.73015827", "0.7296284", "0.72696656", "0.72463566", "0.72321266", "0.720884...
0.71902525
22
Compute logistic sigmoid activation
def activation_function(self, z): return 1. / (1. + np.exp(-np.clip(z, -250, 250)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid_activation(x):\n return 1.0 / (1 + np.exp(-x))", "def sigmoid(x):\n return 1 / (1 + exp(-x))", "def sigmoid(x):\n return 1 / (1 + exp(-x))", "def sigmoid(x):\r\n return 1 / (1 + np.exp(-x))", "def sigmoid(x):\n return 1 / (1 + np.exp(-x))", "def sigmoid(x):\n return 1 / (1 +...
[ "0.838003", "0.819735", "0.819735", "0.81502354", "0.8134324", "0.8134324", "0.8134324", "0.8134324", "0.8134324", "0.8134324", "0.812058", "0.8110861", "0.8107186", "0.8099222", "0.8098866", "0.80923676", "0.80923676", "0.8088351", "0.80804044", "0.8072143", "0.80694366", ...
0.0
-1
fixture for creating a spark context
def spark_context(request): spark = SparkSession.builder.master("local[1]").appName("pytest-test").getOrCreate() request.addfinalizer(lambda: spark.stop()) quiet_py4j() return spark
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spark():\n\n quiet_log4j()\n\n builder = (\n SparkSession.builder\n .master(\"local[2]\")\n .appName(\"pytest-pyspark-local-testing\")\n # By default spark will shuffle to 200 partitions, which is\n # way too many for our small test cases. This cuts execution\n #...
[ "0.7401126", "0.7185849", "0.7147665", "0.71358913", "0.6700026", "0.66479564", "0.6571936", "0.6427863", "0.6411044", "0.636135", "0.6243758", "0.6203419", "0.6150244", "0.61185306", "0.6116119", "0.6085249", "0.6083701", "0.60627055", "0.6043724", "0.60128736", "0.6011979",...
0.77547735
0
Plot range of reward high and low percentile
def draw_reward_range(self, data_builder, env, color=None, alpha=0.2, **kwargs): x, mean = data_builder.get_reward_mean() _, low = data_builder.get_reward_percentile(self.env_params[env]['high_low_percentile']) _, high = data_builder.get_reward_percentile(100 - self.env_params[env]['high_low_pe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_stability_function(self,bounds=[-20,1]):\n import matplotlib.pyplot as plt\n p,q=self.stability_function()\n xx=np.arange(bounds[0], bounds[1], 0.01)\n yy=p(xx)/q(xx)\n fig, = plt.plot(xx,yy)\n plt.draw()", "def set_color_by_percentile(this, start, end):\n\tif s...
[ "0.61897177", "0.6142304", "0.61223316", "0.60464966", "0.5764064", "0.57531226", "0.5688331", "0.5688129", "0.56239134", "0.56094724", "0.5551428", "0.55341935", "0.55000323", "0.5484973", "0.5470953", "0.5462968", "0.5457872", "0.5455016", "0.5430253", "0.53900945", "0.5378...
0.6613888
0
Get a working copy of whole dataset (list of dicts)
def get_all(self): self.data = list(self.data) return self.data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n new_data_collection = DataCollection()\n for item in self.iteritems():\n new_data_collection.add_data(item)\n return new_data_collection", "def get_pure_data_copy(self):\n import copy\n data=copy.copy(self)\n data.xp = data.xp.get_pure_data_c...
[ "0.67610884", "0.65187263", "0.6476569", "0.63374424", "0.63339067", "0.61601204", "0.61589545", "0.61473143", "0.6135965", "0.612407", "0.60831195", "0.6003884", "0.599526", "0.5956172", "0.594787", "0.5930081", "0.59126955", "0.5895318", "0.58703154", "0.5868029", "0.586651...
0.5738142
31
Extract min value and max value for Minmax Scaler according to the provided column.
def fit(self, col_df: dd.Series) -> Any: self.min = col_df.min() self.max = col_df.max() return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_max_min(self, col):\n self.max = max(col)\n self.min = min(col)", "def minMax(df, column):\n df_result = df.copy()\n not_nulls = df[column].isnull() == False\n\n v = np.matrix(df_result.loc[not_nulls, column]) #.as_matrix()\n scaler = skpreprocess.MinMaxScaler()\n df_result....
[ "0.7673651", "0.71557504", "0.70815915", "0.67124826", "0.6703426", "0.6681409", "0.6659227", "0.66270506", "0.6586529", "0.6434424", "0.63125056", "0.62613964", "0.6247337", "0.6200842", "0.6154483", "0.6103468", "0.6069686", "0.6069235", "0.6069235", "0.60514814", "0.602198...
0.59047997
24
Return True once the User enters a valid puzzle string, it should have a length of 81 chars and should contain only digits.
def validate_puzzle_string(self): is_puzzle_string_valid = False while is_puzzle_string_valid is False: question = "Enter a valid puzzle. (81 inline digits where zeros " +\ "represent empty spots) E.g. 01040506.... and so on\npuzzle" puzzle_parameter = self.ask_us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_validation(input_: str) -> bool:\n return fullmatch('[1-9]', input_) is not None", "def check_for_validity_puzzle_1(limits: tuple, rep_char: str, password: str):\n\n reps = password.count(rep_char)\n\n lower, upper = limits\n\n if lower <= reps <= upper:\n return True\n else:\...
[ "0.6988238", "0.687215", "0.6835534", "0.68153137", "0.6782101", "0.64769334", "0.64731705", "0.6458984", "0.643432", "0.6433204", "0.6431435", "0.64165646", "0.6377844", "0.6358205", "0.6288739", "0.6282731", "0.62333125", "0.6206595", "0.6188043", "0.61569345", "0.61154485"...
0.9071734
0
Default the container to use specified encryption scope for all writes.
def default_encryption_scope(self) -> Optional[str]: return pulumi.get(self, "default_encryption_scope")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_encryption(key):\n global_scope['enc'] = Encryption(key.encode())", "def require_encryption_for_write_access(self):\n if \"requireEncryptionForWriteAccess\" in self._prop_dict:\n return self._prop_dict[\"requireEncryptionForWriteAccess\"]\n else:\n return None", "...
[ "0.5898364", "0.5772351", "0.57698435", "0.57698435", "0.56035644", "0.5572135", "0.5525414", "0.53106827", "0.5251916", "0.5183517", "0.5142388", "0.51339895", "0.5103925", "0.5067164", "0.5056541", "0.5053999", "0.49991542", "0.4992962", "0.4899988", "0.48994812", "0.488171...
0.5906583
0
The hasImmutabilityPolicy public property is set to true by SRP if ImmutabilityPolicy has been created for this container. The hasImmutabilityPolicy public property is set to false by SRP if ImmutabilityPolicy has not been created for this container.
def has_immutability_policy(self) -> bool: return pulumi.get(self, "has_immutability_policy")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def immutability_policy(self) -> 'outputs.ImmutabilityPolicyPropertiesResponse':\n return pulumi.get(self, \"immutability_policy\")", "def immutability_settings(self) -> Optional['outputs.ImmutabilitySettingsResponse']:\n return pulumi.get(self, \"immutability_settings\")", "def immutable(self) -...
[ "0.6947443", "0.57288796", "0.56547576", "0.5653203", "0.54542214", "0.53227615", "0.5313179", "0.5109668", "0.5021372", "0.49839082", "0.49568674", "0.49565306", "0.49460852", "0.4944232", "0.49010536", "0.48988754", "0.48743588", "0.48399776", "0.48239785", "0.481021", "0.4...
0.7187662
0
Remaining retention days for soft deleted blob container.
def remaining_retention_days(self) -> int: return pulumi.get(self, "remaining_retention_days")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def soft_delete_retention_days(self) -> int:\n return pulumi.get(self, \"soft_delete_retention_days\")", "def retention_days(self) -> Optional[int]:\n return pulumi.get(self, \"retention_days\")", "def container_delete_retention_policy(self) -> pulumi.Output[Optional['outputs.DeleteRetentionPolic...
[ "0.7603276", "0.65898246", "0.6585647", "0.65824777", "0.65142", "0.6479939", "0.6467616", "0.6465218", "0.63896096", "0.63780963", "0.6276856", "0.62488556", "0.6040693", "0.57856303", "0.5741927", "0.56296825", "0.5572426", "0.551001", "0.54318726", "0.5428414", "0.5401405"...
0.7409727
1
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
def type(self) -> str: return pulumi.get(self, "type")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")", "def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")", "def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource_type\")", "def ...
[ "0.7918516", "0.7918516", "0.7866337", "0.7866337", "0.7866337", "0.7866337", "0.7866337", "0.7708053", "0.75534964", "0.7282099", "0.70591027", "0.6979169", "0.69202054", "0.6868452", "0.67303157", "0.67049116", "0.6654272", "0.6646357", "0.65510035", "0.65426683", "0.654266...
0.66396123
57
Init method for initializaing the CNN model
def __init__(self, n_input_channels=3, n_conv_output_channels=16, k=3, s=1, pad=1, p = 0.5): super(ModelCNN, self).__init__() # 1. Convolutional layers # Single image is in shape: 3x96x96 (CxHxW, H==W), RGB images self.conv1 = nn.Conv2d(in_channels = n_input_channels, out_channels = n_co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, model_config):\n # Training Parameters\n self.__learning_rate = model_config[\"cnnLearningRate\"]\n\n # Network Parameters\n self.__num_classes = model_config[\"numClasses\"]\n self.__weight_decay = 1e-4\n self.__num_gpus = model_config[\"numGpus\"]\n ...
[ "0.76347876", "0.72431886", "0.7222825", "0.7211717", "0.71300805", "0.71097064", "0.7040969", "0.70310324", "0.7016919", "0.69921887", "0.6986525", "0.6986486", "0.69744736", "0.6958348", "0.69579613", "0.69438034", "0.69347113", "0.69238573", "0.6914468", "0.6886502", "0.68...
0.0
-1
Return True if the queen at column c clashes with any queen to its left.
def col_clashes(bs, c): for i in range(c): # Look at all columns to the left of c if share_diagonal(i, bs[i], c, bs[c]): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isfree(col,queens):\n if col in queens:\n return False\n elif any([ abs(col-col1)==len(queens)-index for index,col1 in enumerate(queens)]):\n #c[r]==c[j]; r-j==c[r]-c[j]; r-j==c[j]-c[r]\n # col is the colomn to check; len(queens) just be the row index of col, dont subtract 1\n ...
[ "0.77055407", "0.72922397", "0.7145801", "0.70153964", "0.6985228", "0.6902115", "0.66958386", "0.65576535", "0.6551649", "0.6548673", "0.6523149", "0.6523149", "0.6522317", "0.6519715", "0.65155363", "0.6512403", "0.6512403", "0.65036315", "0.6501785", "0.64987516", "0.64938...
0.6340493
36
Creates a new app instance for every test case.
def setUp(self): super(MainTest, self).setUp() self.testbed.init_blobstore_stub() self.testbed.init_urlfetch_stub() admin = auth.Identity(auth.IDENTITY_USER, 'admin@example.com') full_access_group = config.settings().auth.full_access_group auth.bootstrap_group(full_access_group, [admin]) aut...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app():\n print('creating app with test vars')\n\n app = create_app('test')\n app.testing = True\n\n ctx = app.app_context()\n ctx.push()\n yield app\n\n ctx.pop()", "def test_app():\n param = {\n 'DEBUG': True,\n 'TESTING': True\n }\n _app = create_app(settings_ove...
[ "0.7631757", "0.7527916", "0.736817", "0.73311406", "0.7328756", "0.73164105", "0.73162866", "0.73058444", "0.7255259", "0.7248177", "0.724135", "0.72368133", "0.720076", "0.7198792", "0.7191736", "0.7186308", "0.71752286", "0.7173285", "0.7163543", "0.7163543", "0.7163543", ...
0.0
-1
Sets the recipient_email of this GiftDetails.
def recipient_email(self, recipient_email): self._recipient_email = recipient_email
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recipient(self, recipient):\n\n self._recipient = recipient", "def email(self, email):\n\n self._email = email", "def email(self, email):\n\n self._email = email", "def email(self, email):\n\n self._email = email", "def email(self, email):\n\n self._email = email", ...
[ "0.7003676", "0.655063", "0.655063", "0.655063", "0.655063", "0.655063", "0.655063", "0.655063", "0.655063", "0.655063", "0.655063", "0.6463328", "0.6463328", "0.6395344", "0.6375733", "0.6240201", "0.6240201", "0.6240201", "0.62081444", "0.6160627", "0.61436236", "0.605806...
0.824746
0
Sets the sender_name of this GiftDetails.
def sender_name(self, sender_name): self._sender_name = sender_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sender(self, sender: str):\n if sender is None:\n raise ValueError(\"Invalid value for `sender`, must not be `None`\") # noqa: E501\n\n self._sender = sender", "def sender(self, sender: Address) -> None:\n enforce(\n isinstance(sender, str), f\"Sender must be strin...
[ "0.71977746", "0.7106946", "0.65814424", "0.62214434", "0.62214434", "0.61114466", "0.61114466", "0.61114466", "0.61114466", "0.61114466", "0.60985005", "0.60284305", "0.60284305", "0.5976745", "0.5976745", "0.59699434", "0.5942325", "0.59321296", "0.59235996", "0.5812395", "...
0.8307557
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, GiftDetails): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
A Recurrent module that performs soft attention over the input. At timestep t, the output o = softmax(K^Tq/sqrt(d))V, where 'q' is the embedded input at timestep 't', K = [k_1, ... k_{t1}] is a matrix of the previous inputs embedded as keys. V = [v_1, ... , v_{t1}] is the same, but for the values
def __init__( self, buffer_size, keys_dim, vals_dim, query_dim=None, num_heads=1, last_timestep_only=False, postprocess=None, dense=True, name=None): super(CausalAttention, self).__init__(name=name) with self._enter_variable_scope(): if isinstance(keys_dim, int): keys...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, h_prev, x_t):\n from scipy.special import softmax\n # softmax(arr, axis=0)\n m, i = x_t.shape\n Wi = self.Wh[:i]\n Wh = self.Wh[i:]\n cat = np.concatenate((h_prev, x_t), axis=1)\n # print('meow', cat.shape)\n h_next = np.tanh(cat @ self.Wh +...
[ "0.6452041", "0.6319821", "0.62740105", "0.6259367", "0.6225947", "0.615052", "0.6131718", "0.6130936", "0.60880506", "0.6066625", "0.6018428", "0.5973469", "0.596313", "0.5950622", "0.59385467", "0.59383583", "0.5909008", "0.5903755", "0.5896433", "0.5893444", "0.5890925", ...
0.0
-1
Return the value of opamversion.
def get_version(file_data): for individual in file_data: if 'opam-version' in individual: version = individual.split('"') return version[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getVersion(self):\n return self.get('Version', type=\"numeric\")", "def version(self):\n if \"version\" in self._prop_dict:\n return self._prop_dict[\"version\"]\n else:\n return None", "def version(self) -> Optional[str]:\n return pulumi.get(self, \"versio...
[ "0.7108706", "0.70909154", "0.7048375", "0.7048375", "0.7048375", "0.7048375", "0.7048375", "0.70407534", "0.70192933", "0.70127195", "0.70103025", "0.69899166", "0.6983395", "0.69403905", "0.6925841", "0.6925841", "0.6925841", "0.6925841", "0.6925841", "0.6925841", "0.692584...
0.7085643
2
L2normalize columns of X
def l2norm(X): norm = torch.pow(X, 2).sum(dim=1, keepdim=True).sqrt() a = norm.expand_as(X) + 1e-8 X = torch.div(X, a) return X
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def l2_normalize(data, eps, axis=None):\n return cpp.nn.l2_normalize(data, eps, axis)", "def normalize_l2(x):\n return x / (npla.norm(x))", "def L2_normalize(xx):\r\n\tZx = compute_L2_normalization(xx)\r\n\treturn xx / np.sqrt(Zx[:, np.newaxis])", "def normalizeRows(x):\n\n ### YOUR CODE HERE\n #...
[ "0.76127386", "0.74197316", "0.72367084", "0.7202008", "0.7162083", "0.7133827", "0.70338094", "0.69962883", "0.6908121", "0.69054306", "0.6894549", "0.6815722", "0.6789521", "0.6779976", "0.67509", "0.6738499", "0.6678439", "0.6676479", "0.66763866", "0.665484", "0.665484", ...
0.66768813
17
Method sets the prompt embedding weights to 0.0
def clear_prompt_embedding_weights(self,): self.prompt_embeddings.weight.fill_(0.0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weights(self):\n self.embedding.weight.data.uniform_(-0.1, 0.1)\n self.word.bias.data.fill_(0)\n self.word.weight.data.uniform_(-0.1, 0.1)", "def init_weights(self):\r\n self.embedding.weight.data.uniform_(-0.1, 0.1)\r\n self.fc.bias.data.fill_(0)\r\n self.fc.we...
[ "0.7463873", "0.7199745", "0.71822166", "0.71816295", "0.7171803", "0.7171803", "0.7171803", "0.709266", "0.7066728", "0.7066646", "0.6958817", "0.690859", "0.68791986", "0.672614", "0.67151546", "0.6635397", "0.65766937", "0.65614665", "0.6556054", "0.653788", "0.65227437", ...
0.8714095
0
Method sets the prompt embedding weights with a new weight w
def set_prompt_embedding_weights(self, weight: torch.Tensor): self.prompt_embeddings.weight.data = weight.type_as(self.prompt_embeddings.weight.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_prompt_embedding_weights(self,):\n self.prompt_embeddings.weight.fill_(0.0)", "def init_weights(self):\n self.embedding.weight.data.uniform_(-0.1, 0.1)\n self.word.bias.data.fill_(0)\n self.word.weight.data.uniform_(-0.1, 0.1)", "def setWeights(self, w):\n raise Not...
[ "0.73268247", "0.72788864", "0.7256226", "0.7252996", "0.701445", "0.6961656", "0.6961656", "0.6951745", "0.6946087", "0.6880116", "0.68501544", "0.6839706", "0.68244517", "0.68196607", "0.68133944", "0.681045", "0.678291", "0.67816025", "0.67816025", "0.67816025", "0.6776748...
0.7940417
0
This method caches the output representation from the Encoder and saves it inside `self.inference_table`.
def set_inference_table(self, prompt_representation: torch.Tensor): prompt_representation = prompt_representation.detach().clone() self.inference_table.set_prompt_table(prompt_representation)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postprocess(self, inference_output):\n logger.info(inference_output)\n return inference_output", "def finalize_output_dict(self):\n self.output_dict = {\n key: torch.cat(value).numpy() for key, value in self.output_dict.items()\n }", "def fit_transform(self):\n ...
[ "0.60971045", "0.5868804", "0.576231", "0.57325697", "0.5721347", "0.5717437", "0.56383574", "0.56224364", "0.5604912", "0.55992657", "0.55775964", "0.5576467", "0.5551276", "0.5551276", "0.554509", "0.55051947", "0.5466245", "0.5459163", "0.5447188", "0.54386246", "0.5412206...
0.0
-1
Set value of the element defined by the locator.
def set_value( self, locator: Optional[Locator] = None, value: Optional[str] = None, append: bool = False, enter: bool = False, newline: bool = False, send_keys_fallback: bool = True, validator: Optional[Callable] = set_value_validator, ) -> WindowsEle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __set__(self, obj, value):\n # def set_value(self, obj, owner):\n driver = obj.driver\n if self.locator[0] != 'css selector':\n raise 'Using a locator other than css'\n WebDriverWait(driver, 100).until(\n lambda driver: driver.find_element_by_css_selector(self.loca...
[ "0.7702934", "0.7651599", "0.7624431", "0.75003856", "0.71484035", "0.7023398", "0.68845725", "0.67296845", "0.64471656", "0.62897176", "0.62897176", "0.62872565", "0.6217247", "0.62076586", "0.61985034", "0.6128379", "0.6094752", "0.6094752", "0.6069835", "0.60674113", "0.59...
0.64328885
9
Given a flow name within this Storage object, load and return the Flow.
def get_flow(self, flow_name: str) -> "Flow": if flow_name not in self.flows: raise ValueError("Flow is not contained in this Storage") req_function = self._method_to_function[self.get_flow_request_http_method] get_flow_request_kwargs = _render_dict(self.get_flow_request_kwargs) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def read_flow_by_name(\n self,\n flow_name: str,\n ) -> Flow:\n response = await self._client.get(f\"/flows/name/{flow_name}\")\n return Flow.parse_obj(response.json())", "async def read_flow(self, flow_id: UUID) -> Flow:\n response = await self._client.get(f\"/flows/{...
[ "0.7934159", "0.646134", "0.63433677", "0.6178463", "0.6128208", "0.5960097", "0.5926186", "0.58671963", "0.5768048", "0.56477654", "0.5555112", "0.5476098", "0.53369844", "0.5315714", "0.5313755", "0.5297373", "0.51395684", "0.51168096", "0.510803", "0.5079798", "0.50309175"...
0.81868434
0
Process sentences in the tweets into a list of tokens.
def sent_to_words(sentences): for sentence in sentences: yield(gensim.utils.simple_preprocess(str(sentence), deacc=True))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize_tweets_by_word(self):\n sent_tok_list = []\n all_tok_list = []\n\n for t in range(len(self.all_tweets) - 1):\n sent_list = sent_tokenize(self.all_tweets[t][0][1]) # all_tweets[tweet][look at tuple][look at text]\n all_tok_list.append([])\n for s in...
[ "0.7719989", "0.75884455", "0.75834835", "0.73863953", "0.73863953", "0.737072", "0.7334494", "0.73207206", "0.73027545", "0.71946573", "0.7133221", "0.70299", "0.70299", "0.7024187", "0.70050687", "0.69844687", "0.6942141", "0.6907542", "0.6873646", "0.68733406", "0.6864705"...
0.0
-1
Process the words in each tweet of the corpus to remove stopwords as defined by NLTK.
def remove_stopwords(texts): return [[word for word in simple_preprocess(str(doc)) if word not in stop_words] for doc in texts]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_stop_words(tweet):\n tokens_without_sw = \"\"\n for word in tweet.split():\n if not word.lower() in STOPWORDS:\n tokens_without_sw += word.lower() + \" \"\n return tokens_without_sw", "def remove_stopwords(tweet, stopwords):\n\n\timport re\n\n\tstopwords_set = set(stopwords)...
[ "0.7504535", "0.7311473", "0.72665703", "0.71183944", "0.71179533", "0.70261437", "0.70210373", "0.70041984", "0.69915", "0.69900596", "0.6963771", "0.69616854", "0.696012", "0.6955361", "0.6955017", "0.6950152", "0.6946842", "0.69362426", "0.69338983", "0.6927413", "0.691163...
0.70493966
5
Create list of bigrams from the tweets in the corpus.
def make_bigrams(texts,bigram_mod): return [bigram_mod[doc] for doc in texts]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_bigrams(bigram_mod, texts):\n return [bigram_mod[doc] for doc in texts]", "def list_bigrams(sentence_list):\n assert nltk_enabled\n return bigrams(sentence_list)", "def get_bigrams(self, tokens):\n return [a + \" \" + b for a, b in zip(tokens, tokens[1:])]", "def _generateBigrams(sel...
[ "0.7402998", "0.7327968", "0.7226348", "0.70147127", "0.6941188", "0.68485177", "0.67478436", "0.6733484", "0.6681483", "0.6675648", "0.6675056", "0.66608196", "0.66165566", "0.638539", "0.6374289", "0.6310031", "0.6274061", "0.61876446", "0.61874664", "0.6078481", "0.6074752...
0.7377119
1
return a comma + space (', ') separated string of jeep models (original order)
def get_all_jeeps(cars=cars): return str(', '.join(cars['Jeep']))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comma_separated_list(model):\n return \", \".join(model)", "def __str__(self):\r\n\t\tacumulador = \"[\"\r\n\t\tfor x in self.elementos:\r\n\t\t\tacumulador += str(x) + \",\"\r\n\t\treturn acumulador.rstrip(\",\")+\"]\"", "def __str__(self):\n L = []\n for s,e in self.normalized():\n ...
[ "0.75830364", "0.6378074", "0.6335463", "0.6308942", "0.62725854", "0.6264572", "0.6233202", "0.62196636", "0.61696225", "0.6104148", "0.6097838", "0.60654783", "0.6030665", "0.6030577", "0.5962757", "0.59550625", "0.5922775", "0.5852799", "0.5805409", "0.5793003", "0.5783226...
0.5372605
75
return a copy of the cars dict with the car models (values) sorted alphabetically
def sort_car_models(cars=cars): return {k:sorted(cars[k]) for k in cars.keys()}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_car_models():\n for make, model in cars.items():\n cars[make] = sorted(model)\n return cars", "def sort_car_models(cars=cars):\r\n for model in cars:\r\n cars[model].sort()\r\n return cars", "def load_car_models(self):\n car_models_all = OrderedDict([])\n loggin...
[ "0.8386408", "0.78856957", "0.6111236", "0.5691202", "0.56717473", "0.5667032", "0.5664055", "0.5633449", "0.55873", "0.5546567", "0.5545345", "0.5537814", "0.5529127", "0.5487243", "0.54769766", "0.5475808", "0.54684997", "0.54667825", "0.5397825", "0.538667", "0.5378415", ...
0.8272651
1
PUT /reviews with ID api route
def put_review(review_id): ignored_data = ["id", "created_at", "updated_at", "user_id", "place_id"] return put(cls, review_id, ignored_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_review(review_id=None):\n\n review = storage.get(Review, review_id)\n if not review:\n abort(404)\n data = request.get_json()\n if not data:\n abort(400, 'Not a JSON')\n keys_ignore = ['id', 'user_id', 'recipe_id', 'created_at', 'updated_at']\n for key in data.keys():\n ...
[ "0.73310935", "0.7320185", "0.70410097", "0.6979166", "0.69729793", "0.68921614", "0.6873529", "0.6861512", "0.67701066", "0.6640359", "0.6605413", "0.65403956", "0.6475809", "0.6309277", "0.62332803", "0.61628556", "0.6126825", "0.6078451", "0.6028495", "0.5958496", "0.59473...
0.7094173
2