query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Normalize featurex in x Uses convolution operator
def normalize_conv(self, x): x = self.normalize_global(x) if self.right_context is None and self.left_context is None: return x if self.left_context is None: left_context = x.shape[0] else: left_context = self.left_context if self.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def featureNormalization(X):\n mean=np.hstack(np.mean(X[:,0]),np.mean(X[:,1]),np.mean(X[:,2]))\n std=np.hstack(np.std(X[:,0]),np.std(X[:,1]),np.std(X[:,2]))\n \n X_norm = (X - mean)/std\n \n return X_norm", "def featureNormalize(X):\n\n mu = np.mean(X, axis=0)\n sigma = np.std(X, axis=0)\...
[ "0.7001014", "0.6958568", "0.6947279", "0.6911823", "0.68875635", "0.688526", "0.68802506", "0.67933905", "0.6703754", "0.6662799", "0.6658532", "0.66394544", "0.65971243", "0.6586872", "0.6554928", "0.655141", "0.6546741", "0.6542242", "0.65421134", "0.6541674", "0.6541674",...
0.747153
0
Normalize featurex in x Uses cumsum
def normalize_cumsum(self, x): x = self.normalize_global(x) if self.right_context is None and self.left_context is None: return x if self.left_context is None: left_context = x.shape[0] else: left_context = self.left_context if self.right_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalizeFeatureVector(self):\n # Normalize features\n total = 0.0\n for v in self.features.values(): total += abs(v)\n if total == 0.0: \n total = 1.0\n for k,v in self.features.iteritems():\n self.features[k] = float(v) / total", "def normalize(self,...
[ "0.6832469", "0.6690539", "0.6601666", "0.6567487", "0.6520064", "0.6463737", "0.6463737", "0.6457855", "0.64390934", "0.64250743", "0.64143485", "0.64006764", "0.63584495", "0.63248", "0.62188417", "0.6214726", "0.6194945", "0.6157462", "0.61206234", "0.6100991", "0.60978", ...
0.71182775
0
Get the version attribute from an HDF5 file dataset
def get_version(self, dataset_name=None): if dataset_name is None: return self._version else: # resolve dataset name dataset = self.__getitem__(dataset_name) try: # dataset can be either an HDF5 dataset or numpy.ndarray vers...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_version(self, version, dataset_name=None):\n if dataset_name is None:\n self._version = version\n return self._version\n\n # resolve dataset name\n dataset = self.__getitem__(dataset_name)\n if dataset is None:\n raise KeyError(\"Dataset %s does ...
[ "0.62416416", "0.6132358", "0.60425794", "0.60321635", "0.60267454", "0.59994763", "0.5996349", "0.5956318", "0.59558326", "0.58938944", "0.5799507", "0.57933867", "0.57784915", "0.5757647", "0.575594", "0.57504493", "0.57495874", "0.56915843", "0.56868637", "0.56811076", "0....
0.74687374
0
Set the version attribute from an HDF5 file dataset Provide a portable way to set the global schema version or the version of a specific dataset.
def set_version(self, version, dataset_name=None): if dataset_name is None: self._version = version return self._version # resolve dataset name dataset = self.__getitem__(dataset_name) if dataset is None: raise KeyError("Dataset %s does not exist" % d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_version(self, version):\n self._metadata['version'] = version\n\n if self._type == '.json':\n with open(self._filename, 'w') as f:\n f.write(json.dumps(self._metadata, indent=2))\n\n dof_filename = os.path.join(self.path, self.name + '.dof')\n if os....
[ "0.6301009", "0.6152109", "0.5982696", "0.58730686", "0.5677768", "0.56389517", "0.56382006", "0.5544754", "0.55337244", "0.5522617", "0.54995793", "0.54979336", "0.54815686", "0.54782933", "0.54554266", "0.5445918", "0.5419565", "0.5405056", "0.5396554", "0.5391516", "0.5381...
0.7403423
0
Get the column names of an h5lmt dataset
def _get_columns_h5lmt(self, dataset_name): dataset = self.__getitem__(dataset_name) orig_dataset_name = dataset_name.lstrip('/') dataset_name = dataset.name.lstrip('/') if dataset_name == 'MDSOpsGroup/MDSOpsDataSet' and orig_dataset_name != dataset_name: return numpy.array([...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataset_headers(dataset):\n return list(dataset.columns.values)", "def column_names(self):\n return self.data.columns.values", "def get_grid_names(fname):\r\n with h5py.File(fname, 'r') as f:\r\n vnames = [k for k in f.keys() if f[k].ndim == 2]\r\n return vnames", "def printAllColu...
[ "0.72392476", "0.6839041", "0.6669447", "0.6599707", "0.6541439", "0.6489346", "0.64400506", "0.6324311", "0.62254834", "0.62129956", "0.6196603", "0.61897725", "0.6180919", "0.6180919", "0.6136875", "0.61191624", "0.6101461", "0.6051285", "0.60433984", "0.6043134", "0.600245...
0.70566535
1
Cache or calculate the timestep for a dataset
def get_timestep(self, dataset_name, timestamps=None): if dataset_name not in self._timesteps: if timestamps is None: timestamps = self.get_timestamps(dataset_name)[0:2] self._timesteps[dataset_name] = timestamps[1] - timestamps[0] return self._timesteps[dataset_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_time_step():\n\n dt = Hydro.compute_time_step()\n\n return dt", "def timeStep(self):\n return self.params['h']", "def time_step(self):\n return self._time_step", "def time_step(self) -> float:\n return self._timestep", "def ntimestep(self):\n if self._ntimestep i...
[ "0.68056685", "0.6197205", "0.61664444", "0.61242294", "0.6024762", "0.6024098", "0.6019428", "0.59897035", "0.5952691", "0.59042937", "0.583655", "0.5777142", "0.5762552", "0.5736868", "0.57018983", "0.569628", "0.56816363", "0.5672008", "0.56670314", "0.56577533", "0.564930...
0.6729556
1
Return timestamps dataset corresponding to given dataset name This method returns a dataset, not a numpy array, so you can face severe performance penalties trying to iterate directly on the return value! To iterate over timestamps, it is almost always better to dereference the dataset to get a numpy array and iterate ...
def get_timestamps(self, dataset_name): return get_timestamps(self, dataset_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_timeseries(self, dataset_name, light=False):\n timeseries = tokio.timeseries.TimeSeries()\n timeseries.dataset_name = dataset_name\n\n try:\n dataset = self[dataset_name]\n except KeyError:\n # can't attach because dataset doesn't exist; pass this back to ca...
[ "0.65763235", "0.62229455", "0.6188971", "0.61169475", "0.609614", "0.6072521", "0.5950156", "0.5916501", "0.5862984", "0.585179", "0.5825536", "0.58060277", "0.57536995", "0.57235116", "0.5684953", "0.56650066", "0.5656442", "0.5648486", "0.5628166", "0.5624232", "0.55767566...
0.7672565
0
Return the FSMissingGroup dataset from an H5LMT file Encodes a hot mess of hacks to return something that looks like what `get_missing()` would return for a real dataset.
def _get_missing_h5lmt(self, dataset_name, inverse=False): dataset = self.__getitem__(dataset_name) missing_dataset = self.get('/FSMissingGroup/FSMissingDataSet') if len(dataset.shape) == 1: result = numpy.zeros((dataset.shape[0], 1), dtype=numpy.int8) elif dataset.shape == m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unknowns(self):\n cr = CaseReader(self.filename)\n last_case = cr.get_case(-1)\n last_case_id = cr.list_cases()[-1]\n with h5py.File(self.filename, 'r') as f:\n for key in f[last_case_id]['Unknowns'].keys():\n val = f[last_case_id]['Unknowns'][key][()]...
[ "0.5405403", "0.5272365", "0.51956326", "0.51813143", "0.51290506", "0.51161104", "0.51061404", "0.5078639", "0.5072669", "0.50722384", "0.50722384", "0.5068671", "0.5047558", "0.5043016", "0.5025955", "0.50164866", "0.50073695", "0.49746954", "0.49742365", "0.49636933", "0.4...
0.64077026
0
Convert a dataset into a dataframe via H5LMT native schema
def _to_dataframe_h5lmt(self, dataset_name): normed_name, modifier = reduce_dataset_name(dataset_name) if not modifier: normed_name = dataset_name.lstrip('/') else: normed_name = normed_name.lstrip('/') col_header_key = H5LMT_COLUMN_ATTRS.get(normed_name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def h5ToDf(filename):\n log.info(f\"Import data from: {filename}\")\n with h5py.File(filename, \"r\") as hf :\n d = {}\n for name in list(hf.keys()):\n d[name] = np.array(hf[name][:])\n df = pd.DataFrame(data=d)\n return(df)", "def h5ToDf(filename):\n log.info(f\"Impor...
[ "0.7143555", "0.7143555", "0.7048276", "0.67303795", "0.6392127", "0.6344469", "0.62888217", "0.6245664", "0.6230337", "0.62290436", "0.61946446", "0.61645913", "0.61239225", "0.611539", "0.6056494", "0.6012412", "0.60102594", "0.59969115", "0.599295", "0.5991492", "0.5972420...
0.7532569
0
Creates a TimeSeries representation of a dataset Create a TimeSeries dataset object with the data from an existing HDF5 dataset. Responsible for setting timeseries.dataset_name, timeseries.columns, timeseries.dataset, timeseries.dataset_metadata, timeseries.group_metadata, timeseries.timestamp_key
def to_timeseries(self, dataset_name, light=False): timeseries = tokio.timeseries.TimeSeries() timeseries.dataset_name = dataset_name try: dataset = self[dataset_name] except KeyError: # can't attach because dataset doesn't exist; pass this back to caller so it c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_datasets(self, dataset_names, columns):\n for dataset_name in dataset_names:\n hdf5_dataset_name = self.schema.get(dataset_name)\n if hdf5_dataset_name is None:\n warnings.warn(\"Skipping %s (not in schema)\" % dataset_name)\n else:\n s...
[ "0.66837883", "0.6682503", "0.66262865", "0.6564524", "0.65194076", "0.6270985", "0.6240489", "0.6212664", "0.6193296", "0.61755055", "0.6172306", "0.6065922", "0.6015418", "0.5992854", "0.5972118", "0.5956499", "0.5909353", "0.58855987", "0.58850574", "0.5875654", "0.5855839...
0.6987109
0
Given new timestamps and an existing series of timestamps, find the indices overlap so that new data can be inserted into the middle of an existing dataset
def get_insert_indices(my_timestamps, existing_timestamps): existing_timestep = existing_timestamps[1] - existing_timestamps[0] my_timestep = my_timestamps[1] - my_timestamps[0] # make sure the time delta is ok if existing_timestep != my_timestep: raise Exception("Existing dataset has different...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matching_time_indices(stamps_1, stamps_2, max_diff=0.01, offset_2=0.0):\n matching_indices = []\n stamps_2 = copy.deepcopy(stamps_2)\n stamps_2 += offset_2\n for stamp in stamps_1:\n diffs = np.abs(stamps_2 - stamp)\n argmin = np.argmin(diffs)\n if diffs[argmin] <= max_diff:\n ...
[ "0.7072352", "0.60652965", "0.6010271", "0.6009399", "0.5942639", "0.59273934", "0.5910188", "0.58947986", "0.57909936", "0.5788388", "0.56203854", "0.56187886", "0.5588447", "0.55560046", "0.55394334", "0.5524071", "0.55121887", "0.5487693", "0.5475373", "0.54752785", "0.546...
0.7164443
0
Generates new tile (either 2 or 4) in empty tile (val=0) returns True if there are no empty tiles, returns False
def genNewTile(self): # Find which tiles are empty emptyList = [] for i in range(4): for j in range(4): tileKey = 4*i + j if self.isTileEmpty(i, j): emptyList.append(tileKey) # If there's no empty tiles, return false ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_tile(self):\n two_or_four = random.random();\n if two_or_four < 0.9:\n value = 2\n else:\n value = 4\n empty = False\n all_cells = 0\n while empty == False:\n all_cells += 1 \n row = random.choice(range(self._height))\n ...
[ "0.77199364", "0.7705852", "0.7643477", "0.74754184", "0.74417657", "0.73738", "0.73584956", "0.732259", "0.7283175", "0.7268269", "0.71189415", "0.70368147", "0.69459987", "0.69384986", "0.693621", "0.69070476", "0.6903651", "0.6902501", "0.67619956", "0.67570543", "0.673717...
0.8566022
0
Slides tile[i,j] in given direction until it hits another tile or the wall if it hits another tile theat's the same, they combine.
def slideTile(self, i, j, direct): tile = self.getTile(i,j) if direct==Move.UP: # if the direction is up iRange = list(range(i - 1, -1, -1)) # list the squares above i,j jRange = [j]*len(iRange) # in iRange,jRange elif direct==Move.DO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self, direction):\n # replace with your code\n for start_cell in self._directions[direction]:\n temp_list = []\n for step in range(self._height):\n temp_list.append(self.get_tile(start_cell[0] + step * OFFSETS[direction][0], start_cell[1] + step * OFFSETS...
[ "0.63548803", "0.6264339", "0.611938", "0.60902923", "0.6072351", "0.5913068", "0.5899172", "0.58917207", "0.5845971", "0.5822954", "0.5770947", "0.5742559", "0.5675266", "0.5652263", "0.5648763", "0.5626357", "0.56217366", "0.54647565", "0.54617625", "0.54331356", "0.542682"...
0.77153933
0
calculate_mil_hdbk_217f_part_count() should return an error message when the subcategory ID is missing.
def test_calculate_mil_hdbk_217f_part_count_missing_subcategory(): ATTRIBUTES['subcategory_id'] = 0 ATTRIBUTES['type_id'] = 1 ATTRIBUTES['quality_id'] = 1 _attributes, _msg = Connection.calculate_217f_part_count(**ATTRIBUTES) assert isinstance(_attributes, dict) assert _msg == ('RAMSTK WARNING...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_calculate_mil_hdbk_217f_part_count_missing_type():\n ATTRIBUTES['subcategory_id'] = 1\n ATTRIBUTES['type_id'] = 0\n ATTRIBUTES['quality_id'] = 1\n\n _attributes, _msg = Connection.calculate_217f_part_count(**ATTRIBUTES)\n\n assert isinstance(_attributes, dict)\n assert _msg == ('RAMSTK W...
[ "0.77790284", "0.7428882", "0.7272342", "0.62895495", "0.6044478", "0.5830861", "0.57197976", "0.5630708", "0.56203777", "0.5600136", "0.549876", "0.547893", "0.54551303", "0.5293024", "0.52531815", "0.52061087", "0.5192283", "0.51816136", "0.51679295", "0.5159145", "0.514611...
0.8395305
0
calculate_mil_hdbk_217f_part_count() should return an error message when the type ID is missing and needed.
def test_calculate_mil_hdbk_217f_part_count_missing_type(): ATTRIBUTES['subcategory_id'] = 1 ATTRIBUTES['type_id'] = 0 ATTRIBUTES['quality_id'] = 1 _attributes, _msg = Connection.calculate_217f_part_count(**ATTRIBUTES) assert isinstance(_attributes, dict) assert _msg == ('RAMSTK WARNING: Base ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_calculate_mil_hdbk_217f_part_count_missing_subcategory():\n ATTRIBUTES['subcategory_id'] = 0\n ATTRIBUTES['type_id'] = 1\n ATTRIBUTES['quality_id'] = 1\n\n _attributes, _msg = Connection.calculate_217f_part_count(**ATTRIBUTES)\n\n assert isinstance(_attributes, dict)\n assert _msg == ('R...
[ "0.7765009", "0.7551046", "0.70483583", "0.6431075", "0.6211223", "0.58158875", "0.57131565", "0.56473655", "0.5562129", "0.5535393", "0.5494476", "0.54905933", "0.54770267", "0.5459114", "0.54572916", "0.53880715", "0.5373725", "0.53553927", "0.5353308", "0.5337825", "0.5337...
0.8425449
0
calculate_mil_hdbk_217f_part_count() should return an error message when the active environment ID is missing.
def test_calculate_mil_hdbk_217f_part_count_missing_environment(): ATTRIBUTES['subcategory_id'] = 1 ATTRIBUTES['type_id'] = 1 ATTRIBUTES['environment_active_id'] = 100 ATTRIBUTES['quality_id'] = 1 _attributes, _msg = Connection.calculate_217f_part_count(**ATTRIBUTES) assert isinstance(_attribu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_calculate_mil_hdbk_217f_part_count_missing_type():\n ATTRIBUTES['subcategory_id'] = 1\n ATTRIBUTES['type_id'] = 0\n ATTRIBUTES['quality_id'] = 1\n\n _attributes, _msg = Connection.calculate_217f_part_count(**ATTRIBUTES)\n\n assert isinstance(_attributes, dict)\n assert _msg == ('RAMSTK W...
[ "0.80005944", "0.7928446", "0.71682566", "0.63611627", "0.59827584", "0.5918756", "0.5715912", "0.5701705", "0.5700001", "0.5646414", "0.56444186", "0.5602938", "0.5587165", "0.55460465", "0.5541681", "0.55189186", "0.5459585", "0.54094356", "0.54054445", "0.5361951", "0.5285...
0.8433559
0
calculate_mil_hdbk_217f_part_stress() should return a dictionary of updated values on success.
def test_calculate_mil_hdbk_217f_part_stress(): ATTRIBUTES['hazard_rate_method_id'] = 2 ATTRIBUTES['environment_active_id'] = 3 ATTRIBUTES['subcategory_id'] = 1 ATTRIBUTES['type_id'] = 1 ATTRIBUTES['specification_id'] = 1 ATTRIBUTES['temperature_active'] = 32.0 ATTRIBUTES['quality_id'] = 2 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_217f_part_stress(**attributes): # pylint: disable=R0912, R0914\n _dic_ref_temp = {\n 1: 343.0,\n 2: {\n 1: 343.0,\n 2: 343.0,\n 3: 398.0,\n 4: 398.0\n },\n 3: 298.0,\n 5: 398.0,\n 6: 298.0,\n 7: 298.0,\n ...
[ "0.7384861", "0.5954882", "0.584901", "0.5771176", "0.5724177", "0.5674415", "0.5631516", "0.54941267", "0.54369915", "0.53917396", "0.53193885", "0.53128684", "0.5287413", "0.52593803", "0.5256924", "0.5252032", "0.52132815", "0.519272", "0.51898295", "0.5179746", "0.5155998...
0.7128509
1
Test the calculate_insert_temperature() function.
def test_calculate_insert_temperature(): ATTRIBUTES['subcategory_id'] = 1 ATTRIBUTES['current_operating'] = 2.65 ATTRIBUTES['contact_gauge'] = 20 _attributes = Connection.do_calculate_insert_temperature(**ATTRIBUTES) assert isinstance(_attributes, dict) assert pytest.approx(_attributes['temper...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_store_temperature(self):\n timestamp = datetime.datetime(\n 2016, 7, 23, 10, 51, 9, 928000, tzinfo=pytz.utc)\n temperature = 21.1\n mock_cursor = mock.Mock()\n store = db_store.TemperatureStore(mock_cursor)\n store.store_temperature(timestamp, temperature)\n ...
[ "0.76219624", "0.66773856", "0.6617106", "0.657196", "0.6491968", "0.64831626", "0.6375222", "0.6360685", "0.6313509", "0.6300823", "0.620122", "0.6118299", "0.6116886", "0.60959363", "0.60889196", "0.60804313", "0.6051325", "0.6025685", "0.6024754", "0.5979038", "0.5968049",...
0.8078616
0
overstressed() should return True when active temperature is within 10C of rated temperature in a harsh environment and False otherwise.
def test_temperature_overstress_harsh_environment(temperature_active, environment_active_id): ATTRIBUTES['voltage_rated'] = 40.0 ATTRIBUTES['voltage_ac_operating'] = 0.005 ATTRIBUTES['voltage_dc_operating'] = 10.0 ATTRIBUTES['temperature_rated_max'] = 12...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_high_temp(self):\n status = self.get_status_response()\n return ((status[1] & 0x20) == 0x20)\n #end is_power_limited()", "def is_heating(self) -> bool:\r\n self._logger.debug(log_message_formatter(\r\n \"get\", f\"{self}\", \"is_heating\"))\r\n return (self._a...
[ "0.6756321", "0.6546203", "0.6312019", "0.62715244", "0.61742234", "0.6141289", "0.6100559", "0.6080527", "0.5978337", "0.5914961", "0.5908283", "0.5899085", "0.5891543", "0.5788742", "0.5737176", "0.57143235", "0.56663424", "0.5660556", "0.56551176", "0.5653711", "0.5647905"...
0.6774686
0
Quick Select algorithm This is basically a modified quicksort algorithm to find kth largest/smallest element.
def quick_select(arr: list, k: int) -> int: start, end = 0, len(arr) - 1 while start <= end: pivot = randint(start, end) arr[pivot], arr[end] = arr[end], arr[pivot] # important in case of random pivot pivot = end i, j = start - 1, start while j < end: if ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quick_select(lst, k):\n if lst != []:\n pivot = lst[(len(lst)//2)]\n smallerlist = []\n largerlist = []\n count = 0\n for i in range(0,len(lst)):\n if lst[i] == pivot:\n count += 1\n elif lst[i] < pivot:\n smallerlist.app...
[ "0.8119777", "0.79877746", "0.78890777", "0.78225964", "0.7486998", "0.7414676", "0.6941773", "0.68768364", "0.682346", "0.6805021", "0.67767894", "0.66897416", "0.6661307", "0.65881485", "0.65717554", "0.6544481", "0.6535568", "0.65219456", "0.6476873", "0.6452643", "0.64378...
0.809842
1
Preprocess the raw iris data.
def preprocess_iris(self): print('[ INFO ]: Preprocessing iris data...') # Rename headers of data frame iris_data = pd.read_csv(self.iris_path, header=None) iris_data.columns = ['sepal_length','sepal_width','petal_length','petal_width', 'iris_class'] df_columns = [iris_data.co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_data(self):\n\n self._preprocess_train_data()\n self._preprocess_test_data()", "def preprocess(data):\n raise NotImplementedError", "def preprocess_data(X):\n # NOTE: # If you have conducted any pre-processing on the image,\n # please implement this function to apply onto ...
[ "0.7421892", "0.73782796", "0.71080923", "0.6955228", "0.6939069", "0.68282217", "0.6787369", "0.67452693", "0.67069346", "0.6697186", "0.6696623", "0.6678541", "0.6678541", "0.6678541", "0.66598964", "0.6657938", "0.6629379", "0.66273135", "0.6597975", "0.6564123", "0.656408...
0.77570486
0
Execute the program runner over the iris dataset.
def iris_runner(self): print('[ INFO ]: Initializing the iris program runner...') data, features, classes = self.preprocess_iris() iris = alg() selected_features, selected_clusters, basePerformance = iris.stepwise_forward_selection(data, features, len(classes)) return selected...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n print('Retrieving iris data from servers...', end='')\n iris_data = sklearn.datasets.load_iris()\n print('done')\n sys.stdout.flush()\n\n X = iris_data['data']\n Y = [iris_data['target_names'][label] for label in iris_data['target']]\n\n examples = [{'id': 'EXAMPLE_{}'.format(i),...
[ "0.709067", "0.70287454", "0.65261036", "0.6488195", "0.64578766", "0.64085656", "0.64014155", "0.63960904", "0.6391269", "0.63898265", "0.6342316", "0.6315404", "0.627279", "0.6270482", "0.6241478", "0.61836636", "0.6161432", "0.6149055", "0.6145847", "0.61287856", "0.612802...
0.7538364
0
process pred data for voc
def voc_pred_process(pred_data, val_cls, recs): num_classes = config.num_classes cls_img_ids = {} cls_bboxes = {} cls_scores = {} classes = {} cls_npos = {} for cls in val_cls: if cls == 'background': continue class_recs = {} npos = 0 for imagename...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _postprocess(self, preds):\n ntok = preds.pop(\"ntok\")\n ids = preds.pop(\"input_ids\")[:ntok]\n preds[\"tokens\"] = self._detokenize(ids)\n\n # Decode predicted top-k tokens.\n # token_topk_preds will be a List[List[(word, prob)]]\n # Initialize prediction for 0th token as N/A.\n token_t...
[ "0.6588032", "0.6408021", "0.6372262", "0.63347125", "0.6306381", "0.6263748", "0.6167508", "0.6096504", "0.6093882", "0.6053253", "0.6043406", "0.60269785", "0.60160464", "0.5968107", "0.59524506", "0.5949088", "0.593739", "0.59267086", "0.590351", "0.5903409", "0.5902041", ...
0.6925866
0
Fetches an image from the webcam
def get_from_webcam(self): print "try fetch from webcam..." stream=urllib.urlopen('http://192.168.0.20/image/jpeg.cgi') bytes='' bytes+=stream.read(64500) a = bytes.find('\xff\xd8') b = bytes.find('\xff\xd9') if a != -1 and b != -1: jpg = bytes[a:b+2]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_from_webcam():\n print \"try fetch from webcam...\"\n stream=urllib.urlopen('http://192.168.0.20/image/jpeg.cgi')\n bytes=''\n bytes+=stream.read(64500)\n a = bytes.find('\\xff\\xd8')\n b = bytes.find('\\xff\\xd9')\n\n if a != -1 and b != -1:\n jpg = bytes[a:b+2]\n bytes=...
[ "0.7827291", "0.76451534", "0.7485317", "0.7398917", "0.73532814", "0.7327935", "0.723286", "0.71116555", "0.7085131", "0.69627434", "0.69531965", "0.6927045", "0.69184226", "0.6917829", "0.68581426", "0.679654", "0.67718625", "0.67500067", "0.6721516", "0.66741693", "0.66704...
0.8029526
0
For each contour in contours approximate the contours such that small variations are removed calulate the area of the contour if the area is within the desired range we append the box points to the bricks.
def get_bricks(self, contours): bricks = [] for cnt in contours: epsilon = 0.04*cv2.arcLength(cnt,True) approx = cv2.approxPolyDP(cnt,epsilon,True) if len(approx) >= 4: rect = cv2.minAreaRect(approx) area = cv2.contourArea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geometric_area_filtering(boxes, divider):\n correct_boxes = []\n mx = -1\n for box in boxes:\n polygon = Polygon([box.x0, box.x1, box.x2, box.x3])\n if polygon.area > mx:\n mx = polygon.area\n for box in boxes:\n polygon = Polygon([box.x0, box.x1, box.x2, box.x3])\n ...
[ "0.6179232", "0.60534996", "0.60341394", "0.5964177", "0.5951638", "0.5912081", "0.59034485", "0.57786894", "0.5738673", "0.5724003", "0.5695245", "0.5653011", "0.56505156", "0.564354", "0.5601445", "0.55871683", "0.5569139", "0.5550918", "0.55442214", "0.5501987", "0.5492682...
0.6861748
0
Extract the contours of the image by first converting it to grayscale and then call findContours
def contours(self, image,debug=False): imgray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY) if debug: cv2.imwrite('debug_pics/gray_scale_contour.jpg',imgray) # cv2.imshow('gray_scale_contour',imgray) im2, contours, hierarchy = cv2.findContours(imgray,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocessing(self, img):\n [a, contours, c] = cv2.findContours(img, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)\n return contours", "def get_contours(image):\n assert len(image.shape) == 2, 'Image should be binary'\n contour_image = image.copy()\n contour_image[contour_image == 1] = 255\n...
[ "0.78187734", "0.7661035", "0.7589499", "0.75295717", "0.7386969", "0.7378125", "0.73394626", "0.73241246", "0.72412294", "0.7207451", "0.7201522", "0.7187535", "0.71175456", "0.71082413", "0.7089867", "0.70871", "0.7048233", "0.7039752", "0.703097", "0.70194477", "0.698676",...
0.8015258
0
Main methods for processing an image and detect rectangles in the given hsv color range set debug to True in order to show the intermediate images
def do_full(self, image,hsv,upper,lower,debug=False): single_color_img = self.extract_single_color_range(image,hsv,lower,upper) if debug: # cv2.imshow('single_color_img',single_color_img) cv2.imwrite('debug_pics/single_color_img.jpg',single_color_img) single_channel = sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def color_segmentation(self):\n cv.namedWindow(\"Segmentation parameters\")\n self.create_trackbar(\"h-u\", \"Segmentation parameters\")\n self.create_trackbar(\"h-l\",\"Segmentation parameters\")\n self.create_trackbar(\"s-u\",\"Segmentation parameters\")\n self.create_trackbar(...
[ "0.696143", "0.6401711", "0.6373562", "0.6301263", "0.6265845", "0.6176286", "0.6054084", "0.6040024", "0.6017521", "0.60081893", "0.6006654", "0.59735584", "0.5952983", "0.59478396", "0.5922244", "0.58953005", "0.5884164", "0.5851137", "0.582648", "0.58227485", "0.5819431", ...
0.6962819
0
Calculates Laplace(f), using the inverse metric g_inv, the determinant of the metric g_det, all in variables X.
def laplace(f, g_inv, g_det, X): r = 0 for i in range(len(X)): for j in range(len(X)): r += g_inv[i, j]*f.diff(X[i]).diff(X[j]) for sigma in range(len(X)): for alpha in range(len(X)): r += g_det.diff(X[sigma]) * g_inv[sigma, alpha] * \ f.diff(X[alpha])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_laplace():\n f = np.asarray([\n [0.99, 1.0, 0.5],\n [0.69, 0.6, 0.6]])\n R = common_metrics.laplace(f, maximise=True)\n expected = np.asarray(\n [0.83, 0.63])\n assert np.allclose(R, expected)\n R = common_metrics.laplace(f, maximise=False)\n expected = np.asarray(\n...
[ "0.64064103", "0.6297081", "0.6274002", "0.6263391", "0.6242661", "0.62282777", "0.61210316", "0.5967666", "0.5862251", "0.5788763", "0.57770044", "0.5719663", "0.57003623", "0.5660094", "0.56073123", "0.5557608", "0.5544218", "0.5538814", "0.5485621", "0.5401206", "0.5354963...
0.79890525
0
Transforms from cartesian coordinates X to any curvilinear coordinates Y. It printing useful information, like Jacobian, metric tensor, determinant of metric, Laplace operator in the new coordinates, ... g_correct ... if not None, it will be taken as the metric this is useful if sympy's trigsimp() is not powerful enoug...
def transform(name, X, Y, *, g_correct=None, recursive=False): print("_"*80) print("Transformation:", name) for x, y in zip(X, Y): pprint(Eq(y, x)) J = X.jacobian(Y) print("Jacobian:") pprint(J) g = J.T*eye(J.shape[0])*J g = g.applyfunc(expand) print("metric tensor g_{ij}:")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform(self, X, y=None):\n return super().transform(X, y)", "def transform(self, X, y=None):\n return super().transform(X, y)", "def transform(self, x, y):\n # return self.transform_2D(x, y)\n return self.transform_perspective(x, y)", "def transform(self, X, y=None):\n\n ret...
[ "0.52566093", "0.52566093", "0.5220973", "0.5089404", "0.5089404", "0.49982306", "0.49911278", "0.49351227", "0.49199647", "0.49117693", "0.49009869", "0.48878467", "0.48503932", "0.4850297", "0.4845579", "0.48407027", "0.4806407", "0.47740543", "0.47578695", "0.4748493", "0....
0.60966045
0
Parse the list of files to be downloaded, and store the parsed list in file_list
def parse_file_list(self, file_path=None, file_name_id='Producer Granule ID', url_id='Online Access URLs'): # read in and maintain the raw csv file as df df = pd.read_csv(file_path) # record the number of files self.file_num = df.__len__() # initiate the data frame sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_list(self):\n try:\n for filename in os.listdir(SHARED_DIR):\n self.file_list.append(filename)\n except Exception as e:\n print \"Error: retriving file list, %s\" % e", "def download_file_list(self, limit=None, test_page='https://www.google.com'):\n...
[ "0.6634947", "0.66294754", "0.6588218", "0.65680903", "0.6527309", "0.64246124", "0.6423928", "0.6388754", "0.6381681", "0.6351323", "0.6306409", "0.6305285", "0.6262373", "0.62578475", "0.625636", "0.6251173", "0.62471753", "0.62363446", "0.6236343", "0.6228881", "0.62274766...
0.6931189
0
Download the list of files, given that the csv list of files have been parsed
def download_file_list(self, limit=None, test_page='https://www.google.com'): # test csv file parsing if self.file_list is None: raise NoFileListProvided() # test Internet connection try: urllib.request.urlopen(test_page, timeout=2) except urllib.request....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_files(self):", "def download_files(valid_links: list) -> list:\n print('Starting process...')\n print('')\n\n year_month_filepath = []\n\n for link_info in valid_links:\n\n # Get file extension\n extension = link_info[0].split('.')[-1]\n\n # Link to download\n ...
[ "0.7131704", "0.67974687", "0.66485363", "0.66200274", "0.65845114", "0.6547753", "0.6500131", "0.6495944", "0.64852464", "0.6441919", "0.64127886", "0.63451385", "0.6319795", "0.6298241", "0.629731", "0.6291227", "0.62871563", "0.6274597", "0.62631905", "0.62613964", "0.6258...
0.6831913
1
LNPay module initialization function required for interacting with the LNPay API.
def initialize(public_api_key, default_wak=None, params=None): if params is None: params = {} print('initializing lnpay..') global __VERSION__ global __PUBLIC_API_KEY__ global __ENDPOINT_URL__ global __DEFAULT_WAK__ __VERSION__ = 'py' + __version__ __PUBLIC_API_KEY__ = public...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._ll = LowLevelLibs()\n self._lib = self._ll.pythia", "def initialize(self):\n global VERSION_DATE\n\n data = self._request.getData()\n pyhttp = self._request.getHttp()\n config = self._request.getConfiguration()\n\n data[\"pyblosxom_vers...
[ "0.6154277", "0.61001724", "0.6054132", "0.6024553", "0.5988483", "0.5988483", "0.5922967", "0.58868134", "0.5761735", "0.5758438", "0.57558525", "0.56707066", "0.5660591", "0.5646594", "0.56424695", "0.5636701", "0.5632077", "0.56191194", "0.55972165", "0.55972165", "0.55972...
0.7036206
0
Implements fast multifile find and replace. Given an |original| string and a |replacement| string, find matching files by running git grep on |original| in files matching any pattern in |file_globs|. Once files are found, |re.sub| is run to replace |original| with |replacement|. |replacement| may use capture group back...
def MultiFileFindReplace(original, replacement, file_globs): # Posix extended regular expressions do not reliably support the "\s" # shorthand. posix_ere_original = re.sub(r"\\s", "[[:space:]]", original) if sys.platform == 'win32': posix_ere_original = posix_ere_original.replace('"', '""') out, err = sub...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def substitute(files: str, pattern: str, replacement: str):\n with fileinput.input(\n files=glob.glob(files, recursive=True), inplace=True\n ) as file:\n for line in file:\n print(re.sub(pattern, replacement, line), end='')", "def ReplaceInFiles(paths, subs):\n for path in paths:\...
[ "0.6340841", "0.5749575", "0.57493734", "0.5454545", "0.53997403", "0.52976716", "0.5259832", "0.5253908", "0.5240462", "0.52327704", "0.52273464", "0.5196495", "0.5152803", "0.51405317", "0.5137571", "0.51317704", "0.5103747", "0.5099597", "0.50637054", "0.50498545", "0.5040...
0.8400449
0
returns number of common characters between two strings
def commonCharacterCount(s1, s2): return sum(min(s1.count(x),s2.count(x)) for x in set(s1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_characters(s1: str, s2: str) -> int:\n\n # s1 and s2 are accessible\n\n # initiliazing an empty list consisting of 26 empty slots corresponding to every alphabet (lower and upper case)\n freq1 = [0] * 26\n freq2 = [0] * 26\n\n # looping through the string s1\n for i in range(len(s1)):\n...
[ "0.800966", "0.76403654", "0.7600191", "0.75874645", "0.74726385", "0.7415083", "0.73708755", "0.7356206", "0.73445696", "0.73059744", "0.72877365", "0.7276837", "0.72768134", "0.72388124", "0.72035867", "0.72035867", "0.7170381", "0.71561134", "0.7145151", "0.7137106", "0.70...
0.8598089
0
Fit the model using the given censored and noncensored inputs, and return predictions and probabilities.
def naive_fit(censored_inputs, noncensored_inputs, initialize): censored_inputs = censored_inputs[ :, 1: ] # To feed into scikit learn, we omit the unnecessary leading 1's. noncensored_inputs = noncensored_inputs[:, 1:] n_noncens = len(noncensored_inputs) n_cens = len(censored_inputs) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_poisson(train_factors_s, eval_factors_s, train_spikes_s, eval_spikes_s=None, alpha=0.0):\n train_in = train_factors_s if eval_spikes_s is None else np.vstack([train_factors_s, eval_factors_s])\n train_out = train_spikes_s if eval_spikes_s is None else np.vstack([train_spikes_s, eval_spikes_s])\n t...
[ "0.59389585", "0.59029716", "0.5845168", "0.5760662", "0.57252455", "0.57163966", "0.5665872", "0.5628701", "0.56263745", "0.5616551", "0.5616293", "0.5577915", "0.5576326", "0.5566659", "0.55639714", "0.55630285", "0.5561608", "0.5537759", "0.5509608", "0.55047905", "0.55013...
0.6868726
0
Bundling the flow conversion functions into a class to track a wider range of normalisation and transformation options. Note that conversions combining norm_factor+cmax, or lower_bound+cmin, may have unintended edge cases. Please combine with caution.
def __init__(self, norm_factor=None, lower_bound=None, rmax=None, rmin=None): #TODO: Enforce typing on arguments self.norm = norm_factor self.eps = lower_bound self.rmax = rmax self.rmin = rmin items = [rmax, rmin] self.inv_rad = any([False if i is None else True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self) -> None:\n self.name = \"minmaxScaler\"\n self.min = 0\n self.max = 0", "def converter(c, f):\n u, v, w, x, y = [connector() for _ in range(5)]\n multiplier(c, w, u)\n multiplier(v, x, u)\n adder(v, y, f)\n constant(x, 5)\n constant(w, 9)\n constant(y,...
[ "0.56339", "0.55140436", "0.5513656", "0.54614097", "0.539342", "0.53918165", "0.5380368", "0.5315554", "0.5289665", "0.5280117", "0.52765554", "0.5269731", "0.523385", "0.52318275", "0.52205384", "0.5200212", "0.51992685", "0.51877004", "0.51508045", "0.5150155", "0.51384044...
0.5558805
1
This function plots decision tree.
def plot_decision_tree(classifier, feature_names=None, class_names=None): fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(4, 4)) tree.plot_tree( classifier, feature_names=feature_names, class_names=class_names, rounded=True, filled=True, ) fig.show()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decision_tree(df):\n features = df[['Temperature(F)', 'Humidity(%)', 'Visibility(mi)', 'Wind_Speed(mph)',\n 'Precipitation(in)', 'Amenity', 'Bump', 'Crossing', 'Give_Way',\n 'Junction', 'No_Exit', 'Railway', 'Roundabout', 'Station', 'Stop',\n 'Traffic_Calming', 'Traffic_Signal', 'Civil_Twi...
[ "0.8264724", "0.7777769", "0.7761293", "0.7662027", "0.7634077", "0.71495396", "0.71364504", "0.6872267", "0.6851188", "0.67767745", "0.6744987", "0.6742791", "0.67203844", "0.67165804", "0.6704155", "0.6664205", "0.6644486", "0.6598917", "0.6598917", "0.65818554", "0.6557833...
0.80958647
1
This function takes a pandas dataframe, a list of numerical columns and create a list of columns that needs to be converted to categorical column if it is less than or equal to n_unique_val.
def num_to_cat_list(df, num_col_list, n_unique_val): # columns that needs to converted cols_to_convert = [] for col in num_col_list: unique_val = df[col].nunique() print(col, unique_val) if unique_val <= n_unique_val: cols_to_convert.append(col) return cols_to_conver...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infer_categorical_variables_in_place(df: pd.DataFrame):\n # infer which variables are categorical\n MAX_UNIQUE_VALUES = 10\n for column in df.columns:\n if df[column].nunique() <= MAX_UNIQUE_VALUES:\n df[column] = df[column].astype('category')", "def __create_categorical_col(self, ...
[ "0.745963", "0.7149264", "0.7120445", "0.70760703", "0.6970383", "0.6909347", "0.6766935", "0.6656278", "0.6650777", "0.6622291", "0.6622291", "0.6604648", "0.65618986", "0.6501624", "0.64483404", "0.64301884", "0.63352746", "0.63263255", "0.6257224", "0.6249298", "0.621783",...
0.78975564
0
This function calculates the confidence interval for the population mean when standard deviation is known.
def ci_mean_std_known(array, std, conf_level=95): # calculate significance level alpha = np.round((1 - conf_level / 100), 2) mean = np.mean(array) n = len(array) # calculate standard error std_error = std / np.sqrt(n) # find z critical value z_star = np.round(stats.norm.ppf(1 - alpha / 2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confidenceInterval(start,end,confidence):\n\n\tmean = 0.5*(end+start)\n\tstddev = getStdDev(0.5*(end-start), confidence)\n\n\treturn (mean,stddev)", "def ci_mean_std_unknown(array, conf_level=95):\n # calculate significance level\n alpha = np.round((1 - conf_level / 100), 2)\n # mean of the sample\n...
[ "0.7189722", "0.71272296", "0.6962448", "0.6914454", "0.6882166", "0.6815987", "0.67848796", "0.66185623", "0.66126984", "0.65101427", "0.65050197", "0.6486976", "0.63816524", "0.6380929", "0.62752855", "0.6266103", "0.62544006", "0.62422734", "0.6201593", "0.61766994", "0.61...
0.7549891
0
This function calculates the confidence interval for a population mean when the standard deviation is unknown.
def ci_mean_std_unknown(array, conf_level=95): # calculate significance level alpha = np.round((1 - conf_level / 100), 2) # mean of the sample mean = np.mean(array) # standard deviation std = np.std(array) # size of the sample n = len(array) # degrees of freedom df = n - 1 # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ci_mean_std_known(array, std, conf_level=95):\n # calculate significance level\n alpha = np.round((1 - conf_level / 100), 2)\n mean = np.mean(array)\n n = len(array)\n # calculate standard error\n std_error = std / np.sqrt(n)\n # find z critical value\n z_star = np.round(stats.norm.ppf(...
[ "0.7538571", "0.6852045", "0.6817115", "0.67218345", "0.6645797", "0.66445607", "0.65967333", "0.657363", "0.654638", "0.6469942", "0.6465091", "0.6414436", "0.6358439", "0.62987244", "0.6262952", "0.6260672", "0.6180537", "0.61620814", "0.6156442", "0.6151018", "0.60827583",...
0.751156
1
This function calculates the Confidence Interval for the difference between two means.
def ci_diff_mean_std_known(array1, array2, std1, std2, conf_level=95): # calculate significance level alpha = np.round((1 - conf_level / 100), 2) # means of samples mean1 = np.mean(array1) mean2 = np.mean(array2) # size of the samples n1 = len(array1) n2 = len(array2) # difference...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_mean_cis_differ(mean1, ci1, mean2, ci2):\n\n assert ci1 >= 0.0 and ci2 >= 0.0, 'Found negative confidence interval from bootstrapping.'\n x1 = mean1 - ci1\n y1 = mean1 + ci1\n x2 = mean2 - ci2\n y2 = mean2 + ci2\n return do_intervals_differ((x1, y1), (x2, y2))", "def confidenceInterval(s...
[ "0.7481591", "0.6877871", "0.6793342", "0.6785257", "0.649572", "0.64709365", "0.64428174", "0.63138247", "0.620401", "0.61890686", "0.6064723", "0.59944206", "0.5817804", "0.5816245", "0.58076453", "0.58061665", "0.5801175", "0.5801057", "0.57517874", "0.57517874", "0.574222...
0.70960885
1
This function calculates the confidence interval for a population proportion.
def ci_prop(p, n, conf_level=95): # calculate significance level alpha = np.round((1 - conf_level / 100), 2) # standard error std_error = np.sqrt(p * (1 - p) / n) # find the z critical value z_star = np.round(stats.norm.ppf(1 - alpha / 2), 3) # margin of error margin_of_error = np.round(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_confidence_interval(data):\n a = 1.0 * np.array(data)\n m = np.mean(a)\n std = np.std(a)\n pm = 1.96 * (std / np.sqrt(len(a)))\n return m, pm", "def confidenceInterval(start,end,confidence):\n\n\tmean = 0.5*(end+start)\n\tstddev = getStdDev(0.5*(end-start), confidence)\n\n\treturn (mea...
[ "0.6508893", "0.639346", "0.638804", "0.6352521", "0.63073725", "0.62562823", "0.62539876", "0.6225825", "0.6165775", "0.6103992", "0.6073545", "0.60363185", "0.60099113", "0.59602016", "0.5904212", "0.5887613", "0.5869475", "0.5854851", "0.5843365", "0.58110493", "0.5808328"...
0.6790471
0
This function calculates Confidence Interval for the difference in two population proportions.
def ci_diff_prop(p1, p2, n1, n2, conf_level=95): # calculate significance level alpha = np.round((1 - conf_level / 100), 2) prop_diff = p1 - p2 # find the z critical value z_star = np.round(stats.norm.ppf(1 - alpha / 2), 3) margin_of_error = z_star * (np.sqrt((p1 * (1 - p1) / n1) + (p2 * (1 - p2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_confidence_interval(self,a,b):\n\t\tk_vals,prob_vals = self.tuple_of_probabilities\n\t\tworking_indices = [i for i,v in enumerate(k_vals) if (v >= a and v<= b)]\n\t\tworking_prob_vals = [prob_vals[i] for i in working_indices]\n\t\treturn sum(working_prob_vals)", "def confidence_interval(self):\r\n ...
[ "0.640517", "0.61800444", "0.6132308", "0.6064131", "0.59797853", "0.5976771", "0.59490985", "0.5910599", "0.5906186", "0.5900102", "0.5826578", "0.5802886", "0.5569585", "0.5555584", "0.5505047", "0.5487674", "0.54656273", "0.5463146", "0.54491574", "0.53844345", "0.53474367...
0.7145907
0
This function takes a pandas date column and give some summary information between two dates.
def describe_date(date): min_date = date.min() max_date = date.max() total_months = ( pd.to_datetime(date.max()).year - pd.to_datetime(date.min()).year ) * 12 + (pd.to_datetime(date.max()).month - pd.to_datetime(date.min()).month) total_days = str(pd.to_datetime(date.max()) - pd.to_datetime(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_basic_stats_by_date(log_path, log_sheet, log_type, start_date, end_date):\n start_date = pd.to_datetime(start_date)\n end_date = pd.to_datetime(end_date)\n log_date = '{}Date'.format(log_type)\n df = create_dataframe_from_log(log_path, log_sheet, log_type)\n df[log_date] = df[log_date].apply...
[ "0.5894576", "0.58755857", "0.585744", "0.5772013", "0.57079697", "0.5684464", "0.56818116", "0.56587607", "0.5618798", "0.56076604", "0.5575749", "0.5541634", "0.55393195", "0.5515998", "0.54770017", "0.5463349", "0.54563814", "0.54358685", "0.541089", "0.53747004", "0.53652...
0.6521554
0
Given a list of words, return list with duplicates removed.
def without_duplicates(words): # initialize empty list where non duplicate words will be stored non_duplicate_words = [] # iterate over list for item in words: # if an item in list is not already in list containing duplicate words.. if item != non_duplicate_words: # append i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def without_duplicates(words):\n\n # the long way: add each item to a set through iteration\n #\n # duplicate_remover = set([])\n # for word in words:\n # duplicate_remover.add(word)\n # words = list(duplicate_remover)\n # return words\n\n # the quick version: convert to set removes dup...
[ "0.8782853", "0.80357206", "0.79982984", "0.7957965", "0.78726363", "0.7813481", "0.73638797", "0.7334073", "0.730446", "0.7295227", "0.7275074", "0.7244554", "0.7232783", "0.71240723", "0.7089221", "0.7059419", "0.7034976", "0.70081365", "0.7008079", "0.69790393", "0.6970064...
0.8540177
1
Translate phrase to pirate talk. Given a phrase, translate each word to the Piratespeak equivalent. Words that cannot be translated into Piratespeak should pass through unchanged. Return the resulting sentence.
def translate_to_pirate_talk(phrase): english_to_pirate = {"sir": "matey", "hotel": "fleabag inn", "student": "swabbie", "boy": "matey", "professor": "foul blaggart", "restaurant": "galley", "your": "yer", "excuse": "arr", "students": "swabbies", "are": "be", "restroom": "head", "my": "me", "is": "be", "man": "mate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate_to_pirate_talk(phrase):\n\n ## creates source dictionary for pirate translations\n pirate_dict = {\"sir\": \"matey\", \"hotel\": \"fleabag inn\", \"student\": \"swabbie\",\n \"man\": \"matey\", \"professor\": \"foul blaggart\",\n \"restaurant\": \"galley\", \...
[ "0.81421345", "0.79255074", "0.743007", "0.709145", "0.68250006", "0.6617237", "0.632442", "0.6244687", "0.62232274", "0.6181861", "0.60016143", "0.600124", "0.59442425", "0.5941216", "0.58954793", "0.5889972", "0.58676326", "0.58536464", "0.58353055", "0.5805738", "0.5797474...
0.7961879
1
Given list of numbers, return list of pair summing to 0. Given a list of numbers, add up each individual pair of numbers. Return a list of each pair of numbers that adds up to 0.
def get_sum_zero_pairs(numbers): # use set to remove duplicates from list, and listize the set numbers = list(set(numbers)) # list where pairs that sum to zero will go sum_zero_pairs = [] # use enumerate to get item indexes for index, item in enumerate(numbers): # start second iterati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sum_zero_pairs(numbers):\n numbers = set(numbers)\n numbers = list(numbers)\n pairs_that_add_to_zero = []\n\n for i, item in enumerate(numbers):\n if numbers[i] == len(numbers):\n break\n\n if numbers[i] == 0:\n pairs_that_add_to_zero.append([0, 0]) \n\n ...
[ "0.8536479", "0.75723654", "0.75510067", "0.63915706", "0.638892", "0.6212343", "0.62008375", "0.61706585", "0.6158872", "0.6149037", "0.61452645", "0.61306053", "0.610505", "0.6100116", "0.605187", "0.6027694", "0.6022084", "0.59631264", "0.59343916", "0.59168124", "0.589817...
0.84713465
1
Displays the explained variance score
def explained_variance_score(self): print('Explained variance score: ' + str(explained_variance_score(self.model.dataset.get_y_test(), self.model.get_predicted())))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def explained_variance(returns, values):\n exp_var = 1 - torch.var(returns - values) / torch.var(returns)\n return exp_var.item()", "def display_scores(scores):\n\n\t#print(\"\\t\\t\\tScores: \", list(scores))\n\tprint(\"\\t\\t\\tMean: \", scores.mean())\n\tprint(\"\\t\\t\\tStandard Deviation: \", scores.s...
[ "0.6666768", "0.65777737", "0.6552098", "0.6535087", "0.6417936", "0.6357317", "0.6346055", "0.6317528", "0.6288997", "0.62822455", "0.6268632", "0.62040895", "0.6188964", "0.6173931", "0.61395174", "0.61304075", "0.61240715", "0.61104304", "0.6100188", "0.60918933", "0.60918...
0.8385872
0
Displays the maximum residual error
def max_error(self): print('Maximum residual error: ' + str(max_error(self.model.dataset.get_y_test(), self.model.get_predicted())))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotEvolutionMaximum(self):\n evolutionMaximum = self.getEvolutionMax();\n plt.plot(evolutionMaximum)\n plt.xlabel('Time')\n plt.ylabel('Maximum realizations')\n plt.show()", "def printEvolutionMaximum(self):\n evolutionMaximum = self.getEvolutionMax();\n prin...
[ "0.63394094", "0.6229266", "0.61144316", "0.60820836", "0.60620254", "0.6015813", "0.59734255", "0.5941071", "0.59147125", "0.5911583", "0.5861819", "0.584382", "0.583055", "0.57213044", "0.5712971", "0.57032347", "0.567537", "0.565882", "0.5655846", "0.56436265", "0.5638071"...
0.8214193
0
Displays the mean absolute error regression loss
def mean_absolute_error(self): print('Mean absolute error regression loss: ' + str(mean_absolute_error(self.model.dataset.get_y_test(), self.model.get_predicted())))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_squared_error(self):\n print('Mean squared error regression loss: ' + str(mean_squared_error(self.model.dataset.get_y_test(),\n self.model.get_predicted())))", "def print_mean_loss(self):\n print(f'Moyenne {self.l...
[ "0.74813354", "0.7364976", "0.67774594", "0.65576684", "0.65496135", "0.6503192", "0.64455837", "0.64087117", "0.6399268", "0.63544685", "0.6322085", "0.6311512", "0.62850654", "0.624884", "0.62461305", "0.62344646", "0.6222857", "0.6218391", "0.61946243", "0.61939836", "0.61...
0.81985563
0
Displays the mean squared error regression loss
def mean_squared_error(self): print('Mean squared error regression loss: ' + str(mean_squared_error(self.model.dataset.get_y_test(), self.model.get_predicted())))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_absolute_error(self):\n print('Mean absolute error regression loss: ' + str(mean_absolute_error(self.model.dataset.get_y_test(),\n self.model.get_predicted())))", "def print_mean_loss(self):\n print(f'Moyenne {s...
[ "0.7077627", "0.690039", "0.6756349", "0.67075014", "0.6685136", "0.66078496", "0.6522489", "0.6502419", "0.6479918", "0.638685", "0.6335452", "0.63126904", "0.6305478", "0.62974066", "0.62580615", "0.62539923", "0.6252608", "0.62420887", "0.6241032", "0.6231236", "0.62139463...
0.7994973
0
Displays the median absolute error regression loss
def median_absolute_error(self): print('Median absolute error regression loss: ' + str(median_absolute_error(self.model.dataset.get_y_test(), self.model.get_predicted())))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def median_absolute_error(y_true, y_pred, *, multioutput=..., sample_weight=...):\n ...", "def stderr(predicted, actual):\n return np.sqrt(mse(predicted, actual))", "def mean_absolute_error(self):\n print('Mean absolute error regression loss: ' + str(mean_absolute_error(self.model.dataset.get_y_te...
[ "0.70553166", "0.64234465", "0.6116956", "0.6105252", "0.6023425", "0.60127705", "0.59997356", "0.59459203", "0.59157705", "0.59152037", "0.5889653", "0.58809096", "0.58801013", "0.58737195", "0.5849917", "0.5830612", "0.5815691", "0.5808731", "0.5789277", "0.5766636", "0.571...
0.81183386
0
Displays the R^2 (coefficient of determination) regression score function
def r2_score(self): print('R^2 (coefficient of determination) regression score function: ' + str(r2_score(self.model.dataset.get_y_test(), self.model.get_predicted())))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def R2_ScoreFunction(y_data, y_model):\n\tcounter = np.sum((y_data-y_model)**2)\n\tdenominator = np.sum((y_data-np.mean(y_data))**2)\n\tR_2 = 1 - (counter/denominator)\n\n\treturn R_2", "def show_score(x, y, estimator):\n # Instantiate models and predict values\n model = estimator\n model.f...
[ "0.69786924", "0.6863876", "0.6714537", "0.6663713", "0.6653193", "0.663446", "0.66082966", "0.6394224", "0.6334016", "0.6288533", "0.62300736", "0.6228127", "0.6219256", "0.62071186", "0.61891454", "0.61589086", "0.61319155", "0.6112997", "0.61078864", "0.60952294", "0.60153...
0.8624666
0
Displays the mean Poisson deviance regression loss
def mean_poisson_deviance(self): print('Mean Poisson deviance regression loss: ' + str(mean_poisson_deviance(self.model.dataset.get_y_test(), self.model.get_predicted())))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_poisson_deviance(y_true, y_pred, *, sample_weight=...):\n ...", "def mean_gamma_deviance(self):\n print('Mean Gamma deviance regression loss: ' + str(mean_gamma_deviance(self.model.dataset.get_y_test(),\n self.model...
[ "0.7326635", "0.71956617", "0.6374109", "0.63290167", "0.62312263", "0.61962885", "0.61569554", "0.60720193", "0.5908816", "0.58727163", "0.5853543", "0.5825269", "0.5815448", "0.5789546", "0.5742261", "0.57205164", "0.5705856", "0.5695632", "0.5679369", "0.5668491", "0.56531...
0.8667775
0
Displays the mean Gamma deviance regression loss
def mean_gamma_deviance(self): print('Mean Gamma deviance regression loss: ' + str(mean_gamma_deviance(self.model.dataset.get_y_test(), self.model.get_predicted())))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_gamma_deviance(y_true, y_pred, *, sample_weight=...):\n ...", "def mean_poisson_deviance(self):\n print('Mean Poisson deviance regression loss: ' + str(mean_poisson_deviance(self.model.dataset.get_y_test(),\n se...
[ "0.7158686", "0.7101518", "0.6530801", "0.61291957", "0.61092436", "0.60038245", "0.6001759", "0.59312135", "0.5916489", "0.5910665", "0.590451", "0.5888444", "0.5879291", "0.58651125", "0.5829451", "0.5822385", "0.5811706", "0.579473", "0.5727554", "0.56729794", "0.5639032",...
0.839935
0
Function responsible for displaying the feature importance
def feature_importance(self): if self.model.algorithm == 'DecisionTree' or self.model.algorithm == 'RandomForest': print("Feature importance\n") print(pd.DataFrame(self.model.clf.feature_importances_, index=self.model.dataset.feature_names, columns=['Import...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feature_importance(model, feature_names):\n features_list = []\n imp_list = []\n feat_imps = model.feature_importances_\n for j, importance in enumerate(feat_imps):\n features_list.append(feature_names[j])\n imp_list.append(importance)\n features_df = pd.DataFrame(data=zip(features...
[ "0.73295325", "0.72397596", "0.7200983", "0.7115441", "0.70092887", "0.6911728", "0.68184775", "0.6777727", "0.6690072", "0.6689416", "0.66208804", "0.6547856", "0.652573", "0.6515406", "0.6428097", "0.64271075", "0.64217865", "0.6387838", "0.63680726", "0.63674223", "0.62737...
0.8153875
0
Exports the decision tree graph
def export(self): if self.model.algorithm == 'DecisionTree': dot_data = tree.export_graphviz(self.model.clf, out_file=None) graph = graphviz.Source(dot_data) graph.render("exports/DecisionTreeRegressor")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_graphviz(decision_tree, out_file=SENTINEL, max_depth=None,\n feature_names=None, class_names=None, label='all',\n filled=False, leaves_parallel=False, \n node_ids=False, proportion=False, rotate=False,\n rounded=False, special_c...
[ "0.7513455", "0.7438119", "0.67898655", "0.6753352", "0.6686428", "0.6423555", "0.6369015", "0.6338368", "0.63073826", "0.62821263", "0.62155956", "0.6207554", "0.6189983", "0.60867596", "0.60415936", "0.6016153", "0.5951688", "0.5908345", "0.5900759", "0.5900651", "0.589483"...
0.83298147
0
Converts an array of IDs to a sentence, optionally cutting the result off at the endofsequence token.
def array_to_sentence(self, array: np.array, cut_at_eos=True) -> List[str]: sentence = [] for i in array: s = self.itos[i] if cut_at_eos and s == EOS_TOKEN: break sentence.append(s) return sentence
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def truncate_sentence(snt_ids, max_len, add_start=True, add_end=True):\n if add_start:\n snt_ids = [BOS_ID] + snt_ids\n\n if add_end:\n snt_ids = snt_ids + [EOS_ID]\n\n return snt_ids[:max_len]", "def seqs_to_strs(self,id_array,remove_pads=True):\n l = self.seqs_to_toks(id_array,remove_...
[ "0.68359005", "0.6395812", "0.626578", "0.61484563", "0.60752255", "0.5992985", "0.5990151", "0.5893979", "0.58907855", "0.5822735", "0.5814051", "0.5810707", "0.5809499", "0.5774166", "0.57483464", "0.57446057", "0.57314324", "0.57277256", "0.57211536", "0.57102835", "0.5708...
0.68120545
1
Convert multiple arrays containing sequences of token IDs to their sentences, optionally cutting them off at the endofsequence token.
def arrays_to_sentences(self, arrays: np.array, cut_at_eos=True) \ -> List[List[str]]: sentences = [] for array in arrays: sentences.append( self.array_to_sentence(array=array, cut_at_eos=cut_at_eos)) return sentences
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_to_sentence(self, array: np.array, cut_at_eos=True) -> List[str]:\n sentence = []\n for i in array:\n s = self.itos[i]\n if cut_at_eos and s == EOS_TOKEN:\n break\n sentence.append(s)\n return sentence", "def _ticks_to_sentences(ticks...
[ "0.673198", "0.6581544", "0.6515886", "0.64929503", "0.64929503", "0.6448785", "0.6409684", "0.6307942", "0.62738013", "0.62008506", "0.6192786", "0.61842006", "0.6183306", "0.61517054", "0.6142672", "0.6117138", "0.61081755", "0.6088635", "0.6079087", "0.6078653", "0.6069158...
0.72692674
0
Filter counter by min frequency
def filter_min(counter: Counter, min_freq: int): return Counter({t: c for t, c in counter.items() if c >= min_freq})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_freq_filter(self, min_freq):\n self._apply_filter(lambda ng, freq: freq < min_freq)", "def filter_counts(list_of_elements, minimum):\n counts = Counter(list_of_elements)\n lookup = {}\n for k, v in counts.items():\n if v >= minimum:\n lookup[k] = v\n return lookup",...
[ "0.73322994", "0.67449033", "0.66097105", "0.6316284", "0.6150185", "0.6113307", "0.6106483", "0.5946687", "0.5877302", "0.58707523", "0.5834614", "0.5814952", "0.57811344", "0.57709473", "0.5762835", "0.57114893", "0.56441766", "0.5609483", "0.5606482", "0.56064117", "0.5598...
0.84415966
0
Cut counter to most frequent, sorted numerically and alphabetically
def sort_and_cut(counter: Counter, limit: int): # ignoring the alphabetical part, it's fine to do # [word_type for (word_type, count) in counter.most_common(limit)] tokens_and_frequencies = sorted(counter.items(), key=lambda tup: tup[0]) tokens_and_frequencies.sort(key=lambda tup: tup[1], reverse=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def counting_sort(num_lst):\n n = len(num_lst)\n # initialise counter list with base\n counter = [0 for i in range(26)]\n # for each value in input list, store count of each element at their respective indexes\n for element in num_lst:\n counter[element] += 1\n\n # calculate the cumulative...
[ "0.6387916", "0.6327695", "0.6248439", "0.6214767", "0.61751616", "0.6143504", "0.6136808", "0.6134283", "0.61199725", "0.60332125", "0.6024323", "0.6019326", "0.6003685", "0.59793115", "0.5978353", "0.59728426", "0.594236", "0.5940202", "0.59232295", "0.5909065", "0.58379614...
0.70725256
0
Load the sample set and traces.
def load_sample(self): self.load_images(self.folder + "/sampleSet.txt") self.load_traces(self.folder + "/sampleLabel.txt")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_sample_table(self):\n self.sampleTable = pd.read_table(self.config['sampletable'], sep='\\t', dtype=str)\n self.sampleTable.set_index('sampleID', inplace=True)\n self.samples = self.sampleTable.reset_index().to_dict('records')", "def create_samples(self):\n self._samples = s...
[ "0.6352468", "0.6320655", "0.62501895", "0.62003464", "0.5998394", "0.5983532", "0.5981883", "0.58995247", "0.58671796", "0.58421236", "0.5813359", "0.58025646", "0.5787868", "0.57836264", "0.57810724", "0.5770746", "0.5746215", "0.57129824", "0.5708305", "0.56885326", "0.568...
0.8160066
0
Prints the image at index idx.
def print_img_at_idx(self, idx): img = self.images[idx] print_img(img)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_image(data, index):\n image = data[index]\n for line in image:\n print(line)", "def show_image(self, idx):\n image, target = self.__getitem__(self, idx)\n im_h, im_w, _ = image.size()\n labels_num = target['labels']\n rescale = torch.tensor([[im_w, im_h, im_w, i...
[ "0.8027864", "0.7028585", "0.65850884", "0.6566818", "0.6445934", "0.6417184", "0.6408333", "0.6344743", "0.63059354", "0.62832993", "0.6233442", "0.6177695", "0.61742324", "0.6162923", "0.6120766", "0.61027026", "0.61015904", "0.6092742", "0.6043923", "0.6020888", "0.5964212...
0.9082608
0
Create the chain of explode_images and explode_traces formed by counting across two timesteps.
def explode(self): words = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine"] for i, image in enumerate(self.images): for j, chain in enumerate(list(self.traces[i])): for k, link in enumerate(chain): if k is 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def explode_chained(self):\n\n words = [\"one\", \"two\", \"three\", \"four\", \"five\", \"six\", \"seven\", \"eight\", \"nine\"]\n\n for i, image in enumerate(self.images):\n for j, chain in enumerate(list(self.traces[i])):\n\n # initialize new lists to keep track of anothe...
[ "0.72900915", "0.61216235", "0.5654389", "0.5051107", "0.50087726", "0.49835867", "0.49133712", "0.49129376", "0.49058077", "0.48597026", "0.48422557", "0.48244214", "0.4756994", "0.46575746", "0.46027762", "0.4548416", "0.4543137", "0.45293173", "0.45156074", "0.44919112", "...
0.69984066
1
Create the chain of explode_images and explode_traces formed by counting across all timesteps.
def explode_chained(self): words = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine"] for i, image in enumerate(self.images): for j, chain in enumerate(list(self.traces[i])): # initialize new lists to keep track of another chain explod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def explode(self):\n\n words = [\"one\", \"two\", \"three\", \"four\", \"five\", \"six\", \"seven\", \"eight\", \"nine\"]\n\n for i, image in enumerate(self.images):\n for j, chain in enumerate(list(self.traces[i])):\n for k, link in enumerate(chain):\n\n ...
[ "0.72582537", "0.63111275", "0.61801237", "0.52270603", "0.5220393", "0.513857", "0.50932354", "0.5039007", "0.50177896", "0.50173956", "0.49849254", "0.48881117", "0.47876167", "0.47563213", "0.47534576", "0.4738801", "0.47347093", "0.47179896", "0.47104254", "0.46855706", "...
0.73219496
0
Return the queryset of pages to be filtered by this page. By default this includes only live pages and pages that live in the same Wagtail Site as this page. If this page cannot be mapped to a Wagtail site (for example, if it does not live under a site root), then it will not return any filterable results. The filter_c...
def get_filterable_queryset(self): site = self.get_site() if not site: return self.get_model_class().objects.none() queryset = self.get_model_class().objects.in_site(site).live() filterable_list_block = self.get_filterable_list_wagtail_block() if filterable_list_bl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n request = self.request\n # Allow pages to be filtered to a specific type\n page_type = request.GET.get('type', 'wagtailcore.Page')\n try:\n models = page_models_from_string(page_type)\n except (LookupError, ValueError):\n raise BadR...
[ "0.6996249", "0.68621105", "0.6222618", "0.615874", "0.612804", "0.5968924", "0.57828724", "0.5772105", "0.5768434", "0.5738781", "0.56695443", "0.5567301", "0.5491212", "0.5459988", "0.54599816", "0.545539", "0.54398525", "0.5426571", "0.5425202", "0.53988904", "0.53756344",...
0.7274537
0
Do not index queries unless they consist of a single topic field.
def set_do_not_index(self, field, value): if field != 'topics' or len(value) > 1: self.do_not_index = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topic_index():\n topic = db.topic(request.args(0)) or redirect(URL('default', 'index'))\n return dict(topic=topic)", "def is_valid_topic(index):\n return all_topics[index][1] == \"1\"", "def topic_less(request, topic_id):\n posts = Post.objects.filter(topic=topic_id).order_by(\"-created\")[:3]\...
[ "0.61402464", "0.5902785", "0.5697492", "0.56159985", "0.5605689", "0.5600221", "0.5495163", "0.54723555", "0.54283845", "0.5422594", "0.53822017", "0.5371926", "0.53154904", "0.5312726", "0.53057456", "0.5281506", "0.5271937", "0.5254258", "0.5235442", "0.5222118", "0.521876...
0.6924741
0
Return the queryset of pages to be filtered by this page. The class property filterable_categories can be set to a list of page categories from the set in v1.util.ref.categories. If set, this page will only filter pages that are tagged with a tag in those categories. By default this is an empty list and all page tags a...
def get_filterable_queryset(self): queryset = super().get_filterable_queryset() category_names = get_category_children(self.filterable_categories) return queryset.filter(categories__name__in=category_names)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n request = self.request\n # Allow pages to be filtered to a specific type\n page_type = request.GET.get('type', 'wagtailcore.Page')\n try:\n models = page_models_from_string(page_type)\n except (LookupError, ValueError):\n raise BadR...
[ "0.6912378", "0.6573393", "0.6258653", "0.5990369", "0.591675", "0.56241983", "0.560125", "0.5568376", "0.5566044", "0.55467755", "0.5484514", "0.5474891", "0.5461475", "0.54209685", "0.53906417", "0.53899264", "0.53657895", "0.5362309", "0.5350851", "0.5350851", "0.5339508",...
0.6594297
1
If the specified modules have never been imported, and import prevention is requested, L{ensureNotImported} makes sure they will not be imported in the future.
def test_ensureWhenNotImported(self): modules = {} self.patch(sys, "modules", modules) ensureNotImported(["m1", "m2"], "A message.", preventImports=["m1", "m2", "m3"]) self.assertEqual(modules, {"m1": None, "m2": None, "m3": None})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ensureWhenNotImportedDontPrevent(self):\n modules = {}\n self.patch(sys, \"modules\", modules)\n ensureNotImported([\"m1\", \"m2\"], \"A message.\")\n self.assertEqual(modules, {})", "def test_ensureWhenFailedToImport(self):\n modules = {\"m2\": None}\n self.pat...
[ "0.77868134", "0.76718533", "0.7179845", "0.68672884", "0.68647116", "0.6863298", "0.6388706", "0.63881147", "0.6380834", "0.63714015", "0.6363046", "0.63586533", "0.63446426", "0.6326218", "0.614632", "0.6052401", "0.59559643", "0.5944775", "0.5866974", "0.5864253", "0.58517...
0.8029372
0
If the specified modules have never been imported, and import prevention is not requested, L{ensureNotImported} has no effect.
def test_ensureWhenNotImportedDontPrevent(self): modules = {} self.patch(sys, "modules", modules) ensureNotImported(["m1", "m2"], "A message.") self.assertEqual(modules, {})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ensureWhenNotImported(self):\n modules = {}\n self.patch(sys, \"modules\", modules)\n ensureNotImported([\"m1\", \"m2\"], \"A message.\", preventImports=[\"m1\", \"m2\", \"m3\"])\n self.assertEqual(modules, {\"m1\": None, \"m2\": None, \"m3\": None})", "def test_ensureWhenFai...
[ "0.8182791", "0.7787674", "0.7259192", "0.69785875", "0.69313335", "0.6900012", "0.6583769", "0.65730286", "0.64673966", "0.6407936", "0.638167", "0.63726836", "0.6343517", "0.62946564", "0.6175918", "0.61043787", "0.6074291", "0.60018104", "0.5989511", "0.5963485", "0.591212...
0.7958783
1
C{simulate} can be called without raising any errors when there are no delayed calls for the reactor and hence there is no defined sleep period.
def test_simulate(self): sut = gireactor.PortableGIReactor(useGtk=False) # Double check that reactor has no sleep period. self.assertIs(None, sut.timeout()) sut.simulate()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def sleep_fake(*args, **kwargs):\n sleep_sync_mock(*args, **kwargs)", "async def twisted_sleep(delay: float, twisted_reactor: \"SygnalReactor\") -> None:\n deferred: Deferred[None] = Deferred()\n twisted_reactor.callLater(delay, deferred.callback, None)\n await deferred", "def sleep(self,...
[ "0.6647582", "0.6263564", "0.6207192", "0.6207192", "0.6162311", "0.6160184", "0.60685694", "0.60234535", "0.59704494", "0.59572023", "0.59538174", "0.5932901", "0.5912397", "0.58879507", "0.58746934", "0.5859946", "0.58422786", "0.5829184", "0.5823037", "0.5767227", "0.57418...
0.7879855
0
Compute the multipie pose report, ploting the FNMR for each view point
def multipie_pose_report( scores_dev, scores_eval, output_filename, titles, figsize=(16, 8), fmr_threshold=1e-3, colors=plt.cm.tab10.colors, optimal_threshold=False, threshold_eval=False, ): cameras = [ "11_0", "12_0", "09_0", "08_0", "13_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comp2profile(output):\n\n # Load components\n data = '/home/scott/data/insar/cvz/los2xyz/components.txt_backup'\n lon,lat,x,ur,uz = np.loadtxt(data,unpack=True)\n\n # Load FEM output\n points = '/home/scott/research/models/pylith/3d/fialko2012/model3_agu/output_points.txt'\n pointsh5 = '/home...
[ "0.55813044", "0.55394816", "0.5490679", "0.5486501", "0.5486186", "0.547605", "0.54446495", "0.54431546", "0.541309", "0.540711", "0.53623724", "0.53529036", "0.53522944", "0.5351714", "0.5296804", "0.52754503", "0.5270347", "0.52599376", "0.52546656", "0.5246114", "0.524177...
0.58655304
0
Welcomes the user with a message and randomly picks a question to ask the user about their number
def welcome(): on_session_start() return question(PRIME_QUESTION, intro=WELCOME_SPEECH)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_subjunctiveimp_quiz_selector():\n\n go_again = True\n while go_again:\n number = random.randint(1, 3)\n if number == 1:\n begin_subjunctiveimp_are_quiz()\n if number == 2:\n begin_subjunctiveimp_ere_quiz()\n if number == 3:\n begin_subju...
[ "0.6517504", "0.65107214", "0.6487297", "0.6467281", "0.6423161", "0.6418092", "0.63956076", "0.63721585", "0.63658226", "0.63579506", "0.629759", "0.6254375", "0.6242317", "0.62325805", "0.6222446", "0.62075084", "0.6197382", "0.61891055", "0.6186061", "0.615394", "0.6150918...
0.67799115
0
Returns the unexpected response speech.
def unexpected_response(): return say(UNEXPECTED_ANSWER_SPEECH)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fallback_response():\n\n speech_output = FALLBACK_MESSAGE\n return response(speech_response(speech_output, False))", "def get_fallback_response():\n\n speech_output = FALLBACK_MESSAGE\n return response(speech_response(speech_output, False))", "def get_stop_response():\n\n speech_output =...
[ "0.69592965", "0.69592965", "0.6456097", "0.6456097", "0.63705957", "0.63415974", "0.63415974", "0.6329912", "0.6329912", "0.608461", "0.6012853", "0.6012853", "0.5934471", "0.5909186", "0.5853033", "0.58314586", "0.58188784", "0.58042705", "0.5800646", "0.57519466", "0.57291...
0.8277924
0
Returns the middle item in the number list (by position not value) picks lower middle index if number is even
def get_middle(): num_list = session_attributes[NUMBER_LIST_KEY] return num_list[round(len(num_list) / 2) - 1] # Subtract 1 since arrays start at 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findMiddle(inList):\n middle = float(len(inList))/2\n if middle % 2 != 0:\n return int(middle - .5), inList[int(middle - .5)]\n else:\n return (int(middle), int(middle-1)), (inList[int(middle)], inList[int(middle-1)])", "def mid(arr):\n\n \n arr_ln = len(arr)\n mid = arr_ln//2...
[ "0.762548", "0.68348694", "0.6707999", "0.6486468", "0.64032376", "0.6217714", "0.6140569", "0.6090736", "0.60830855", "0.60313183", "0.5982748", "0.5931421", "0.59305763", "0.5910867", "0.5903021", "0.58987117", "0.58973026", "0.58823586", "0.5881148", "0.5853946", "0.584717...
0.76432437
0
Rounds a number up if the decimal portion of the number is >= 0.5
def round(x): return int(x + copysign(0.5, x))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def round_half_up(number):\n return number.quantize(decimal.Decimal(\"0.01\"), rounding=decimal.ROUND_HALF_UP)", "def round_up(number, decimals=0):\n multiplier = 10 ** decimals\n return math.ceil(number * multiplier) / multiplier", "def iround(x):\n return ipart(x + 0.5)", "def roundUP(x...
[ "0.74790084", "0.73123646", "0.7160137", "0.708739", "0.7070409", "0.69941044", "0.6974298", "0.6959436", "0.69463545", "0.6906102", "0.68576556", "0.6839834", "0.6785563", "0.675457", "0.6722403", "0.66750073", "0.6658349", "0.6645449", "0.65253603", "0.65068376", "0.6444034...
0.7339733
1
Keeps or remove each number in the number list that returns a true value for a given predicate function. Defaults to keeping the number
def keep_in_numbers(predicate): session_attributes[NUMBER_LIST_KEY] = [n for n in session_attributes[NUMBER_LIST_KEY] if predicate(n)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keep(self, predicate=None):\n self.__ff.append(\n lambda c: filter(\n self._as_callable(predicate) if (predicate is not None) else None,\n c\n )\n )\n return self", "def remove(predicate, coll):\r\n return filter(lambda x: not predic...
[ "0.643755", "0.600988", "0.5939062", "0.5744947", "0.57243794", "0.57096106", "0.5705385", "0.5552493", "0.55080616", "0.55044746", "0.54972285", "0.5489465", "0.5411159", "0.53511506", "0.5338411", "0.53280807", "0.5312854", "0.53053385", "0.52984107", "0.52871335", "0.52522...
0.7749854
0
Set model weights and bias value as candidates value
def set_weights_to_layers(self, candidate): last_idx = 0 # Iterate over every layer for layer_idx in range(0, self.num_layers, 1): if layer_idx %2 == 0 : # Get layer dimensions w_shape = self.layers[layer_idx].weight.shape w_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_para(from_model, to_model):\n for i, j in zip(from_model.trainable_weights, to_model.trainable_weights):\n j.assign(i)", "def init_weights(model):\n ...", "def __init__(self, bias):\n self.bias = bias", "def _set_weights(self, weights):\n i = iter(weigh...
[ "0.6731761", "0.6630802", "0.6534233", "0.6501609", "0.6501609", "0.64567965", "0.6429755", "0.6429006", "0.64271486", "0.64271486", "0.64271486", "0.63852525", "0.63852525", "0.6357867", "0.6259028", "0.62573665", "0.6253519", "0.6248842", "0.6248842", "0.6248842", "0.624107...
0.66814166
1
Parse out Package name from a repo git url
def package_name_from_url(url): url_repo_part = url.split('/')[-1] if url_repo_part.endswith('.git'): return url_repo_part[:-4] return url_repo_part
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_reponame_from_git_url(url: str) -> Optional[str]:\n repo_url = parse_git_repo(url)\n if repo_url:\n return repo_url.repo\n return None", "def get_package_repo_name(package_info):\n\n # should check that there is EXACTLY one line\n repo_lines = \\\n [line for line in package_i...
[ "0.72414875", "0.72083384", "0.7030862", "0.70207083", "0.67696077", "0.66770506", "0.660389", "0.6549706", "0.6517252", "0.64830387", "0.6323906", "0.626601", "0.61832666", "0.6168786", "0.61365557", "0.61157113", "0.6077839", "0.6076937", "0.60562384", "0.6024497", "0.60198...
0.81526685
0
Extract coordinates of first path from the KMZ file.
def parse_kmz(filename: str) -> List[Tuple[float, float]]: kmz = ZipFile(filename, "r") kml = kmz.open("doc.kml", "r").read() tree = etree.parse(BytesIO(kml)) coordinates = tree.xpath( "/a:kml/a:Document/a:Placemark/a:LineString/a:coordinates", namespaces={"a": "http://www.opengis.net/...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_kml_coordinates(kml_obj: fastkml.kml.KML) -> Path:\n\t\n\tgeometry_obj = next(get_kml_document(kml_obj).features()).geometry\n\tcoords_path = [\n\t\tCoordinates(*co_tuple)\n\t\tfor co_tuple in geometry_obj.coords\n\t]\n\t\n\treturn coords_path", "def extract_geometry(file_path):\r\n file_path = Path(f...
[ "0.6404248", "0.5811924", "0.5574849", "0.54486424", "0.5429072", "0.54257977", "0.5381483", "0.53652686", "0.5365162", "0.5334948", "0.52342975", "0.5230452", "0.5186258", "0.5183778", "0.51795775", "0.51611644", "0.51311326", "0.51266706", "0.51190346", "0.51118606", "0.509...
0.67098784
0
Parse a list of coordinates into a dictionary structure with distances.
def calculate_distances(coords: List[Tuple[float, float]]) -> List[Dict]: miles = 0 od = [] for idx in range(len(coords)): if idx == 0: continue dist = distance(coords[idx], coords[idx - 1]).miles miles = miles + dist od.append( { "star...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coords_to_dict(self, coords_list, translate=True):\n contact_points_list = []\n contact_points_dict = {\n 'urdf_file': self.urdf_file,\n 'contact_points': []}\n for coords in coords_list:\n if translate:\n coords = coords.copy_worldcoords().t...
[ "0.6461486", "0.6265718", "0.6173742", "0.60725236", "0.60452074", "0.5923347", "0.58179253", "0.5781503", "0.5750801", "0.570378", "0.5661705", "0.5610204", "0.55624807", "0.5538704", "0.55327296", "0.54816514", "0.5440584", "0.5433838", "0.54264134", "0.539488", "0.53932744...
0.7301482
0
Output a list of dictionaries as JSON lines. This is intended as a simple helper function that takes any list of dictionaries and outputs it one record per line to a jsonl file. This file can be incrementally parsed by a web page, which is handy if you need to operate on records earlier in the file, don't think you'll ...
def output_jsonl(filename: str, data: List): with open(filename, "w") as outfile: for x in data: print(json.dumps(x)) json.dump(x, outfile) outfile.write("\n")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_jsonl(data, output_path, append=False):\n mode = 'a+' if append else 'w'\n with open(output_path, mode, encoding='utf-8') as f:\n for line in data:\n json_record = json.dumps(line, ensure_ascii=False)\n f.write(json_record + '\\n')\n print('Wrote {} records to {}'.for...
[ "0.7530426", "0.7303714", "0.70899904", "0.6549696", "0.65207946", "0.6460005", "0.6458344", "0.63876325", "0.6206445", "0.6142811", "0.6059669", "0.6042038", "0.6030695", "0.60122764", "0.6003252", "0.59942335", "0.59873027", "0.5963597", "0.5959496", "0.5941699", "0.5941406...
0.75136214
1
Mmain routine to convert KMZ to JSON lines output. This is a convenience function to run the entire script and convert the inputfile from a KMZ file to a JSON lines output file.
def main(infile: str, outfile: str): coords = parse_kmz(infile) distances = calculate_distances(coords) output_jsonl(outfile, distances)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n parser = argparse.ArgumentParser()\n parser.add_argument(\"datafile\", help=\"Name of JSON file containing WP3-mapped metadata\")\n parser.add_argument(\"csvfile\", help=\"Corrected CSV file\")\n parser.add_argument(\"vcffile\", help=\"VCF file with samples\")\n args = parser.parse_arg...
[ "0.5842944", "0.58020306", "0.57788396", "0.56499743", "0.56482315", "0.56431854", "0.5634168", "0.56085443", "0.54784906", "0.54282206", "0.5415367", "0.5361926", "0.5360702", "0.5353047", "0.5343036", "0.5316234", "0.5265992", "0.52290285", "0.5194032", "0.5167681", "0.5159...
0.67937523
0
An error should be raised when attempting to decorate a nonclass object.
def test_non_class_decorate_error(): with pytest.raises( TypeError, match="Only classes can be decorated with @component." ): @component def fn(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get__(self, obj, objtype=None):\n if obj is None:\n return self\n if self._isdecorator():\n if self.fdec is None:\n raise AttributeError(\"can't decorate with attribute\")\n return self.fdec(obj)\n else:\n return super().__get__(...
[ "0.60806555", "0.5956477", "0.5902239", "0.5902239", "0.5902239", "0.5859485", "0.57599473", "0.57570636", "0.57287323", "0.56788677", "0.56517816", "0.55756956", "0.5545064", "0.54661506", "0.54542154", "0.54498947", "0.5446554", "0.5419578", "0.5419578", "0.5417726", "0.539...
0.66655755
0
An error should be raised when attempting to decorate an abstract class.
def test_abstract_class_decorate_error(): with pytest.raises( TypeError, match="Abstract classes cannot be decorated with @component." ): @component class A(abc.ABC): @abc.abstractmethod def foo(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def abstract(f):\r\n\tdef raiser(*args,**kargs):\r\n\t\traise Exception('Abstract function must be overridden by a child class before being called')\r\n\treturn raiser", "def test_non_class_decorate_error():\n with pytest.raises(\n TypeError, match=\"Only classes can be decorated with @component.\"\n ...
[ "0.6555189", "0.6119802", "0.59687835", "0.5935532", "0.59303457", "0.5900127", "0.58974797", "0.5860091", "0.58452564", "0.58310467", "0.5818588", "0.5789497", "0.5767116", "0.5753108", "0.56930834", "0.56487316", "0.5625374", "0.5625374", "0.5625374", "0.5625374", "0.562537...
0.7525886
0
An error should be raised when attempting to decorate a class with an `__init__` method.
def test_init_decorate_error(): with pytest.raises( TypeError, match="Component classes must not define a custom `__init__` method.", ): @component class A: def __init__(self, a, b=5): self.a = a self.b = b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raise_init(cls):\r\n def init(self):\r\n raise TypeError(\"Instance creation is not allowed for %s\" % cls)\r\n cls.__init__ = init\r\n return cls", "def decorate_init(cls, f):\n def wrap(*args, **kwargs):\n if not hasattr(cls, '_init'):\n f(*args, **kwargs)\n...
[ "0.7525594", "0.67122096", "0.66206926", "0.6576155", "0.6510298", "0.6470717", "0.644648", "0.6425982", "0.64141744", "0.63906014", "0.63906014", "0.63906014", "0.6362", "0.63326836", "0.631936", "0.631936", "0.631936", "0.63108283", "0.6281808", "0.6270976", "0.6270976", ...
0.7653365
0
When not configuring interactively, an error should be raised if a field has neither a default nor a configured value.
def test_configure_non_interactive_missing_field_value(ExampleComponentClass): with pytest.raises( ValueError, match=r"^No configuration value found for annotated field 'FAKE_NAME.a' of type 'int'.", ): configure(ExampleComponentClass(), {"b": "bar"}, name="FAKE_NAME")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _field_sanity(self, field):\r\n if isinstance(field, models.BooleanField) and field.has_default():\r\n field.default = int(field.to_python(field.get_default()))\r\n return field", "def test_alright_when_required_field_is_missing_but_default_is_given():\n\n model_definition = {'lan...
[ "0.6695413", "0.65769535", "0.64575714", "0.6353493", "0.6322573", "0.62943566", "0.6255532", "0.6252152", "0.62233865", "0.61484694", "0.61009645", "0.6074976", "0.6074976", "0.6070259", "0.60668075", "0.6021924", "0.59889513", "0.59593755", "0.595348", "0.5941748", "0.59336...
0.69991153
0
When configuring interactively, subcomponent fields without default or configured values should prompt for a choice of subcomponents to instantiate through the CLI.
def test_configure_interactive_prompt_for_subcomponent_choice(): class AbstractChild: pass @component class Child1(AbstractChild): pass @component class Child2(AbstractChild): pass class Child3_Abstract(AbstractChild): pass @component class Child3A(Ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extend_cli(self, subparser):", "def test_configure_interactive_prompt_missing_field_value(ExampleComponentClass):\n\n x = ExampleComponentClass()\n a_value = 42\n\n with patch(\"click.prompt\", return_value=a_value) as prompt:\n configure(x, {\"b\": \"bar\"}, name=\"FAKE_NAME\", interactive=T...
[ "0.5997453", "0.5864058", "0.5818779", "0.5815398", "0.56679916", "0.5526979", "0.55202293", "0.5496357", "0.548957", "0.53695256", "0.5332412", "0.5314471", "0.5282983", "0.52583236", "0.523805", "0.5197468", "0.5196903", "0.5196903", "0.5175764", "0.51646525", "0.5162486", ...
0.62702954
0
Bytes received over wired connection.
def wired_rx_bytes(self): return self.raw.get('wired-rx_bytes', 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _readBytes(self, len):\n return self.socket.recv(len)", "def recv_bytes(self):\r\n try:\r\n received = self.socket.recv(4096)\r\n # printf(\"Bytes received: %d\" % (len(received)))\r\n self.recvBuffer += received\r\n # printf(\"recvbuflen=%d\" % (len(...
[ "0.7046475", "0.69434017", "0.6936908", "0.6700926", "0.6685529", "0.66591656", "0.6566578", "0.6559678", "0.6559678", "0.6555346", "0.6518236", "0.6493846", "0.64905614", "0.6424472", "0.64112633", "0.64035577", "0.63976884", "0.63746953", "0.6366579", "0.63548017", "0.62907...
0.69995594
1
Bytes transferred over wired connection.
def wired_tx_bytes(self): return self.raw.get('wired-tx_bytes', 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def BytesTransferred(self) -> int:", "def bytes_transferred(self):\n return self._bytes_transferred", "def bytes_copied(self) -> float:\n return pulumi.get(self, \"bytes_copied\")", "def wired_rx_bytes(self):\n return self.raw.get('wired-rx_bytes', 0)", "def bytes_pumped(self):\n ...
[ "0.740504", "0.65117455", "0.6106829", "0.6065427", "0.6052558", "0.60236627", "0.60225016", "0.6011965", "0.590449", "0.5823942", "0.5777263", "0.57178843", "0.56749284", "0.5627719", "0.5622611", "0.55965275", "0.5554534", "0.55226654", "0.5520241", "0.5509976", "0.54942083...
0.6674562
1
Find squared contours with min area
def find_squares(img,minArea=1000): squares = [] contours, hierarchy = cv2.findContours(img, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE) for cnt in contours: cnt_len = cv2.arcLength(cnt, True) cnt = cv2.approxPolyDP(cnt, 0.02*cnt_len, True) if len(cnt) == 4 and cv2.contourArea(cnt) > 1000 and cv2.isCon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_squares( contours, debug=False ):\r\n #=================================================================\r\n # The Minimum and Maximum rations for width vs height for the goal\r\n # based on experimental results goal is approx 1.5:1\r\n #=======================================================...
[ "0.6977078", "0.6791378", "0.67512304", "0.6542777", "0.65151954", "0.6437664", "0.63116986", "0.6303321", "0.6193718", "0.61646706", "0.59557414", "0.5937291", "0.5829638", "0.57413834", "0.574052", "0.5728676", "0.5698981", "0.56793606", "0.5676223", "0.5671764", "0.5667022...
0.7305225
0
Create a mask with the label on the center
def mask_center_label ( gray ) : assert gray is not None # s = ndimage.generate_binary_structure(2,2) # iterate structure label_im, nb_labels = label(gray) # get center label h = label_im.shape[0] w = label_im.shape[1] l = label_im [h//2,w//2] gray [ label_im == l ] = 255 gray [ label_im != l ] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test(shape=(1000,2000)):\n mask = Mask()\n mask.addCircle(400,300,250)\n mask.subtractCircle(400,300,150)\n mask.addRectangle(350,250,1500,700)\n plt.imshow( mask.getMask(shape) )\n return mask", "def get_labeled_mask(mask, cutoff=.5):\n mask = mask.reshape(mask.shape[0], mask.shape[1])\n lab_mas...
[ "0.6803218", "0.6571681", "0.65246916", "0.6497999", "0.63692355", "0.6286419", "0.6268337", "0.6121464", "0.60790145", "0.60746795", "0.6064677", "0.60231245", "0.6011445", "0.60024136", "0.59374267", "0.5933298", "0.5933298", "0.59226876", "0.5905292", "0.58858913", "0.5859...
0.7901079
0
Find keypoints return keypoints,oob,oob_corners
def find_keypoints ( gray , quality , ksize , blocksize , max_area = None ) : gray32 = np.float32(gray) points = cv2.goodFeaturesToTrack(gray32,maxCorners = 100, qualityLevel = quality ,minDistance = ksize , blockSize = blocksize ) if points is None : return None , None , None if len(points) < 4 : ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_keypoints():\n # Keypoints are not available in the COCO json for the test split, so we\n # provide them here.\n keypoints = [\n 'nose',\n 'neck',\n 'right_shoulder',\n 'right_elbow',\n 'right_wrist', \n 'left_shoulder',\n 'left_elbow',\n '...
[ "0.658829", "0.6321282", "0.6251691", "0.62504333", "0.61729217", "0.6127858", "0.6038871", "0.5958532", "0.588819", "0.58789515", "0.584122", "0.58378017", "0.57971174", "0.5792397", "0.5779205", "0.5744641", "0.5741418", "0.5735973", "0.56906796", "0.5690645", "0.56815356",...
0.7369708
0
Report a game user (publicReportUser) This API is used to report a game user.
def public_report_user( user_id: str, body: Optional[UserReportRequest] = None, namespace: Optional[str] = None, x_additional_headers: Optional[Dict[str, str]] = None, **kwargs ): if namespace is None: namespace, error = get_services_namespace() if error: return None,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def public_report_user_async(\n user_id: str,\n body: Optional[UserReportRequest] = None,\n namespace: Optional[str] = None,\n x_additional_headers: Optional[Dict[str, str]] = None,\n **kwargs\n):\n if namespace is None:\n namespace, error = get_services_namespace()\n if error...
[ "0.6700652", "0.5891406", "0.5739046", "0.5566783", "0.54898053", "0.5434313", "0.5175307", "0.5167019", "0.5063156", "0.50373536", "0.49089944", "0.4897654", "0.48848084", "0.47880802", "0.47798076", "0.4726982", "0.46465796", "0.46253952", "0.45950738", "0.45738474", "0.457...
0.7041506
0
Report a game user (publicReportUser) This API is used to report a game user.
async def public_report_user_async( user_id: str, body: Optional[UserReportRequest] = None, namespace: Optional[str] = None, x_additional_headers: Optional[Dict[str, str]] = None, **kwargs ): if namespace is None: namespace, error = get_services_namespace() if error: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def public_report_user(\n user_id: str,\n body: Optional[UserReportRequest] = None,\n namespace: Optional[str] = None,\n x_additional_headers: Optional[Dict[str, str]] = None,\n **kwargs\n):\n if namespace is None:\n namespace, error = get_services_namespace()\n if error:\n ...
[ "0.70421743", "0.58893025", "0.5736027", "0.556663", "0.54870945", "0.5431025", "0.5173642", "0.51648986", "0.5062724", "0.50327814", "0.4912808", "0.4900122", "0.4882108", "0.47911742", "0.4778611", "0.47274184", "0.46434143", "0.46279213", "0.45987266", "0.45737627", "0.457...
0.67011523
1
Unban user (unBanUsers) Unban user.
def un_ban_users( body: Optional[ADTOForUnbanUserAPICall] = None, namespace: Optional[str] = None, x_additional_headers: Optional[Dict[str, str]] = None, **kwargs ): if namespace is None: namespace, error = get_services_namespace() if error: return None, error request...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def unban(self, ctx, name: str):\n try:\n bans = await self.bot.get_bans(ctx.message.server)\n user = discord.utils.get(bans, name=name)\n if user is not None:\n await self.bot.unban(ctx.message.server, user)\n except discord.Forbidden:\n ...
[ "0.73927313", "0.7286222", "0.7191122", "0.70447034", "0.6991706", "0.69295615", "0.6800117", "0.6725039", "0.6711565", "0.66853315", "0.6641307", "0.64752614", "0.6458169", "0.6411947", "0.6342894", "0.6303848", "0.6295091", "0.6165509", "0.6080306", "0.60705745", "0.6019670...
0.7423315
0
Allow items to be randomly assigned to a specific door
def door_assignment(): doors = ['door-money.png', 'door-goat.png', 'door-trash.png'] GameScreen.door1_reveal = random.choice(doors) doors.remove(GameScreen.door1_reveal) GameScreen.door2_reveal = random.choice(doors) doors.remove(GameScreen.door2_reveal) GameScreen.door3...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_item_random(self, x, y):\n r = int(random() * 10)\n if 3 < r and r <= 6:\n self.put_fireitem(x, y)\n elif 6 < r and r <= 9:\n self.put_bombitem(x, y)", "def randomly_spawn_mothership(self) -> None:\n return", "def make_selection(self, num):\n oth...
[ "0.6729286", "0.6421847", "0.63770074", "0.6332747", "0.6300454", "0.6246168", "0.6197324", "0.61616385", "0.614601", "0.61001724", "0.60988545", "0.607681", "0.60475236", "0.60334176", "0.5995888", "0.59947056", "0.59499204", "0.5910717", "0.5909556", "0.5908517", "0.5888024...
0.7309903
0
Exit game to main menu, reset doors and its counter, reenable buttons, and set score back to 0 (frontend and backend)
def exit_game(self): for i in range(1, 4, 1): self.ids['door' + str(i)].source = \ 'door_closed.jpg' self.ids['button' + str(i)].disabled = False setattr(self, 'door'+str(i)+'_counter', 0) self.manager.current = 'MainMenu' self.ids['score'].tex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart_game(self):\n for i in range(1, 4, 1):\n self.ids['door' + str(i)].source = \\\n 'door_closed.jpg'\n self.ids['button' + str(i)].disabled = False\n setattr(self, 'door'+str(i)+'_counter', 0)\n self.ids['score'].text = 'SCORE: 0'\n sel...
[ "0.727037", "0.66885936", "0.6639878", "0.6521734", "0.64991874", "0.64402384", "0.62949705", "0.62849057", "0.6265572", "0.6215285", "0.6215182", "0.6201738", "0.61912596", "0.61843693", "0.6183439", "0.61401874", "0.61354685", "0.6110541", "0.60959685", "0.60884243", "0.607...
0.80285466
0
Have game continue to next round, reset doors and its counter, reenable buttons, return to gamescreen, and initate random door selection for new game round
def next_round(self): for i in range(1, 4, 1): self.ids['door' + str(i)].source = \ 'door_closed.jpg' self.ids['button' + str(i)].disabled = False setattr(self, 'door'+str(i)+'_counter', 0) self.win() self.manager.current = 'GameScreen' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart_game(self):\n for i in range(1, 4, 1):\n self.ids['door' + str(i)].source = \\\n 'door_closed.jpg'\n self.ids['button' + str(i)].disabled = False\n setattr(self, 'door'+str(i)+'_counter', 0)\n self.ids['score'].text = 'SCORE: 0'\n sel...
[ "0.76112235", "0.6896782", "0.67471427", "0.6692765", "0.66255456", "0.62401", "0.6160332", "0.61408514", "0.6125911", "0.6124651", "0.60867697", "0.60854703", "0.60683846", "0.6045126", "0.6037761", "0.6029508", "0.5998361", "0.5985919", "0.5934712", "0.5919912", "0.5916393"...
0.79653376
0
Have user restart game, reset doors and its counter, reenable buttons, return to gamescreen, and initate random door selection for new game
def restart_game(self): for i in range(1, 4, 1): self.ids['door' + str(i)].source = \ 'door_closed.jpg' self.ids['button' + str(i)].disabled = False setattr(self, 'door'+str(i)+'_counter', 0) self.ids['score'].text = 'SCORE: 0' self.score = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exit_game(self):\n for i in range(1, 4, 1):\n self.ids['door' + str(i)].source = \\\n 'door_closed.jpg'\n self.ids['button' + str(i)].disabled = False\n setattr(self, 'door'+str(i)+'_counter', 0)\n self.manager.current = 'MainMenu'\n self.ids...
[ "0.70774907", "0.68887424", "0.6887234", "0.67669386", "0.6693799", "0.64543575", "0.6377583", "0.63584447", "0.6319402", "0.6313194", "0.6307152", "0.62581056", "0.6147627", "0.61346436", "0.60630757", "0.6037693", "0.60371745", "0.6024656", "0.6011252", "0.5971611", "0.5955...
0.81087166
0