query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Returns the number of seconds since the specified date time and the epoch.
def seconds_since_epoch(date_time, epoch=None): return microseconds_since_epoch(date_time) / 10.0**6
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def epoch_seconds(date):\r\n td = date - epoch\r\n return td.days * 86400 + td.seconds + (float(td.microseconds) / 1000000)", "def epoch_seconds(date):\n td = date - epoch\n return td.days * 86400 + td.seconds + (float(td.microseconds) / 1000000)", "def epoch_seconds(date):\n td = date - epoch\n...
[ "0.79905504", "0.7959791", "0.7959791", "0.74697816", "0.7390712", "0.72889346", "0.683709", "0.66271365", "0.6539021", "0.65093756", "0.65055966", "0.646052", "0.64029956", "0.6380848", "0.6337035", "0.6337035", "0.62685007", "0.6263151", "0.62394416", "0.62313217", "0.61927...
0.85569555
0
Returns the time converted to a string in the common format used throughout the agent and in UTC. This should be used to make how we report times to the user consistent. If the time_value is None, then the returned value is 'Never'. A time value of None usually indicates whatever is being timestamped has not occurred y...
def format_time(time_value): if time_value is None: return "Never" else: result = "%s UTC" % (time.asctime(time.gmtime(time_value))) # Windows uses a leading 0 on the day of month field, which makes it different behavior from Linux # which uses a space in place of the leading 0. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _time_str(self):\n try:\n if not self._time:\n raise ValueError\n format_ = '%a, %d %b %Y %H:%M:%S'\n return datetime.fromtimestamp(float(self._time)).strftime(format_)\n except ValueError:\n return plastic_date()", "def friendly_time(t...
[ "0.73506796", "0.7261154", "0.7097956", "0.6999141", "0.6994948", "0.6947722", "0.6930713", "0.688532", "0.68747634", "0.68705386", "0.68705386", "0.68705386", "0.68705386", "0.68705386", "0.68705386", "0.6780817", "0.6768058", "0.6767254", "0.67623085", "0.6718343", "0.67046...
0.73072875
1
Returns True if val is a list (or enumerable) of strings. False otherwise
def is_list_of_strings(vals): try: # check if everything is a string for val in vals: if not isinstance(val, six.string_types): return False except Exception: # vals is not enumerable return False # everything is a string return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_list(val):\n\n return isinstance(val, list)", "def _is_list(arg):\n return isinstance(arg, collections.Sequence) and not _is_string(arg)", "def is_list ( self, s ):\r\n\t\treturn isinstance ( s, type( list () ) )", "def is_list(value):\n return isinstance(value, list)", "def is_list_like...
[ "0.82103974", "0.7857942", "0.76296186", "0.75907093", "0.75727284", "0.7517688", "0.744345", "0.74352455", "0.7357243", "0.72813374", "0.7231826", "0.7205841", "0.7193552", "0.7144983", "0.71066606", "0.69213253", "0.6887997", "0.6834831", "0.6815361", "0.68069726", "0.67668...
0.82013506
1
Sets the run state to stopped. This also ensures that any threads currently sleeping in 'sleep_but_awaken_if_stopped' will be awoken.
def stop(self): callbacks_to_invoke = None self.__condition.acquire() if self.__is_running: callbacks_to_invoke = self.__on_stop_callbacks self.__on_stop_callbacks = [] self.__is_running = False self.__condition.notifyAll() self.__condition...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n self._run_flag = False\n self.wait()", "def stop(self):\n self._run_flag = False\n self.wait()", "def stop(self):\n self._run_flag = False\n self.wait()", "def stop(self):\n self._run_flag = False\n self.wait()", "def stop(self):\n ...
[ "0.72227144", "0.72227144", "0.72227144", "0.72227144", "0.72227144", "0.72227144", "0.71333134", "0.7112831", "0.7038793", "0.7000053", "0.69978726", "0.69468284", "0.69182724", "0.69182724", "0.69126165", "0.689604", "0.6869468", "0.6860904", "0.6860904", "0.6857158", "0.68...
0.61305076
97
Invoked when the thread has been asked to stop. It is called after the run state has been updated to indicate the thread should no longer be running. Derived classes may override this method to perform work when the thread is about to be stopped.
def _prepare_to_stop(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n self._Thread__stop()", "def stop(self):\n self._state.transit(sitcpy.THREAD_STOPPING)", "def stop(self):\n self._state.transit(sitcpy.THREAD_STOPPING)", "def stop(self) -> None:\n # set the stop event, then cancel the timer\n self._stop_event.set()\n\n ...
[ "0.8127558", "0.8099216", "0.8099216", "0.802027", "0.79884636", "0.79696316", "0.7928377", "0.7876752", "0.7856269", "0.7815238", "0.77680606", "0.7694817", "0.767162", "0.76605624", "0.76506084", "0.7644156", "0.7603393", "0.759474", "0.75870687", "0.7575391", "0.7555915", ...
0.0
-1
Returns true if this thread is still running.
def _is_running(self): return self._run_state.is_running()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_running(self):\n if self._thread and self._thread.is_alive:\n return True\n\n return False", "def is_alive(self) -> bool:\n if self._thread is None:\n return False\n return self._thread.is_alive()", "def running(self):\n try:\n return s...
[ "0.8376448", "0.8364221", "0.8321162", "0.8121196", "0.81022656", "0.8046446", "0.78882974", "0.7851813", "0.783901", "0.7837171", "0.78326553", "0.78319436", "0.7829257", "0.7787646", "0.7769437", "0.767879", "0.7677225", "0.7672349", "0.76554555", "0.75820357", "0.7580455",...
0.7435963
29
Calculates an estimate for the median of all the values since the last reset. The accuracy of this estimate will depend on the granularity of the original buckets.
def estimate_median(self): return self.estimate_percentile(0.5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def median(self):\n # TO DO\n pass", "def calc_median(data: list) -> float:\n if len(data) == 0:\n return 0.0\n py = copy.copy(data)\n py.sort()\n if len(py) % 2 == 1:\n return float(py[len(py) / 2])\n return (py[len(py) // 2] + py[len(py) // 2 - 1]) / 2", "def median...
[ "0.70919174", "0.68523", "0.6752347", "0.673764", "0.6698552", "0.6669107", "0.66475743", "0.6635787", "0.65959364", "0.6587221", "0.6569069", "0.6510392", "0.6443126", "0.6442634", "0.6439239", "0.6433529", "0.6433236", "0.6423841", "0.6417586", "0.64068717", "0.63886946", ...
0.7157025
0
Return the process object of the manager.
def process(self): # type: () -> Optional[multiprocessing.Process] try: return self._process # type: ignore # pylint: disable=no-member except: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getProcessManager(self): \n \n return self.procmgr", "def get_my_process():\n return get_process_object(os.getpid())", "def get_process(self, pid):\n return self.processes.get(pid, None)", "def get_manager():\n\n return multiprocessing.Manager()", "def process(self) -> Un...
[ "0.8057181", "0.7549178", "0.74803835", "0.73483336", "0.7164539", "0.71124125", "0.6688558", "0.6636701", "0.6536632", "0.65358174", "0.65162414", "0.65155315", "0.65155315", "0.6464416", "0.6427347", "0.63867813", "0.6335485", "0.62992775", "0.62147784", "0.62028503", "0.61...
0.7249502
4
For Panorama, set the device group for a device
def set_device_group(self, devicegroup, devices, exclusive=False): # TODO: Implement 'exclusive' self._logger.debug("Set device-group to '%s'" % devicegroup) if issubclass(devices.__class__, base.PanDevice): devices = [devices] device_refresh_needed = False for device...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setGroup(self, group):\n\t\tself.config.GROUP = group", "def test_create_device_group(self):\n pass", "def create_device_group(self, devicegroup, devices=None):\n self._logger.debug(\"Create device-group: %s\" % (devicegroup,))\n if devices is not None:\n self.set_device_gro...
[ "0.6819736", "0.6648235", "0.6601121", "0.64736104", "0.6432157", "0.63735425", "0.6299927", "0.62080634", "0.620689", "0.61986876", "0.6157184", "0.6157184", "0.6157184", "0.6124651", "0.61217713", "0.6063388", "0.60384625", "0.6013527", "0.6002653", "0.59893006", "0.5975592...
0.7065936
0
takes an array of tuples of the form [(1,2), (2,1)] and creates a string "1221" [(1,'1')] > "11" [(2,'1')] > "21" [(1, '2'), (1, '1')] > "1211"
def count_array_to_string(count_array): retval = '' for pair in count_array: retval += '{}{}'.format(pair[0], pair[1]) return retval
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _tupstr(tuple_):\n return ', '.join(list(map(str, tuple_)))", "def transfer_2d_array_to_str(array):\n str_list = []\n for r in array:\n str_list.append(\",\".join([str(e) for e in r]))\n return \" \".join(str_list)", "def _tuple_to_str(self, the_tuple):\r\n ret = \"\"\r\n for item in...
[ "0.7371714", "0.7369142", "0.7096699", "0.683996", "0.6807138", "0.6770024", "0.6745209", "0.671889", "0.6690493", "0.664251", "0.66416913", "0.65668154", "0.6417413", "0.64115834", "0.63200945", "0.6317648", "0.6279729", "0.6231889", "0.6191664", "0.61297274", "0.6004082", ...
0.7075939
3
Calcute Q matrix which depends on delta_theta_k. Param is delta_theta_k because variances are constant.
def calculate_Q(self, delta_theta_k): Q = np.zeros(shape=(2, 2)) Q.setflags(write=1) Q[0, 0] = delta_theta_k**2 * self.var_delta_theta**2 Q[1, 1] = self.var_D**2 return(Q)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Q(self, k, x):\n g = np.asarray(self.g(k, x))\n Q = g @ g.T\n return Q", "def initialize_theta_parameters(K):\n mu = np.zeros(K)\n sigma = np.zeros(K) + 10\n for k in range(K):\n mu[k] = np.random.randint(10,240)\n return mu, sigma", "def init_tau(k, p, q): # wherea...
[ "0.6474097", "0.62096256", "0.61218417", "0.6061278", "0.5860491", "0.5819143", "0.57812893", "0.57636017", "0.5729947", "0.5722007", "0.5717501", "0.5706793", "0.5671405", "0.5656988", "0.5636768", "0.5604311", "0.55788094", "0.5559651", "0.5550361", "0.55001515", "0.5481632...
0.8427375
0
Get the AutoML Tabular v1 default training pipeline.
def _get_default_pipeline_params( project: str, location: str, root_dir: str, target_column: str, prediction_type: str, optimization_objective: str, transformations: str, train_budget_milli_node_hours: float, stage_1_num_parallel_trials: Optional[int] = None, stage_2_num_parallel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pipeline(self):\n if hasattr(self, \"pipeline\"):\n return self.pipeline\n steps = [\n # before preprocessor, comes the feature extractor\n ('extractor', TurkishFeatureExtractor()),\n # first the pre-processor\n (\"preprocessor\", Turkish...
[ "0.6049091", "0.5889316", "0.58341855", "0.55706054", "0.5561689", "0.54455847", "0.54233634", "0.5415953", "0.53870225", "0.5371389", "0.5337543", "0.5331838", "0.5328411", "0.53209394", "0.52656424", "0.5210732", "0.5206889", "0.5172878", "0.5144029", "0.51272", "0.51243216...
0.0
-1
Get the AutoML Tabular v1 default training pipeline.
def get_automl_tabular_pipeline_and_parameters( project: str, location: str, root_dir: str, target_column: str, prediction_type: str, optimization_objective: str, transformations: str, train_budget_milli_node_hours: float, stage_1_num_parallel_trials: Optional[int] = None, stage_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pipeline(self):\n if hasattr(self, \"pipeline\"):\n return self.pipeline\n steps = [\n # before preprocessor, comes the feature extractor\n ('extractor', TurkishFeatureExtractor()),\n # first the pre-processor\n (\"preprocessor\", Turkish...
[ "0.604643", "0.58905214", "0.5834656", "0.556958", "0.5561301", "0.54469717", "0.5424372", "0.54137915", "0.5386114", "0.5371919", "0.5335051", "0.53315324", "0.53266007", "0.53199464", "0.5263988", "0.5212694", "0.52073026", "0.51731324", "0.5146535", "0.51297414", "0.512310...
0.48706952
57
Get the AutoML Tabular default training pipeline.
def get_default_pipeline_and_parameters( project: str, location: str, root_dir: str, target_column_name: str, prediction_type: str, optimization_objective: str, transformations: Dict[str, Any], split_spec: Dict[str, Any], data_source: Dict[str, Any], train_budget_milli_node_hours...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pipeline(self):\n if hasattr(self, \"pipeline\"):\n return self.pipeline\n steps = [\n # before preprocessor, comes the feature extractor\n ('extractor', TurkishFeatureExtractor()),\n # first the pre-processor\n (\"preprocessor\", Turkish...
[ "0.6204101", "0.6087396", "0.58353305", "0.55468464", "0.5515661", "0.5461058", "0.54043025", "0.54004246", "0.53821343", "0.5368783", "0.5368713", "0.53479767", "0.5347572", "0.53335017", "0.5303856", "0.52945197", "0.52928764", "0.5281382", "0.52508307", "0.524458", "0.5217...
0.5048569
34
Test loading JSON from a file
def test_load_json(): schema = pa.schema([ pa.field("foo", pa.int32()), pa.field("bar", pa.int64()) ]) path = "{}/tests/fixtures/simple_json.txt".format(os.getcwd()) converted_data = client.load_json(path, schema) assert converted_data.to_pydict() == {'foo': [1, 10], 'bar': [2, 20]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_loader_loads_from_file():\n base_json = 'tests/test_json.json'\n json_test = {\"foo\": \"bar\"}\n assert whenzat.loader(base_json) == json_test", "def test_loads_a_non_object_json_file(self):\n from test.resources import simple_json\n self.assertEqual(simple_json._data, 'test')", ...
[ "0.86879337", "0.84496784", "0.81121325", "0.81051344", "0.79654866", "0.78033584", "0.77817893", "0.77686185", "0.76298505", "0.7617606", "0.75773966", "0.7503725", "0.7476689", "0.7467876", "0.74446785", "0.7425429", "0.7408026", "0.7381063", "0.73782104", "0.73772216", "0....
0.74011886
17
Test converting a JSON file to Parquet
def test_convert_json(): schema = pa.schema([ pa.field("foo", pa.int32()), pa.field("bar", pa.int64()) ]) input_path = "{}/tests/fixtures/simple_json.txt".format(os.getcwd()) expected_file = "{}/tests/fixtures/simple.parquet".format(os.getcwd()) with tempfile.NamedTemporaryFile() as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_convert_xlsx_to_parquet(self):\n # use temp dir where files will be created for testing purposes\n # the underlying context manager will remove the temp dir and all its content when it closes\n with TemporaryDirectory() as tmp:\n # define path to files\n fp_xlsx ...
[ "0.64748096", "0.63159096", "0.6003324", "0.59860045", "0.5878807", "0.5761645", "0.5743737", "0.57324475", "0.5630995", "0.56160295", "0.56043875", "0.5585743", "0.55694664", "0.5568402", "0.55084854", "0.5506862", "0.5498844", "0.5472452", "0.5468466", "0.54525715", "0.5450...
0.8036174
0
Get extreme points of the bound box
def points(self): return self._points
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xmin(self):\n return asarray([b[0] for b in self.bounds])", "def bounds(self):\n return self.xmin, self.xmax, self.ymin, self.ymax", "def boundingBox(self):\n y_max = np.max(self.points[:,0])\n x_max = np.max(self.points[:,1])\n y_min = np.min(self.points[:,0])\n x...
[ "0.6732695", "0.668376", "0.66619664", "0.66580755", "0.6619263", "0.65811795", "0.65434974", "0.6541368", "0.65210086", "0.6501977", "0.6485779", "0.64453363", "0.6443519", "0.6419357", "0.6411286", "0.64107174", "0.63754445", "0.63723296", "0.6369544", "0.63514954", "0.6299...
0.0
-1
Get bound box's width. That is, distance in Xaxis of the extreme points
def width(self): return self.get_delta_value(self.X_INDEX)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def width(self):\n return self.x.max() - self.x.min()", "def width(self):\n return self.maxx - self.minx", "def width_of_box(box: ndarray) -> float:\n\n (w, _) = dimensions_of_box(box)\n return w", "def getWidth(self):\n return _libsbml.BoundingBox_getWidth(self)", "def xsize(sel...
[ "0.8004437", "0.7864515", "0.7670311", "0.7522582", "0.74599737", "0.7448322", "0.7429577", "0.73367816", "0.7299074", "0.7299074", "0.71894395", "0.710924", "0.7059142", "0.7004135", "0.69718", "0.6913485", "0.68849415", "0.6868249", "0.6829013", "0.6823261", "0.67672306", ...
0.72261685
10
Get bound box's length. That is, distance in Zaxis of the extreme points
def length(self): return self.get_delta_value(self.Z_INDEX)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def length(self):\n return pyvista.Box(self.bounds).length", "def box_size(self) -> np.ndarray:\n return self.upper - self.lower + 1", "def box_size(self) -> np.ndarray:\n return self.upper - self.lower + 1", "def length(self):\n return math.sqrt(self.x**2 + self.y**2 + self.z**2)...
[ "0.7766419", "0.7275063", "0.7275063", "0.72082436", "0.7154248", "0.71439695", "0.7064661", "0.69692796", "0.6922036", "0.68999904", "0.68193364", "0.6720814", "0.6647718", "0.658567", "0.65817654", "0.65233445", "0.6491014", "0.6480405", "0.64773154", "0.6467268", "0.646166...
0.6900251
9
Get distance in Xaxis of the extreme points
def x_distance(self): return self.get_distance(self.X_INDEX)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMinX(self):\n return self.minx", "def min_x_arg(self):\n return self.T.min_y_arg", "def left(self) -> float:\n points = self.get_adjusted_points()\n x_points = [point[0] for point in points]\n return min(x_points)", "def width(self):\n return self.x.max() - se...
[ "0.6774578", "0.67199284", "0.65585256", "0.653598", "0.64674413", "0.6451616", "0.6414549", "0.6399805", "0.6389649", "0.6381544", "0.63492584", "0.629017", "0.6266538", "0.6261303", "0.6258523", "0.625362", "0.62533", "0.6245798", "0.6228424", "0.6212645", "0.62065345", "...
0.73487055
0
Get distance in Yaxis of the extreme points
def y_distance(self): return self.get_distance(self.Y_INDEX)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_distance(self):\n return self.y", "def argminY( self ):\n min = 1e30\n for i in range( 0, self.GetN() ):\n p = ( ROOT.Double(), ROOT.Double() )\n self.GetPoint( i, p[0], p[1] )\n if p[1] < min: min = p[1]\n return min", "def min_y_arg(self):\n return...
[ "0.68499255", "0.6775996", "0.66804487", "0.66030234", "0.6551834", "0.6498724", "0.6488226", "0.6456238", "0.6409803", "0.6386271", "0.63705224", "0.6363148", "0.6334271", "0.6334271", "0.6334271", "0.6334271", "0.6334271", "0.6334271", "0.6334271", "0.63315594", "0.63215786...
0.7231944
0
Get maximum value in the Xaxis which is inside the bound box
def x_max(self): return self.get_max_value(self.X_INDEX)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maxX(self):\n return max(self.getx())", "def maxx(self):\n return self.__maxx", "def getMaxX(self):\n return self.maxx", "def x_max(self) -> ir.FloatingValue:\n return ops.GeoXMax(self).to_expr()", "def get_max_x(self) -> float:\n return self.pendulum2.get_max_x()", ...
[ "0.74742377", "0.7209412", "0.71896464", "0.701031", "0.69345057", "0.684597", "0.6829194", "0.68147933", "0.68057424", "0.6777867", "0.67655337", "0.6720525", "0.6665314", "0.66474515", "0.6624075", "0.65529066", "0.6551931", "0.65511984", "0.65265614", "0.6525518", "0.65104...
0.7448766
1
Get maximum value in the Yaxis which is inside the bound box
def y_max(self): return self.get_max_value(self.Y_INDEX)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_y_max(self):\n if len(self._statDict) == 0:\n return -1E10\n\n line_id_list = self._statDict.keys()\n max_y = self._statDict[line_id_list[0]][3]\n for i_plot in range(1, len(line_id_list)):\n if self._statDict[line_id_list[i_plot]][3] > max_y:\n ...
[ "0.7541381", "0.74904484", "0.74281317", "0.73432803", "0.72998357", "0.7294661", "0.70857316", "0.7006347", "0.69994617", "0.6956303", "0.69313383", "0.69075584", "0.68747133", "0.6835905", "0.6744096", "0.672221", "0.66955966", "0.6672782", "0.66606635", "0.660949", "0.6591...
0.7641309
0
Get minimum value in the Zaxis which is inside the bound box
def z_min(self): return self.get_min_value(self.Z_INDEX)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getZMin(self):\n return self.zmin", "def OpenZmin(self, *args):\n return _Bnd.Bnd_Box_OpenZmin(self, *args)", "def get_min_3d_bb(obj, step_ang):\n planes = [\"xy\", \"xz\", \"yz\"]\n for plane in planes:\n reorient_obj(obj, step_ang, plane)\n # from this point the object is al...
[ "0.71592534", "0.67602134", "0.6752162", "0.66501963", "0.6497532", "0.64557976", "0.6424906", "0.6408144", "0.64010316", "0.639504", "0.63894147", "0.6381308", "0.6376642", "0.6351686", "0.634612", "0.63362414", "0.63211524", "0.6318193", "0.63091284", "0.62932694", "0.62932...
0.7540704
0
Linear transform layer with inputs or weights normalization. No bias term and no activation function.
def normalized_linear_layer(inputs, num_outputs, weights_initializer, weights_regularizer, scale_inputs=None, normalize_weights=True, reuse=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_linear_transform(self):\n \n with tf.variable_scope(\"linear_transform\"):\n \n # feature scales/weights\n self.w = tf.get_variable(\"weights\", shape=[self.dim_input], \n initializer= tf.contrib.layers.xavier_initializer())\n ...
[ "0.71732223", "0.6706053", "0.65677994", "0.6514602", "0.62537766", "0.62260795", "0.61949426", "0.6154482", "0.6154482", "0.6106016", "0.60810983", "0.6076307", "0.6051369", "0.60420084", "0.6038474", "0.60333353", "0.60108155", "0.59951806", "0.59934235", "0.59934235", "0.5...
0.69058263
1
Method to add a new read to the sampler. If sampler is in sampling mode, then converts self.reads to a list and sets the sampler flag back to False.
def add_read(self, new_read): if self.sampling: self.convert_to_list() self.reads.append(new_read) self.total+=1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_reads(self, new_reads): \n if self.sampling:\n self.convert_to_list()\n self.reads.extend(new_reads)", "def add_read(self, read):\n r = Read(read)\n if read not in self.reads:\n self.reads[read] = r\n else:\n self.reads[read].visit_limit...
[ "0.7937817", "0.7067379", "0.6677851", "0.6520843", "0.6228419", "0.5909837", "0.5897686", "0.5734235", "0.57280785", "0.57016504", "0.56358886", "0.5574339", "0.5542197", "0.5537196", "0.5472256", "0.5428592", "0.53970003", "0.5393971", "0.53765446", "0.536611", "0.5310486",...
0.83547616
0
Formats duration (in seconds) as human readable value e.g. 1h 30min
def format_duration(total_seconds): if not total_seconds: return "" total_hours = math.floor(total_seconds / 3600) total_minutes = round((total_seconds % 3600) / 60) if not total_minutes and not total_hours: return "<1min" rv = [] if total_hours: rv.append(f"{total_hou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_seconds(duration):\n\treturn stats_utils.format_seconds(duration)", "def format_duration(seconds: float) -> str:\n if seconds < 60:\n return f'{seconds:.0f}s'\n elif seconds < 3600:\n minutes = math.floor(seconds / 60)\n seconds -= minutes * 60\n return f'{minutes}m{seconds:.0f}s'\n els...
[ "0.8344664", "0.8102342", "0.79915935", "0.7708223", "0.76700497", "0.76409245", "0.7537313", "0.7534906", "0.7521195", "0.74680334", "0.7440218", "0.7414463", "0.73737323", "0.72883284", "0.72676134", "0.72450006", "0.71776354", "0.71700746", "0.71638143", "0.71562797", "0.7...
0.76913726
4
Default plot configuration for scatter plots.
def _get_plot_config_scatter_plots(self, rcfile=None, rotation=0, rcparams=dict()): try: if not rcfile == None: plt.style.use(rcfile) else: path = '/'.join(moana.__file__.split('/')[:-1]) plt.style.use(f'{path}/stylelib/corner_plots_times.m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_scatter_points(self):\n self.plot(1)", "def scatter_plot(self):\n\n X = self.reduce_dimension(n_components=2)\n\n plt.figure()\n plt.scatter(X[:,0], X[:,1])\n\n return plt", "def PlotSettings():\n\n # Color palette\n import seaborn as sns\n # sns.set()\n\n ...
[ "0.7086913", "0.6570228", "0.6459563", "0.64513946", "0.64513946", "0.64435023", "0.64260197", "0.64238083", "0.64158964", "0.63677245", "0.63304406", "0.6320877", "0.63124216", "0.63094187", "0.6297425", "0.62436503", "0.62094563", "0.6207687", "0.6182318", "0.6163529", "0.6...
0.66012764
1
Transforms a time delta type to a float, for readability on the display Note that only minutes are considered, because I assume that response times won't exceed an hour
def timedeltaToFloat(self,time_d): time_d_min = time_d / timedelta(minutes=1) time_d_s = time_d / timedelta(seconds=1) time_d_ms = time_d / timedelta(milliseconds=1) return (time_d_min * 60 + time_d_s + time_d_ms * 0.001)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __time_to_float(time_value):\n return time_value.hour/24 + time_value.minute/(24*60) + time_value.second/(24*60*60) + round(time_value.microsecond, 3)/(24*60*60*1e6)", "def parse_time(value: str) -> float:\n return float(value[:-1]) * TIME[value[-1]]", "def _normalizeTime(self, t : float) -> floa...
[ "0.76231855", "0.668309", "0.64283836", "0.6269647", "0.62330186", "0.62080836", "0.6121103", "0.6028541", "0.60277337", "0.6004556", "0.59803414", "0.595862", "0.5822345", "0.5818246", "0.5804378", "0.57998633", "0.57959163", "0.5786809", "0.5779277", "0.577107", "0.57612437...
0.6920918
1
Compute intermediate features at the end of the every linear block, for a given input image. Get feature before every ReLU layer at the convolutional (feature extraction) layers
def _getFeatures(self, image): self.model.eval() lin_block = 0 blockwise_features = [image] feature = image for m in self.model.modules(): # Assume modules are arranged in "chronological" fashion if isinstance(m, nn.ReLU): # Get pre-ReLU...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_features(self, inputs):\n\n # Stem\n x = relu_fn(self._bn0(self._conv_stem(inputs)))\n\n # Blocks\n for idx, block in enumerate(self._blocks):\n drop_connect_rate = self._global_params.drop_connect_rate\n if drop_connect_rate:\n drop_conn...
[ "0.62779695", "0.62601125", "0.61591315", "0.615501", "0.6137922", "0.6128604", "0.6122214", "0.6110424", "0.6069798", "0.59715444", "0.59542006", "0.5913249", "0.58990014", "0.5894336", "0.5878412", "0.58759695", "0.5860734", "0.58549595", "0.58512866", "0.5845676", "0.58362...
0.65452904
0
Update the alpha (opacity) of a particle.
def set_opacity(): function = LegacyFunctionSpecification() function.addParameter('index_of_the_particle', dtype='int32', direction=function.IN) function.addParameter("alpha", dtype='float64', direction=function.IN, description = "The new opacity of the particle") function.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setAlpha ( self, newalpha ):\n if isinstance( newalpha, int ):\n raise ValueError('Expects a float value in the [ 0.0 - 1.0 ] range!')\n if newalpha > 1.0:\n newalpha = 1.0\n if newalpha < 0.0:\n newalpha = 0.0\n self.a = newalpha\n self.hsla...
[ "0.6732262", "0.66056144", "0.6556245", "0.6473101", "0.6462577", "0.6362623", "0.6352399", "0.6329618", "0.6268703", "0.62566036", "0.6253275", "0.6174478", "0.61498547", "0.60841316", "0.6067323", "0.60636026", "0.60617745", "0.6008345", "0.6001389", "0.5975062", "0.5969629...
0.75366676
0
>>> s = get_random_string(11) >>> len(s) == 11 True >>> get_random_string(4, 'q') 'qqqq'
def get_random_string( length=12, alphabet=string.digits + string.ascii_letters ): return ''.join(random.choice(alphabet) for _ in range(length))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_string(strlen=10):\n return \"\".join([random.choice(string.ascii_letters) for _ in range(strlen)])", "def rand_string(nSize=20):\n cString = ''\n while len(cString) < nSize:\n cString = cString + str(random.randint(1,9))\n return cString", "def randomstring(stringLength=10):\n letters =...
[ "0.7645533", "0.7624857", "0.7598097", "0.75964457", "0.7594843", "0.7579982", "0.75724673", "0.75674134", "0.75136", "0.75136", "0.75136", "0.75136", "0.75136", "0.75136", "0.75136", "0.75136", "0.75136", "0.75136", "0.75136", "0.75136", "0.75136", "0.7512192", "0.749540...
0.0
-1
Outputs root path of the module. Acounts for changes in path when app is frozen. Returns str string with root module path See also
def module_path() -> Path: if hasattr(sys, "frozen"): return Path(sys.executable).resolve().parent else: return (Path(__file__) / "..").resolve().parent
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRootPath():\n return '/'.join(__file__.split('/')[:-4]) # Path of this file with pagebot/__init__.py(c) removed.", "def getRootPath()->str:\n if '--develop' in sys.argv:\n return eel._get_real_path('public') + '/'\n\n return eel._get_real_path('build') + '/'", "def module_path():\n tr...
[ "0.74557966", "0.7286394", "0.7218153", "0.7120571", "0.7113359", "0.7109116", "0.6938434", "0.6937811", "0.69167507", "0.6906767", "0.6859036", "0.67624795", "0.67624795", "0.67520964", "0.67345464", "0.6708727", "0.6672236", "0.666232", "0.6654515", "0.6642217", "0.66197646...
0.688365
10
Tests retrieval of 'serial_number' property.
def test_serial_number(self): serial_number = self.device.serial_number self.assertTrue(serial_number) self.assertIsInstance(serial_number, str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_serial_value(self):\n \n serial = get_serial()\n \n # Check to make sure it is not null\n # Exact matching is not done on purpose - serials should be kept private!\n self.assertIsNotNone(serial)", "def test_serial_type(self):\n \n serial = get_seri...
[ "0.79679155", "0.69792295", "0.69109297", "0.6877585", "0.6629523", "0.6608312", "0.65227044", "0.65179205", "0.65101063", "0.6476087", "0.6454777", "0.64506555", "0.6449033", "0.64433", "0.64431906", "0.6438108", "0.64353764", "0.6396314", "0.6362745", "0.62802845", "0.62571...
0.7525656
1
Calculates the cumulative centimorgans for the given genome locations based on the given recombination data.
def cumulative_cm(locations, recombination_data): np_locations = np.array(locations, dtype = np.uint32, copy = False) base_ends = recombination_data.bases assert np.all(np_locations <= base_ends[-1]) end_index = np.searchsorted(base_ends, np_locations, side = "left") cm_ends = recombination_dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_cumulants(self, force=False):\n self._cumulant_computer.compute_cumulants(verbose=self.verbose,\n force=force)", "def mp_calc_cov_accum_stats(self, args):\n # initalises data array classes\n nlat = len(args[\"grid_lat\"])\n ...
[ "0.56814325", "0.54490376", "0.53863883", "0.5335535", "0.52945", "0.5241094", "0.5235662", "0.52240306", "0.5222806", "0.51976585", "0.51930463", "0.5161214", "0.5160792", "0.5155688", "0.51530266", "0.5125482", "0.5122534", "0.5116457", "0.5102366", "0.5097955", "0.50858957...
0.7512987
0
Calculates the sigmoid of the input value Calculates the sigmoid of Z
def sigmoid(z): S = (1 / (1 + np.exp(-z))) return S
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid(z):\r\n \r\n return vSigmoid(z);", "def sigmoid(z):\n # print \"sigmoid input:\", z\n return 1.0 / (1.0 + math.exp(- z))\n # return math.tanh(z)", "def sigmoid(z):\n return 1 / (1 + e ** -z)", "def sigmoid_function(z):\n\n return 1 / (1 + math.exp(-z))", "def sigmoid(z): \...
[ "0.8955454", "0.8890781", "0.8828379", "0.87985164", "0.87687737", "0.8729436", "0.8696154", "0.869019", "0.8679281", "0.8652778", "0.8651561", "0.864925", "0.86400265", "0.86176926", "0.86074966", "0.85967016", "0.8587262", "0.85720056", "0.85573554", "0.8537837", "0.8531523...
0.8599718
15
Initializes the wieghts and biases Itinitalizes the wieght and bias to zero
def initialize_with_zeros(dim): w = np.zeros((dim, 1)) b = 0 return w, b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weights(self) -> None:\n self.fc.bias.data.fill_(0)\n self.fc.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.weight.data.uniform_(-0.1, 0.1)", "def init_paramete...
[ "0.82007", "0.7968959", "0.7954887", "0.7940678", "0.7940678", "0.7940678", "0.7933203", "0.7933203", "0.7931243", "0.78369486", "0.78322995", "0.77844167", "0.77750945", "0.7678348", "0.7646407", "0.7646407", "0.7646407", "0.76440847", "0.7642164", "0.7642164", "0.7620399", ...
0.0
-1
Asks users to specify city, month and day to analyze
def get_filters(): print('Hello! Let\'s explore the US bikeshare data!') city = input('What city data you would like to explore? Chicago, New York or Washington! ').title() while city not in (CITY_DATA.keys()): print("Invalid city data Entry") city = input('What city data you would li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(city, month, day):\n #load the data of the specified city in a dataframe:\n df = pd.read_csv(CITY_DATA[city])\n\n #convert the type of data in 'Start Time' column to datetime:\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n\n #create new columns required to calculate time_stats...
[ "0.6675187", "0.66258955", "0.66011196", "0.6526871", "0.6519688", "0.64164835", "0.6379545", "0.6368198", "0.63452756", "0.63326335", "0.6313391", "0.6294445", "0.62924045", "0.62578005", "0.6253967", "0.62339133", "0.6233816", "0.62231874", "0.62229705", "0.6216558", "0.620...
0.60959655
46
Hash a password for storing.
def hash_password(password): salt = hashlib.sha256(os.urandom(60)).hexdigest().encode('ascii') pwdhash = hashlib.pbkdf2_hmac('sha512', password.encode('utf-8'), salt, 100000) pwdhash = binascii.hexlify(pwdhash) return (salt + pwdhash).decode('ascii')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_password(self):\n self.__password = self.str_to_hash(self.__password)", "def hash_password(self, password):\n self.password = pwd_context.encrypt(password)", "def hash_password(self, password):\n self.password_hash = generate_password_hash(password)", "def hash_passwd(password, ...
[ "0.847967", "0.8346137", "0.82644516", "0.80417943", "0.7999399", "0.7979167", "0.7971465", "0.7947968", "0.7919728", "0.78821445", "0.78162515", "0.77545875", "0.77411246", "0.766462", "0.76507545", "0.76267356", "0.75862885", "0.75638247", "0.755944", "0.7549114", "0.754458...
0.7519686
21
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes.
def add_header(r): r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate" r.headers["Pragma"] = "no-cache" r.headers["Expires"] = "0" r.headers['Cache-Control'] = 'public, max-age=0' return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response", "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, m...
[ "0.8221727", "0.8220911", "0.8220911", "0.8220911", "0.8220911", "0.81940746", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", ...
0.71513546
40
Finds a subnode in the item node and the retrieves a value from it An attribute value
def get_attrib_from_subnode(xml_node, subnode_xpath_expr, attrib_name): global ETREE_VERSION node = None if ETREE_VERSION[0] <= 1 and ETREE_VERSION[1] < 3: match_obj = re.search( r"([^\@]+?)\[\@([^=]*?)=\'([^\']*?)\'", subnode_xpath_expr ) if match_obj is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search_subnode_value(self):\n\n lista = []\n for (node, value) in self.parser.search(self.xml, 'node@id=3'):\n self.assertEqual(node.attribute('id'), '3')\n lista.append(value)\n self.assertEqual(lista, ['Node 3'])\n self.assertEqual(self.parser.searchFirs...
[ "0.67884034", "0.6664346", "0.6518009", "0.6428013", "0.638288", "0.6242172", "0.6214696", "0.6187792", "0.61799276", "0.61799276", "0.6129445", "0.60453105", "0.60377824", "0.60239166", "0.59977484", "0.5989937", "0.5944985", "0.59262747", "0.58838993", "0.58518505", "0.5841...
0.61072165
11
Returns average TD error (in negative scale). This metics suggests how Q functions overfit to training sets. If the TD error is large, the Q functions are overfitting.
def td_error_scorer(algo, episodes, window_size=1024): total_errors = [] for episode in episodes: for batch in _make_batches(episode, window_size, algo.n_frames): # estimate values for current observations values = algo.predict_value(batch.observations, batch.actions) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error(self, trainset: ([], [])):\n # MSE = Σ | d – y |^2 / n\n error_sum = 0.0\n for index, example in enumerate(trainset):\n # | d – y |^2\n output = self.activate(example[0])\n\n target = example[1][0]\n\n error = target - output\n e...
[ "0.69848794", "0.6936333", "0.6682219", "0.6475348", "0.6361711", "0.6357897", "0.62698233", "0.6247199", "0.6237416", "0.6222707", "0.61759144", "0.61693835", "0.6158774", "0.61391896", "0.6084701", "0.6080817", "0.60798496", "0.6059532", "0.605753", "0.60522324", "0.6022591...
0.62106884
10
Returns average value estimation (in negative scale). This metrics suggests the scale for estimation of Q functions. If average value estimation is too large, the Q functions overestimate actionvalues, which possibly makes training failed.
def average_value_estimation_scorer(algo, episodes, window_size=1024): total_values = [] for episode in episodes: for batch in _make_batches(episode, window_size, algo.n_frames): actions = algo.predict(batch.observations) values = algo.predict_value(batch.observations, actions) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def em_mean(self) -> float:\n if self.__total_pulls == 0:\n raise Exception('Number of pulls is 0. No empirical mean.')\n return self.__total_rewards / self.__total_pulls", "def _ave(self):\n return np.asarray(np.mean(self.model_estim.x, axis=0)).flatten()", "def _ave(self):\n\n return...
[ "0.6381866", "0.6329545", "0.63229567", "0.62736017", "0.60035795", "0.59976417", "0.59931386", "0.5980788", "0.59308845", "0.5924415", "0.58965933", "0.58808154", "0.58773243", "0.58747685", "0.58726436", "0.5866779", "0.5852114", "0.5841467", "0.5840968", "0.581699", "0.581...
0.64437544
0
Returns mean estimated actionvalues at the initial states. This metrics suggests how much return the trained policy would get from the initial states by deploying the policy to the states. If the estimated value is large, the trained policy is expected to get higher returns.
def initial_state_value_estimation_scorer(algo, episodes, window_size=1024): total_values = [] for episode in episodes: for batch in _make_batches(episode, window_size, algo.n_frames): # estimate action-value in initial states actions = algo.predict([batch.observations[0]]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avg_act(self) -> float:\n return torch.mean(self.units.act)", "def viterbiMeansEstimate(self):\n for i in range(self.noOfEmmittingStates):\n self.outputProbabilities[i,0] = \\\n self.observationSequence[0, nonzero(self.mostLikelyPath ==\n ...
[ "0.64955926", "0.63865435", "0.6367172", "0.62509525", "0.6214142", "0.6130478", "0.6129793", "0.61216795", "0.6096814", "0.60361725", "0.6030837", "0.6028586", "0.60238165", "0.6020851", "0.59896433", "0.59670013", "0.5954571", "0.59288144", "0.59166723", "0.5905351", "0.588...
0.6600532
0
Returns scorer function of evaluation on environment. This function returns scorer function, which is suitable to the standard scikitlearn scorer function style. The metrics of the scorer function is ideal metrics to evaluate the resulted policies.
def evaluate_on_environment(env, n_trials=10, epsilon=0.0, render=False): # for image observation observation_shape = env.observation_space.shape is_image = len(observation_shape) == 3 def scorer(algo, *args): if is_image: stacked_observation = StackedObservation(observation_shape,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _resolve_objective_function(self) -> Scorer:\n\n objective = self.cfg_.objective\n if objective == 'accuracy':\n return make_scorer(ex.accuracy_score_round_inputs)\n if objective.startswith('precision'):\n if objective.endswith('macro'):\n return make_s...
[ "0.6892896", "0.61446154", "0.6023374", "0.6012144", "0.59919465", "0.5975325", "0.59716463", "0.5925197", "0.59205544", "0.59205544", "0.59205544", "0.59205544", "0.59205544", "0.59205544", "0.59205544", "0.59205544", "0.59205544", "0.59205544", "0.59205544", "0.59205544", "...
0.0
-1
Returns MSE of observation prediction (in negative scale). This metrics suggests how dynamics model is generalized to test sets. If the MSE is large, the dynamics model are overfitting.
def dynamics_observation_prediction_error_scorer(dynamics, episodes, window_size=1024): total_errors = [] for episode in episodes: for batch in _make_batches(episode, window_size, dynamics.n_frames): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mse(observed, predicted):\n return np.sqrt(np.mean((observed - predicted)**2))", "def mse(self, y):\n return T.mean((self.y_pred - y) ** 2)", "def rmse(self):\n y_pred, y_true = self._finalize_labels_and_prediction()\n\n return np.sqrt(F.mse_loss(y_pred, y_true).cpu().item())", "d...
[ "0.7574157", "0.75656706", "0.7530633", "0.7530633", "0.7448306", "0.73541784", "0.7340636", "0.7335292", "0.7323921", "0.72795135", "0.70932496", "0.7058951", "0.7049409", "0.70316064", "0.70205283", "0.70205283", "0.70011556", "0.69988394", "0.69923276", "0.69890773", "0.69...
0.0
-1
Returns MSE of reward prediction (in negative scale). This metrics suggests how dynamics model is generalized to test sets. If the MSE is large, the dynamics model are overfitting.
def dynamics_reward_prediction_error_scorer(dynamics, episodes, window_size=1024): total_errors = [] for episode in episodes: for batch in _make_batches(episode, window_size, dynamics.n_frames): pred = dy...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rmse(self):\n y_pred, y_true = self._finalize_labels_and_prediction()\n\n return np.sqrt(F.mse_loss(y_pred, y_true).cpu().item())", "def rmse(self):\n y_pred, y_true = self._finalize_labels_and_prediction()\n\n return np.sqrt(F.mse_loss(y_pred, y_true).cpu().item())", "def mse(s...
[ "0.7310605", "0.7310605", "0.71747905", "0.6982706", "0.6936442", "0.6930994", "0.69081956", "0.6904223", "0.68868244", "0.68763876", "0.68303573", "0.6797328", "0.67760646", "0.67528445", "0.67326534", "0.6730757", "0.6697275", "0.6678495", "0.66770864", "0.66656226", "0.664...
0.0
-1
Calculate the great circle distance between two points on the earth (specified in decimal degrees)
def haversine_df(x:pd.core.frame.DataFrame): # convert decimal degrees to radians lon1, lat1, lon2, lat2 = map(np.radians, [x.iloc[:,0], x.iloc[:,1], x.iloc[:,2], x.iloc[:,3]]) # haversine formula dlon = lon2 - lon1 dlat = lat2 - lat1 a = np.sin(dlat/2)**2 + np.cos(lat1) * np.cos(lat2) * np...
{ "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.8145943", "0.786374", "0.7631911", "0.7604138", "0.7595379", "0.75943846", "0.75926137", "0.75699973", "0.75633204", "0.7556198", "0.7528967", "0.7515343", "0.7494148", "0.74658763", "0.74503314", "0.7432437", "0.7391979", "0.73558265", "0.7346732", "0.7329711", "0.7327623...
0.0
-1
Calculate the great circle distance between two points on the earth (specified in decimal degrees), based on the haversine formula
def great_circle_distance(lon1, lat1, lon2, lat2): # convert decimal degrees to radians lon1, lat1, lon2, lat2 = map(np.radians, [lon1, lat1, lon2, lat2]) # haversine formula dlon = lon2 - lon1 dlat = lat2 - lat1 a = np.sin(dlat/2)**2 + np.cos(lat1) * np.cos(lat2) * np.sin(dlon/2)**2 c ...
{ "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.8265375", "0.8060585", "0.7973465", "0.7789512", "0.77638704", "0.7753281", "0.7752877", "0.77025986", "0.7690278", "0.76630974", "0.7656591", "0.7630186", "0.76179534", "0.7603211", "0.7598478", "0.7593108", "0.75565076", "0.7551032", "0.7543566", "0.754222", "0.75312644"...
0.7903282
3
Return framelevel labels corresponding to reference and system RTTMs.
def rttms_to_frames(ref_rttm_fn, sys_rttm_fn, step=0.010): # Load turns from RTTMs. ref_rec_id_to_turns = rttm_to_turns(ref_rttm_fn) sys_rec_id_to_turns = rttm_to_turns(sys_rttm_fn) ref_labels = [] sys_labels = [] max_ref_label = max_sys_label = 0 rec_ids = sorted(set(ref_rec_id_to_turns.key...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SAMT_labels(self):\n \t\t#find basic labels\n \t\tlabels_basic = self.dependency_labels()\n \t\tlabels = Labels(labels_basic)\n \t\treturn labels.SAMT_labels()", "def get_tpx_labels_rel():\n\t#labels_rel = [\"tpx_all_rel\", \"tpx_date_rel\", \"tpx_time_rel\", \"tpx_duration_rel\", \"tpx_set_rel\", \"tpx_date...
[ "0.6332124", "0.60676605", "0.60184467", "0.59407926", "0.5811902", "0.5765534", "0.5759234", "0.5643875", "0.56169105", "0.55962616", "0.5539411", "0.5501064", "0.5489214", "0.54742974", "0.5468236", "0.5458612", "0.543227", "0.54296374", "0.54233646", "0.54233646", "0.54233...
0.63305277
1
Returns a softmax policy with itensity of choice
def get_softmax_policy(intensity_of_choice): beta = intensity_of_choice def softmax_policy(Qvalues_oa): """Returns softmax action probabilites from Qvalues""" betaQoa = beta * Qvalues_oa betaQoa_ = betaQoa - betaQoa.mean(-1, keepdims=True) expQoa = np.exp(betaQoa_) a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(p):\n p_exp = np.exp(p)\n return p_exp / np.sum(p_exp)", "def greedy_policy(self):\n # print(self.weights)\n policy = defaultdict(lambda: 0)\n\n for entry, values in self.weights.items():\n policy[entry] = np.argmax(self.weights[entry])\n # print(polic...
[ "0.7016117", "0.69460994", "0.6879938", "0.68575317", "0.6818527", "0.67711675", "0.6767319", "0.67598736", "0.67218924", "0.6713369", "0.67110723", "0.67001647", "0.6698933", "0.66975707", "0.66716725", "0.6669723", "0.66591364", "0.66516346", "0.6643095", "0.6643095", "0.66...
0.8068657
0
Returns softmax action probabilites from Qvalues
def softmax_policy(Qvalues_oa): betaQoa = beta * Qvalues_oa betaQoa_ = betaQoa - betaQoa.mean(-1, keepdims=True) expQoa = np.exp(betaQoa_) assert not np.any(np.isinf(expQoa)), "behavior policy contains infs" return expQoa / expQoa.sum(axis=-1, keepdims=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(values):\n exps = np.exp(values)\n return exps / sum(exps)", "def softmax(self):\n return self.feats", "def computeQValueFromValues(self, state, action):\n #get the Transition function and nextStates\n state_prob_pair=self.mdp.getTransitionStatesAndProbs(state,action)\n ...
[ "0.71028745", "0.68144006", "0.6589849", "0.6578847", "0.654885", "0.6545937", "0.6520924", "0.6519107", "0.64908624", "0.6471858", "0.6457514", "0.6457265", "0.6419212", "0.6413455", "0.64043844", "0.63822687", "0.63719785", "0.63500994", "0.63427275", "0.6330747", "0.632765...
0.7077686
1
Returns softmax action probabilites from Qvalues
def epsilongreedy_policy(Qvalues_oa): X = np.zeros_like(Qvalues_oa) # where are the actions with maximal value? maxX = Qvalues_oa == np.max(Qvalues_oa, axis=-1, keepdims=True) # assign 1-eps probability to max actions X += (1-epsilon) * maxX / maxX.sum(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(values):\n exps = np.exp(values)\n return exps / sum(exps)", "def softmax_policy(Qvalues_oa):\n betaQoa = beta * Qvalues_oa\n betaQoa_ = betaQoa - betaQoa.mean(-1, keepdims=True)\n expQoa = np.exp(betaQoa_)\n assert not np.any(np.isinf(expQoa)), \"behavior policy con...
[ "0.7103655", "0.70782906", "0.68156475", "0.6588675", "0.6578603", "0.654928", "0.6544951", "0.6519542", "0.6518668", "0.64894354", "0.6473027", "0.645643", "0.64554685", "0.6417392", "0.6411798", "0.640538", "0.6382993", "0.635005", "0.634142", "0.6330782", "0.6328235", "0...
0.63711154
17
Get the opacity transfer function for a mapping. These values will map on to a scalar bar range and thus the number of colors (``n_colors``) must correspond to the number of colors in the color mapping that these opacities are associated to. If interpolating, ``scipy.interpolate.interp1d`` is used if available, otherwi...
def opacity_transfer_function(mapping, n_colors, interpolate=True, kind='quadratic'): sigmoid = lambda x: np.array(1 / (1 + np.exp(-x)) * 255, dtype=np.uint8) transfer_func = { 'linear': np.linspace(0, 255, n_colors, dtype=np.uint8), 'geom': np.geomspace(1e-6, 255, n_colors, dtype=np.uint8), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_transfer_functioin(self, color_file=None, volume_opacity=0.25):\n if color_file: # Color file is given\n\n import csv\n fid = open(color_file, \"r\")\n reader_color = csv.reader(fid)\n\n dict_RGB = {}\n for line in reader_color:\n ...
[ "0.55930394", "0.55316156", "0.50504357", "0.49188092", "0.48760167", "0.4855414", "0.48036402", "0.47205135", "0.47052422", "0.4703402", "0.47010672", "0.46880192", "0.46676612", "0.4627839", "0.46085966", "0.45557666", "0.45543578", "0.45360452", "0.45211875", "0.4510912", ...
0.685514
0
Compares predicted segmentation with groundtruth, accumulates its metric.
def compare_and_accumulate( self, gt_panoptic_labels: List[tf.Tensor], pred_panoptic_labels: List[tf.Tensor] ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: gt_panoptic_label = tf.concat(gt_panoptic_labels, axis=1) pred_panoptic_label = tf.concat(pred_panoptic_labels, axis=1) retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binary_classification_metrics(prediction, ground_truth):\n precision = 0\n recall = 0\n accuracy = 0\n f1 = 0\n\n correct = sum(a == b for a, b in zip(prediction, ground_truth))\n\n true_pos = 0\n false_pos = 0\n false_neg = 0\n\n for i in range(len(prediction)):\n if predicti...
[ "0.6940569", "0.6800629", "0.67113835", "0.6670339", "0.66312253", "0.6608224", "0.6587453", "0.65735006", "0.6570892", "0.6564395", "0.65442914", "0.65312976", "0.6530009", "0.65284437", "0.6506368", "0.6499696", "0.64822036", "0.6454737", "0.64545", "0.6435713", "0.6424957"...
0.0
-1
Preprocess the tweet text removing stop words, stemming, transforming in lowercase and return the tokens of the text.
def getTerms(text, tolist=True): mywords = ["https", "youtube", "@youtub", "co", "youtub"] stemming = PorterStemmer() stops = set(stopwords.words("english")) # Transform in lowercase text = text.lower() # delete urls and Via @ (for exameple via @youtube makes a lot of noise): text = re.sub(r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self,text):\n return preprocess.get_tokens(text)", "def pre_process(text):\n # replace (,.'\") with ''\n text = text.replace(',', '')\n text = text.replace('.', '')\n text = text.replace(\"'\", '')\n text = text.replace(\"\\\"\", '')\n\n # tokenize into words\n tokens =...
[ "0.8058271", "0.7988689", "0.7979284", "0.7817034", "0.7811119", "0.77895784", "0.775713", "0.7745608", "0.77297425", "0.766903", "0.7653596", "0.76223826", "0.75884736", "0.74595714", "0.7444765", "0.7424432", "0.7424432", "0.739778", "0.7380796", "0.73607236", "0.7346429", ...
0.0
-1
Returns the string representation of the actual instance
def to_str(self) -> str: return pprint.pformat(self.dict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return self.to_str()", "def __repr__(self):\n return self.to_str()", "def __repr__(self):\n return self.to_str()", "def __repr__(self):\n return self.to_str()", "def __repr__(self):\n return self.to_str()", "def __repr__(self):\n return self...
[ "0.82674795", "0.82674795", "0.82674795", "0.82674795", "0.82674795", "0.82674795", "0.82674795", "0.82674795", "0.82674795", "0.82674795", "0.82674795", "0.82674795", "0.82674795", "0.82674795", "0.82674795", "0.82674795", "0.82674795", "0.82674795", "0.82674795", "0.82674795"...
0.0
-1
Defines the data loader to use during training. Must return an instance of ``determined.pytorch.DataLoader``.
def build_training_data_loader(self) -> DataLoader: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_dataloader(self) -> DataLoader:\n return self._custom_data_loader()", "def train_dataloader(self) -> torch.utils.data.DataLoader: \n return torch.utils.data.DataLoader(self.dataset_train, **self.dl_kwargs)", "def _custom_data_loader(self) -> DataLoader:\n dataloaders = Da...
[ "0.84034705", "0.8279102", "0.79837555", "0.78005785", "0.7670223", "0.752724", "0.7516198", "0.75075793", "0.74182534", "0.73896635", "0.73626274", "0.7362255", "0.73437697", "0.73054117", "0.7251776", "0.7220833", "0.7210749", "0.7186548", "0.716646", "0.71132886", "0.70667...
0.7452937
8
Defines the data loader to use during validation. Must return an instance of ``determined.pytorch.DataLoader``.
def build_validation_data_loader(self) -> DataLoader: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_dataloader(self) -> DataLoader:\n return self._custom_data_loader()", "def _custom_data_loader(self) -> DataLoader:\n dataloaders = DataLoader(self.dataset, batch_size=1)\n return dataloaders", "def val_dataloader(self) -> torch.utils.data.DataLoader: \n return torc...
[ "0.78061867", "0.7671166", "0.7587993", "0.75830245", "0.7362492", "0.7352656", "0.7349625", "0.73191166", "0.72567874", "0.7215976", "0.71958566", "0.71163446", "0.70881486", "0.7083401", "0.7043951", "0.7036675", "0.7000069", "0.6961058", "0.69603753", "0.69501793", "0.6893...
0.7609273
2
Create a learning rate scheduler for the trial given an instance of the optimizer.
def create_lr_scheduler( self, optimizer: torch.optim.Optimizer # type: ignore ) -> Optional[LRScheduler]: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scheduler_creator(optimizer, config):\n return torch.optim.lr_scheduler.StepLR(optimizer, step_size=5, gamma=0.9)", "def get_scheduler(optimizer, opt):\n def lambda_rule(epoch):\n lr_l = 1.0 - max(0, epoch + opt.epoch_count - opt.n_epochs) / float(opt.n_epochs_decay + 1)\n return lr_l\n ...
[ "0.7665485", "0.7469368", "0.745588", "0.74433166", "0.72010976", "0.71758765", "0.699004", "0.6977123", "0.6831133", "0.68148637", "0.6814036", "0.6787764", "0.67611724", "0.67562705", "0.67110527", "0.6701818", "0.6701818", "0.67015475", "0.66723293", "0.6637394", "0.655224...
0.72730505
4
Reshapes numpy array a by combining count dimensions, starting at dimension index start
def flatten(a, start=0, count=2): s = a.shape return np.reshape(a, s[:start] + (-1,) + s[start+count:])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reshape(arr):\r\n reshape_arr = np.empty((3,240,320),dtype='float32')\r\n reshape_arr[0,:,:] = arr[:,:,0]\r\n reshape_arr[1,:,:] = arr[:,:,1]\r\n reshape_arr[2,:,:] = arr[:,:,2]\r\n return reshape_arr", "def reshape(x, shape):\n return Reshape(shape)(x)", "def _reshape_channels(x):\n ...
[ "0.6697543", "0.6587314", "0.6523234", "0.6340069", "0.6288854", "0.62768674", "0.62768674", "0.6272361", "0.6256879", "0.62106115", "0.618544", "0.6177837", "0.6176469", "0.61546266", "0.6098897", "0.6085183", "0.60675347", "0.6045209", "0.60398096", "0.6016787", "0.6012479"...
0.7081491
0
get_rating() Returns the weighted average rating.
def get_rating(self): if not (self.votes and self.score): return 0 return float(self.score)/(self.votes+self.field.weight)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_rating(self):\n return self.proto.aggregateRating.starRating", "def average_rating(self):\n return ( self.rating_1 + self.rating_2 + self.rating_3) / 3", "def rating(self):\n average = self.review.all().aggregate(Avg('rating'))['rating__avg']\n if not average:\n ...
[ "0.7534053", "0.7533969", "0.74148315", "0.73885727", "0.73139024", "0.7219586", "0.7185771", "0.7175802", "0.6898228", "0.6818854", "0.6813653", "0.6806613", "0.6806613", "0.67193705", "0.6716667", "0.6582727", "0.657171", "0.6568441", "0.65149355", "0.64450717", "0.6286553"...
0.7309541
5
get_rating() Returns the unmodified average rating.
def get_real_rating(self): if not (self.votes and self.score): return 0 return float(self.score)/self.votes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_rating(self):\n return self.proto.aggregateRating.starRating", "def average_ratings(self):\n return get_average_rate(\n model=Rating,\n article=self.pk\n )", "def rating(self):\n average = self.review.all().aggregate(Avg('rating'))['rating__avg']\n ...
[ "0.800111", "0.77384853", "0.76732725", "0.7646535", "0.7617238", "0.75875473", "0.7412179", "0.7385679", "0.7268192", "0.72286123", "0.72176546", "0.71029866", "0.71029866", "0.70122916", "0.700525", "0.6898622", "0.6805637", "0.670934", "0.6613443", "0.657856", "0.64890283"...
0.63610286
22
Return an array of the picked file paths
def picked_file_paths(self): return self._picked_file_paths
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paths(self, toNative=True):\n if self.__mode == E5PathPickerModes.OpenFilesMode:\n return self.path(toNative=toNative).split(\";\")\n else:\n return [self.path(toNative=toNative)]", "def get_paths(file_path):\n return glob(path.join(file_path, '*'))", "def get_paths(s...
[ "0.74787486", "0.72094625", "0.6922468", "0.6906244", "0.68703943", "0.6818079", "0.6793266", "0.67811495", "0.6768815", "0.67364264", "0.6687062", "0.6667483", "0.6627807", "0.65272945", "0.65220636", "0.64986014", "0.6498593", "0.64963806", "0.6490335", "0.64838564", "0.647...
0.8093097
0
Check if a path match with an excluded pattern
def _is_in_excluded_patterns(self, path): for excluded_pattern in self._excluded_patterns: expandeduser_pattern = os.path.expanduser(excluded_pattern) if (path + '/').find(expandeduser_pattern) != -1: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _match_excl_regexp(self, rel_path):\n\n for regexp in self.exclude_regexps:\n if regexp.search(rel_path) is not None:\n self.logger.debug(\"The path %s matches the ignore regexp\"\n \" %s.\" % (rel_path, regexp.pattern))\n return ...
[ "0.7789504", "0.7760624", "0.76972985", "0.7372461", "0.7088563", "0.70793945", "0.70644695", "0.70047367", "0.68405354", "0.6752779", "0.66936946", "0.6645324", "0.66405964", "0.65979844", "0.64947605", "0.6459626", "0.6455101", "0.64278984", "0.6408623", "0.6392678", "0.635...
0.756114
3
transfor dict to str
def dict2argstr(args_dict): arg_str = "" for arg, value in args_dict.items(): if value is not None: arg_str += " --{} {}".format(str(arg), str(value)) return arg_str
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dict_str(d: dict) -> str:\n\treturn str({str(u): str(v) for u, v in d.items()})", "def _dict_to_string(self, dictionary):\n st = ''\n for i in range(len(dictionary)):\n st = st + dictionary[i]\n return st", "def dict2str(d):\n els = ['%s=%s' % (k,v) for k,v in sorted(...
[ "0.8312909", "0.80891365", "0.7939768", "0.79385525", "0.7786703", "0.7696606", "0.7627299", "0.7492187", "0.74260765", "0.73394775", "0.7319993", "0.7286076", "0.7198708", "0.71938056", "0.7120752", "0.711729", "0.7029355", "0.7022204", "0.6984527", "0.69834435", "0.69784915...
0.0
-1
Normalize stop positions between 0 and 1. Return ``(first, last, positions)``.
def normalize_stop_positions(positions): first, last = positions[0], positions[-1] total_length = last - first if total_length == 0: positions = [0] * len(positions) else: positions = [(pos - first) / total_length for pos in positions] return first, last, positions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boundingIndices(start, stop, step, value):\n if value < start:\n return 0, 0\n elif value > stop:\n stopIndex = int((stop - start)/step)\n return stopIndex, stopIndex\n lowerIndex = int((value - start)/step)\n return lowerIndex, lowerIndex+1", "def normalise(self):\n\n ...
[ "0.58877885", "0.5700644", "0.56990623", "0.5623811", "0.56155854", "0.55112684", "0.5462739", "0.5458823", "0.5376977", "0.53356355", "0.5280006", "0.52378756", "0.52115214", "0.5207846", "0.52024466", "0.5195813", "0.51931804", "0.5179173", "0.517815", "0.5170206", "0.51608...
0.8073658
0
f(x) = p/(2p) (1p)^(abs(x))
def pmf(self, x, location=0): centered_x = np.abs(x-location) centered_int_x = int(centered_x) if np.abs(centered_x - centered_int_x) > 1e-5: return 0 return (self.p / (2 - self.p)) * ((1 - self.p)**centered_int_x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def func(x, f, fp):\n\n return np.sqrt((1+fp(x)**2) / (2 * g * f(x)))", "def f(x):\n return math.exp(-x**2)/(1+x**2)+(2*math.cos(x)**2)/(1+(x-4)**2)", "def f(x):\n return -math.exp(x[0]**3/-3 + x[0] - x[1]**2)", "def f(x):\n return -math.exp(x[0]**3/-3 + x[0] - x[1]**2)", "def F(x):\n return...
[ "0.76272184", "0.76210064", "0.743775", "0.743775", "0.7307853", "0.7274711", "0.7231187", "0.7159073", "0.7120218", "0.7064366", "0.7064366", "0.7051788", "0.702703", "0.7026965", "0.7019476", "0.7010128", "0.7008661", "0.6988997", "0.69120836", "0.6908973", "0.6898149", "...
0.0
-1
Calculates the number of 2combinations of n elements.
def _n_choose_2(n): return (n * (n - 1)) // 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combinations(n) -> float:\r\n c = math.factorial(n) / (math.factorial(2) * math.factorial(n - 2))\r\n return c", "def combinations_count(n, r):\n # TODO: How should I do when n - r is negative?\n if n < 0 or r < 0:\n raise Exception('combinations_count(n, r) not defined when n ...
[ "0.72446275", "0.71420753", "0.6895217", "0.6690682", "0.66628313", "0.6630058", "0.66193277", "0.6524849", "0.65196854", "0.6488778", "0.64810777", "0.6472397", "0.6472104", "0.64634687", "0.6439681", "0.6420571", "0.6392413", "0.6359141", "0.6335844", "0.6335844", "0.632115...
0.68550634
3
Test that when the ``max_n_features`` parameter is too small, an exception is raised.
def test_quadratic_features_max_n_features_too_small(include_bias, max_n_features): transformer = QuadraticFeatures(include_bias=include_bias, max_n_features=max_n_features,) with pytest.raises(ValueError): transformer.fit(X_small)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_n_features(n_features, cols):\n\n if n_features is None:\n raise Exception(\"n_features must be specified.\")\n\n if n_features <= 0:\n raise Exception(\"n_features cannot be 0 or a negative number.\")\n\n if n_features > 1 and not isinstance(n_features, int):\n raise Except...
[ "0.73481774", "0.6930973", "0.69208556", "0.6651948", "0.6543531", "0.64575773", "0.6416252", "0.6360548", "0.62864786", "0.62349683", "0.61920166", "0.61920166", "0.61815804", "0.61522067", "0.61344296", "0.612243", "0.6106404", "0.60964715", "0.6052933", "0.60080224", "0.59...
0.75444853
0
Export the current record selection as .csv file
def export(self,**kwargs): # import pdb;pdb.set_trace() # provide for case where recs are set extenally if not self.recs: self.select_recs(**kwargs) if self.recs: if self.export_file_name: filename = self.export_file_name ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_csv(self):\n outputfile = tkinter.filedialog.asksaveasfilename(\n defaultextension=\".csv\",\n filetypes=((\"comma seperated values\", \"*.csv\"),\n (\"All Files\", \"*.*\")))\n if outputfile:\n tabledata = self.tabs.window.aistracker....
[ "0.7680147", "0.7477583", "0.7281239", "0.7205981", "0.703632", "0.7025615", "0.68767613", "0.68384284", "0.6814293", "0.679718", "0.67688566", "0.67543817", "0.6729891", "0.671606", "0.6686868", "0.66808385", "0.6654098", "0.66405934", "0.6623323", "0.6621741", "0.66202533",...
0.7070016
4
return a ListFilter object populated with the query 'where' and 'order_by' sql strings
def get_list_filters(self): # look in session for the saved search... filters = ListFilter() filters.get_list_filter(self.table) return filters
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_filter(self,table=None,**kwargs):\n # import pdb;pdb.set_trace()\n self.where = '1'\n self.order_by = 'id'\n if not isinstance(table,SqliteTable):\n return\n \n # get the column names for the table\n table_column_names = table.get_column_...
[ "0.75963634", "0.7184143", "0.7079877", "0.6772565", "0.6522713", "0.64408326", "0.64408326", "0.64399344", "0.63823104", "0.6359873", "0.6338444", "0.63322735", "0.6330408", "0.6330153", "0.6329599", "0.63259137", "0.6324765", "0.6318439", "0.6300109", "0.6260102", "0.625216...
0.63085145
18
We cannot create an account with a duplicate email.
def test_create__duplicate(self): testing_config.sign_in('admin@example.com', 123567890) json_data = {'email': 'user@example.com'} with test_app.test_request_context(self.request_path, json=json_data): with self.assertRaises(werkzeug.exceptions.BadRequest): self.handler.do_post() unrevis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_duplicate_email(self, email):\r\n request = self.req_factory.post('unused_url', data={\r\n 'new_email': email,\r\n 'password': 'test',\r\n })\r\n request.user = self.user\r\n self.assertFailedRequest(self.run_request(request), 'An account with this e-mail...
[ "0.80907", "0.77106434", "0.7604814", "0.7552231", "0.73918915", "0.7367582", "0.73545414", "0.7157024", "0.71532613", "0.71035326", "0.7097324", "0.70040345", "0.68800247", "0.6872876", "0.6818471", "0.679485", "0.67883915", "0.67609304", "0.67603403", "0.6736359", "0.672531...
0.6449408
38
We cannot delete an account with the wrong account_id.
def test_delete__not_found(self): testing_config.sign_in('admin@example.com', 123567890) with test_app.test_request_context(self.request_path): with self.assertRaises(werkzeug.exceptions.NotFound): self.handler.do_delete(account_id=self.appuser_id + 1) unrevised_appuser = user_models.AppUser...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_account(self, account):\n \n pass", "def delete_account_id(account_id):\n conn = get_connect()\n conn.execute(\"DELETE from account WHERE accountId = ?\", [account_id])\n conn.commit()\n conn.close()\n return", "def delete_account():\n print(\"\\n\")\n prin...
[ "0.75249714", "0.71695817", "0.7063182", "0.69392323", "0.68539894", "0.6777766", "0.6706891", "0.6646325", "0.6598743", "0.6569689", "0.6557555", "0.65555596", "0.6487144", "0.6485097", "0.638602", "0.63218164", "0.62832916", "0.6183612", "0.6177636", "0.6169193", "0.6162365...
0.56658304
52
Create or update a new snippet instance, given a dictionary of deserialized field values. If we didn't define restore_object, then deserializing would simply return a dictionary of items.
def restore_object(self, attrs, instance=None): if instance: # Update existing instance instance.title = attrs.get('title', instance.title) instance.code = attrs.get('code', instance.code) instance.value = attrs.get('value', instance.value) return inst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, validated_data: dict) -> Snippet:\n return Snippet.objects.create(**validated_data)", "def update(self, instance: Snippet, validated_data: dict) -> Snippet:\n instance.title = validated_data.get('title', default=instance.title)\n instance.code = validated_data.get('code', de...
[ "0.57991594", "0.56356645", "0.55026495", "0.54909813", "0.5405005", "0.5213584", "0.5195762", "0.51663965", "0.51352364", "0.5130504", "0.5128134", "0.508893", "0.50486034", "0.501819", "0.49977008", "0.49599707", "0.4943577", "0.49337602", "0.49291852", "0.4873383", "0.4851...
0.6258189
0
Returns signed lateral distance with r > 0 as early and r < 0 as late hits. For the rotation matrix, use to_shower_cs(...). Requires numpy.
def signed_r_z(rotation_matrix, positions, core): arr = np.array pos = arr(positions) - core rot_pos = arr(rotation_matrix * pos.T).T x = rot_pos[:, 0].T y = rot_pos[:, 1].T z = rot_pos[:, 2].T r = (x ** 2 + y ** 2) ** 0.5 * np.sign(-x) return r, z
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_CRR(self, FAR):\r\n print('Computing CRR')\r\n return (np.ones((1, len(FAR))) - FAR)[0]", "def _calc_distance(r1, r2):\n return np.linalg.norm(r1 - r2)", "def calc_dist(atom_R, env_R_arr):\n assert atom_R not in env_R_arr\n return np.linalg.norm(atom_R - env_R_arr, axis=1)", ...
[ "0.5519314", "0.54408634", "0.53497726", "0.53364074", "0.53084165", "0.5274187", "0.52249354", "0.51766247", "0.51758146", "0.5139521", "0.51336575", "0.5126647", "0.51096755", "0.51074237", "0.50842744", "0.5084118", "0.5071017", "0.50596344", "0.5058725", "0.5049967", "0.5...
0.4983115
26
The dataset contains several continuous features with strong postive skews. In order to increase each feature's normality, we will transform each continuous feature using a log function. Since each feature has '0' values, we will first determine the minumum nonzero value for each feature, divide this value by 2, and ad...
def log_trans(data, test=False): logs = ['Administrative', 'Administrative_Duration', 'Informational', 'Informational_Duration', 'ProductRelated', 'ProductRelated_Duration', 'BounceRates', 'ExitRates', 'PageValues'] if test: data_test = data.loc[data['Train'] == 0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manual_log_like_normal(x, data):\n return np.sum(-np.log(x[1] * np.sqrt(2 * np.pi))-((data-x[0])**2) / (2*x[1]**2))", "def feature_zero_mean(x, xtest):\n mu = np.mean(x, axis=0)\n return x - mu, xtest - mu", "def normalize_features(X):\n std = X.std(axis=0)\n std = np.where(std == 0, 1, std)...
[ "0.63411707", "0.6172084", "0.60807943", "0.6066534", "0.5985815", "0.58821535", "0.5741113", "0.56013954", "0.55950326", "0.5583334", "0.5570576", "0.55460113", "0.55328333", "0.5530171", "0.55258614", "0.55132806", "0.5473804", "0.5468627", "0.5468627", "0.5431832", "0.5429...
0.0
-1
The dataset contains multiple features that use different numerical ranges, and which have different statistical properties. In order to standardize these prior to clustering and/or a regression function, we will fit a SciKit StandardScaler algorithm to our data, and then create a scaled version of our data. This featu...
def scale(data, test=False): if test: data_test = data.loc[data['Train'] == 0] data = data.loc[data['Train'] == 1] scaler = StandardScaler() scaler.fit(data) scaled_array = scaler.transform(data) data = pd.DataFrame(scaled_array, columns=list(data.columns)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def standardize_data(X_train, X_test):\n scaler = StandardScaler()\n scaler.fit(X_train)\n X_train = scaler.transform(X_train)\n # apply same transformation to test data\n X_test = scaler.transform(X_test)\n return X_train, X_test", "def test_scale_features_standardize(self):\n data = ar...
[ "0.743777", "0.7422206", "0.7365145", "0.71343154", "0.7053879", "0.7050634", "0.70316046", "0.702284", "0.6988668", "0.6949841", "0.69108343", "0.6822141", "0.6817659", "0.68081343", "0.6746688", "0.67462397", "0.67447764", "0.661862", "0.66052467", "0.6543129", "0.65251344"...
0.69786984
9
Return the global NSApplication instance (NSApp)
def _NSApp(): return msg(C("NSApplication"), n("sharedApplication"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_app():\n if get_ipython() is not None:\n return get_ipython().pt_app.app", "def get_app():\n\n global _app\n if _app is None:\n\n entrypoint = get_config().get('APP_ENTRYPOINT')\n if not entrypoint:\n raise RuntimeError('APP_ENTRYPOINT missing from config')\n ...
[ "0.71960133", "0.7181655", "0.716194", "0.7133081", "0.7077775", "0.6900688", "0.68966043", "0.67953384", "0.66349036", "0.66250646", "0.65939736", "0.65765357", "0.65395737", "0.653224", "0.65027946", "0.64923954", "0.6486357", "0.6486357", "0.6457912", "0.6439479", "0.63418...
0.74628025
0
Return the branch representation for this element
def get_repr(self, *args): level_representation = "--" if self.level == 0: node = "| " else: node = "+ " _tree_structure = node + level_representation * self.level + ' ' + self.name return _tree_structure
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return \"<Branch: %s>\" % self", "def _branch(self):\n printer = Printer(None)\n ci_manager = CIManager(printer)\n return ci_manager.get_branch()", "def __repr__(self):\n s = self.print_bfs()\n return s", "def __str__(self):\r\n levels = ...
[ "0.78112435", "0.6936263", "0.6835555", "0.68111444", "0.6665453", "0.6559021", "0.6434938", "0.6407048", "0.64000213", "0.63460195", "0.63458353", "0.63402003", "0.6327201", "0.63086444", "0.6281268", "0.6262849", "0.6239941", "0.6239941", "0.62325335", "0.62187225", "0.6202...
0.58360094
43
Ustawia kursor na _name.
def setCursor(self, _name = None): _before = self._cursor self._cursor = _name if _before != _name: self._updated.append(tuple(self.rect)) self.updateCursor() self._updated.append(tuple(self.rect))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __set_name__(self, cls, name):\n pass", "def name(self, name):\n pass", "def __set_name(self, name):\r\n\t\tself.__name = name\r\n\t\tself._window.chat_panel.place_name = name\r\n\t\tself.encode_message(action=\"NO\", selected_name=name)", "def enter_name(self, name):\n self.name = n...
[ "0.643674", "0.6181837", "0.6030711", "0.59619987", "0.59137547", "0.58539736", "0.58364743", "0.583163", "0.583163", "0.58269495", "0.5802995", "0.57779956", "0.577077", "0.577077", "0.577077", "0.577077", "0.57459503", "0.57459503", "0.5734393", "0.5734393", "0.5734393", ...
0.0
-1
Loads images in the training directory and builds a dictionary of their names and encodings.
def encode_known_faces( model: str = "hog", encodings_location: Path = DEFAULT_ENCODINGS_PATH ) -> None: names = [] encodings = [] for filepath in Path("training").glob("*/*"): name = filepath.parent.name image = face_recognition.load_image_file(filepath) face_locations = face_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_dataset(self):\n\n train_path = os.path.join(self.dataset_path, 'images_background')\n validation_path = os.path.join(self.dataset_path, 'images_evaluation')\n\n # First let's take care of the train alphabets\n for alphabet in os.listdir(train_path):\n if alphabet[0]...
[ "0.69726944", "0.69583046", "0.6883979", "0.6692237", "0.6650402", "0.66498816", "0.65559566", "0.65189314", "0.65187967", "0.64336777", "0.6415335", "0.6390455", "0.63836396", "0.6380861", "0.6349792", "0.6346489", "0.6327738", "0.631124", "0.6307286", "0.6285744", "0.626611...
0.0
-1
Draws bounding boxes around faces, a caption area, and text captions.
def _display_face(draw, bounding_box, name): top, right, bottom, left = bounding_box draw.rectangle(((left, top), (right, bottom)), outline=BOUNDING_BOX_COLOR) text_left, text_top, text_right, text_bottom = draw.textbbox( (left, bottom), name ) draw.rectangle( ((text_left, text_top),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_rects(image, face_locations):\n\n # Placeholder\n emotions = ['Poker'] * len(face_locations)\n\n # Convert to grayscale and extract faces\n gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)\n faces = [process_face(gray_image, coords)\n for coords in face_locations]\n emoti...
[ "0.6833757", "0.676635", "0.67364866", "0.66572917", "0.659261", "0.6570618", "0.65500027", "0.6502011", "0.6450708", "0.6425191", "0.6380102", "0.637316", "0.6364349", "0.63245785", "0.6316589", "0.63064027", "0.62404", "0.6215222", "0.6192796", "0.61915624", "0.614718", "...
0.705009
0
Translate connector info to storage system host name. Create a storage compatible host name based on the host shortname, replacing any invalid characters (at most 55 Characteristics) and adding a random 8character suffix to avoid collisions. The total length should be at most 63 characters.
def _hostname_prefix(self, hostname_str): if not hostname_str or len(hostname_str) == 0: msg = _("Invalid Hostname: %(hostname_str)s for storage") % \ locals() LOG.exception(msg) ex_args = {'hostname': hostname_str} raise SVCInvalidHostnameError(*...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shortHostname(self) -> str:\n\t\treturn self.hostname[0]", "def format_host(host):\n\n host = strip_suffix(host, \".lan.urlab.be\")\n host = strip_suffix(host, \".lan\")\n host = strip_suffix(host, \".local\")\n host = strip_suffix(host, \"iPodtouch\")\n host = strip_suffix(host, \"-PC\")\n ...
[ "0.6487104", "0.6350929", "0.6086436", "0.603447", "0.58526766", "0.5847234", "0.584464", "0.58241206", "0.5786955", "0.57844216", "0.56773245", "0.56574607", "0.56208944", "0.5618583", "0.5614177", "0.5604663", "0.5570011", "0.5542763", "0.5507587", "0.54958093", "0.54934114...
0.5660802
11
Returns the constructor parameters needed to serialize the instance, as a tuple containing positionnal arguments and keyword arguments. The default implementation returns a dict containing the object
def uncall(self): args = {} for name in self.schema: args[name] = serialize(getattr(self, name)) return (), args
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_constructor_parameters(self) -> Dict[str, Any]:\n return dict(\n obs_space=self.obs_space,\n action_space=self.action_space,\n scale_imgs=self.scale_imgs,\n )", "def _serialize_attributes_as_kwargs(self) -> Dict[str, Any]:\n if self._constructed_manu...
[ "0.7077096", "0.6922872", "0.6855776", "0.67223036", "0.6666737", "0.661517", "0.65050936", "0.64652973", "0.6335165", "0.6322905", "0.6307007", "0.628957", "0.62874436", "0.62839305", "0.6278867", "0.6252015", "0.6249554", "0.62253684", "0.61987895", "0.6181472", "0.6157026"...
0.0
-1
Convert obj to its serialized form.
def serialize(obj): obj_type = type(obj) if obj_type in reverse_registry: # Registered entry uncall, name = reverse_registry[obj_type] args, kwargs = uncall(obj) data = { "__class__": name, "__args__": args, "__kwargs__": kwargs, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self, obj):\n pass", "def serialize(self, obj):\n return obj", "def serialize(obj):\n return serialization_manager.serialize(obj)", "def serialize(self, obj):\n return json.dumps(obj)", "def serialize_forstorage(cls, obj):\n return misc.serialize_forstorage(obj)...
[ "0.8406487", "0.8309733", "0.81081086", "0.797359", "0.7929667", "0.7793133", "0.7697814", "0.76823914", "0.7545402", "0.7516702", "0.74070036", "0.73387456", "0.73387456", "0.73348546", "0.7239775", "0.72175926", "0.72175926", "0.72175926", "0.71664274", "0.71312326", "0.705...
0.6480148
56
Dump JSONserializable obj object to a string. The arguments after obj are passed directly to json.dumps().
def dumps(obj, *args, **kwargs): defaults = {"indent": 4} defaults.update(kwargs) return json.dumps(serialize(obj), *args, **defaults)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_dumps(self, obj: object) -> str:\n return json.dumps(obj, sort_keys=self.beautify, indent=4)", "def dumps(obj):\n return json.dumps(obj, indent=4, sort_keys=True, cls=CustomEncoder)", "def to_json(obj: Any) -> str:\n return mark_safe(json.dumps(obj))", "def toJSON(cls, obj):\n re...
[ "0.8076336", "0.7908761", "0.789156", "0.77527696", "0.7642598", "0.76375353", "0.7577813", "0.7538517", "0.7447329", "0.74253076", "0.74253076", "0.74136806", "0.74136806", "0.74136806", "0.74136806", "0.7404573", "0.7387096", "0.7308565", "0.730726", "0.7304467", "0.7294984...
0.8028637
1
Returns True if state appears to be a serialized object.
def is_serialized_state(state): if looks_like_mapping(state) and len(state) == 3 \ and "__class__" in state and "__args__" in state \ and "__kwargs__" in state: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_serializable(instance_or_class: Any) -> bool:\n return hasattr(instance_or_class, SERDE_SCOPE)", "def is_picklable(obj):\n try:\n pickle.dumps(obj)\n\n except pickle.PicklingError:\n return False\n return True", "def load_state(self, state: dict) -> bool:\n if '__type__' in ...
[ "0.69327426", "0.66838723", "0.6530832", "0.64396644", "0.6423432", "0.6400139", "0.6318863", "0.6291209", "0.62856704", "0.6229611", "0.62080455", "0.6199739", "0.6142469", "0.6136935", "0.6102762", "0.6101413", "0.6101413", "0.6085936", "0.60775167", "0.60304314", "0.599351...
0.8285743
0
Return True if obj looks like a mapping type object.
def looks_like_mapping(obj): meths = ("items", "keys", "values") for meth in meths: if not callable(getattr(obj, meth, None)): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isMapping(obj):\n # type: (Any) -> bool\n return isinstance(obj, Mapping)", "def is_verifiable(obj):\n from amelie.claudia.models import Mapping\n\n if isinstance(obj, Mapping):\n return True\n\n for k in Mapping.RELATED_CLASSES:\n if isinstance(obj, Mapping.RELATED_CLASSES[k]):\...
[ "0.8717767", "0.745791", "0.74369603", "0.7179815", "0.7011508", "0.6986974", "0.69569397", "0.677571", "0.6695523", "0.6642924", "0.6625887", "0.65964216", "0.6574112", "0.6573133", "0.6554533", "0.6436629", "0.64157873", "0.6404855", "0.6376043", "0.6353967", "0.6347385", ...
0.6810762
7
Fire a bullet, if limit not reached yet.
def fire_bullet(settings, screen, ship, bullets): if len(bullets) < settings.bullets_allowed: #create a new bullet and add it to the bullets group.bullets new_bullet = Bullet(settings, screen, ship.rect.centerx, ship.rect.top) bullets.add(new_bullet)# stores the new bullet in the group bullets. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fire_bullet(self):\n if len(self.bullets) < self.settings.bullets_max:\n new_bullet = Bullet(self)\n self.bullets.add(new_bullet)", "def _fire_bullet(self):\n\t\tif len(self.bullets)<self.settings.bullets_allowed:\n\t\t\tnew_bullet = Bullet(self)\n\t\t\tself.bullets.add(new_bull...
[ "0.80372375", "0.8023084", "0.80035716", "0.7920329", "0.7920329", "0.7920329", "0.7822412", "0.75878584", "0.730836", "0.7290562", "0.72568864", "0.7192206", "0.7192206", "0.71880776", "0.71776384", "0.71310365", "0.7129722", "0.70625895", "0.69708365", "0.67962444", "0.6791...
0.7429765
8
Test that the tile server is serving images.
def _testTilesZXY(server, admin, itemId, metadata, tileParams=None, imgHeader=utilities.JPEGHeader, token=None): if tileParams is None: tileParams = {} if token: kwargs = {'token': token} else: kwargs = {'user': admin} # We should get images for all valid levels...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testimage_handler(self):\n\t\t\n\t\tthings = Thing.objects.all()\n\t\tif len( things ):\n\t\t\tthing = things[0]\n\t\telse:\n\t\t\tc = Client()\n\t\t\tdata = parse_qs( 'title=&tags=&lattitude=32.82248&longitude=-96.762986&duration=&parent=&privacy=U&lifespan=&format=txt' )\n\t\t\tdata[ 'media' ] = open( MEDIA_...
[ "0.71731037", "0.6950917", "0.68130016", "0.6810461", "0.66901284", "0.6556818", "0.6526308", "0.6509652", "0.6496555", "0.6493908", "0.63738555", "0.634201", "0.6284062", "0.62674224", "0.621944", "0.6143598", "0.6120843", "0.610792", "0.6096926", "0.6066289", "0.60625124", ...
0.55696315
91
Adds a vertex to the Knowledge Graph.
def add_vertex(self, vertex: Vertex) -> None: self._vertices.add(vertex) if not vertex.predicate: self._entities.add(vertex)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_vertex(self, vertex):\n raise NotImplementedError", "def add_vertex(self, vertex_name: n):\n new_vertex = Vertex(vertex_name)\n self._graph[new_vertex.name] = new_vertex", "def add_vertex(self, vertex):\n if isinstance(vertex, Vertex):\n self.vertices.append(verte...
[ "0.8542118", "0.80838484", "0.8076212", "0.8028007", "0.7932468", "0.79250866", "0.7864605", "0.77719676", "0.7742398", "0.7730389", "0.7662699", "0.7662699", "0.76509726", "0.7644595", "0.76046056", "0.75919557", "0.75383806", "0.75364584", "0.7495279", "0.74820215", "0.7460...
0.7870925
6
Adds a unidirectional edge.
def add_edge(self, v1: Vertex, v2: Vertex) -> None: self._transition_matrix[v1].add(v2) self._inv_transition_matrix[v2].add(v1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addEdge(self, edge):\n Digraph.addEdge(self, edge)\n rev = Edge(edge.getDestination(), edge.getSource())\n Digraph.addEdge(self, rev)", "def add_edge(self, edge):\n assert edge not in self.edges\n self.edges.append(edge)", "def add_edge(self, ed):\n self.edge.appen...
[ "0.72547656", "0.71551913", "0.7136761", "0.6996675", "0.69335425", "0.6906999", "0.6867886", "0.6848392", "0.6832838", "0.67802316", "0.6766016", "0.67413867", "0.6734741", "0.6649388", "0.66461784", "0.66410136", "0.66404545", "0.66286445", "0.6620167", "0.6554595", "0.6551...
0.6170092
74
Splits a list based on separators
def split_list_by(lst, sepfunc, includesep): blocks = [] block = [] for elem in lst: if sepfunc(elem): if includesep: block.append(elem) blocks.append(block) block = [] else: block.append(elem) if len(block): blocks.append(block) return blocks
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_list(l, separator):\n result_list = [[]]\n\n for a in l:\n # Checks if the current element is a separator\n if a == separator:\n result_list += [[]]\n else:\n result_list[-1] += [a]\n\n return result_list", "def _split_input_list(str_list):\r\n\r\n ...
[ "0.78012913", "0.74653584", "0.7211531", "0.71981245", "0.7146156", "0.6926131", "0.6878298", "0.68329966", "0.68156505", "0.6701067", "0.6655588", "0.66434073", "0.66321224", "0.6538529", "0.6537672", "0.65368515", "0.6455192", "0.6420418", "0.64135903", "0.6400178", "0.6389...
0.72391486
2
Check whether a bbox is in the roi or not.
def _is_in_roi(self, bbox, threshold=0.0): (xmin, ymin, xmax, ymax) = bbox obj_polygon = geometry.Polygon([[xmin, ymin], [xmax, ymin], [xmax, ymax], [xmin, ymax]]) overlap_area = self._roi_polygon.intersection(obj_polygon).area return overlap_area ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_bbox(bbox):\n assert bbox.shape == (4,)\n negative_elements = [box_element for box_element in bbox if box_element < 0]\n assert not negative_elements\n assert bbox[0] + bbox[2] <= ORIGINAL_IMAGE_SIZE[0]\n assert bbox[1] + bbox[3] <= ORIGINAL_IMAGE_SIZE[1]", "def __contains__(self, item: ...
[ "0.70913166", "0.7041275", "0.70259506", "0.6957747", "0.6711874", "0.6705239", "0.6694444", "0.66857284", "0.64876735", "0.6479501", "0.6450394", "0.6426561", "0.636439", "0.6348769", "0.63485754", "0.63373446", "0.6257993", "0.6254897", "0.6252382", "0.6247336", "0.62021905...
0.8275249
0
Rotate a point (or vector) about the origin in 3D space.
def rotation(point, axis, theta=None, sign=1): def Rx(x, y, z, theta): return (round(x, 1), round(math.cos(theta) * y - math.sin(theta) * z, 1), round(math.sin(theta) * y + math.cos(theta) * z, 1)) def Ry(x, y, z, theta): return (round(math.cos(theta) * x + math....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate_about(self, rotation, point):\n\t\tif not isinstance(point,Vector3d):\n\t\t\tpoint = Vector3d(*point)\n\t\treturn (self - point).rotate(rotation) + point", "def rotateZ(self, point):\n\n rad = self.offset_rotation.z * math.pi / 180\n\n cosa = math.cos(rad)\n sina = math.sin(rad)\n...
[ "0.80808747", "0.744316", "0.7347716", "0.7040909", "0.68405426", "0.6827031", "0.67915654", "0.67793113", "0.67770964", "0.67294234", "0.67103386", "0.66828126", "0.66695416", "0.66270137", "0.66002107", "0.6599441", "0.6599441", "0.6599441", "0.6599441", "0.657041", "0.6551...
0.6900867
4
Return dot product between two vectors a & b.
def dot_product(a, b): a1, a2, a3 = a b1, b2, b3 = b return a1 * b1 + a2 * b2 + a3 * b3
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot(a, b):\n\n if len(a) != len(b):\n raise Exception(\"Input vectors must be of same length, not %d and %d\" % (len(a), len(b)))\n\n return float(sum([a[i] * b[i] for i in range(len(a))]))", "def dot(a, b):\n return np.vdot(a.arr,b.arr)", "def dot(a, b):\n return a[0]*b[0] +...
[ "0.9071718", "0.8711775", "0.85941565", "0.8592905", "0.84637684", "0.84218085", "0.8336118", "0.8286875", "0.82628596", "0.8245896", "0.8238678", "0.8221559", "0.81987447", "0.819434", "0.81914735", "0.81475925", "0.8129567", "0.8104411", "0.80812734", "0.8056187", "0.805066...
0.78256476
27
given a sklearn confusion matrix (cm), make a nice plot Arguments
def plot_confusion_matrix(cm, target_names, title='Confusion matrix', cmap=None, normalize=True): import matplotlib.pyplot as plt import numpy as np import itertools accuracy = np.trace(cm) / float(n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, class_names):\n figure = plt.figure(figsize=(10, 10))\n plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)\n plt.title(\"Confusion matrix\")\n plt.colorbar()\n tick_marks = np.arange(len(class_names))\n plt.xticks(tick_marks, class_names, rotation=45)\n plt.yticks(tick_...
[ "0.79997694", "0.79955804", "0.7947871", "0.79360676", "0.79129595", "0.7897813", "0.7879448", "0.786082", "0.786082", "0.78540397", "0.78501374", "0.78499055", "0.78404397", "0.7835427", "0.7828328", "0.78253037", "0.78049725", "0.78017557", "0.77822274", "0.77789044", "0.77...
0.0
-1
return first three characters
def sameThreeCharStartPredicate(field: str) -> FrozenSet[str]: return frozenset(initials(field.replace(" ", ""), 3))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def front3(str):\r\n if len(str)<4:\r\n return 3*str\r\n else:\r\n return 3*str[:3]", "def print_third_character(text):\n third_character = [word[2] for word in text.split()]\n print(third_character)", "def first_two(s):\n if len(s) >= 2:\n string = s[0:2]\n return st...
[ "0.77657", "0.6840356", "0.66136867", "0.6529674", "0.6380211", "0.6153346", "0.607873", "0.60289335", "0.6011704", "0.59972364", "0.5990348", "0.59649134", "0.59456074", "0.5923997", "0.5917582", "0.59121597", "0.5908646", "0.5905611", "0.58917016", "0.5886052", "0.58432496"...
0.51884234
84
Play a full episode and return training data.
def play(self, worker_idx: int, start_state: np.ndarray, clear: bool = True) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: if clear: self.clear(worker_idx) # Current state of the game, this will be updated during play state = start_state.copy() # Return Buffers stat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play(self, test_ep=0., n_step=10000, n_episode=1000):\n\n # If not training, clear log of old data, initialize TF variables, and load model.\n if self.stat and not self.is_train:\n tf.initialize_all_variables().run()\n self.stat.load_model()\n\n self.target_network.ru...
[ "0.6878473", "0.66031724", "0.656003", "0.656003", "0.6303272", "0.6168578", "0.60849535", "0.60476965", "0.60294855", "0.60185343", "0.60173064", "0.5983644", "0.5956759", "0.5955803", "0.5936548", "0.5914538", "0.5909551", "0.5909531", "0.5895501", "0.5887614", "0.585641", ...
0.0
-1