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
Calculate boxes area in pixels.
def calculate_bbox_area(bbox, bbox_type): if bbox_type == "ltrb": width = bbox[:, 2] - bbox[:, 0] + 1 # add 1 to include edge pixel height = bbox[:, 3] - bbox[:, 1] + 1 # add 1 to include edge pixel area = width * height else: raise RuntimeError("Unsupp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def box_area(boxes):\n return (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])", "def box_area(boxes):\n return (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])", "def box_area(box):\n x1, y1, x2, y2 = box\n w = x2 - x1\n h = y2 - y1\n return float(w) * h", "def area(boxes):\n y_...
[ "0.82021964", "0.82021964", "0.8180777", "0.7811634", "0.77659494", "0.77412575", "0.7683576", "0.76729196", "0.76225615", "0.75673455", "0.7540724", "0.7513449", "0.75095534", "0.7485753", "0.74593365", "0.7446931", "0.7422548", "0.7420123", "0.7420123", "0.7420123", "0.7420...
0.647344
98
Resize boxes according to output image shape.
def resize(self, image_shape_output): # calculate transformation between original and resized images corners_orig = Box.get_corners_rect(self.image_shape).astype(np.float32)[:3] # corner coordinates of original image corners_resized = Box.get_corners_rect(image_shape_output).astype(np.float32)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale_boxes(boxes, image_shape):\n height = image_shape[0]\n width = image_shape[1]\n image_dims = K.stack([height, width, height, width])\n image_dims = K.reshape(image_dims, [1, 4])\n boxes = boxes * image_dims\n return boxes", "def crop_and_resize(image, boxes, size):\n box_ind = kera...
[ "0.7424618", "0.69612247", "0.6908602", "0.68544734", "0.6651493", "0.66463804", "0.66296613", "0.6503239", "0.64866376", "0.6479316", "0.64778477", "0.6473767", "0.63909173", "0.6380702", "0.63686496", "0.6362892", "0.6362892", "0.6350432", "0.6281782", "0.6246963", "0.62409...
0.69329417
2
Returns either the liveChar or the deadChar for the Cell class depending on the state of the cell.
def __str__(self): if self.__style == 'default': if self.living: return Cell.liveChar else: return Cell.deadChar
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def char(self):\n return self._char", "def get_character(self):\n return self.character", "def state_to_char(observation):\n if observation == self.TileState.CLEAN.value:\n return \"-\"\n if observation == self.TileState.DIRTY.value:\n return \"...
[ "0.599122", "0.58862513", "0.58294487", "0.5689513", "0.56680214", "0.56389457", "0.55471045", "0.55102175", "0.5465052", "0.54368836", "0.5416882", "0.53987974", "0.5352043", "0.53455234", "0.5340178", "0.53316617", "0.53224826", "0.5300615", "0.5266198", "0.5259957", "0.523...
0.6397915
0
Test adding an element to the Container so len > limit.
def test_sample_container_add_exceeds_limit(self): self.assertEqual(self.container._data, defaultdict(list)) retval = self.container.add("key1", ["1", "2", "3", ], 2) self.assertEqual(retval, ["1", "2", "3", ]) self.assertEqual([], self.container._data["key1"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_append_to_full_deque_size(full_deque):\n full_deque.append(\"Denny Way\")\n assert full_deque.size() == 4", "def test_append_increases_size_of_list(val, filled_deque):\n filled_deque.append(val)\n assert filled_deque._container.head.val == val", "def test_append_to_empty_deque_size(empty_d...
[ "0.67297107", "0.6686526", "0.65378165", "0.6484884", "0.64790905", "0.6444569", "0.62696064", "0.62535566", "0.62418246", "0.6166781", "0.61371374", "0.6067837", "0.6024052", "0.6008349", "0.59733355", "0.5957236", "0.5952602", "0.5921319", "0.5872479", "0.5865469", "0.58471...
0.7260694
0
add to the map and remove from the player's inventory. also, place it at the player's coordinates
def drop(self): Game.instance.area_map.entities.append(self.owner) Game.instance.inventory.remove(self.owner) self.owner.x = Game.instance.player.x self.owner.y = Game.instance.player.y message('You dropped a ' + self.owner.name + '.', palette.yellow)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pickUp(self):\n pos = self.getRoverLocation()\n item = self.map[pos.y,pos.x]\n if type(item) == Part:\n self.inventory.addPart(str(item))\n self.map[pos.y,pos.x] = None", "def place_dungeon_items(self):\r\n self.place_entrance()\r\n self.place_exit()\r...
[ "0.6960528", "0.6309587", "0.6008711", "0.6005832", "0.5967411", "0.5950741", "0.59070283", "0.58811086", "0.5876707", "0.5848311", "0.58454764", "0.58021855", "0.57439965", "0.5719421", "0.5708377", "0.56854624", "0.5677255", "0.5671153", "0.5649042", "0.5633106", "0.5624618...
0.6489897
1
Open a milestone in a web browser
def cli(repo, milestone): webbrowser.open_new(repo.milestone(milestone).data["html_url"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def browser_open(story_id, arguments):\r\n\r\n story = load_story(story_id, arguments)\r\n\r\n webbrowser.open(story.url)", "def openNewIssueUrl(self):\r\n url = QUrl(\"https://github.com/Freeseer/freeseer/issues/new\")\r\n QDesktopServices.openUrl(url)", "def open(url):\r\n webbrowser.o...
[ "0.7456779", "0.73963964", "0.7321084", "0.7040319", "0.70087194", "0.7005911", "0.6979996", "0.69309425", "0.6905293", "0.68769723", "0.6868704", "0.67567384", "0.6751907", "0.6685546", "0.65568763", "0.6541719", "0.65377015", "0.64843136", "0.64732045", "0.6453417", "0.6412...
0.8849123
0
Basename of backup copy
def basename(self, filename): return filename.replace(self.remote_path, '', 1).lstrip(sep)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basename(self):\n return self.name.basename", "def basename(self):\n return get_basename(self.filename)", "def basename(self):\n return self._getbyspec(\"basename\")[0]", "def purebasename(self):\n return self.namebase", "def basename(self) -> str:\n return self._base...
[ "0.7278603", "0.7153585", "0.7085726", "0.70516014", "0.7011415", "0.69851536", "0.6926248", "0.68886983", "0.68771446", "0.68593824", "0.6840162", "0.68339103", "0.68156743", "0.6807148", "0.68051606", "0.677143", "0.6722053", "0.6710797", "0.6704565", "0.668083", "0.6626187...
0.6619269
21
Closing the open sessions.
def __del__(self): self.db_conn.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n for session in self.sessions.copy().values():\n session.close(SessionCloseErrorCode.SESSION_DIED)", "def close(self):\r\n _logger.debug(\"Closing sessions...\")\r\n dbs = self._sessions.keys()\r\n while len(dbs) > 0:\r\n session = self._session...
[ "0.82773626", "0.8130109", "0.8080426", "0.8010299", "0.7870844", "0.78705907", "0.7857028", "0.78181744", "0.78181744", "0.78181744", "0.78181744", "0.78181744", "0.78181744", "0.7817565", "0.78132427", "0.77991784", "0.7725012", "0.7725012", "0.7725012", "0.7692708", "0.765...
0.0
-1
Return the size of the system memory, in bytes.
def memsize(self): return self.xlist("get-memsize")[1][0] * 1024
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_total_memory_size(self):\n return self.drt_manager.get_total_memory_size()", "def getSize(self) -> int:\n return len(self.mem)", "def memory():\n sin = psutil.virtual_memory()\n return round((sin.total / sin.used) / 100, 3)", "def get_memory_info():\n return psutil.virtual_memo...
[ "0.792762", "0.76847845", "0.76320076", "0.7536214", "0.7525382", "0.7368874", "0.7354409", "0.72946846", "0.72898495", "0.7216704", "0.72160745", "0.7210482", "0.7205699", "0.7195887", "0.71562374", "0.71436924", "0.71367824", "0.7123436", "0.71218604", "0.7073706", "0.70603...
0.80239904
0
Generates a data filename out of date and time
def generate_file_name(hour, minute): hour = str(hour) if len(hour) == 1: hour = "0" + hour minute = str(minute) if len(minute) == 1: minute = "0" + minute file_name = date + "--" + hour + special_char + minute + special_char + "00,00.mvol" # print "filename: ",file_name ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_datetime_filename(label=\"data\", extension=\"csv\", postfix=None, fractional=True, dt=None):\n if dt is None:\n dt = datetime.now()\n filename = \"\" if label is None else f\"{label}-\"\n fractional_str = f\"-{dt.microsecond:06d}\" if fractional is True else \"\"\n filename += f\"{...
[ "0.7274047", "0.70063484", "0.6991718", "0.69580024", "0.68336576", "0.6821516", "0.6695857", "0.668563", "0.6668656", "0.6630324", "0.6598306", "0.6592337", "0.65795225", "0.6535598", "0.6510145", "0.6498421", "0.64621747", "0.6441371", "0.6437495", "0.64099765", "0.64072114...
0.70164764
1
Test we show user form on api key retrieval failure.
async def test_zero_conf_failure(hass: HomeAssistant) -> None: with patch( "homeassistant.components.lidarr.config_flow.LidarrClient.async_try_zeroconf", side_effect=exceptions.ArrZeroConfException, ): result = await hass.config_entries.flow.async_init( DOMAIN, co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_invalid_key(hass: HomeAssistant, invalid_key_api: Mock) -> None:\n result = await hass.config_entries.flow.async_init(\n DOMAIN, context={\"source\": SOURCE_USER}\n )\n assert result.get(\"type\") == data_entry_flow.FlowResultType.FORM\n assert result.get(\"step_id\") == \"user\"\...
[ "0.7214798", "0.7047174", "0.6973599", "0.693866", "0.67619634", "0.67581934", "0.6752249", "0.6722141", "0.6655639", "0.6655639", "0.66529447", "0.6628021", "0.65783834", "0.6493186", "0.64573175", "0.64496297", "0.64456594", "0.64233255", "0.6422043", "0.63976526", "0.63824...
0.0
-1
Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None
def __init__(self): super().__init__() import sklearn import sklearn.svm self.model = sklearn.svm.LinearSVR
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, learning_rate=0.1):\n self.learning_rate = learning_rate\n self._b = 0.0 # y-intercept\n self._w = None # weights assigned to input features\n # count of errors during each iteration\n self.misclassified_samples = []", "def __init__(self, initialLearnRate):...
[ "0.7502457", "0.73741865", "0.7322712", "0.7293263", "0.7251718", "0.71864325", "0.7184399", "0.7160075", "0.7129084", "0.7111028", "0.7106927", "0.70859164", "0.70628464", "0.70461", "0.7045854", "0.70244485", "0.7023777", "0.70198345", "0.70055443", "0.69822884", "0.6962856...
0.0
-1
Fixture to provide a fake recipe with test ingredients
def recipe(db, recipe_factory, ingredient_factory): recipe = recipe_factory.create() db.session.add(recipe) db.session.commit() ingredients = ingredient_factory.create_batch(10) db.session.add_all(ingredients) db.session.commit() for i in ingredients: recipe_ingredient = RecipeIngr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_creating_recipe_with_ingredients(self):\n ingredient1 = sample_ingredients(user=self.user, name='Prawns')\n ingredient2 = sample_ingredients(user=self.user, name='Garlic')\n\n payload = {\n 'title': 'Avocado lime cheesecake',\n 'time_minutes': 20,\n 'p...
[ "0.7726799", "0.7476634", "0.7197073", "0.7110067", "0.7082946", "0.7017125", "0.7014578", "0.7013509", "0.6951112", "0.6946583", "0.68967474", "0.6824715", "0.6820863", "0.6768924", "0.6763262", "0.66042614", "0.6594717", "0.65712065", "0.6570931", "0.65597415", "0.6554908",...
0.5909413
77
returns probability of all items in the feasible set
def fs_probability(self, fs): probs = [] for c in fs: probs.append(self.get_probability(c)) probs /= np.sum(probs) return probs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probabilities(self):\n raise NotImplementedError", "def prob1(n):\n#raise NotImplementedError(\"Problem 1 Incomplete\")\n if n == 0 :\n raise ValueError(\"Sampling 0 points is not defined.\")\n total = 0\n for i in xrange(n) :\n if np.random.normal() > 3 :\n total += ...
[ "0.6879535", "0.6873858", "0.673211", "0.67066664", "0.6686513", "0.668116", "0.6644997", "0.6628469", "0.65978545", "0.6539971", "0.64429015", "0.6434126", "0.6409813", "0.64075905", "0.63872385", "0.6377082", "0.6366414", "0.63418585", "0.63340247", "0.63287497", "0.6291711...
0.0
-1
Switch on and off the requires_grad option for the parameters in the discriminator.
def set_requires_grad(self, requires_grad): for parameter in self.parameters(): parameter.requires_grad = requires_grad
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_enable_grad(self, flag):\n self._executor.set_enable_grad(flag)", "def _set_trainable(self, disc=False):\n def set_requires_grad(m, rg):\n for p in m.parameters(): p.requires_grad_(rg)\n set_requires_grad(self.learn.model.G_A, not disc)\n set_requires_grad(self.lear...
[ "0.73572814", "0.72986716", "0.7163927", "0.71465284", "0.6919602", "0.6724481", "0.65857893", "0.6572731", "0.65569574", "0.6514598", "0.64777106", "0.6464855", "0.64086425", "0.6376525", "0.6353441", "0.62977785", "0.6277764", "0.625393", "0.6230714", "0.6226926", "0.620087...
0.659938
6
Switch on and off the requires_grad option for the parameters in the generator.
def set_requires_grad(self, requires_grad): for parameter in self.parameters(): parameter.requires_grad = requires_grad
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_enable_grad(self, flag):\n self._executor.set_enable_grad(flag)", "def requires_grad(self):\n self._activations.requires_grad = True", "def set_grad_flag(self, flag):\n self._executor.set_grad_flag(flag)", "def no_grad():\n prior_value = CrypTensor.AUTOGRAD_ENABLED\n ...
[ "0.77482015", "0.7527673", "0.75132185", "0.7480193", "0.73388475", "0.71357363", "0.70213246", "0.69647264", "0.6786432", "0.6741775", "0.67330474", "0.66833323", "0.6642032", "0.6614007", "0.6570818", "0.65448326", "0.65408564", "0.65243423", "0.65217096", "0.6519588", "0.6...
0.7119291
7
Create Flask application with given configuration
def create_app(config='config.py'): app = Flask(__name__, static_folder=None) app.config.from_pyfile(config) # Initialize extensions/add-ons/plugins. mongo.init_app(app) login_manager.init_app(app) for blueprint in all_blueprints: import_module(blueprint.import_name) app.regist...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app(config: dict) -> Flask:\n for key, value in config.items():\n app.config[key] = value\n db.init_app(app)\n ma.init_app(app)\n app.app_context().push()\n return app", "def create_application(config=None):\n app = Flask(__name__) \n if config is not None:\n prin...
[ "0.8509452", "0.8419027", "0.8372794", "0.8332288", "0.8297076", "0.828172", "0.82453746", "0.82194245", "0.8204439", "0.81907785", "0.8185743", "0.8160872", "0.815409", "0.81204593", "0.81133837", "0.8096133", "0.8095957", "0.8089854", "0.8075544", "0.8071347", "0.8036176", ...
0.7900492
41
Skips to the next track on the playlist.
def skip_to_next(self): spotifyconnect.Error.maybe_raise(lib.SpPlaybackSkipToNext())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def skip(self, ctx: commands.Context) -> None:\n player = self.get_player(ctx.guild)\n\n # Don't even try if we're not connected.\n if not player.is_connected:\n fail = Embeds.status(success=False, desc=\"I'm not even connected. 😪\")\n return await ctx.send(embed=f...
[ "0.7547843", "0.7472687", "0.7390575", "0.7333195", "0.7296058", "0.7045867", "0.6973166", "0.6972223", "0.6917996", "0.68929476", "0.6793254", "0.6753616", "0.67113733", "0.6646978", "0.66461766", "0.6588694", "0.6529875", "0.6516456", "0.64335835", "0.6433091", "0.6389724",...
0.8265994
0
Skips to the previous track on the playlist.
def skip_to_prev(self): spotifyconnect.Error.maybe_raise(lib.SpPlaybackSkipToPrev())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip_to_next(self):\n spotifyconnect.Error.maybe_raise(lib.SpPlaybackSkipToNext())", "def media_previous_track(self):\n self._lms.query(self._id, 'playlist', 'index', '-1')\n self.update_ha_state()", "def skip(self):\n self.skip_votes.clear()\n if self.is_playing():\n ...
[ "0.73364586", "0.72449064", "0.7229757", "0.7141216", "0.7080997", "0.7019818", "0.6927876", "0.68620056", "0.6841429", "0.68413734", "0.6821803", "0.6774181", "0.67711496", "0.67291236", "0.6680401", "0.66772443", "0.66198945", "0.654758", "0.6538848", "0.6473568", "0.643993...
0.8351132
0
Returns Chrome major version
def get_chrome_version(chrome_dir: Optional[AnyStr] = None) -> Optional[int]: result = None if system() == "Windows": for dir_ in scandir(chrome_dir): if isdir(dir_): match = get_match(r"(\d+)\.\d+", basename(dir_.path)) if match: result = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def browser_version_major(self):\n # type: () -> string_types\n return self._browser_version_major", "def version_min():\n return VERSION_MIN", "def major_version(self) -> str:\n return pulumi.get(self, \"major_version\")", "def _major_version(self):\n version_tuple = StrictVer...
[ "0.7573226", "0.6973248", "0.6935522", "0.6919115", "0.67908627", "0.66822195", "0.66005075", "0.652571", "0.6523342", "0.6493484", "0.6465316", "0.64260584", "0.63919985", "0.63559526", "0.632478", "0.6290262", "0.6287883", "0.62755805", "0.626246", "0.6248214", "0.624524", ...
0.6680522
6
Returns Chrome driver major version
def get_chrome_driver_version(binary_path: Optional[AnyStr] = None) -> Optional[int]: result = None if binary_path is None: binary_path = "chromedriver.exe" if system() == "Windows" else "chromedriver" if not isfile(binary_path): return None p = Popen([binary_path, "-v"], stdin=PIPE, std...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def browser_version_major(self):\n # type: () -> string_types\n return self._browser_version_major", "def major_version(self) -> str:\n return pulumi.get(self, \"major_version\")", "def _major_version(self):\n version_tuple = StrictVersion(self.plugin.version).version\n major...
[ "0.7858407", "0.7291026", "0.7211693", "0.697526", "0.69268274", "0.68739474", "0.6822836", "0.68175423", "0.6769331", "0.6744105", "0.6714124", "0.6701906", "0.668185", "0.6680602", "0.6674415", "0.64916724", "0.6387249", "0.6385027", "0.637998", "0.6356597", "0.63390183", ...
0.6504256
15
Read data from file given and return as pandas dataframe with datetime index and OpenHighLowClose data
def read_fx_data_from_file(self, fileName, formatSpec): dataR = pd.read_csv(fileName, index_col=1) dataR.index = pd.to_datetime(dataR.index, format=formatSpec) dataR.sort_index(inplace=True) label = dataR['Name'][0] dataR.drop('Name', axis=1, inplace=True) return dataR, l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_file(fname: str) -> pd.DataFrame:\n raw_data = (\n pd.read_hdf(fname).to_frame().reset_index(level=[0, 1]).loc[ANALYSIS_DATE]\n )\n raw_data[\"date\"] = raw_data.index\n return raw_data", "def load_data(file_path, drop_na=True, utc_time=False):\n df = pd.read_cs...
[ "0.7150399", "0.65281624", "0.64923364", "0.64605063", "0.6382056", "0.6371662", "0.63636786", "0.63594884", "0.62287676", "0.6201117", "0.6190653", "0.61868554", "0.6154914", "0.61388355", "0.6123573", "0.6121012", "0.6121012", "0.6121012", "0.6118661", "0.61070144", "0.6098...
0.5966216
31
Calculate the great circle distance between two points on the earth (specified in decimal degrees)
def haversine(lon1, lat1, lon2, lat2): # convert decimal degrees to radians lon1, lat1, lon2, lat2 = \ [math.radians(deg) for deg in [lon1, lat1, lon2, lat2]] # haversine formula dlon = lon2 - lon1 dlat = lat2 - lat1 a = math.sin(dlat / 2) ** 2 + math.cos(lat1) * \ math.cos(lat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long...
[ "0.8145727", "0.7863793", "0.7632431", "0.76049554", "0.7595838", "0.7594924", "0.75935525", "0.7570717", "0.7564014", "0.75558245", "0.75298345", "0.7516176", "0.7494569", "0.74658835", "0.7451055", "0.7433021", "0.7392573", "0.7356451", "0.73476917", "0.7330554", "0.7327826...
0.0
-1
Computes the distance (in meters) between two LatLng objects.
def distance(gps1, gps2): return haversine(gps1.lng, gps1.lat, gps2.lng, gps2.lat)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_distance_meters(aLocation1, aLocation2):\n dlat = aLocation2.lat - aLocation1.lat\n dlong = aLocation2.lon - aLocation1.lon\n return math.sqrt((dlat*dlat) + (dlong*dlong)) * 1.113195e5", "def get_distance_meters(location1, location2):\n dlat = location2.lat - location1.lat\n dlong = locati...
[ "0.7918164", "0.77871215", "0.7757901", "0.77396554", "0.76471764", "0.76471764", "0.76471764", "0.76471764", "0.76471764", "0.7617091", "0.761612", "0.75822204", "0.7581517", "0.74955326", "0.7490692", "0.7456874", "0.7395217", "0.7369135", "0.7337938", "0.7322662", "0.73030...
0.7490256
15
Calculates the loss for the entropy temperature parameter. log_probs come from the return value of calculate_actor_loss
def calc_entropy_tuning_loss(self, log_probs): with torch.no_grad(): inner_prod = (log_probs + self.target_entropy).detach() alpha_loss = -(self.log_alpha * inner_prod).mean() return alpha_loss
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logp_loss(self, entropy, beta=0.0):\n def loss(y_true, y_pred):\n return -K.mean((y_pred * y_true) \\\n + (beta * entropy), axis=-1)\n\n return loss", "def compute_entropy_loss(logits):\n policy = F.softmax(logits, dim=-1)\n log_policy = F.log_softmax(logits,...
[ "0.71348935", "0.7066955", "0.69833136", "0.69786084", "0.69616413", "0.689037", "0.656051", "0.6536549", "0.65132105", "0.6509999", "0.6502994", "0.64671946", "0.6428732", "0.64063567", "0.6385181", "0.63838303", "0.6376118", "0.63431156", "0.6342992", "0.63398904", "0.63347...
0.78800744
0
Initialize weights with uniform
def init_weights(self, init_w=3e-3): self.l3.weight.data.uniform_(-init_w, init_w) self.l3.bias.data.uniform_(-init_w, init_w)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initWeights(self):\n self.weights = []\n self.bias = []\n for i, dim in enumerate(self.dimensions[1:]):\n self.weights.append(np.random.uniform(-1,1,(self.dimensions[i],dim)))\n self.bias.append(np.random.uniform(-1,1,dim))", "def weights_initializer(self):\n ...
[ "0.8350334", "0.8347514", "0.8326826", "0.8299654", "0.82950056", "0.81186616", "0.8084303", "0.79824525", "0.79822373", "0.79723024", "0.79708546", "0.79650074", "0.79628485", "0.79628485", "0.79628485", "0.79292935", "0.7892532", "0.78501993", "0.77665126", "0.77665126", "0...
0.80286014
7
Initialize weights with uniform
def init_weights(self, init_w=3e-3): self.mean_linear.weight.data.uniform_(-init_w, init_w) self.mean_linear.bias.data.uniform_(-init_w, init_w) self.log_std_linear.weight.data.uniform_(-init_w, init_w) self.log_std_linear.bias.data.uniform_(-init_w, init_w)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initWeights(self):\n self.weights = []\n self.bias = []\n for i, dim in enumerate(self.dimensions[1:]):\n self.weights.append(np.random.uniform(-1,1,(self.dimensions[i],dim)))\n self.bias.append(np.random.uniform(-1,1,dim))", "def weights_initializer(self):\n ...
[ "0.83504826", "0.83486515", "0.83271897", "0.83003116", "0.8294676", "0.8118962", "0.8084455", "0.8029175", "0.8029175", "0.79830945", "0.79823804", "0.79706746", "0.7964909", "0.79626983", "0.79626983", "0.79626983", "0.79292315", "0.7892009", "0.7849895", "0.7766582", "0.77...
0.7972923
11
Initialize weights with uniform
def init_weights(self, init_w=3e-3): self.l3.weight.data.uniform_(-init_w, init_w) self.l3.bias.data.uniform_(-init_w, init_w)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initWeights(self):\n self.weights = []\n self.bias = []\n for i, dim in enumerate(self.dimensions[1:]):\n self.weights.append(np.random.uniform(-1,1,(self.dimensions[i],dim)))\n self.bias.append(np.random.uniform(-1,1,dim))", "def weights_initializer(self):\n ...
[ "0.8350334", "0.8347514", "0.8326826", "0.8299654", "0.82950056", "0.81186616", "0.8084303", "0.79824525", "0.79822373", "0.79723024", "0.79708546", "0.79650074", "0.79628485", "0.79628485", "0.79628485", "0.79292935", "0.7892532", "0.78501993", "0.77665126", "0.77665126", "0...
0.80286014
8
Closes the active connection.
def disconnect(self): logger.debug("disconnecting") if self.connected and self.conn: self.can_listen = False self.conn.close() self.connected = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n with self.connlock:\n self.conn.do_close()", "def close_connection(self):\n\n self._connection.close()\n print(\"Closed connection....\")", "def close(self) -> None:\n self.__is_active = False\n if self.__connection is not None:\n self...
[ "0.8213485", "0.81116426", "0.8088739", "0.80521995", "0.80439425", "0.80384344", "0.7980101", "0.7974622", "0.79337233", "0.7915697", "0.79149276", "0.79135865", "0.79057336", "0.78764397", "0.78764397", "0.78764397", "0.78764397", "0.78764397", "0.78764397", "0.78764397", "...
0.0
-1
Generate a binary number with zeros at the end Calculate a value which, if applied as logical and, sets the lowest `n` bits to 0.
def _generate_bitmask(n: int = 2, n_bits: int = 8) -> int: all_ones = 2 ** n_bits - 1 cancel_bits = 2 ** n - 1 return all_ones - cancel_bits
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maskbits(x: int, n:int) -> int:\n if n >= 0:\n return x & ((1 << n) - 1)\n else:\n return x & (-1 << -n)", "def mask(n):\n if n >= 0:\n return 2**n - 1\n else:\n return 0", "def mask(n):\n if n >= 0:\n return 2**n - 1\n else:\n return 0", "def ones(n, o...
[ "0.71571743", "0.7059622", "0.7059622", "0.6805829", "0.6736999", "0.66980875", "0.6687002", "0.66308963", "0.6593311", "0.65884274", "0.65389544", "0.6534308", "0.64939076", "0.6461085", "0.639978", "0.63715506", "0.6330098", "0.6311478", "0.6279047", "0.6263244", "0.6233976...
0.74272555
0
Get a representative color sample of the given image. Returns a subset of the color values of the given image which has a size of roughly the given percentage.
def _color_sample(img: np.ndarray, p: float = 0.05) -> np.ndarray: # combine the X and Y dimension into one, only keep the channels dimension ravelled = img.reshape(-1, 3) # for 5%, take every 20th value, for 10% every 10th, etc... every_nth = int(1 / p) return ravelled[::every_nth, :]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_colorbalance(img: np.ndarray, percent=1):\n\n out_channels = []\n cumstops = (\n img.shape[0] * img.shape[1] * percent / 200.0,\n img.shape[0] * img.shape[1] * (1 - percent / 200.0)\n )\n for channel in cv2.split(img):\n channel = channel.astype(np.uint8)\n cumhis...
[ "0.6546381", "0.63080335", "0.55237955", "0.5460695", "0.5432275", "0.5385628", "0.5312654", "0.5284238", "0.5271766", "0.5181504", "0.51797736", "0.5151101", "0.5151101", "0.5113417", "0.50898284", "0.5085033", "0.50845134", "0.50830036", "0.5080593", "0.50667834", "0.504878...
0.7113868
0
Combine r, g and b into a single 24 bit value
def _pack_rgb_values(r, g, b): if isinstance(r, np.ndarray): r = r.astype(np.int) rgb = r << 8 rgb |= g rgb = rgb << 8 rgb |= b return rgb
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rgb_pack(r: int, g: int, b: int) -> int:\n rgb = (r << 16) | (g << 8) | b\n return rgb", "def color565(r, g=0, b=0):\n try:\n r, g, b = r # see if the first var is a tuple/list\n except TypeError:\n pass\n return (r & 0xf8) << 8 | (g & 0xfc) << 3 | b >> 3", "def _color565(self...
[ "0.703181", "0.70015895", "0.6811461", "0.6596024", "0.651183", "0.6380668", "0.6134918", "0.6089285", "0.605575", "0.60166234", "0.60071814", "0.5963913", "0.5957245", "0.58931845", "0.5878192", "0.5864687", "0.5861598", "0.5861598", "0.5861598", "0.58493847", "0.5826282", ...
0.72487026
0
Sets the id of this JsonJobImplImpl.
def id(self, id): self._id = id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_id(self, id):\n self.data['id'] = id", "def set_id(self, id):\n self.__id = id", "def set_id(self, id_):\n\n self.id_ = id_", "def setID(self, id):\r\n raise NotImplementedError(\"must be implemented in subclass\")", "def set_id(self, id_=None):\n if id_ is None:\...
[ "0.72039825", "0.7153717", "0.70253026", "0.69916093", "0.68805254", "0.68508697", "0.6821358", "0.68171006", "0.68029004", "0.68029004", "0.68029004", "0.6799925", "0.6798765", "0.6780175", "0.6779595", "0.6779595", "0.6779595", "0.6779595", "0.6779595", "0.6778952", "0.6751...
0.66653514
64
Sets the system of this JsonJobImplImpl.
def system(self, system): self._system = system
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_system(self, game_system):\n\n self._game_system = game_system", "def set_system_definition(\n self,\n system_id,\n allocation\n ): # pylint:disable=arguments-differ\n system = self.get_exec_system(system_id)\n\n if not system.available:\n ...
[ "0.6030612", "0.58944625", "0.5879832", "0.58358693", "0.58358693", "0.5711674", "0.57002276", "0.569219", "0.55712235", "0.5557621", "0.5526618", "0.54285014", "0.5393189", "0.53922594", "0.5373808", "0.53601027", "0.5343373", "0.5301391", "0.52953434", "0.5284736", "0.52663...
0.728365
0
Sets the created_by of this JsonJobImplImpl.
def created_by(self, created_by): self._created_by = created_by
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def created_by(self, created_by: \"str\"):\n self._attrs[\"createdBy\"] = created_by", "def created_by(self, created_by: \"str\"):\n self._attrs[\"createdBy\"] = created_by", "def created_by(self, created_by: \"str\"):\n self._attrs[\"createdBy\"] = created_by", "def created_by(self, cre...
[ "0.72564536", "0.72564536", "0.72564536", "0.72564536", "0.6680431", "0.65499043", "0.6396058", "0.63607204", "0.632521", "0.6298832", "0.6298832", "0.6298832", "0.6298832", "0.6298832", "0.6298832", "0.6284619", "0.6136624", "0.61340016", "0.61282814", "0.59783876", "0.59700...
0.7462367
2
Sets the natural_identifier of this JsonJobImplImpl.
def natural_identifier(self, natural_identifier): self._natural_identifier = natural_identifier
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setIdentifier(self, identifier):\n self._config['identifier'] = identifier", "def setIdentifier(self, identifier):\n self._config['identifier'] = identifier", "def setId(self, identifier):\n self.identifier = identifier", "def identifier(self, identifier):\n self._identifier =...
[ "0.55935544", "0.55935544", "0.5484401", "0.5462023", "0.5462023", "0.54520696", "0.54201585", "0.54201585", "0.54201585", "0.54201585", "0.52602446", "0.5201", "0.51021254", "0.5064833", "0.5064833", "0.5064833", "0.5029128", "0.5029128", "0.5029128", "0.5002118", "0.4846308...
0.7896983
0
Sets the start_date of this JsonJobImplImpl.
def start_date(self, start_date): self._start_date = start_date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_date(self, start_date):\n \n self._start_date = start_date", "def start_date(self, start_date):\n self._start_date = start_date", "def start_date(self, start_date):\n if start_date is None:\n raise ValueError(\"Invalid value for `start_date`, must not be `None`\...
[ "0.8302391", "0.815241", "0.8107304", "0.8051634", "0.7985379", "0.7718837", "0.76095086", "0.7426275", "0.7269317", "0.7195047", "0.67693174", "0.67623657", "0.66729033", "0.6634295", "0.6515647", "0.65067697", "0.65067697", "0.65067697", "0.65067697", "0.65067697", "0.64843...
0.8201327
4
Sets the message of this JsonJobImplImpl.
def message(self, message): self._message = message
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setMessage(self, message):\n self._message = message", "def _set_message(self, value):\n self.__message = value", "def message(self, message: Union[Message, bytes]) -> None:\n self._message = message", "def message(self, message):\n self._message = message", "def message(sel...
[ "0.7402184", "0.7065632", "0.70122194", "0.698777", "0.698777", "0.6836624", "0.6736919", "0.6694453", "0.66536844", "0.6516778", "0.6498536", "0.6447774", "0.63608897", "0.6315439", "0.6246727", "0.60038716", "0.59800917", "0.59793425", "0.59422255", "0.5899055", "0.5866591"...
0.6944192
8
Sets the end_date of this JsonJobImplImpl.
def end_date(self, end_date): self._end_date = end_date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_date(self, end_date):\n self._end_date = end_date", "def end_date(self, end_date):\n if end_date is None:\n raise ValueError(\"Invalid value for `end_date`, must not be `None`\")\n\n self._end_date = end_date", "def set_end_date(self, date):\n pass", "def end_da...
[ "0.8283821", "0.81168276", "0.79830366", "0.7941641", "0.793099", "0.77424204", "0.7638016", "0.753742", "0.7490492", "0.73320127", "0.7265728", "0.7208729", "0.6946179", "0.69126874", "0.69126874", "0.69126874", "0.6869652", "0.6869652", "0.6806993", "0.6806993", "0.6775004"...
0.83493316
2
Sets the type of this JsonJobImplImpl.
def type(self, type): self._type = type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job_type(self, job_type):\n self._job_type = job_type", "def set_type(self, type):\n self._type = type", "def set_type(self, type):\n self.type = type", "def set_type(self, type):\n self.type = type", "def type(self, type: str):\n\n self._type = type", "def type(sel...
[ "0.73121595", "0.70133847", "0.7006206", "0.7006206", "0.67733014", "0.6690951", "0.6690951", "0.6690951", "0.66017246", "0.66017246", "0.65342164", "0.65342164", "0.6475521", "0.6475521", "0.63814986", "0.63734835", "0.6347607", "0.6344959", "0.6323424", "0.61726844", "0.613...
0.6606342
20
Sets the name of this JsonJobImplImpl.
def name(self, name): self._name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_name(self, name):\n self.__name = name", "def set_name(self, name):\n self.__name = name", "def set_name(self, name: str):\n self._name = name", "def set_name(self, name):\n self._name = name", "def set_name(self, name):\r\n self.__name = name", "def setname(sel...
[ "0.739704", "0.739704", "0.7388408", "0.7370636", "0.73672575", "0.73476565", "0.73094296", "0.73094296", "0.73094296", "0.73094296", "0.73094296", "0.7230593", "0.72273356", "0.7224001", "0.72199845", "0.7218784", "0.7218784", "0.71411896", "0.7124874", "0.7072294", "0.70680...
0.68649673
84
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, JsonJobImplImpl): 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.808826", "0.808826", "0.8054592", "0.79827315", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "0.79666996", "...
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
Mock of requests.get(). The object returned must have content, status_code and reason properties and a json method.
def mock_response(content, status): response = Mock() response.content = content def mock_response_json(): return json.loads(content) response.json = mock_response_json response.status_code = status response.reason = 'OK' return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_request(self):\n client = RestClient(host=self.host, username='')\n rest_url = 'some/url/'\n\n # Mock good get response\n with responses.RequestsMock() as rsps:\n rsps.add(responses.GET, f'{self.host}/{rest_url}', status=200,\n json={'value':\"goo...
[ "0.7805346", "0.7746122", "0.7596587", "0.7471551", "0.74266034", "0.73776656", "0.71822804", "0.71612185", "0.7140041", "0.7073958", "0.7069122", "0.70605177", "0.70422447", "0.70132047", "0.6829357", "0.681755", "0.68105954", "0.6786565", "0.6781949", "0.67469496", "0.67449...
0.6641124
27
Argument Must Include Alphavantage API KEY
def __init__(self, apikey, stock_symbol): self.stock_data = None self.stock_resp = None self.stock_params = { "function": TIME_SERIES, "symbol": stock_symbol, "apikey": apikey, "datatype": "json" }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api():\n global KEY_FILE\n global APCA_API_KEY_ID\n global APCA_API_SECRET_KEY\n\n if \"APCA_ID\" in os.environ:\n APCA_ID = os.environ[\"APCA_ID\"]\n APCA_KEY = os.environ[\"APCA_KEY\"]\n elif KEY_FILE:\n auth_header = authentication_header()\n APCA_ID = str(auth_hea...
[ "0.5953359", "0.56549025", "0.559035", "0.5534961", "0.5528001", "0.55154806", "0.54984045", "0.5489328", "0.54622906", "0.54622906", "0.5437995", "0.5409478", "0.5405787", "0.5404888", "0.5400971", "0.5379135", "0.5340568", "0.53258306", "0.53201246", "0.5313721", "0.5301237...
0.47972256
100
Must have news api key as argument
def get_news(self, news_api_key, company): news_params = { "q": company, "apiKey": news_api_key } news_resp = requests.get(NEWS_API_ENDPOINT, params=news_params) news_resp.raise_for_status() news_data = news_resp.json() return news_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_news_api(self):\n self.news_api = newsapi.NewsApiClient(self.api_key)", "def __init__(self, key=None):\n self.key = key\n self.root = 'http://api.nytimes.com/svc/archive/v1/{}/{}.json?api-key={}' \n if not self.key:\n nyt_dev_page = 'http://developer.nytimes.com/d...
[ "0.72833014", "0.66931826", "0.6628576", "0.6512605", "0.6512344", "0.6482467", "0.64756936", "0.64542013", "0.6418292", "0.6338411", "0.6283861", "0.6256314", "0.6239286", "0.6176662", "0.60832626", "0.6081156", "0.6076896", "0.60557866", "0.6052143", "0.60334516", "0.603249...
0.5891824
26
Return zeroshot distributions p(syntax | example), p(syntax, meaning | example).
def zero_shot(learner, example, token): sentence, model, _ = prep_example(learner, example) syntaxes, joint_candidates = learner.predict_zero_shot_tokens(sentence, model) assert list(syntaxes.keys()) == [token] return syntaxes[token], joint_candidates[token].as_distribution()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onehot(inputs, num_classes):\n num_sample = inputs.size(0)\n inputs_onehot = torch.zeros(num_sample, num_classes)\n inputs_onehot.scatter_(1, inputs.unsqueeze(1), 1.0)\n return inputs_onehot", "def hotp(self, counter=4):\n return generate_hotp(self.secret, counter)", "def sample(predicti...
[ "0.5753345", "0.5479027", "0.5417939", "0.5417939", "0.5417939", "0.5398598", "0.5322643", "0.5321528", "0.530034", "0.5289397", "0.5285652", "0.52836144", "0.5280405", "0.5280164", "0.52750236", "0.5258426", "0.52514535", "0.52369314", "0.5234557", "0.522537", "0.52245075", ...
0.5221684
21
Return True if user is in the group, False otherwise.
def is_user_in_group(user, group): # Check group if user in group.users: # O(N) return True # Check subgroups for sub_group in group.groups: # O(N) if is_user_in_group(user, sub_group): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_user_in_group(user, group):\n users = group.get_users()\n if user in users:\n return True\n return False", "def is_in_group(user, group_name):\n return is_in_group_user_id(user.id, group_name)", "def is_user_in_group(user, group):\n\n if user == group.get_name():\n return Tr...
[ "0.8791304", "0.84474826", "0.8253319", "0.81782854", "0.8154014", "0.80775934", "0.8077066", "0.7991211", "0.7917411", "0.79046553", "0.78879106", "0.7874985", "0.78737533", "0.7837497", "0.7784908", "0.7714273", "0.7684502", "0.76652265", "0.7655611", "0.7561973", "0.737242...
0.7571193
19
Given the reference summary as a sequence of tokens, return the input sequence for the decoder, and the target sequence which we will use to calculate loss. The sequence will be truncated if it is longer than max_len. The input sequence must start with the start_id and the target sequence must end with the stop_id (but...
def get_dec_inp_targ_seqs(self, sequence, max_len, start_id, stop_id): inp = [start_id] + sequence[:] target = sequence[:] if len(inp) > max_len: # truncate inp = inp[:max_len] target = target[:max_len] # no end_token else: # no truncation target.append(stop_id) # end token assert len(inp) == len...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TestSeq2Seq(source_seq, target_seq_in, target_seq_out): \r\n loss = 0\r\n pred = []\r\n decoder_length = target_seq_out.shape[1]\r\n # Encode the source.\r\n encoder_outputs = encoder(source_seq)\r\n states = encoder_outputs[1:]\r\n # Decoder predicts the target_seq.\r\n decoder_in =...
[ "0.63756627", "0.62648726", "0.57944375", "0.5775712", "0.57428604", "0.55838984", "0.5561209", "0.5554712", "0.55257416", "0.5479713", "0.5465613", "0.5430287", "0.5429799", "0.5418104", "0.5399574", "0.5372926", "0.5372038", "0.5370328", "0.5360915", "0.5346408", "0.5334914...
0.71003324
0
Evaluate the model on the test dataset Returns metrics as a dict and evaluation loss
def test(model, dataloader, params, args, val): # evaluation mode model.eval() # initialise buffers dice_lv_buffer = [] dice_myo_buffer = [] dice_rv_buffer = [] mcd_lv_buffer = [] hd_lv_buffer = [] mcd_myo_buffer = [] hd_myo_buffer = [] mcd_rv_buffer = [] hd_rv_buffer ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate_model(self, test_data, test_labels,verbose=2):\n test_loss, test_acc = self.model.evaluate(test_data, test_labels, verbose=verbose)\n return test_loss, test_acc", "def model_evaluate(self, test):\n features = {name: np.array(value) for name, value in test.items()}\n label...
[ "0.81468487", "0.8031538", "0.78203595", "0.78044814", "0.7766692", "0.77046716", "0.76557505", "0.7624474", "0.7611108", "0.7589132", "0.75671244", "0.7562814", "0.75541556", "0.7553548", "0.75466615", "0.75265265", "0.7513352", "0.74944675", "0.74944675", "0.74944675", "0.7...
0.0
-1
Gets the similar of this ResultItemSet.
def similar(self) -> List[Item]: return self._similar
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_single_result(self):\n for r in self:\n return r", "def getsimilaritems(self):\n contextuid = self.context.UID()\n service = coreutils.SimService()\n max_votes = 3\n intervall = (1 - service.min_score) / max_votes\n response = service.query([contextuid...
[ "0.63436866", "0.6008089", "0.5891782", "0.5706207", "0.5704947", "0.55869234", "0.55130136", "0.54956096", "0.5450148", "0.5422679", "0.53752875", "0.53586245", "0.5351041", "0.5288984", "0.5288984", "0.5275702", "0.5273479", "0.5273479", "0.52449685", "0.52346355", "0.51228...
0.7733056
0
Gets the count of this ResultItemSet.
def count(self) -> int: return self._count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self):\n if self._result_cache is not None:\n return len(self._result_cache)\n\n return self.query.get_count(using=self.db)", "def count(self):\n self._fetch_if_needed()\n return len(self._result_cache.get('rows', []))", "def count(self):\n \n retu...
[ "0.78391427", "0.7597686", "0.7544895", "0.74960303", "0.7470331", "0.7448607", "0.7420448", "0.7420448", "0.7420448", "0.7420448", "0.7420448", "0.7420448", "0.7420448", "0.7420448", "0.7420448", "0.7420448", "0.7415166", "0.7412319", "0.7412319", "0.74020433", "0.7380571", ...
0.74202186
17
Sets the count of this ResultItemSet.
def count(self, count: int): self._count = count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_count(self, count):\n self._count = count", "def set_count(self, count, asset=None):\n self._set_property('pc:count', count, asset)", "def setCount(self, num):\n self.count=num", "def count(self, count):\n\n self._count = count", "def count(self, count):\n\n self....
[ "0.7392012", "0.7278112", "0.72460145", "0.71506566", "0.71506566", "0.71506566", "0.71506566", "0.7128019", "0.70545644", "0.6773714", "0.66345686", "0.6563995", "0.64899254", "0.6319898", "0.63001806", "0.60857177", "0.6055729", "0.5988985", "0.5962391", "0.59126025", "0.58...
0.7095005
8
Returns parameter name to type map for parameters are neither optional nor have a default value in the template.
def _get_mandatory_parameters(template_dict): # type: (Dict) -> Dict[str, str] mandatory_params = {} all_params = template_dict.get("instance", {}).get("variables", {}) for p in all_params.items(): if not p[1].get("optional", False) and "value" not in p[1]: mandatory_params[p[0]] = p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameter_type_dict():\n return {'filter' : filters.filter_parameters,\n 'global_options' : global_options.global_options_parameters,\n 'input_device' : input_devices.input_device_parameters,\n 'input_stream' : input_streams.input_stream_parameters,\n 'output_devi...
[ "0.6619126", "0.6265336", "0.60736114", "0.5808053", "0.5788363", "0.5761593", "0.5761593", "0.5761593", "0.5761593", "0.5761593", "0.5761593", "0.5761593", "0.5761593", "0.5761593", "0.5761593", "0.5761593", "0.5761593", "0.5699839", "0.5679782", "0.56388754", "0.56268466", ...
0.6376543
1
build a random, sized length, subject
def rand_string(): out = '' for _ in range(24): out += choice(ascii_letters) return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def some_payload(size=32, var=0):\n if var:\n size = random.randint(size-var, size+var)\n return ''.join(random.choice(string.ascii_uppercase) for _ in range(size))", "def generate(length):\n return base64.encodestring(OpenSSL.rand.bytes(256))[:length]", "def make_random_string(\n se...
[ "0.6623993", "0.64051765", "0.6380037", "0.6373875", "0.6366156", "0.6346277", "0.62431794", "0.6221118", "0.6217324", "0.62106735", "0.6193957", "0.6191297", "0.61823064", "0.6180317", "0.61771685", "0.6165575", "0.6161826", "0.6152031", "0.6133353", "0.61116594", "0.6103244...
0.0
-1
Return the number of vertices.
def __len__(self, expand=False, factor=False, simplify=False): self._.n = rewriteExp(self._.n, expand=expand, factor=factor, simplify=simplify) return self._.n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_vertices(self):\n return len(self.vertices)", "def num_vertices(self):\n return len(self.vertices)", "def get_vertices_count(self) -> int:\n # TODO: verify the following claim:\n raise NotImplementedError", "def return_num_vertices(self):\n return self.__size", "d...
[ "0.90264654", "0.90264654", "0.90181196", "0.89943784", "0.8987268", "0.89685875", "0.89193565", "0.8867708", "0.87823063", "0.8756588", "0.8621158", "0.8594945", "0.8565224", "0.8559106", "0.83967066", "0.814736", "0.8068461", "0.8050035", "0.7982884", "0.7942759", "0.772424...
0.0
-1
Return the variables in the graph parameters.
def variables(self): return self._.vars
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variables(self, *args, **kwargs):\n return self._optimizer.variables(*args, **kwargs)", "def get_variables(self):\n return [self.g_t, self.m_t]", "def parameters(self):\n return self.vars", "def get_variables(self):\n\t\treturn self.variables", "def variables(self):\n return...
[ "0.78232825", "0.7687127", "0.76481366", "0.75709665", "0.75493723", "0.748444", "0.7476876", "0.73581666", "0.73500156", "0.73011065", "0.7260298", "0.7239515", "0.7233502", "0.71756274", "0.71639377", "0.7095814", "0.7093458", "0.7081511", "0.7071494", "0.704015", "0.701369...
0.69633853
24
Compare self to other.
def __eq__(self, other): if isinstance(other, self._get_class()): return self._.hash_parameters == other._.hash_parameters else: return not isinstance(other, ASParameters) \ and self._.hash_parameters == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __cmp__(self, other):\n _, _ = self, other\n return 0", "def __eq__(self, other):\n pass", "def __eq__(self, other):\n pass", "def __gt__ (self, other) :\n return other.__lt__(self)", "def __eq__(self, other):\n return self.num == other.num", "def __eq__(self, ot...
[ "0.7784676", "0.77788574", "0.77788574", "0.77520096", "0.77375746", "0.7734634", "0.77342546", "0.77342546", "0.77342546", "0.77133614", "0.7666944", "0.7663646", "0.7657985", "0.7657985", "0.7642626", "0.7632713", "0.7626972", "0.7614204", "0.7604817", "0.75969285", "0.7583...
0.0
-1
Compute the Krein parameters or intersection numbers from the cosine sequences.
def _compute_dualParameters(self, q, k, m, tr): for h in range(self._.d + 1): for i in range(self._.d + 1): for j in range(self._.d + 1): q[h, i, j] = full_simplify( sum(k[t] * self._.omega[tr(h, t)] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_k(self):\n\t\n\tself.k = -np.array([self.sth*self.cphi, self.sth*self.sphi, self.cth])\n\n\treturn", "def cosin_sim_pairs(a, b):\n wordsA = set(a.keys())\n wordsB = set(b.keys())\n inter = wordsA.intersection(wordsB)\n if(len(inter) == 0):\n return 0.0\n aa,...
[ "0.6130739", "0.5887698", "0.58829916", "0.58540815", "0.5819419", "0.5778065", "0.5777621", "0.5661418", "0.5649529", "0.5641881", "0.56227094", "0.5598035", "0.55821687", "0.5579454", "0.5554106", "0.5545023", "0.5540951", "0.5523914", "0.5509384", "0.54931337", "0.5486208"...
0.0
-1
Return the directory where package is installed.
def get_path_from_package(package): if isinstance(package, str): pkg = package elif isinstance(package, _ModuleType): pkg = package.__package__ else: raise ValueError('Invalid package type, must be str or module') dist = _pkg_resources.get_distribution(pkg) return dist.locati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetPackageDirectory():\n return os.path.dirname(__file__)", "def get_package_dir():\n return Path(__file__).parent", "def get_installdir(self):\n import mewlo\n path = os.path.dirname(os.path.realpath(mewlo.__file__))\n return path", "def path(self):\n installed_packages...
[ "0.86402804", "0.84881645", "0.7817885", "0.77641445", "0.77627563", "0.77459925", "0.7730675", "0.76932746", "0.7472139", "0.74470264", "0.74245983", "0.7262097", "0.72245514", "0.72242016", "0.715173", "0.7097122", "0.709112", "0.70810777", "0.70213675", "0.6996441", "0.696...
0.0
-1
Initialize the maze grid. The maze consists of nx x ny cells and will be constructed starting at the cell indexed at (ix, iy).
def __init__(self, nx, ny, ix=0, iy=0): self.nx, self.ny = nx, ny self.ix, self.iy = ix, iy self.svg_name = "maze.svg" self.maze_map = [[Cell(x, y, maze_size=nx) for y in range(ny)] for x in range(nx)] self.__map_ids = {} self.__init_map_ids() self.__current_pos...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_grid(self):\r\n for i in range(self.height):\r\n for j in range(self.width):\r\n self.grid[i][j] = 0\r\n \r\n # fill up unvisited cells\r\n for r in range(self.height):\r\n for c in range(self.width):\r\n if r % ...
[ "0.7657283", "0.7375744", "0.72883576", "0.7048788", "0.69839823", "0.6925315", "0.69205403", "0.6908096", "0.6761972", "0.6554406", "0.65092963", "0.6488068", "0.64474183", "0.644665", "0.64123076", "0.6402823", "0.63638026", "0.6350899", "0.63332653", "0.63074577", "0.62839...
0.6994132
4
Return a (crude) string representation of the maze.
def __str__(self): maze_rows = ['-' * self.nx * 2] for y in range(self.ny): maze_row = ['|'] for x in range(self.nx): prefix = " " if self.cell_at(x, y).is_current_position: prefix = "*" if self.cell_at(x, y).wa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toString(self):\n printme = \"\"\n for i in range (0,len(self.maze)):\n for j in self.maze[i]:\n printme = printme + j\n printme = printme + \"\\n\"\n return printme", "def printMaze(self):\r\n\t\tdef getString(tile):\r\n\t\t\tif tile == 0:\r\n\t\t\t\...
[ "0.7578632", "0.7189414", "0.6598073", "0.6541677", "0.6479986", "0.6479034", "0.64266425", "0.6420899", "0.639439", "0.62365603", "0.62216836", "0.62159926", "0.6184387", "0.6184387", "0.6184387", "0.6184387", "0.6172914", "0.6172914", "0.6172914", "0.6152787", "0.6142905", ...
0.7842171
0
Write an image to the SVG
def write_circle(file, x_coordinate, y_coordinate, radius, color): file.write('\t<circle cx="{}" cy="{}" r="{}" fill="{}"/>\n' .format(x_coordinate, y_coordinate, radius, color))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svg_mask_image(output_name, img_name, mask_name, size, img_write_method, use_gzip):\n with get_writer(output_name, use_gzip) as f:\n f.write(svg_preamble)\n f.write(svg_doctype)\n f.write('<svg width=\"{}\" height=\"{}\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.o...
[ "0.71825755", "0.7174531", "0.7101686", "0.70300364", "0.69774306", "0.6894796", "0.6827552", "0.6760363", "0.6748639", "0.6746363", "0.67450595", "0.6733776", "0.6716201", "0.670319", "0.6569869", "0.65096575", "0.6494438", "0.6459885", "0.64424634", "0.63945234", "0.6393536...
0.0
-1
Like `aleph.utils.pad_from_beginning` but faster. Keyword arguments `axis` and `values` take the default options.
def pad_from_beginning_fast(vals, maxlen): length = len(vals) matrix = np.zeros((length, maxlen)) lens = [len(v) for v in vals] # only iteration mask = np.arange(maxlen)[::-1] < np.array(lens)[:, None] # key line matrix[mask] = np.concatenate(vals) return matrix
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_from_beginning(vals, maxlen=None, value=0., axis=0):\r\n length = len(vals)\r\n lens = [len(v) for v in vals] # only iteration\r\n maxlen_ = max(lens)\r\n if maxlen is None:\r\n pass\r\n elif maxlen < maxlen_:\r\n raise ValueError(\"'maxlen' must be >= '{}'\...
[ "0.7249827", "0.62651724", "0.59953886", "0.5740266", "0.56945086", "0.5605875", "0.5532639", "0.55237985", "0.54457873", "0.54212224", "0.5421095", "0.5413949", "0.54012233", "0.53987527", "0.5388034", "0.5360313", "0.5347461", "0.5305732", "0.5263075", "0.5256061", "0.52466...
0.61978585
2
generate random string with length "string_len"
def random_string_generator(string_len): random_string = ''.join(random.choice( string.ascii_uppercase) for i in range(string_len)) return random_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))", "def get_random_str(len):\n return base64.urlsafe_b64encode(os.urandom(len))[0:len]", "def generate_string(str_length):\n letters = string.ascii_uppercase...
[ "0.8441971", "0.8370659", "0.8295992", "0.82593906", "0.81954896", "0.81844306", "0.81787574", "0.815242", "0.8141357", "0.81361353", "0.8135825", "0.8107537", "0.8103146", "0.8095659", "0.80415386", "0.8039916", "0.8035444", "0.80184287", "0.8013308", "0.8009173", "0.8003434...
0.8461781
0
Days since this version was released.
def elapsed_days(self) -> int: return (datetime.today() - self.release_datetime).days
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remaining_days_in_cycle(self) -> int:\n if not self.expiration:\n return 0\n delta = self.expiration - _today()\n return int(delta.days)", "def getDays(self):\r\n return self._repo", "def days(self):\n return self._days", "def days(self) -> Optional[int]:\n ...
[ "0.7069415", "0.6961588", "0.6927581", "0.6840665", "0.68379945", "0.67419326", "0.67412573", "0.66777295", "0.6653157", "0.65467", "0.6460423", "0.6460008", "0.6447333", "0.6442928", "0.6379237", "0.63777757", "0.63087636", "0.6293964", "0.62152565", "0.6198237", "0.6198237"...
0.8274978
0
Clean up the tag name for display, e.g. "release_1" > "Release 1"
def display_name(self) -> str: if self.is_verified: return f"Verified Package {self.csharp_version}" elif self.is_main: return "main (unstable)" else: return self.release_tag.replace("_", " ").title()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tagify(parsedtag):\n tag = \"\"\n for t in parsedtag:\n if t == '':\n t = '_'\n tag = tag+t\n return tag", "def _tag_of(entry: _LexiconEntry) -> str:\n return entry[\"tag\"].upper()", "def tagify(text):\n if \"(\" in text:\n text = text.split(\"(\")[0]\n ret...
[ "0.6502965", "0.63484806", "0.6333472", "0.63016367", "0.62075454", "0.61773103", "0.61081433", "0.60422105", "0.59870315", "0.5983979", "0.59666455", "0.5954751", "0.58900774", "0.5858985", "0.5825559", "0.57980096", "0.5778871", "0.5763651", "0.5752851", "0.57230306", "0.57...
0.5681454
23
Expect contents of the with statement to print contents of file. The file is looked up relatively in data subdir of the directory where the test is located. When the code finishes, the printed output and contents of the file are compared line by line. By using the `parse_json` argument, it is possible to instead parse ...
def expect_output(self, file, parse_json=False): contents = self._data_file(file) patcher = mock.patch('sys.stdout', new_callable=StringIO) output = patcher.start() yield patcher.stop() if parse_json: self.assertEqual(json.loads(output.getvalue()), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parse(self, tmpdir):\n json_file = tmpdir.join(\"f.json\")\n obj = {\"ds\": [{\"file\": \"data.nc\", \"size\": 0, \"mtime\": 0, \"sha256\": 0}]}\n with open(str(json_file), \"w\") as f:\n json.dump(obj, f)\n\n csv_file = tmpdir.join(\"f.csv\")\n csv_file.write...
[ "0.70361876", "0.6466664", "0.6291269", "0.62801504", "0.6207263", "0.6057451", "0.60144943", "0.59557545", "0.59295994", "0.5842915", "0.58403003", "0.5836702", "0.58155453", "0.5813729", "0.5813314", "0.5812699", "0.58017224", "0.5788531", "0.5788422", "0.5786802", "0.57634...
0.76089746
0
Returns the measurement from the stabilizer state form.
def _perform_measurement(self, qubits: Sequence['cirq.Qid']) -> List[int]: return [self.state._measure(self.qubit_map[q], self.prng) for q in qubits]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state(self, s):\n return (torch.tensor(s, device=self.device).permute(2, 0, 1)).unsqueeze(0).float()", "def state(self):\n return self._measure", "def state(self) -> float:\n return self.value", "def getState(self) -> vector:\n return self._denormalizeState(self.Z)", "de...
[ "0.6365812", "0.63449085", "0.6231717", "0.6154932", "0.60415745", "0.6031512", "0.6023738", "0.5999643", "0.59497786", "0.58836055", "0.5809684", "0.5798972", "0.57740283", "0.5762977", "0.575876", "0.575876", "0.57575566", "0.5729101", "0.565865", "0.5630125", "0.5628611", ...
0.0
-1
Check whether a given password map is a valid password. The condition for validity is that REQ_KEYS should be present in the passport map.
def valid_passport_part_1(pmap): ks = set(pmap.keys()) return len(REQ_KEYS - ks) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_password(data):\n\n if \"password\" not in data:\n return False\n password = data[\"password\"]\n if len(password) < 4 or len(password) > 16:\n return False\n\n return True", "def _check_password(self, password):\n rule = re.compile(constant.password_regex)\n ...
[ "0.72034127", "0.68375593", "0.6731794", "0.67304224", "0.67228657", "0.6637068", "0.65357894", "0.6499789", "0.6485449", "0.6481078", "0.6477679", "0.6476364", "0.64259726", "0.6424538", "0.64149755", "0.64043635", "0.6403271", "0.639213", "0.6386369", "0.6380868", "0.637919...
0.688477
1
Function to compare elements of the two list
def compare_list(first, second): temp1 = first temp2 = second while temp1 and temp2: if temp1.data == temp2.data: temp1 = temp1.next temp2 = temp2.next else: return False if not temp1 and not temp2: retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare(lst1, lst2):\n bonnie = []\n for item in lst1:\n if item in lst2:\n bonnie.append(item)\n return bonnie", "def compare_elements(a, b):\n return set(a or []) == set(b or [])", "def compare_lists(self, list1, list2):\n matching_items = []\n\n list1 = list1....
[ "0.72749346", "0.7256211", "0.72092956", "0.69818544", "0.6854372", "0.68075264", "0.67862076", "0.67827487", "0.6662431", "0.6661828", "0.66295177", "0.6624765", "0.65995467", "0.6572982", "0.65563357", "0.6530561", "0.65189326", "0.651854", "0.6516313", "0.6515189", "0.6503...
0.7206569
3
Load your MRIQC group tsv file and return a pandas df to then use for visualizations or any other functions down the line.
def load_groupfile(infile_path): name, ext = os.path.splitext(os.path.basename(infile_path)) if ext == '.tsv': df = pd.read_table(infile_path, header=0) elif ext == '.csv': df = pd.read_csv(infile_path, header=0) else: raise ValueError("File type not supported: " + ext) retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_mfi(path: str) -> pd.DataFrame:\n\n mfi = pd.read_csv(path, sep=\";\")\n mfi[\"Specificity\"] = mfi[\"Specificity\"].apply(lambda x: set(x.split(\",\")))\n mfi = mfi.drop(\n [\n \"SampleID\",\n \"CatalogID\",\n \"Gate_LUM\",\n \"Analyte_LUM\",\n...
[ "0.6672005", "0.60392207", "0.59602785", "0.589301", "0.58595943", "0.58421874", "0.58252686", "0.57634187", "0.57482696", "0.57482696", "0.57482696", "0.574733", "0.5733737", "0.56916046", "0.5684597", "0.5677396", "0.5673814", "0.5671074", "0.56541735", "0.5623798", "0.5623...
0.7040393
0
Set up the root logger and return a named logger with the same settings
def get_logger(name, level='INFO', terminal_log=True, file_log=False, file_name=None, file_max_bytes=1048576, file_backup_count=3, email_on_warnings=True, email_on_errors=True): # Get the root logger and set the level log_level = getattr(logging, level.upper()) root_logger = lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(name):\r\n log = logging.getLogger(\"%s.%s\" % (ROOT_NAME, name))\r\n return log", "def setupLogger(logger=None, log_format=\"%(asctime)s %(levelname)s [\"+APP_NAME+\"] %(message)s\", level=logging.INFO, log_name=APP_NAME+\".log\", logger_name=APP_NAME):\r\n\tif logger is None:\r\n\t\tlogger = logg...
[ "0.74419606", "0.7388919", "0.7371835", "0.7368482", "0.7302085", "0.7262083", "0.7245627", "0.7243494", "0.7239119", "0.7231543", "0.7200117", "0.7191336", "0.71727073", "0.71418756", "0.71304107", "0.7115696", "0.7111005", "0.71078", "0.7105921", "0.7105388", "0.71020085", ...
0.0
-1
Load the {env}.env file and provide it it as dict
def parse_env_file_form_dict(env='base'): cur_path = os.path.abspath(os.path.dirname(__file__)) file_path = os.path.join(cur_path, r"./config/{}.env".format(env)) with open(file_path, 'r') as fh: logger.debug("Env file fetched is {}.env".format(env)) vars_dict = dict( tup...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_env():\n global api_key\n\n # Load the config file\n env_file = path.join(path.dirname(path.abspath(__file__)), 'env.yml')\n try:\n stream = open(env_file, 'r')\n y = yaml.safe_load(stream)\n except IOError:\n print(\"ERROR: Environment file {} not found\".format(env_fi...
[ "0.76122695", "0.72736365", "0.72263783", "0.71664184", "0.71232295", "0.69728565", "0.6957685", "0.6944801", "0.6874632", "0.68580925", "0.6804481", "0.6797699", "0.6790426", "0.67887735", "0.67012995", "0.6649218", "0.6641965", "0.65775687", "0.6556501", "0.6555425", "0.652...
0.7682503
0
Takes positive (target) samples, negative (generator) samples and prepares inp and target data for discriminator.
def prepare_discriminator_data(pos_samples, neg_samples, gpu=False): inp = torch.cat((pos_samples.to(dtype=torch.long), neg_samples.to(dtype=torch.long)), 0).type(torch.LongTensor) target = torch.ones(pos_samples.size()[0] + neg_samples.size()[0]) target[pos_samples.size()[0]:] = 0 # shuffle perm =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_data(data, samples, targeted=True, start=0, inception=False):\n inputs = []\n targets_1hot = []\n i = 0\n samples_sofar = 0\n while samples_sofar < samples:\n i += 1\n if torch.argmax(model(torch.tensor(data.test_data[start+i:start+i+1]+0.5, device=\"cuda\", dtype=torch.fl...
[ "0.64520276", "0.6308877", "0.6205494", "0.61443424", "0.6140582", "0.6135798", "0.61199737", "0.61057866", "0.6096947", "0.60569197", "0.6026017", "0.6014213", "0.5972494", "0.59564465", "0.5919827", "0.5883783", "0.5849268", "0.58222604", "0.58170223", "0.5800512", "0.57995...
0.70088494
0
Constructs the operation to get the training loss logits, csnn_distances for the Tensorflow graph.
def getTrainLossOp(self, train_images, train_labels): logits_train, csnn_distances = self.__cnnNetFn(train_images, is_training=True) loss_op = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2( logits=logits_train, labels=tf.cast(train_labels, dtype=tf.int32))) return loss_o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_train_op(self):\n\n logits_flatten = tf.reshape(self.logits_up, [-1, self.num_classes])\n pred_flatten = tf.reshape(self.pred, [-1, self.num_classes])\n\n labels_gt = self.labels\n\n if self.ignore_class_bg:\n # ignore background labels: 255\n gt_labels_...
[ "0.6887912", "0.6767527", "0.6698349", "0.66282266", "0.65725696", "0.6519023", "0.6509375", "0.64968497", "0.641242", "0.6408357", "0.6388249", "0.63604534", "0.6355418", "0.6317044", "0.62940353", "0.6292674", "0.6291664", "0.6272121", "0.62623423", "0.6260512", "0.62296814...
0.7062827
0
Constructs the operation to get the validation loss logits, csnn_distances for the Tensorflow graph.
def getValLossOp(self, eval_images, eval_labels): logits_eval, csnn_distances = self.__cnnNetFn(eval_images, is_training=False) loss_op = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2( logits=logits_eval, labels=tf.cast(eval_labels, dtype=tf.int32))) return loss_op, logit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_train_op(self):\n\n logits_flatten = tf.reshape(self.logits_up, [-1, self.num_classes])\n pred_flatten = tf.reshape(self.pred, [-1, self.num_classes])\n\n labels_gt = self.labels\n\n if self.ignore_class_bg:\n # ignore background labels: 255\n gt_labels_...
[ "0.66577405", "0.654751", "0.64120054", "0.6380623", "0.6230708", "0.62300354", "0.62025213", "0.61965275", "0.6169465", "0.6108028", "0.6073684", "0.60591125", "0.60484576", "0.60410196", "0.6021032", "0.6003433", "0.5989599", "0.59187764", "0.59041095", "0.587067", "0.58667...
0.61301076
9
Constructs the operation to evaluate the given logits on the given labels for the Tensorflow graph.
def getEvaluationOp(self, logits, labels): logits = tf.reshape(logits, [-1, self.__num_classes]) correct_prediction = tf.equal(tf.argmax(logits, 1), tf.argmax(labels, 1)) acc_op = tf.reduce_mean(tf.cast(correct_prediction, tf.float32)) return acc_op
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_op(self, logits, labels):\n\n with tf.name_scope(self.name_scope):\n labels = tf.cast(labels, tf.int64)\n cross_entropy = tf.nn.softmax_cross_entropy_with_logits(labels=labels, logits=logits)\n cross_entropy_mean = tf.reduce_mean(cross_entropy, name=self.name_scope)\...
[ "0.72578645", "0.677383", "0.6761128", "0.65983254", "0.65686077", "0.6508367", "0.6467305", "0.645875", "0.6411135", "0.6238663", "0.6179096", "0.61715287", "0.6167055", "0.616245", "0.61564714", "0.61561054", "0.6142413", "0.61305994", "0.6086913", "0.6068687", "0.601253", ...
0.6939274
1
Constructs the csnn optimizer operations for the Tensorflow graph.
def getCsnnOptimizerOp(self, global_step): # Define loss and optimizer csnn_optimizer, _ = self.__csnn.applySomLearning(global_step, self.__num_gpus) return csnn_optimizer
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_train_op(self):\n replay_action_one_hot = tf.one_hot(\n self._replay.actions, self.num_actions, 1., 0., name='action_one_hot')\n replay_chosen_q = tf.reduce_sum(\n self._replay_net_outputs.q_values * replay_action_one_hot,\n axis=1,\n name='replay_chosen_q')\n\n targ...
[ "0.59183174", "0.5881031", "0.5868258", "0.5846113", "0.5846113", "0.5821982", "0.5818678", "0.5805225", "0.57749754", "0.57198286", "0.56768715", "0.5652327", "0.5649427", "0.5645144", "0.56085443", "0.5604281", "0.56009", "0.5588784", "0.5584687", "0.55810755", "0.55807525"...
0.70077485
0
Save the combined df into csv file
def to_csv(data_path): news_df, price_df = load_data(data_path) combined_df = combine_stock_news(news_df, price_df) combined_df.to_csv(data_path + "news_price_df.csv")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_csv(self):\n path = partial(os.path.join, 'datasets')\n save_name = self.name.lower().replace(' ', '_')\n self.df['values'].sum(axis=1).to_csv(path('{0}_values.csv'.format(save_name)))\n self.df['allocations'].to_csv(path('{0}_allocations.csv'.format(save_name)))\n se...
[ "0.7718506", "0.7580443", "0.756145", "0.7543628", "0.7460872", "0.73379743", "0.73055285", "0.72538066", "0.72422975", "0.7224752", "0.7129633", "0.7123644", "0.71182275", "0.71071327", "0.7085494", "0.7052338", "0.7028234", "0.7022592", "0.69441295", "0.69319344", "0.692790...
0.69810593
18
Return a cleaned list of text
def cleanup_text(sent): monthStrings = list(calendar.month_name)[1:] + list(calendar.month_abbr)[1:] monthPattern = '|'.join(monthStrings) sent = re.sub(r'\s+', ' ', str(sent)).strip() sent = re.sub(r'\/+', '', sent) sent = re.sub(r'U.S.', 'United States', sent) sent = re.sub(r'CORRECTED-', '', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listify_txt(txt):\n Replacements = [ \n (\"!\", \" _explanation_mark_ \"), (\"?\", \" _question_mark_ \"), (\"“\", \"\\\"\"), (\"’\", \" ’ \"),\n (\"\\n\", \"\"), (\"\\t\", \"\"), (\"$\", \" _dollar_ \"), (\"_id\", \"_iid\"), (\"'\", \" ' \"), (\".\", \" _period_ \")\n ]\n for replacemen...
[ "0.7676261", "0.75812167", "0.75047386", "0.7429559", "0.7418554", "0.7394964", "0.7367431", "0.73315823", "0.72822934", "0.72736675", "0.72261316", "0.7214597", "0.7185486", "0.7169864", "0.71407974", "0.70867705", "0.7065648", "0.6993477", "0.6985526", "0.69674", "0.6956729...
0.0
-1
Remove stop words, lemmatize the cleaned text and tokenize
def spacy_tokenize(df, col): nlp = English() STOP_WORDS = construct_stop_words() sentences = df[col].tolist() docs = [] for sent in sentences: docs.append(cleanup_text(sent)) def token_filter(token, stop_words): return not (token.is_punct or token.is_stop or token.is_space) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(text):\n \n #regular expression to avoid pucntuations or any special character\n tokenizer = nltk.RegexpTokenizer(r\"\\w+\")\n \n #tokenizing text\n tokens = tokenizer.tokenize(text)\n \n #initiating lemmatizer\n lemmatizer = WordNetLemmatizer()\n \n #iteratating throu...
[ "0.83384", "0.83384", "0.8267428", "0.82411367", "0.8215645", "0.81557035", "0.81421757", "0.8125196", "0.8113442", "0.81109077", "0.8098556", "0.8084172", "0.8036796", "0.8019", "0.79350513", "0.7933403", "0.788842", "0.78695995", "0.7865849", "0.78331035", "0.7828462", "0...
0.0
-1
Update the spacy stopwords list
def construct_stop_words(): stop_words_list = ["uk", "ceo", "apple", "wal", "st", "q1", "q2", "q3", "q4", "bp", "wednesday", "tuesday", "monday", "thursday", "friday", "sept", "johnson", "inc", "david", "amazon.com"] for words in stop_words_list: STOP_WORDS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n if token.lower() not in self.stopword_list]\n self.doc = ' '.join(cleaned_tokens)", "def setStopWords(self, value):\n return self._set(stopWords=va...
[ "0.7030776", "0.6862245", "0.6862245", "0.6862245", "0.65755266", "0.646131", "0.6437224", "0.6407811", "0.6378788", "0.6375782", "0.636124", "0.63465846", "0.6338826", "0.63313925", "0.63228583", "0.63228583", "0.63228583", "0.63228583", "0.6304065", "0.6296856", "0.627908",...
0.62300164
22
calculate the days remaining of options
def calc_remained_days(name: str, full_date: str, current: str): expiry_date = get_expiry_date(name, full_date) intervals = datetime.strptime(expiry_date, DATE_FORMAT) - datetime.strptime(current, DATE_FORMAT) days = intervals.days + 1 if days <= 0: raise ValueError(f'remained days {expiry_date}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remaining_days(self):\n if self.trialing or self.trial_ended:\n return self.remaining_trial_days\n else:\n return self.remaining_days_in_current_period", "def remaining_days_in_current_period(self):\n try:\n return self.count_days_from_now(self.current_pe...
[ "0.7238859", "0.6890269", "0.66552985", "0.6620526", "0.6446516", "0.6280493", "0.62484264", "0.6178633", "0.6161026", "0.6113574", "0.6094649", "0.609262", "0.60382944", "0.6004305", "0.5999049", "0.5995339", "0.5974528", "0.59238577", "0.5888994", "0.58707434", "0.5845678",...
0.60866976
12
yields all key,value pairs.\n _prec is for internal use
def items(self, _prec=""): if self.isLeaf: yield (_prec + self.ch, self.value) for chld in self.children.values(): yield from chld.items(_prec + self.ch)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self) -> Generator:\n for k in self.raw.keys():\n yield k", "def __iter__(self):\n for key, value in self.read():\n yield key, value", "def __next__(self):\n for (k, v) in pairs(self._data):\n yield (v, k)", "def iteritems(self):\n\t\tself.filep.seek(s...
[ "0.68902713", "0.68727726", "0.66183037", "0.6593857", "0.6530129", "0.6482902", "0.64742374", "0.64491975", "0.64129525", "0.6385039", "0.6365974", "0.6365974", "0.6362972", "0.63514125", "0.6306162", "0.6304844", "0.6297374", "0.6275462", "0.627239", "0.6259833", "0.6254719...
0.64273936
8
Get a list of available categories.
def GetCategories(): return GetDataFromCsvFile('categories.csv')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_categories(self):\n _url = urljoin(self.base_url, self.API_CATEGORIES)\n return requests.get(_url)", "def getAllCategories(self):\n return self.categories", "def list_categories(self):\n raise NotImplementedError()", "def categories(self):\n cur = self.con.execute('...
[ "0.82397544", "0.807381", "0.7918923", "0.7855676", "0.7817363", "0.7802275", "0.777953", "0.76957124", "0.7668995", "0.766829", "0.7631534", "0.76274914", "0.7620425", "0.76144123", "0.7597723", "0.75778395", "0.7569844", "0.7567356", "0.7482422", "0.7471019", "0.7436705", ...
0.6551812
100
Return scheme portion of the URL.
def GetSchemeFromUrl(url): return __ParseUrl(url)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_scheme(url):\n return urlsplit(url, \"http\").scheme", "def _update_url_scheme(self, url):\n if self.base_scheme and not url.startswith(\"%s://\" % self.base_scheme):\n # url_split = urlparse.urlsplit(url)\n url_split = urlsplit(url)\n # url = urlparse.urlun...
[ "0.8060812", "0.7401703", "0.7264351", "0.72213924", "0.7190771", "0.7179156", "0.70948786", "0.7007386", "0.6888326", "0.68830097", "0.67684615", "0.67314094", "0.6690798", "0.66803247", "0.6644304", "0.6568912", "0.65453434", "0.65418875", "0.64323175", "0.64319795", "0.642...
0.7944406
1
Return netloc portion of the URL.
def GetNetLocFromUrl(url): return __ParseUrl(url)[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def domain(self):\n return urlparse(self._base_url).netloc", "def _resolve_url_to_ip_and_netloc(self, url):\n netloc = urlparse.urlsplit(url).netloc\n url_base = netloc.split(':')[0] if ':' in netloc else netloc\n return gethostbyname(url_base), url_base", "def get_domain(url):\n ...
[ "0.7282419", "0.72304505", "0.7169247", "0.69372994", "0.692266", "0.6890893", "0.6851572", "0.6684058", "0.6672256", "0.6634862", "0.6622515", "0.66002756", "0.6597982", "0.65397567", "0.64953226", "0.6451391", "0.6392355", "0.6363931", "0.6353941", "0.63356864", "0.6314497"...
0.77849126
0
Return reconstructed scheme and netloc portion of the URL.
def GetServerFromUrl(url): return urlunparse((GetSchemeFromUrl(url), GetNetLocFromUrl(url), '', '', '', ''))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_url(url):\n newurl = urlparse(url)\n return \"{0}://{1}\".format(newurl.scheme, newurl.netloc)", "def process_url(url):\n parsed = urlparse(url)\n if parsed.scheme:\n return parsed.netloc, parsed.path\n else:\n host_part = parsed.path\n hostname = host_part.partition...
[ "0.7171993", "0.71311706", "0.7070693", "0.68896455", "0.6804265", "0.67765", "0.677451", "0.6732212", "0.6730791", "0.6546403", "0.65274227", "0.64655286", "0.6425569", "0.6422138", "0.6408597", "0.63958263", "0.6383387", "0.6374716", "0.6373915", "0.63674384", "0.63671947",...
0.6370075
19
Return API version portion of the URL.
def GetVersionFromUrl(url): return __ParseUrl(url)[2].split('/')[3]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_api_version(self):\n from webapi import VERSION\n return '.'.join(map(str, VERSION))", "def get_api_version(self):\n major, minor, patch = self.client.config['api_version']\n return '%s.%s.%s' % (major, minor, patch)", "def api_version(self) -> Optional[str]:\n return...
[ "0.7666009", "0.76078206", "0.74938995", "0.74938995", "0.74938995", "0.74938995", "0.74938995", "0.74938995", "0.74938995", "0.74938995", "0.74938995", "0.74938995", "0.74938995", "0.74938995", "0.74938995", "0.74938995", "0.74938995", "0.74938995", "0.74938995", "0.74938995",...
0.765197
1
Return current function/method name.
def GetCurrentFuncName(): return sys._getframe(1).f_code.co_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_method_name():\n return inspect.currentframe().f_back.f_code.co_name", "def getcurrentmethod(self):\n if self._methodname == None:\n print(\"No method defined.\")\n else:\n return self._methodname", "def name(self):\n\t\treturn self._func_name", "def get_fun...
[ "0.8977989", "0.84945333", "0.8167263", "0.8001941", "0.7676916", "0.76708436", "0.76708436", "0.76632315", "0.7660885", "0.7652004", "0.7451642", "0.73987216", "0.7371387", "0.73334", "0.73334", "0.7331267", "0.73177457", "0.72483987", "0.7244786", "0.72430754", "0.72255754"...
0.8382676
2
Return newly built dictionary with out the keys that point to no values.
def CleanUpDict(dct): SanityCheck.ValidateTypes(((dct, dict),)) new_dct = {} for key in dct: if dct[key]: new_dct[key] = dct[key] return new_dct
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_empty_values(_dict):\n return {k: v for k, v in list(_dict.items()) if v is not None}", "def remove_none_values(dict_):\r\n\r\n res = {}\r\n res.update((key, value) for key, value in dict_.iteritems() \\\r\n if value is not None)\r\n return res", "def create_vals_no_total(...
[ "0.74386626", "0.7287083", "0.72253877", "0.7168036", "0.70902735", "0.7071511", "0.70585984", "0.704456", "0.696196", "0.6918474", "0.68888426", "0.6878363", "0.6794465", "0.6736633", "0.66875935", "0.6625054", "0.66186434", "0.65367424", "0.6527482", "0.65106803", "0.650438...
0.0
-1
Remove stop words in order to get only relevant words
def parser_words(self): words = self.query_no_accent.split() query_words = [] for word in words: if (word not in STOP_WORDS and word not in QUESTION_WORDS): query_words.append(word) query_words = ' '.join(query_words) return query_words
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stopword_filter(words):\n new_words = []\n for w in words:\n if w in stopwords.words(\"german\"): continue\n else: new_words += [w]\n return new_words", "def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n ...
[ "0.8103921", "0.8063142", "0.80384845", "0.79229915", "0.7908562", "0.79079854", "0.78798497", "0.78683394", "0.7863507", "0.78624344", "0.78611565", "0.7857573", "0.7849009", "0.7849009", "0.7849009", "0.7849009", "0.78194845", "0.7791206", "0.7787543", "0.77669585", "0.7742...
0.0
-1
The parameters of the model. Returns dict A dictionary containing the parameters of the model. The keys are strings representing the parameter names and the corresponding value is the associated parameter.
def get_params(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameters(self):\n return self.model.parameters()", "def attributes(self):\n params = self.model.param_array\n return {'parameters': params}", "def get_parameter_dict(self):\n prm = ModelParameters()\n prm.define(\"a\", self.a)\n return prm", "def parameters(sel...
[ "0.8165052", "0.8155979", "0.8130693", "0.8039488", "0.80285066", "0.7920229", "0.7883336", "0.7827633", "0.7806405", "0.7795987", "0.7793577", "0.774611", "0.77221334", "0.76672655", "0.7643577", "0.76416487", "0.7641423", "0.7637318", "0.763673", "0.7568352", "0.7555088", ...
0.7094229
79
A title describing the model. Returns str A string representing the title for the model.
def get_model_title(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_title(self):\n return \"{id}@{hn}\".format(id=self.model.identity, hn=self.model.hostname)", "def title(self) -> str:\r\n return self._title", "def title(self) -> str:\n return pulumi.get(self, \"title\")", "def title(self) -> str:\n return pulumi.get(self, \"title\")", ...
[ "0.79752433", "0.7720122", "0.7705524", "0.7705524", "0.7705524", "0.7703756", "0.7703756", "0.7703756", "0.7703756", "0.7703756", "0.7703756", "0.7703756", "0.7700775", "0.7700775", "0.7700775", "0.7698023", "0.76512134", "0.76512134", "0.76512134", "0.76512134", "0.76415753...
0.8705097
0
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion matrix") else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.81940335", "0.8095006", "0.80290395", "0.8019189", "0.7993875", "0.7991161", "0.79809004", "0.7975263", "0.7961412", "0.7956938", "0.7937461", "0.7934524", "0.7934342", "0.7931134", "0.7926225", "0.79244965", "0.792367", "0.79231006", "0.7922885", "0.792215", "0.7917699", ...
0.7828839
71
Calculate the energy .
def calculate_energy(wfc, H_k, H_r, dx): # Creating momentum conjugate wavefunctions wfc_k = np.fft.fft(wfc) wfc_c = np.conj(wfc) # Finding the momentum and real-space energy terms energy_k = 0.5 * wfc_c * np.fft.ifft((H_k ** 2) * wfc_k) energy_r = wfc_c * H_r * wfc # Integrating over all ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calc_energy( self, V_a, eos_d ):\n pass", "def energy(self):\n self.E = - np.sum(self.phi) + 0.5 * self.mass * np.sqrt((self.v_x ** 2 + self.v_y **2))", "def energy_func(self):\n i = self.inl[0].to_flow()\n o = self.outl[0].to_flow()\n\n T_m = (T_mix_ph(i, T0=self.inl[0]...
[ "0.81467515", "0.79908603", "0.7985894", "0.79768443", "0.781722", "0.7769743", "0.77221036", "0.7658667", "0.761706", "0.7592158", "0.7528501", "0.752324", "0.75020045", "0.74937963", "0.74876225", "0.7471714", "0.74621636", "0.74450123", "0.7424718", "0.7406239", "0.7399219...
0.6468783
99
Stores the state of all the important variables so that they can be output later
def storeState(self): self.action_history[self.trial] = self.action self.ball_history[self.trial] = self.ballcolor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_state(self):\n pass", "def updateVariables(self) -> None:\n ...", "def variables(self):\n return ()", "def variables_used (self) :\r\n\t\treturn []", "def store_normalization_vars(cls, vars):\n cls.stored_normalization = vars", "def set_vars():\n return dict()"...
[ "0.65080214", "0.644111", "0.62653786", "0.62563854", "0.6254373", "0.6208681", "0.6163054", "0.6136873", "0.61368036", "0.61218286", "0.6088892", "0.6062175", "0.6016328", "0.5991006", "0.59428346", "0.59423923", "0.5926998", "0.5926998", "0.58958405", "0.58956605", "0.58916...
0.61561656
7
Rectified Linear Unit (ReLU)
def relu(self, z): return np.maximum(0, z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grad_ReLU(self):\n y = self.x\n y[y<=0] = 0\n y[y>0] = 1\n return y\n raise NotImplementedError(\"ReLU gradient not implemented\")", "def relu(input, inplace=False):\n return FunctionLib.apply(\n 'Relu', input.device, [input],\n outputs=[input if inplace el...
[ "0.68823594", "0.6656349", "0.665104", "0.6598859", "0.65181655", "0.6446503", "0.6430316", "0.64270854", "0.6419369", "0.6362339", "0.632346", "0.62590414", "0.624027", "0.6216927", "0.62141967", "0.6192416", "0.6186813", "0.617796", "0.6108094", "0.60894126", "0.6082186", ...
0.5827536
32
Good ol' sigmoid function
def sigmoid(self, z): return 1 / (1 + np.exp(-z))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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\treturn 1 / (1 + m.exp(-x))", "def sigmoid(x):\n return 1 / (1 + math.exp(-x))", "def sigmoid(x):\n return 1 / (1 + math.exp(-x))",...
[ "0.8861487", "0.8861487", "0.88061184", "0.87991226", "0.87970185", "0.87529016", "0.87523186", "0.87523186", "0.87523186", "0.87523186", "0.87523186", "0.87523186", "0.8738948", "0.8737321", "0.8737321", "0.8724351", "0.87177825", "0.8715363", "0.87146324", "0.8714254", "0.8...
0.0
-1