query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Train a model. This downloads any previous output saved to the train_uri, starts training (or resumes from a checkpoint), periodically syncs contents of train_dir to train_uri and after training finishes.
def train(self, tmp_dir): self.log_options() # Sync output of previous training run from cloud. train_uri = self.backend_opts.train_uri train_dir = get_local_path(train_uri, tmp_dir) make_dir(train_dir) sync_from_dir(train_uri, train_dir) # Get zip file for each...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self):\n # Change directory to the code directory\n current_working_directory = os.getcwd()\n\n os.chdir(self.model_parameters[\"NN_code_directory\"])\n\n self.call_training_routine()\n\n # Come back to the original directory\n os.chdir(current_working_directory)...
[ "0.684478", "0.67909753", "0.6788122", "0.6568369", "0.64934313", "0.6482503", "0.64557904", "0.64470214", "0.64431083", "0.64344686", "0.64344686", "0.6407435", "0.6387641", "0.638085", "0.63221234", "0.6311758", "0.6304773", "0.62890357", "0.6258352", "0.6238692", "0.620988...
0.0
-1
Check that all annotations have been properly mapped to the new categories.
def test_annotations_mapping(): old_pair_to_new_pair = {} for search_row in map_rows: OL, OP, NL, NP = search_row[0], search_row[1], search_row[2], search_row[3] if not NL == 'NA': old_pair_to_new_pair[(OL, OP)] = (NL, NP) # rows where multiple old categories map to a single new category surjections = [] #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_total_new_annotations():\n\told_num_anns = len(oset['annotations'])\n\tnew_num_anns = len(nset['annotations'])\n\tnum_NAs_found = 0\n\n\told_anns = oset['annotations']\n\tfor ann in old_anns:\n\t\tann_id = ann['id']\n\t\tcat_id = ann['category_id']\n\t\tcat = old_coco_obj.cats[cat_id]\n\t\tOL = cat['name'...
[ "0.7045758", "0.65581656", "0.63707834", "0.6224227", "0.61580133", "0.59519255", "0.59435195", "0.5936222", "0.57769525", "0.57261133", "0.5719562", "0.5670107", "0.5578703", "0.55559886", "0.55353236", "0.55286354", "0.5504459", "0.5482841", "0.54776967", "0.5453385", "0.54...
0.7257445
0
Create dataloader for training
def create_train_dataloader(configs): train_lidar_aug = OneOf([ Random_Rotation(limit_angle=np.pi / 4, p=1.0), Random_Scaling(scaling_range=(0.95, 1.05), p=1.0), ], p=0.66) train_dataset = KittiDataset(configs, mode='train', lidar_aug=train_lidar_aug, hflip_prob=configs.hflip_prob, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_dataloader(self) -> torch.utils.data.DataLoader: \n return torch.utils.data.DataLoader(self.dataset_train, **self.dl_kwargs)", "def train_dataloader(self) -> DataLoader:\n return DataLoader(\n self.train_dataset,\n batch_size=self.hparams.batch_size,\n ...
[ "0.83937114", "0.82088375", "0.81918836", "0.816491", "0.810904", "0.774214", "0.77251464", "0.76816916", "0.763693", "0.76358676", "0.761047", "0.7593995", "0.7588503", "0.75882864", "0.75821257", "0.75185645", "0.7442169", "0.7397551", "0.73786515", "0.7349592", "0.72975796...
0.79936796
5
Create dataloader for testing phase
def create_test_dataloader(configs): test_dataset = KittiDataset(configs, mode='test', lidar_aug=None, hflip_prob=0., num_samples=configs.num_samples) test_sampler = None if configs.distributed: test_sampler = torch.utils.data.distributed.DistributedSampler(test_dataset) test_dataloader = DataL...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dataloader(self) -> torch.utils.data.DataLoader: \n return torch.utils.data.DataLoader(self.dataset_test, **self.dl_kwargs)", "def test_dataloader(self) -> data.DataLoader:\n return data.DataLoader(dataset=self.datasets['test'], batch_size=self.batch_size,\n ...
[ "0.8374431", "0.8200052", "0.819104", "0.8127956", "0.7568495", "0.73299706", "0.7184626", "0.7120198", "0.70956695", "0.7048255", "0.70100737", "0.6945022", "0.6931024", "0.69055", "0.6884618", "0.68773216", "0.6870127", "0.6861115", "0.6848709", "0.68153614", "0.68077546", ...
0.7715962
4
Initializes a new instance from the given pair of line numbers.
def __init__(self, start, stop): if start > stop: raise IndexError(f'range is invalid: start={start} > stop={stop}') self._start = start - 1 self._stop = stop - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, line, lineno, syspaths):\n self._line = line\n self._lineno = lineno\n self._orig_line = None\n self._syspaths = syspaths", "def fromLines(cls, listOfLine: list):\n points = cls.edgeToVertex(listOfLine)\n return cls.fromPoints(points)", "def fromLine...
[ "0.6218174", "0.6215272", "0.6215272", "0.6215272", "0.62006766", "0.6183", "0.6107653", "0.6002348", "0.59075344", "0.5890233", "0.5864715", "0.58521837", "0.5808647", "0.57976574", "0.575521", "0.57459915", "0.5735326", "0.5706522", "0.565815", "0.558863", "0.5567786", "0...
0.0
-1
Returns a copy of the given slice, but shifted by self's position.
def _shifted(self, aslice): return slice( self._start if aslice.start is None else self._clamp(aslice.start), self._stop if aslice.stop is None else self._clamp(aslice.stop), aslice.step)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slice(self, start=None, end=None, inplace=False):\n if inplace:\n self.data = self.data[start:end]\n else:\n cpy = self.copy()\n\n cpy.data = cpy.data[start:end]\n\n return cpy\n return", "def __getslice__(self, start, stop):\n return se...
[ "0.64713943", "0.64195925", "0.63719803", "0.63636476", "0.61665016", "0.6126936", "0.6126204", "0.612334", "0.6081072", "0.6071493", "0.60502535", "0.602803", "0.60064894", "0.6001442", "0.59779346", "0.5954122", "0.59535617", "0.5867082", "0.58670145", "0.579886", "0.578891...
0.78440887
0
Calculates the rangerespecting value of the given 0based index.
def _clamp(self, index, strict=False): self_len = len(self) if strict and not -self_len <= index < self_len: raise IndexError('list index out of range') clamped_index = ( max(index + self_len, 0) if index < 0 else min(index, self_len)) return self._start + clamped...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc(self,index, counter_values):\n try:\n angles = self.ik220_dev.read_attribute('Angles').value\n if index == 9:\n return sum(angles[:3])/3.0 # Excluded channel 4 of grating pitch encoder because of problems of Homing in the last header of the RON grating encoder.\...
[ "0.6782899", "0.62422496", "0.61681116", "0.6138765", "0.60408014", "0.57973915", "0.5787379", "0.5787013", "0.5786146", "0.57632565", "0.57589334", "0.57574314", "0.5734256", "0.5706606", "0.5703005", "0.56936306", "0.56923205", "0.56814224", "0.5669622", "0.5666487", "0.565...
0.0
-1
Return a list of weak references to the values. The references are not guaranteed to be 'live' at the time they are used, so the result of calling the references needs to be checked before being used. This can be used to avoid creating references that will cause the garbage collector to keep the values around longer th...
def valuerefs(self): return [ref(value) for value in self.itervalues()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _refs(self, items):\n # type: (Iterable[Any]) -> Iterable[weakref.ReferenceType]\n return map(self.ref, items)", "def get_pyweakrefs(obj: typing.Any) -> list[ReferenceType]:\r\n seq = _reference_id_registry.get(id(obj), [])\r\n return [seq[0] for item in seq]", "def keyrefs(self):\n ...
[ "0.6810221", "0.6778115", "0.66598004", "0.6452447", "0.64434457", "0.6413558", "0.6380604", "0.63622016", "0.63602793", "0.62803125", "0.6164134", "0.6074865", "0.607191", "0.59667325", "0.59284765", "0.58959025", "0.588602", "0.586008", "0.586008", "0.58286846", "0.57168734...
0.74253666
0
Return a list of weak references to the keys. The references are not guaranteed to be 'live' at the time they are used, so the result of calling the references needs to be checked before being used. This can be used to avoid creating references that will cause the garbage collector to keep the keys around longer than n...
def keyrefs(self): return [ref(key) for key in self.iterkeys()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keyrefs(self):\n return list(self.data)", "def keyrefs(self):\r\n return self.data.keys()", "def keyrefs(self):\r\n return self.data.keys()", "def iterkeyrefs(self):\n for key in self.iterkeys():\n yield ref(key)", "def list_ref_keys(self):\n print('=======...
[ "0.730597", "0.72394276", "0.72394276", "0.70282", "0.68516254", "0.6593718", "0.6593718", "0.6565825", "0.64929503", "0.6406534", "0.62809074", "0.62600255", "0.62514955", "0.6240461", "0.6136878", "0.6136365", "0.61295134", "0.61295134", "0.6096409", "0.60934657", "0.608915...
0.8208134
0
Calculate absolute magnitues. All inputs (except null_mag) can be arrays.
def calc_abs_mags(app_mags,unc_mags,distance,unc_distance,extinction, null_mag=-9999.): # Only do the calculation where the magnitudes are valid bad_app = np.where(app_mags==null_mag)[0] good_app = np.where(app_mags!=null_mag)[0] # Calculate absolute mags abs_mags = ((app_mags - extinc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app_mag(abs_mag, phase_angle, slope_g, d_ast_sun, d_ast_earth):\n\n # Compute the apparent / visual magnitude\n mag = red_mag(abs_mag, phase_angle, slope_g) \\\n + 5.0 * np.log10(d_ast_sun * d_ast_earth)\n\n # Return the apparent magnitude\n return mag", "def calculate_mags(self):\n ...
[ "0.6696639", "0.65538675", "0.6433252", "0.64180446", "0.64014375", "0.6386693", "0.6381196", "0.6375431", "0.6362607", "0.6361963", "0.6334615", "0.627792", "0.62765354", "0.6202803", "0.6190469", "0.6167587", "0.6141246", "0.61259466", "0.6087195", "0.6084879", "0.6060082",...
0.7148699
0
Convert T to bolometric correction in (g,r,i) with uncertainty.
def calc_bc(teff,unc_teff,which_mag="r",null_teff=-9999.): funcs, teffrange, slopes, teff_bins = read_files.read_BCs() # Find the range where the interpolation is valid interp_range = np.where((teff >= teffrange[0]) & (teff <= teffrange[1]))[0] # Interpolate where Tef...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _squash_correction(t):\n # TODO: Refer to OpenAI implementation for more numerically stable correction\n # https://github.com/openai/spinningup/blob/master/spinup/algos/pytorch/sac/core.py\n return torch.sum(torch.log(1 - t ** 2 + EPS), dim=1)", "def convertC(TF):\r\n TC = 5.0/9.0*(TF...
[ "0.5984823", "0.59735805", "0.5735796", "0.569013", "0.56001407", "0.5503545", "0.5480254", "0.54718375", "0.54646087", "0.5457353", "0.5447354", "0.53911436", "0.5359841", "0.5354821", "0.53404236", "0.5326141", "0.53195953", "0.5307312", "0.5303006", "0.52490443", "0.523554...
0.5198966
25
Center rect2 in rect1 with offset.
def center(rect1, rect2, xoffset=0, yoffset=0): return (rect1.centerx - rect2.centerx + xoffset, rect1.centery - rect2.centery + yoffset)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blit_centered(surface1, surface2):\n rect = surface2.get_rect()\n rect = rect.move((surface1.get_width()-rect.width)//2,\n (surface1.get_height()-rect.height)//2)\n surface1.blit(surface2, rect)", "def rectIntersect(rect1, rect2):\n rect = np.zeros_like(rect1)\n rect[[0, 2]...
[ "0.64493525", "0.61856055", "0.6095993", "0.6095495", "0.6095495", "0.6017771", "0.6010632", "0.5806191", "0.5763811", "0.57583576", "0.5653849", "0.564151", "0.5632748", "0.5626661", "0.5612254", "0.561219", "0.55702823", "0.5547422", "0.5543303", "0.55384064", "0.55295676",...
0.81087
0
Factory method to create dict of obj from files in given folder.
def from_folder(cls, fname): raw_dict = read_from_folder(fname) ret_dict = {} for key in raw_dict: data = RawTimings(raw_dict[key]) data.tags = key.split('_') ret_dict[key] = data return ret_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(cls, raw_folder: str) -> Dict[str, Any]:\n folder_path = os.path.abspath(raw_folder)\n data = dict()\n files = os.listdir(folder_path)\n for file in files:\n if is_ignored(file):\n continue\n try:\n file = os.path.join(raw_f...
[ "0.68157285", "0.6399903", "0.6375229", "0.63564295", "0.62388086", "0.62054795", "0.617772", "0.61027855", "0.60750955", "0.6059533", "0.6026899", "0.59532785", "0.59530497", "0.59278876", "0.5907951", "0.5889522", "0.5867117", "0.5865455", "0.58501536", "0.58164465", "0.580...
0.6836337
0
Reads all LIRC raw message files from a folder and returns a dict over it with the filename as keys.
def read_from_folder(folder): raw_dict = dict() for file in os.listdir(folder): raw = read_raw_from_file(os.path.join(folder, file)) raw_dict[file] = raw return raw_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(cls, raw_folder: str) -> Dict[str, Any]:\n folder_path = os.path.abspath(raw_folder)\n data = dict()\n files = os.listdir(folder_path)\n for file in files:\n if is_ignored(file):\n continue\n try:\n file = os.path.join(raw_f...
[ "0.7085507", "0.66897714", "0.62822896", "0.6047928", "0.600232", "0.59483385", "0.5932311", "0.5888907", "0.58852863", "0.57499075", "0.574329", "0.57030106", "0.56325465", "0.5603814", "0.5555686", "0.55541354", "0.55478114", "0.5543213", "0.5537173", "0.5529094", "0.550334...
0.75373226
0
Gets or sets the GUID of the anchor Term object for a TaxonomyField object.
def anchor_id(self): return self.properties.get('AnchorId', None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def term_id(self) -> Optional[str]:\n return pulumi.get(self, \"term_id\")", "def tax_id(self) -> str:\n return self._tax_id", "def tax_id(self):\n return self._tax_id", "def anchor_id(self):\n id = \"\"\n f = lambda ch: filter(lambda k: self.sentence._anchors[k] == ch, sel...
[ "0.5557944", "0.5198456", "0.5151815", "0.51344466", "0.50646406", "0.5026327", "0.5011637", "0.5011637", "0.4989578", "0.49556795", "0.49195692", "0.49081844", "0.48903033", "0.48865855", "0.48728147", "0.48494673", "0.4838756", "0.48160574", "0.47449657", "0.47395033", "0.4...
0.532937
1
Gets a Boolean value that specifies whether the Term object identified by the AnchorId property is valid.
def is_anchor_valid(self): return self.properties.get('IsAnchorValid', None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isAnchor(node):\n # TODO What is considered an anchor needs to be subject to an option\n return bool((isinstance(node, nodes.target)\n or isinstance(node, nodes.Structural))\n and node[DuAttrIds]\n and not node.get(DuAttrRefuri, None))", ...
[ "0.58818954", "0.56784624", "0.5366098", "0.5359269", "0.52730113", "0.52590793", "0.52466124", "0.52367127", "0.51960933", "0.5176873", "0.5148184", "0.51372683", "0.5110057", "0.5106547", "0.51018214", "0.5100335", "0.507144", "0.5058995", "0.50334364", "0.50139815", "0.500...
0.7163166
0
Gets the GUID that identifies the hidden text field in an item.
def text_field(self): return self.properties.get('TextField', None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guid(self):\n _, _, _, guid, _ = RPR.GetSetMediaItemTakeInfo_String(\n self.id, 'GUID', 'stringNeedBig', False\n )\n return guid", "def guid(self) -> str:\n return pulumi.get(self, \"guid\")", "def guid(self) -> str:\n return pulumi.get(self, \"guid\")", "def...
[ "0.66063565", "0.5996896", "0.5996896", "0.5946919", "0.5946919", "0.58882385", "0.5775294", "0.56421673", "0.557816", "0.55312073", "0.5524665", "0.54650605", "0.5428426", "0.5377309", "0.5366651", "0.534912", "0.53467125", "0.5341688", "0.5325107", "0.53201675", "0.53106844...
0.0
-1
Return the slices to split by. A group array is made of strictly increasing group identifiers. >>> slices_using_group_array(np.array([0, 0, 0, 1, 1, 2, 3, 3, 3])) [(0, 3), (3, 5), (5, 6), (6, 9)]
def slices_using_group_array(group_array): unique_elements = np.unique(group_array) slices = [] for unique_element in unique_elements: indexes = np.flatnonzero(group_array == unique_element) low, high = (indexes[0], indexes[-1] + 1) sli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_array(arr, num_of_splits):\n # TODO Replace this function with gluon.utils.split_data() once targeting MXNet 1.7\n size = arr.shape[0]\n if size < num_of_splits:\n return [arr[i:i + 1] for i in range(size)]\n slice_len, rest = divmod(size, num_of_splits)\n div_points = [0] + [(slice...
[ "0.68200743", "0.6126065", "0.6118591", "0.61129004", "0.6072251", "0.6020736", "0.5962752", "0.58874077", "0.58483255", "0.5841077", "0.5815266", "0.5772807", "0.57603204", "0.57099736", "0.5683247", "0.5667062", "0.56557834", "0.56422514", "0.56315434", "0.5619974", "0.5602...
0.87439823
0
Return list of index lists, ordered by first occurance of value.
def indices_using_group_array(group_array): unique_elements = np.unique(group_array) indices = [] for unique_element in unique_elements: indices.append((unique_element, np.flatnonzero(group_array == unique_element))) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def occ_indices(self):\n indices = []\n for index,item in enumerate(self):\n if item==1:\n indices.append(index)\n return indices", "def _get_lowest_order_label_indices(self):\n indices = OrderedDict()\n for i, term in enumerate(self.label_vector):\n ...
[ "0.6796414", "0.662611", "0.651024", "0.6478894", "0.64324385", "0.6290973", "0.618396", "0.6164228", "0.61522245", "0.6146814", "0.61326003", "0.60264134", "0.59267384", "0.5917327", "0.5909607", "0.5905965", "0.5889817", "0.58883524", "0.58873314", "0.5825982", "0.58143395"...
0.0
-1
Copy elements of other dict and proceed with visiting each copy using the same visitor.
def visit_dict(self, sydict): for key, value in sydict.items(): child = type(value)(value.container_type) self.current[key] = child value.visit(SpineCopyVisitor(child))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_data(first: dict, second: dict, changeables: tuple):\n for name, field in first.items():\n if name not in changeables:\n second[name] = field", "def copy_from_other(self, other):\n super(RabjDict, self).copy_from_other(other)\n self.rabjcallable = other.rabjcallable", "de...
[ "0.65114534", "0.6267726", "0.6209626", "0.62063473", "0.6184538", "0.60668284", "0.60277677", "0.59823406", "0.59443116", "0.5917133", "0.5906282", "0.5881764", "0.5873025", "0.58619976", "0.58373904", "0.5829111", "0.5791056", "0.5731859", "0.5727664", "0.5710617", "0.56969...
0.6238025
2
Copy sygroup container structure updated with noncontainer types.
def spinecopy(sygroup_): copy = type(sygroup_)(sygroup_.container_type) visitor = SpineCopyVisitor(copy) sygroup_.visit(visitor) return copy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visit_dict(self, sydict):\n for key, value in sydict.items():\n child = type(value)(value.container_type)\n self.current[key] = child\n value.visit(SpineCopyVisitor(child))", "def visit_record(self, syrecord):\n for key, value in syrecord.items():\n c...
[ "0.55524445", "0.54819393", "0.5447223", "0.5340024", "0.5278873", "0.52377933", "0.51386845", "0.5107444", "0.507348", "0.4991297", "0.49442747", "0.4920816", "0.48656544", "0.48373306", "0.47423097", "0.47308445", "0.47214356", "0.4708827", "0.46894085", "0.46705914", "0.46...
0.6497219
0
Maximum output length supported by the encoder.
def max_positions(self): return self.args.max_positions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setMaxOutputLength(self, value):\n return self._set(maxOutputLength=value)", "def setMaxOutputLength(self, value):\n return self._set(maxOutputLength=value)", "def setMaxOutputLength(self, value):\n return self._set(maxOutputLength=value)", "def len_max(self):\n return 16 + 16...
[ "0.761554", "0.761554", "0.761554", "0.75845206", "0.7364795", "0.7340533", "0.7268281", "0.72500485", "0.7244087", "0.70455", "0.70181966", "0.70042694", "0.70007545", "0.6991749", "0.69536597", "0.6952096", "0.69393617", "0.69274753", "0.69184226", "0.6898335", "0.6890571",...
0.0
-1
First we squeeze the added dimension for conv ops which is the second axis. Then, we transpose key_feature then dot multiplying it with key feature.
def Calculate_Graph(self, key_feature, query_feature, idx): key_feature = tf.squeeze(key_feature, axis=1) query_feature = tf.squeeze(query_feature, axis=1) key_feature = tf.transpose(key_feature, [0, 2, 1]) key_feature = \ Dense( key_feature, self.grap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_features_op(\n self, train_features: Dict[str, tf.Tensor], metadata_features: Dict[str, tf.Tensor]\n ):\n\n # Sorting the train features dictionary so that we control the order\n train_features_list = [train_features[k] for k in sorted(train_features)]\n\n # Concat all ...
[ "0.57621706", "0.55088896", "0.5471666", "0.54623723", "0.54553473", "0.53864247", "0.53768206", "0.5371355", "0.5356253", "0.5354748", "0.53519464", "0.53500116", "0.5332922", "0.5313343", "0.5282896", "0.52676773", "0.5257309", "0.5244476", "0.5242193", "0.5231572", "0.5226...
0.0
-1
To using CNN on 3dimensions embedding inputs, we have to add a new dimension on inputs Here the original inputs is [batch_size, num_steps, channels], we convert it into [batch_size, 1, num_steps, channels], hence, a conv kernel is working on a set of steps which has a sequential relationship with each other.
def Graph_Predictor(self): with tf.variable_scope(self.graph_scope): graph_inputs = tf.expand_dims(self.inputs, axis=1) assert tf.shape(graph_inputs)[0] > 0, 'Inputs must have at least 1 batch size' assert tf.shape(graph_inputs)[2] > 0, 'Inputs must have a length greater ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_cnn_input(config):\n print('Building input to cnn layer')\n input_layer = tf.keras.layers.Input(\n shape=(config['sequence_length'],), name='input_sequence')\n embedding_layer = tf.keras.layers.Embedding(\n input_dim=len(config['vocab']), output_dim=config['emb_size'],\n inp...
[ "0.6819845", "0.6781657", "0.6577443", "0.6461137", "0.636022", "0.6326726", "0.6325827", "0.63257647", "0.63224506", "0.632157", "0.63060427", "0.6280856", "0.62797594", "0.6276163", "0.6263549", "0.62392586", "0.62108946", "0.62087405", "0.6203808", "0.62018", "0.61915106",...
0.0
-1
Go through the list of words, and seperate into old and new arrays Take DataEntry and assign appropriate dictionaries with word arrays, inti to 0 count static, no return
def assignWordList(filename, thisDataEntry): oldArr = [] newArr = [] try: with open(filename, encoding="latin-1") as file: lines = [line.rstrip() for line in file] idx = 0 while(lines[idx] != "***"): oldArr.append(lines[idx].lower()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(articles): # Here, the articles will be very long strings\r\n vdictionary = {} # dictionary for tokens that are found in dictionary\r\n _odata = [0...
[ "0.6147924", "0.6115093", "0.6113084", "0.6100439", "0.60799885", "0.6044524", "0.6013873", "0.5965036", "0.59587365", "0.5939699", "0.5929528", "0.59289545", "0.5869795", "0.5863623", "0.5857215", "0.5824337", "0.5800687", "0.5794351", "0.5782081", "0.5773047", "0.576525", ...
0.70239985
0
edits a parcel's destination with the id provided
def edit_a_parcel(destination, id): query = """UPDATE parcels SET destination = %s WHERE id = %s""" tuple =(destination , id) db.insert(query, tuple)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_parcel_destination(self, new_destination, parcel_id):\n\n sql = \"UPDATE parcel_orders SET parcel_destination = '{}' WHERE parcel_id = '{}'\".format(new_destination,parcel_id)\n self.db_object.cursor.execute(sql)\n rowcount = self.db_object.cursor.rowcount\n return rowcount",...
[ "0.736655", "0.66343945", "0.62988603", "0.6107465", "0.6000879", "0.57703507", "0.573675", "0.57220083", "0.5698883", "0.55384564", "0.5447052", "0.54358333", "0.54333776", "0.5427935", "0.5408045", "0.5350747", "0.53474456", "0.53294116", "0.53275293", "0.5324247", "0.53029...
0.8699025
0
Convert string to corresponding list of int values.
def string_to_ord(string): return [ord(char) for char in string]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_int_list(input_str):\n return [int(part) for part in input_str.split(\",\")]", "def strToListInt(x):\n if type(x)==str:\n return [int(i) for i in x[1:-1].split(\", \")]", "def str2ints(params: str) -> List[int]:\n return list(map(int, params.split(\",\")))", "def get_int_lis...
[ "0.81040645", "0.79922307", "0.79642045", "0.79137284", "0.7797719", "0.7731629", "0.7480717", "0.7470639", "0.7468229", "0.73378205", "0.73141694", "0.7286076", "0.7268324", "0.725023", "0.7228379", "0.721461", "0.72010165", "0.7187583", "0.71824574", "0.7177309", "0.7151673...
0.0
-1
Determine whether any of the same waters are present in two different frames x and y. Returns 1 if any water is present in both frames, 0 otherwise.
def same_water_present(x, y): if (x == None) or (y == None): return 0.0 if len(x.intersection(y)) > 0: return 1.0 return 0.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _overlap(x1, w1, x2, w2):\r\n if x1+w1 < x2-w2: return False\r\n if x1-w1 > x2+w2: return False\r\n\r\n return True", "def fits(a, b):\n return all(x & y for x, y in zip(a, b))", "def match(uspec1, uspec2):\n \n if uspec1.is_power_onoff() and uspec2.is_power_onoff():\n return True\n ...
[ "0.61665714", "0.5950268", "0.59061784", "0.5891662", "0.58575016", "0.58547527", "0.5789657", "0.5777125", "0.5716584", "0.56735265", "0.56633663", "0.56318915", "0.561875", "0.5609413", "0.55924594", "0.5548763", "0.5525367", "0.5523931", "0.5514826", "0.5507595", "0.547921...
0.73565584
0
Return currency's precision. Precision is the number of decimals found after the decimal point in the currency's format pattern.
def get_currency_precision(currency: str) -> int: precisions = get_global('currency_fractions') return precisions.get(currency, precisions['DEFAULT'])[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _price_precision(self) -> int:\n return selectors.get_exchange(self.exchange).vars['precisions'][self.symbol]['price_precision']", "def precision(self):\n string = self.ask('od;E;') # get the actual output\n i1 = string.find('.')\n # find the indices of the dot be...
[ "0.7914333", "0.7511029", "0.7387204", "0.7387204", "0.7224677", "0.72148305", "0.7010322", "0.68732375", "0.68732375", "0.68202674", "0.67987674", "0.67037594", "0.6684054", "0.6544114", "0.65028507", "0.6479882", "0.6465569", "0.6403635", "0.6368875", "0.63601667", "0.63574...
0.7536575
1
Return the given number formatted for a specific locale.
def format_number(number: float | decimal.Decimal | str, locale: Locale | str | None = LC_NUMERIC) -> str: warnings.warn('Use babel.numbers.format_decimal() instead.', DeprecationWarning, stacklevel=2) return format_decimal(number, locale=locale)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_number(n):\n # locale.setlocale(locale.LC_ALL, 'en_US') # commented by me\n # return locale.format('%d', n, grouping=True)\n return n", "def format_thousands(number):\r\n return locale.format('%d', number, True)", "def format_thousands(number):\n return locale.format('%d', number, Tr...
[ "0.7406203", "0.6556014", "0.648363", "0.6404901", "0.636395", "0.6129434", "0.61163366", "0.6072753", "0.60621035", "0.5997408", "0.5988963", "0.5982823", "0.5980337", "0.5960048", "0.5913231", "0.5856187", "0.5840071", "0.58193314", "0.5810381", "0.5800327", "0.57965493", ...
0.69247735
1
Return maximum precision of a decimal instance's fractional part. Precision is extracted from the fractional part only.
def get_decimal_precision(number: decimal.Decimal) -> int: # Copied from: https://github.com/mahmoud/boltons/pull/59 assert isinstance(number, decimal.Decimal) decimal_tuple = number.normalize().as_tuple() # Note: DecimalTuple.exponent can be 'n' (qNaN), 'N' (sNaN), or 'F' (Infinity) if not isinstan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(self):\n string = self.ask('od;E;') # get the actual output\n i1 = string.find('.')\n # find the indices of the dot before the decimal part and the E before\n # the exponent\n i2 = string.find('E', i1)\n # calculate the number of digit in the...
[ "0.64896065", "0.6373377", "0.6296392", "0.6089381", "0.6086621", "0.60409886", "0.59476304", "0.59327143", "0.59276164", "0.5920862", "0.59200484", "0.5918107", "0.58923376", "0.5864464", "0.5864464", "0.5853472", "0.58504164", "0.5841112", "0.5816055", "0.5795287", "0.57911...
0.66313976
0
Return minimal quantum of a number, as defined by precision.
def get_decimal_quantum(precision: int | decimal.Decimal) -> decimal.Decimal: assert isinstance(precision, (int, decimal.Decimal)) return decimal.Decimal(10) ** (-precision)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def native_min_value(self) -> float:\n return TEMP_MINIMUM", "def smallest_geq(x: int) -> int:\n assert x >= 0\n\n n = 0\n while iterative_factorial(n) < x:\n n += 1\n\n return n", "def min_value(self) -> float:\n return DEFAULT_MIN_VALUE", "def compute_minimum_scale(self):\n...
[ "0.60778457", "0.5820537", "0.5724802", "0.57093203", "0.56937045", "0.5684333", "0.56749463", "0.56694984", "0.56376165", "0.5634356", "0.5620904", "0.5617333", "0.559829", "0.55979747", "0.5594859", "0.55829436", "0.5561236", "0.554131", "0.55141485", "0.55095994", "0.54910...
0.70896184
0
Return value formatted in scientific notation for a specific locale. >>> format_scientific(10000, locale='en_US') u'1E4'
def format_scientific( number: float | decimal.Decimal | str, format: str | NumberPattern | None = None, locale: Locale | str | None = LC_NUMERIC, decimal_quantization: bool = True, ) -> str: locale = Locale.parse(locale) if not format: format = locale.scientific_formats[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scientific(x):\n return '{:.2e}'.format(x)", "def scientific(c, e):\n return Scientific(long(c), long(e))", "def scientific_notation(value, error):\n if value is None:\n return ''\n\n if error is None or error == 0:\n value_str = '{0:f}'.format(value)\n return value_str\n\n...
[ "0.733562", "0.71118754", "0.6928385", "0.6489217", "0.6208518", "0.6121842", "0.60598665", "0.6034714", "0.6002601", "0.59686226", "0.59622484", "0.58563364", "0.5708003", "0.55703825", "0.553533", "0.54954976", "0.543827", "0.5298684", "0.5289273", "0.522817", "0.52015847",...
0.79752964
0
Parse localized decimal string into a decimal. >>> parse_decimal('1,099.98', locale='en_US') Decimal('1099.98') >>> parse_decimal('1.099,98', locale='de') Decimal('1099.98') >>> parse_decimal('12 345,123', locale='ru') Decimal('12345.123')
def parse_decimal(string: str, locale: Locale | str | None = LC_NUMERIC, strict: bool = False) -> decimal.Decimal: locale = Locale.parse(locale) group_symbol = get_group_symbol(locale) decimal_symbol = get_decimal_symbol(locale) if not strict and ( group_symbol == '\xa0' and # if the grouping ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_to_decimal_price(str_val):\n result = None\n\n try:\n val = Decimal(str_val)\n except (InvalidOperation, TypeError):\n result = None\n else:\n if val >= 0.0:\n result = val.quantize(Decimal('0.01'), rounding=ROUND_HALF_UP)\n\n return result", "def validate_d...
[ "0.6275083", "0.5797707", "0.5754744", "0.571358", "0.56184185", "0.5564877", "0.5561406", "0.5551627", "0.54063076", "0.53856814", "0.53078383", "0.52382034", "0.5184538", "0.5178389", "0.5163225", "0.51388603", "0.5119634", "0.5112141", "0.5077678", "0.50584054", "0.5022155...
0.67647815
0
Parse number format patterns
def parse_pattern(pattern: NumberPattern | str) -> NumberPattern: if isinstance(pattern, NumberPattern): return pattern def _match_number(pattern): rv = number_re.search(pattern) if rv is None: raise ValueError(f"Invalid number pattern {pattern!r}") return rv.groups(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_precision(p):\n min = max = 0\n for c in p:\n if c in '@0':\n min += 1\n max += 1\n elif c == '#':\n max += 1\n elif c == ',':\n continue\n else:\n break\n return mi...
[ "0.6118207", "0.59317815", "0.5889084", "0.58346325", "0.5834607", "0.5824663", "0.5804219", "0.5796304", "0.57957983", "0.5742348", "0.57285416", "0.5701324", "0.5661479", "0.5587385", "0.55601746", "0.5557253", "0.5548763", "0.55412185", "0.553761", "0.54900753", "0.5464063...
0.7236204
0
Return list with projects for given client.
def get_client_projects(self, client=None): if type(client) is Client: return [p for p in self.project_list if client.client_id == p.client_id]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_list(self):\n try:\n ids = self.request[api.DATA][api.DATA][\"ids\"]\n return self._get_keystone_projects(ids)\n except Exception as e:\n LOG.exception(\"Error occurred: %s\" % e)", "def get_project_list():\n return parse_list_output(Popen(\n '...
[ "0.6964439", "0.68641615", "0.6749762", "0.6722983", "0.67070574", "0.6698339", "0.6672305", "0.66545206", "0.6630925", "0.66209435", "0.6505537", "0.65032464", "0.6490716", "0.6428107", "0.64157766", "0.64015603", "0.6395106", "0.63893366", "0.6373695", "0.63231325", "0.6300...
0.8893517
0
Return string with underscores instead of whitespace.
def us(self, string=''): return string.replace(' ', '_')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def underscore(text):\n # return '__'+text.replace(' ','__') + '__'\n return text.replace(' ', '__')", "def descorize(s):\n return s.replace(\"_\", \" \")", "def pre_underscore(text):\n return f\"__{text}__\"", "def underscore(string):\n # NOTE(retr0h): Taken from jpvanhal/inflection\n # ht...
[ "0.8442713", "0.8127896", "0.7997519", "0.7657125", "0.76087207", "0.75382155", "0.73313576", "0.7319951", "0.72698206", "0.71384627", "0.71343815", "0.7091668", "0.70720977", "0.7024404", "0.701092", "0.7006532", "0.69721234", "0.6940627", "0.69367504", "0.6914674", "0.68824...
0.70833653
12
Returns the top n boxes based on score given DenseCap results.json output
def sort_results(boxes): return sorted(results[k], key=lambda x : x['score'], reverse=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_top_k(predictions, boxes, k):\r\n\r\n if predictions.shape[0] == 0:\r\n predictions2 = torch.Tensor([]).to(device)\r\n labels2 = torch.Tensor([]).to(device)\r\n boxes2 = torch.Tensor([]).to(device)\r\n scores2 = torch.Tensor([]).to(device)\r\n\r\n else:\r\n predict...
[ "0.6446434", "0.6322834", "0.62498367", "0.6240897", "0.6164823", "0.61477464", "0.6142891", "0.61364436", "0.61364436", "0.6129868", "0.6121859", "0.6113042", "0.60681874", "0.6066583", "0.6048908", "0.6048461", "0.60128784", "0.6005901", "0.60055166", "0.6000214", "0.596850...
0.6476702
0
Handle buying and selling these coins.
def handle_coin(self, coin_above_threshold, coin_below_threshold, percentage_btc_amount, celery_app): logger.debug("Handling sell/buy for %s and %s", coin_above_threshold, coin_below_threshold) coin_balance = DatabaseManager.get_coin_balance_model(coin_above_threshold) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_buy(self, args):\n if not self._check_args(args):\n return\n else:\n self.wallet.get_coins_from_faucet(args)", "def Buy(self, X, Y):\n if self.money - (int(Y) * self.price[X][0] * (1 + self.taxe)) < 0:\n raise TradeError(\"Not Enough Money\")\n ...
[ "0.7099257", "0.68507725", "0.6748299", "0.6738942", "0.6699083", "0.6572036", "0.65629864", "0.6522212", "0.6497422", "0.64863956", "0.6474723", "0.64246273", "0.64227295", "0.6394213", "0.63885766", "0.6369195", "0.6346857", "0.6329987", "0.6318518", "0.63131994", "0.629450...
0.6441406
11
Constructor, initialize the base crossentropy loss
def __init__(self): # Call the parent constructor super(GBLoss, self).__init__() self.ce = nn.CrossEntropyLoss() # Cross entropy loss
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initLoss(self):\n\n return torch.nn.CrossEntropyLoss()", "def __init__(self, model=None, reduction: str = \"mean\"):\n super().__init__()\n self.loss_fun = CrossEntropyLoss(reduction=reduction)", "def _init_loss(self) -> None:\n labels_one_hot = tf.one_hot(self.labels, depth=Da...
[ "0.73368114", "0.72877604", "0.71868604", "0.7106897", "0.69613045", "0.69613045", "0.69561845", "0.69443816", "0.693381", "0.6803979", "0.6796964", "0.66473615", "0.66367835", "0.6608472", "0.6581359", "0.65427524", "0.65273535", "0.6525516", "0.64577854", "0.6447759", "0.63...
0.75316936
0
Return the embeddings of the given indexes.
def link(self, input): self.input = input self.output = self.embeddings[self.input] return self.output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_words(self, indices):\n return [self.get_word(index) for index in indices]", "def get_embeddings(vectors, text, generate_missing=False, k=300):\r\n embeddings = text.apply(lambda x: get_average_vec(x, vectors, generate_missing=generate_missing, k=k))\r\n return list(embeddings)", "def inverse_...
[ "0.64886075", "0.5981879", "0.5973237", "0.5931664", "0.5868253", "0.56907225", "0.55753845", "0.5484453", "0.5484441", "0.5473609", "0.54663724", "0.5452264", "0.5400018", "0.53957087", "0.5394601", "0.5388239", "0.53758514", "0.5372525", "0.53689116", "0.5360465", "0.536040...
0.0
-1
p has to be between 0 and 1 (1 excluded). p is the probability of dropping out a unit, so setting p to 0 is equivalent to have an identity layer.
def __init__(self, p=0.5, name='dropout_layer'): assert 0. <= p < 1. self.p = p self.rng = T.shared_randomstreams.RandomStreams(seed=123456) self.name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dropout(X, p=0.):\n if p > 0:\n retain_prob = 1 - p\n X *= t_rng.binomial(X.shape, p=retain_prob, dtype=theano.config.floatX)\n X /= retain_prob\n return X", "def _dropout_from_layer(rng, layer, p):\n srng = theano.tensor.shared_randomstreams.RandomStreams(\n rng.rand...
[ "0.7491583", "0.7151446", "0.7112999", "0.70474446", "0.69922745", "0.683129", "0.6779551", "0.6229587", "0.60466045", "0.59262717", "0.5895786", "0.58859897", "0.5852297", "0.5831989", "0.5822948", "0.5822011", "0.58066833", "0.5787092", "0.5723878", "0.57160604", "0.5709666...
0.7137537
2
Tests whether native_str is really equal to the platform str.
def test_native_str(self): if PY2: import __builtin__ builtin_str = __builtin__.str else: import builtins builtin_str = builtins.str inputs = [b'blah', u'blah', 'blah'] for s in inputs: self.assertEqual(native_str(s), builtin_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assertNativeString(self, original, expected):\n self.assertEqual(nativeString(original), expected)\n self.assertIsInstance(nativeString(original), str)", "def test_stringToString(self):\n self.assertNativeString(\"Hello!\", \"Hello!\")", "def test_bytes_to_native_str(self):\n b ...
[ "0.745193", "0.6902135", "0.68572396", "0.6597366", "0.63543946", "0.62808996", "0.6233105", "0.6227378", "0.6217206", "0.61332524", "0.6130011", "0.6029791", "0.6018057", "0.59672827", "0.59627366", "0.5939566", "0.5922042", "0.59053123", "0.5865725", "0.5783111", "0.5778093...
0.76124686
0
Helper to get index of beginningofsentence symbol
def bos(self): return self.BOS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_word(text):\n # your code here\n space = ' '\n if space in text:\n find_space = text.find(space)\n first_word = text[0:find_space]\n else:\n symbols_counter = len(text)\n first_word = text[0:symbols_counter]\n return first_word", "def index_of_x(word: str, pos...
[ "0.6826329", "0.66446275", "0.652614", "0.652614", "0.652614", "0.64694136", "0.64601475", "0.6432763", "0.6427541", "0.63917696", "0.63636523", "0.63636523", "0.63636523", "0.63544726", "0.6345209", "0.63401127", "0.6272059", "0.6268886", "0.61473566", "0.61407787", "0.61377...
0.0
-1
Helper to get index of endofsentence symbol
def eos(self): return self.EOS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_sentence_end(text: str) -> int:\n end = -1\n for e in sentence_ends:\n p_end = [m.end() for m in re.finditer(e, text)]\n end = max(end, p_end[-1] if len(p_end) > 0 else -1)\n return end", "def end_of_sentence(sentence, index, length):\n if (index >= length - 1): return True...
[ "0.68804824", "0.6375235", "0.6288623", "0.6145748", "0.61178654", "0.61176574", "0.6091038", "0.6065164", "0.60480577", "0.6043393", "0.6043393", "0.6043393", "0.6035267", "0.6028276", "0.60060936", "0.59828883", "0.5974585", "0.5943371", "0.59150094", "0.59040856", "0.58919...
0.0
-1
Creates an int64 feature from integers.
def int64_feature(value): return tf.train.Feature( int64_list=tf.train.Int64List(value=value))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _int64_feature(value):\n return tf.train.Feature(int64_list=tf.train.Int64List(\n value=[int(v) for v in value]))", "def _int64_feature(value):\n return tf.train.Feature(\n int64_list=tf.train.Int64List(value=[int(v) for v in value]))", "def _int64_feature(value):\n return tf.train.Featu...
[ "0.8133064", "0.8071256", "0.80537355", "0.80537355", "0.80466926", "0.8033987", "0.8033987", "0.8033987", "0.80284697", "0.8025053", "0.8025053", "0.8025053", "0.8025053", "0.8025053", "0.8025053", "0.80156994", "0.80156994", "0.80156994", "0.80156994", "0.8010723", "0.79514...
0.7940735
21
Generates examples from the provided files.
def generate_examples(file_name): for line in read_file(file_name): yield json.loads(line)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_examples(self, files):\n idx = 0\n for filename in files:\n with open(filename) as file:\n for line in file:\n yield idx, {\"text\": line}\n idx += 1", "def _generate_examples(self, **kwargs):\n file_paths = kwargs...
[ "0.8132554", "0.73355794", "0.73007077", "0.69143414", "0.6896399", "0.68936986", "0.68238753", "0.68046993", "0.67614686", "0.666237", "0.65927446", "0.65704083", "0.6483951", "0.64169264", "0.6410832", "0.63819736", "0.63579094", "0.6321995", "0.6250402", "0.62482727", "0.6...
0.70573276
3
Helper function to filter nulls.
def is_not_none(e): return e is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_none(elems):\n return [x for x in elems if x is not None]", "def filter_null(item, keep_null=False, null_vals=None):\n\n if item[0] == 0:\n keep = True\n else:\n keep = bool(item[0])\n\n if null_vals and str(item[0]) in null_vals and keep:\n keep = False\n keep ^= keep_null\n\n return...
[ "0.7633141", "0.75922513", "0.73923284", "0.71538997", "0.71167886", "0.6788951", "0.67467916", "0.6637743", "0.6622384", "0.6594909", "0.6540776", "0.6416887", "0.6363579", "0.6352451", "0.6286697", "0.6261447", "0.6253838", "0.6229987", "0.61709136", "0.61360437", "0.611330...
0.0
-1
Create a flask app from a config
def create_app(config_name): app = Flask(__name__) app.config.from_object(config[config_name]) config[config_name].init_app(app) register_extensions(app) from main import main as main_blueprint app.register_blueprint(main_blueprint, url_prefix='/') from preview import preview as preview_b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app(config='dev'):\n if config == 'dev':\n from .conf.config import DevelopmentConfig as dev_config\n app = configure_app(Flask(__name__), dev_config)\n else:\n from .conf.config import ProdConfig\n app = configure_app(Flask(__name__), ProdConfig)\n\n # setup flask b...
[ "0.87236154", "0.8691996", "0.8671103", "0.8659457", "0.8536141", "0.85344017", "0.8533828", "0.8522728", "0.85200995", "0.84936213", "0.84653574", "0.84518415", "0.8426504", "0.8367609", "0.83641696", "0.835771", "0.83470553", "0.8327359", "0.8300211", "0.8275657", "0.826188...
0.8269941
20
Make sure x,y,w,h are valid values
def checkRange(x,y,w,h,maxW,maxH): if x < 0: x = 0 if y < 0: y = 0 if x + w >= maxW: w = maxW-x-1 if y + h >= maxH: h = maxH-y-1 return [x,y,w,h]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_size(self,x,y):\n assert(x <= 10**3), 'Width larger than 1000' \n assert(y <= 10**3), 'Height larger than 1000' \n assert(x*y <= 3*(10**5)), 'Resolution larger than 300000'", "def _assert_valid(self, y: int, x: int) -> None:\n if not (0 <= y < self.size[0] and...
[ "0.71653694", "0.7034472", "0.69790983", "0.6744181", "0.6592219", "0.6548257", "0.6458558", "0.64494437", "0.64102507", "0.63559014", "0.6324437", "0.63214", "0.6292296", "0.62879705", "0.62869936", "0.6252323", "0.62302786", "0.619869", "0.61878496", "0.6187476", "0.6187351...
0.6401271
9
Returns the value from the event.
def GetValue(self): return self._value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _event_to_val(self, evt):\n return evt.val", "def getEventValue(*args, **kwargs):\n pass", "def value(self):\n return self['input'].value()", "def get_value(self, data):\n value = data['value']\n return value", "def _get_value(self):\n \n return self._value"...
[ "0.7985166", "0.7292858", "0.7034268", "0.70213836", "0.70147574", "0.69983095", "0.6995245", "0.6977663", "0.6949626", "0.69414896", "0.68907326", "0.68798876", "0.6873454", "0.6873454", "0.6854066", "0.6830843", "0.6810735", "0.6809196", "0.6809196", "0.6809196", "0.6802341...
0.64827317
95
Returns a dictionary of locations and their associated discard probability, where the location should be discarded if np.random.rand() < probability.
def get_discard_probs(self, sample=0.001) -> Dict[int, float]: # Convert to array loc_freq = np.array(list(self.loc_freq.items()), dtype=np.float64) # Convert to probabilities loc_freq[:, 1] = loc_freq[:, 1] / loc_freq[:, 1].sum() # Perform subsampling # http://mccormic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_observations(self):\n sample_dict={}\n for obs in self.observations:\n domain = obs.properties['domain']\n #If probabilistic, sample from the true distribution\n if obs.type=='probabilistic':\n probabilities = obs.properties['probability']\n ...
[ "0.6155999", "0.60182405", "0.57105905", "0.55896354", "0.55064166", "0.5480306", "0.54610956", "0.54589206", "0.5429589", "0.5418655", "0.5417841", "0.5415235", "0.54079866", "0.54079866", "0.5393525", "0.53922766", "0.53824824", "0.5355842", "0.53446853", "0.5326141", "0.53...
0.6597908
0
Used to create a dense layer.
def dense(x, n1, n2, name): with tf.variable_scope(name, reuse=None): # np.random.seed(1) tf.set_random_seed(1) weights = tf.get_variable("weights", shape=[n1, n2], initializer=tf.random_normal_initializer(mean=0., stddev=0.01)) bias = tf.get_variabl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dense(in_layer):\n return Dense(neurons,\n kernel_initializer=initializer())(in_layer)", "def init_dense(self, layer):\n pass", "def add_dense_layer(self, input_tensor, output_size, activation_fn=None,\n name = None):\n return ...
[ "0.76484036", "0.76465064", "0.76412284", "0.7377716", "0.73189133", "0.7122971", "0.692109", "0.683266", "0.67409086", "0.67067945", "0.66833633", "0.65608716", "0.6544221", "0.6529006", "0.6489199", "0.6448582", "0.6313288", "0.6254297", "0.62455183", "0.6233911", "0.621484...
0.577683
69
Compute mean absolute percentage error (MAPE)
def get_mape(y_true, y_pred): y_true, y_pred = np.array(y_true), np.array(y_pred) return np.mean(np.abs((y_true - y_pred) / y_true)) * 100
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mape(actual: np.ndarray, predicted: np.ndarray):\n return np.mean(np.abs(_percentage_error(actual, predicted)))", "def mean_absolute_percentage_error(y_true, y_pred):\n if len(y_true.shape) > 1 or len(y_pred.shape) > 1:\n raise TypeError('Arrays need to be one-dimensional.')\n \n mape ...
[ "0.7936617", "0.76534235", "0.74976116", "0.74901175", "0.73194784", "0.7313486", "0.7270717", "0.7173098", "0.70893383", "0.70797884", "0.7028908", "0.7017722", "0.70101976", "0.70088273", "0.7007062", "0.7006196", "0.7004329", "0.69965374", "0.69923925", "0.6976094", "0.689...
0.70488787
10
Computes insertion distance between a fragment and it's original position in a reference tree for SEPP. (Definition by Jon Sanders)
def compute_distancesJon_sepp(tree_sepp, tree_bb, err=sys.stderr): # ensure that lengths are assigned to ALL nodes for node in tree_sepp.levelorder(): if node.length is None: node.length = 0.0 res = [] numtips = tree_sepp.count(tips=True) - tree_sepp.count(tips=False) for i, nod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_insertion_length(self, pos):\n if pos in self.insertions:\n return self.insertions[pos]\n return 0", "def get_position_size(insert, risk_per_unit):\n return insert / risk_per_unit", "def _chunk_dist(chunk_left, chunk_right):\n left_start = _chunk_start(chunk_left)\n le...
[ "0.57662094", "0.5729618", "0.5622534", "0.5549117", "0.5468233", "0.5409201", "0.53371346", "0.52995247", "0.5265973", "0.5259109", "0.5256657", "0.5255295", "0.5209044", "0.5162516", "0.51470214", "0.5135439", "0.5126561", "0.51183295", "0.51173306", "0.5102378", "0.5098139...
0.5980526
0
Takes in a full sentence and returns the eorted words.
def sort_sentence(sentence): words = break_words(sentence) return sort_words(words)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_words(sentence):\n\n # Remove punctuation and make all letters lowercase.\n # Autograder didn't like translate: almost_clean_sentence = sentence.translate(None, string.punctuation)\n exclude = set(string.punctuation)\n almost_clean_sentence = ''.join(jot for jot in sentence if jot not in exclud...
[ "0.7075225", "0.7048764", "0.70079935", "0.6927715", "0.6884302", "0.68274534", "0.6826668", "0.6758453", "0.6747152", "0.6688829", "0.6682297", "0.66779876", "0.6676474", "0.6675287", "0.66578215", "0.66540563", "0.6633594", "0.6633594", "0.6629175", "0.6610929", "0.6603069"...
0.65356565
31
Based on input, create instances of ProcessDetail and Measurements.
def _setUpProcessDetailAndMeasurements(self, compPID, compName): myName = self.__class__.__name__ try: pd = ProcessDetail(compPID, compName) self._components.append(pd) self._compMeasurements.append(Measurements(self.numOfMeasurements)) m = ("%s: loaded pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _instantiate_processes(self, input=None, context=None):\n# FIX: ALLOW Projections (??ProjectionTiming TUPLES) TO BE INTERPOSED BETWEEN MECHANISMS IN PATHWAY\n# FIX: AUGMENT LinearMatrix TO USE FULL_CONNECTIVITY_MATRIX IF len(sender) != len(receiver)\n\n # # MODIFIED 2/8/17 OLD: [SEE BELOW]\n # s...
[ "0.6322031", "0.6146779", "0.5966853", "0.5709059", "0.5676976", "0.56705177", "0.5651639", "0.5567384", "0.5553151", "0.5551166", "0.5548403", "0.55034316", "0.54761064", "0.5474005", "0.54238194", "0.5390449", "0.5382829", "0.53635013", "0.5353595", "0.53224444", "0.5318354...
0.66439736
0
Returns the default account which is used to deploy contracts
def default_account(web3): return web3.eth.defaultAccount
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_default_account(web3):\n web3.eth.defaultAccount = web3.eth.accounts[0]", "def default_storage_account_id(self) -> str:\n return pulumi.get(self, \"default_storage_account_id\")", "def default_company():\n return Transaction().context.get('company')", "def account_from_env(cls):\n ...
[ "0.69215536", "0.6733491", "0.6629544", "0.6585447", "0.6526689", "0.6322612", "0.62912434", "0.6243073", "0.6243073", "0.6243073", "0.62177366", "0.6165211", "0.61551297", "0.61551297", "0.6123741", "0.60819095", "0.606224", "0.60390997", "0.60099393", "0.59594226", "0.59594...
0.8169673
0
Creates an instance of this model from a dictionary
def from_dictionary(cls, dictionary): if dictionary is None: return None # Extract variables from the dictionary protected_count = dictionary.get('protectedCount') protected_size = dictionary.get('protectedSize') unprotected_count = dictionary...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction...
[ "0.83181584", "0.8168118", "0.8168118", "0.8118749", "0.8089047", "0.79787344", "0.7949278", "0.79231393", "0.78923255", "0.788838", "0.7882321", "0.7882212", "0.7876749", "0.78585315", "0.7836853", "0.7801407", "0.7801407", "0.7801407", "0.7801407", "0.7801407", "0.7801407",...
0.7898951
8
Return whether SudokuPuzzle self is equivalent to other.
def __eq__(self, other): return (type(other) == type(self) and self._marker == other._marker and self._marker_set == other._marker_set)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n for i in range(len(self.puzzle)):\n for j in range(len(self.puzzle[0])):\n if(self.puzzle[i][j] != other.puzzle[i][j]):\n return False\n return True", "def __eq__(self, other) -> None:\n\t\tfor k, v in enumerate(self.board):\n\...
[ "0.81575924", "0.7818558", "0.78002506", "0.76469505", "0.7432939", "0.73686624", "0.7302579", "0.7295257", "0.72836405", "0.7262963", "0.71944773", "0.7150663", "0.71238744", "0.7076457", "0.7070904", "0.7070904", "0.7059973", "0.7041242", "0.7038466", "0.70332104", "0.70229...
0.0
-1
Return whether GridPegSolitairePuzzle self is solved. Solved when there is only one peg left.
def is_solved(self): marker = self._marker amount_of_pegs = 0 for row in marker: for i in row: if i == "*": amount_of_pegs += 1 return amount_of_pegs == 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_solved(self):\n # Iterate through each square of the puzzle\n for row in range(self.sl):\n for col in range(self.sl):\n val = self.puzzle[row][col]\n\n # If any square value is blank (0), not solved, return False\n if val == 0:\n ...
[ "0.7525934", "0.7359226", "0.7291751", "0.72821176", "0.72481537", "0.72481537", "0.72481537", "0.7194227", "0.7139627", "0.7116922", "0.7099406", "0.6990554", "0.6982106", "0.69773746", "0.6972215", "0.694638", "0.6917622", "0.68853164", "0.68769264", "0.68694305", "0.683497...
0.6582008
35
Get the threshold variance, above which variance is defined as an outlier/to be rejected.
def get_variance_threshold(variances, whisker_percent, whisker_length): low_percentiles, high_percentiles = np.percentile(variances, (whisker_percent, 100-whisker_percent)) threshold = high_percentiles + (high_percentiles - low_percentiles) * whisker_length return threshold
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _threshold(data, sigma=2.0):\r\n return np.mean(data)-sigma*np.sqrt(np.var(data))", "def variance_selection(X):\n try:\n selector = VarianceThreshold()\n X = selector.fit_transform(X)\n return X\n\n except ValueError:\n return 0", "def remove_low_variance(X, threshold=0...
[ "0.69904196", "0.6935698", "0.6740587", "0.6666096", "0.65666103", "0.6505295", "0.64574945", "0.644354", "0.644354", "0.62878823", "0.62736964", "0.6237664", "0.6232071", "0.622443", "0.62203693", "0.6220306", "0.6208514", "0.62013656", "0.61906093", "0.61710745", "0.6169167...
0.6977473
1
returns the main page used to run the application
def renderPage(): return render_template("index.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_page():\n return render_template(\"index.html\")", "def main_page():\n return render_template(\"main_page.html\")", "def single_page_application(self) -> pulumi.Output[Optional['outputs.ApplicationSinglePageApplication']]:\n return pulumi.get(self, \"single_page_application\")", "def ho...
[ "0.75724274", "0.74634606", "0.72146255", "0.7207383", "0.71446586", "0.7106191", "0.7106191", "0.70780355", "0.70780355", "0.7070742", "0.7070742", "0.697983", "0.6945542", "0.68910825", "0.6890517", "0.687441", "0.68608874", "0.6848396", "0.6822954", "0.67923266", "0.677812...
0.6691742
30
returns the main page used to run the application
def evaluationPage(): return render_template("evaluation.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_page():\n return render_template(\"index.html\")", "def main_page():\n return render_template(\"main_page.html\")", "def single_page_application(self) -> pulumi.Output[Optional['outputs.ApplicationSinglePageApplication']]:\n return pulumi.get(self, \"single_page_application\")", "def ho...
[ "0.7572753", "0.7463891", "0.72137946", "0.72080517", "0.714509", "0.7106855", "0.7106855", "0.7078345", "0.7078345", "0.70716584", "0.70716584", "0.6980665", "0.6946101", "0.68908894", "0.6890382", "0.68741405", "0.68612", "0.684796", "0.68227226", "0.6793194", "0.677828", ...
0.0
-1
Parse and validate a WebSocket URI.
def parse_uri(uri: str) -> WebSocketURI: parsed = urllib.parse.urlparse(uri) try: assert parsed.scheme in ["ws", "wss"] assert parsed.params == "" assert parsed.fragment == "" assert parsed.hostname is not None except AssertionError as exc: raise InvalidURI(uri) from ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_uri(value: Any) -> str:\n uri_value = str(value)\n\n if urlparse(uri_value).scheme == \"tcp\":\n # pylint: disable-next=no-value-for-parameter\n return cast(str, vol.Schema(vol.Url())(uri_value))\n\n raise vol.Invalid(\"invalid Wyoming Protocol URI\")", "def _parse(self, strin...
[ "0.7043975", "0.5979977", "0.597198", "0.59564006", "0.57751626", "0.56911254", "0.56148505", "0.56070626", "0.55987835", "0.5548299", "0.55409855", "0.550865", "0.54691494", "0.5468731", "0.5455878", "0.54340553", "0.54056835", "0.53815305", "0.5379671", "0.53651935", "0.536...
0.78901017
0
Ensure that mocked objects are called correctly in the arguments. See `FuncMockArgsDecoratorsChecker' docstring for details.
def test_mock_decorators_and_args(self): errors = [] for dirname, dirnames, filenames in os.walk(self.tests_path): for filename in filenames: if (not filename.startswith("test_") or not filename.endswith(".py")): continue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_arguments(self):\n calls = []\n decorator = self.decorator()\n\n @decorator\n def func(a, b, c):\n calls.append((a, b, c))\n\n func(1, 2, c=3)\n self.assertEqual(calls, [(1, 2, 3)])", "def check_mock_called_with_kwargs(mock: MagicMock, params: dict) -...
[ "0.6781488", "0.65973365", "0.65680736", "0.6377638", "0.6368822", "0.6203718", "0.61801696", "0.6149895", "0.6126929", "0.61236316", "0.61211324", "0.61189735", "0.6055256", "0.60093004", "0.59122205", "0.5903791", "0.5869243", "0.58688474", "0.5868099", "0.58560276", "0.585...
0.7420774
0
Returns a Measurements object corresponding to the time (t) and data (y) vectors. Validity intervals are set to be the midpoint between each time measurement (and the first and last points are given symmetric intervals). If max_step is specified, then validity intervals are truncated to be no larger than max_step/2 awa...
def from_simple(cls, t, y, max_step=None): self = cls() self.t = t.copy() self.data = y.copy() if len(t) > 1: dt = np.diff(t) dt = np.hstack((dt[0], dt, dt[-1])) if max_step is not None: dt[dt>=max_step] = max_step else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_measurements_block(self, *,\n device_data: lnetatmo.WeatherStationData,\n device_id: str,\n module_id: str,\n measurements: ty.Sequence[str],\n utc_per...
[ "0.5777731", "0.55783355", "0.5316199", "0.53065807", "0.51233035", "0.50751364", "0.49751377", "0.4954145", "0.4923153", "0.48464343", "0.4830126", "0.4819197", "0.47780403", "0.47742745", "0.47367942", "0.46780586", "0.46636763", "0.46531948", "0.4630677", "0.46290842", "0....
0.6264581
0
Scatter plot Xs against Ys, optionally scaling the data.
def scatter_plot( xs, ys, x_errs, y_errs, model_names=None, scaling="linear", label="", colors="blue", fitlabel="Linear Fit", fitcolor="red", ): xs = np.array(xs).reshape(-1, 1) ys = np.array(ys).reshape(-1, 1) x_errs = np.asarray(x_errs) y_errs = np.asarray(y_er...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_scatter(x, y):\n\tplt.scatter(x, y)", "def afficher_XY(X, Y):\n plt.scatter(X,Y, s = size)\n plt.show()", "def plot_data(x: np.ndarray, y: np.ndarray) -> None:\n\n _, ax = plt.subplots()\n scatter = ax.scatter(x[:, 0], x[:, 1], c=y, s=40, cmap=plt.cm.RdYlBu)\n legend1 = ax.legend(*scatt...
[ "0.6951007", "0.6924661", "0.6869716", "0.68555844", "0.6819152", "0.6779036", "0.6708514", "0.65661305", "0.65528023", "0.64669144", "0.6418753", "0.6284649", "0.6267013", "0.62607706", "0.62495375", "0.6233114", "0.62042093", "0.6147039", "0.6102304", "0.6072087", "0.607014...
0.5821267
44
Return a string date as 'mm/dd/yyyy'.
def string_date(mnthDay, year): return(mnthDay + '/' + str(year))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_string(date):\n day = date.day\n month = date.month\n year = date.year\n formatted_string = str(month) + \"/\"\n formatted_string += str(day) + \"/\"\n formatted_string += str(year)\n return formatted_string", "def date_to_string(date) -> str:\n\n return date.strftime('%m/%d/...
[ "0.8491548", "0.8044634", "0.75360703", "0.7475533", "0.739568", "0.73313814", "0.7320796", "0.7278793", "0.7214997", "0.7180315", "0.71764225", "0.7117874", "0.706914", "0.7064473", "0.70490277", "0.7048172", "0.70178133", "0.7008141", "0.69617575", "0.69486326", "0.6906095"...
0.75009286
3
Returns dataframe with TOU period rates from TouRate object.
def get_rates(self): rates = np.empty(len(self.periods)) for index, element in enumerate(self.periods): rates[index] = self.periods[element]['price'] return(pd.Series(rates, self.periods.keys()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tree2OTU_table(mvp_tree):\n series = []\n for terminal in mvp_tree.feature_tree.get_terminals():\n try:\n series.append(terminal.sample_series)\n except:\n print('there is no sample series in tree2OTU ')\n df = pd.dataframe(series)\n return df", "def rateTS (se...
[ "0.58361554", "0.55521804", "0.552579", "0.547439", "0.5472493", "0.5418824", "0.5414065", "0.54099125", "0.5390008", "0.53688526", "0.53373814", "0.532125", "0.5312127", "0.52996343", "0.5294884", "0.5290688", "0.5286145", "0.5260798", "0.5258705", "0.5237953", "0.52174205",...
0.6124528
0
Function to calculate days from 2016.1.1
def get_date_in_days(raw_data, target_columns=['Submitby Date Time', 'Posting Date Date']): output = raw_data.copy() for column in target_columns: for i in range(len(raw_data)): date = datetime.date(output.loc[i, column+' Year'], output.loc[i, column+' Month'], output.loc[i, column+' D...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_days(start: date, end: date) -> int:\n delta = end - start\n return delta.days + 1", "def get_number_days(self):\r\n return 1", "def numOfDays():\n\n print(\"Podaj rok, miesiac oraz dzien pierwszej daty: \")\n inputs = [input() for i in range(3)]\n\n print(\"Podaj rok, miesiac...
[ "0.70012283", "0.6771147", "0.6684203", "0.6656057", "0.6622089", "0.66145927", "0.6544161", "0.6525067", "0.65116644", "0.64910316", "0.6453008", "0.64403445", "0.6427572", "0.64052474", "0.6348676", "0.63216996", "0.6315061", "0.62979996", "0.62952507", "0.6286443", "0.6254...
0.5908045
54
Creates a new Flask application and initialize application.
def create_app(dictionary_with_strategies): app = Flask(__name__, static_url_path='', static_folder='../dist', template_folder='../dist') @app.route('/') def home(): return redirect(url_for('static', filename='index.html')) app.url_map.strict_slashes = False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app() -> Flask:\r\n app = Flask(__name__.split('.')[0])\r\n init_config(app)\r\n app.register_blueprint(observer)\r\n app.teardown_appcontext(close_db)\r\n app.cli.add_command(init_db)\r\n\r\n return app", "def create_app(self):\r\n self.app = Flask(__name__, instance_relative...
[ "0.85828066", "0.85069126", "0.8497481", "0.83538234", "0.8301409", "0.82867336", "0.8280871", "0.827583", "0.8225977", "0.82174957", "0.81954056", "0.812173", "0.81138676", "0.80459076", "0.80400544", "0.80331933", "0.8029445", "0.7992402", "0.79870754", "0.7967155", "0.7963...
0.0
-1
Get all documents from a database This method has the same behavior as a view. `all_docs( params )` is the same as `view('_all_docs', params)` and `all_docs( by_seq=True, params)` is the same as `view('_all_docs_by_seq', params)` You can use all(), one(), first() just like views
def all_docs(self, by_seq=False, **params): if by_seq: try: return self.view('_all_docs_by_seq', **params) except ResourceNotFound: # CouchDB 0.11 or sup raise AttributeError("_all_docs_by_seq isn't supported on Couchdb %s" % self.server.in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def documents(self, schema=None, wrapper=None, **params):\n return ViewResults(self.raw_view, '_all_docs',\n wrapper=wrapper, schema=schema, params=params)", "def getDocumentAll(self, query = {}, keys = []):\n query = query or {}\n if \"include_docs\" not in query:\n query...
[ "0.765813", "0.7350759", "0.67364585", "0.6718791", "0.6672379", "0.6552627", "0.6542332", "0.6472379", "0.6295687", "0.6279868", "0.62575454", "0.6247798", "0.62164706", "0.6108061", "0.60862625", "0.6061698", "0.60221756", "0.6013602", "0.5960993", "0.5954225", "0.5946513",...
0.8487874
0
return a list of keyvalue tuples, sorted by key
def sortedItems (dict): items = dict.items () items.sort () return items
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sortedKeys(self):\n sortedItems = list(self.items())\n\n def compare(x, y): return sign(y[1] - x[1])\n sortedItems.sort(cmp=compare)\n return [x[0] for x in sortedItems]", "def keys_sorted_by_value(d):\n # By Daniel Schult, 2004/01/23\n # http://aspn.activestate.com/ASPN/Pyt...
[ "0.73545444", "0.7319236", "0.7312933", "0.7124313", "0.6978976", "0.6749457", "0.6672613", "0.66584545", "0.66504514", "0.66430247", "0.6642821", "0.6641164", "0.66211796", "0.65898705", "0.657548", "0.65446913", "0.64790994", "0.6446089", "0.64296997", "0.6421425", "0.64143...
0.6691645
6
The current system status.
def system(self, language=None): return self._get('/systems.{language}.json', language)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_status(self):\n\n return self._system", "def status(self):\n self.scion_sh('status')", "def _check_status(self):\n self.system_status_lock.acquire()\n info = self.system_status_proxy._getvalue()\n self.system_status_lock.release()\n return info", "def getstat...
[ "0.8810307", "0.7973326", "0.7852858", "0.78043246", "0.7755429", "0.7744563", "0.7744563", "0.7744563", "0.7744563", "0.7744563", "0.7744563", "0.7744563", "0.7744563", "0.7744563", "0.7744563", "0.7744563", "0.7744563", "0.7744563", "0.7744563", "0.7744563", "0.7744563", ...
0.0
-1
Compute the entropy (using base log) of this question, which is a measure how hard this question is. If the entropy is larger then the question is harder to answer correctly.
def entropy(self) -> float: probabilities = np.array([len(players) for players in self.answers.values()]) probabilities = probabilities / sum(probabilities) return sc.stats.entropy(probabilities)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy(self):\n Z = self.sum()\n assert (Z > 0), 'Non-normalizable factor (perhaps log factor?)' # also check for positivity?\n H = 0.0\n for x in np.nditer(self.t, op_flags=['readonly']):\n p = x/Z\n H += 0.0 if p==0 else -p*np.log(p)\n return H", "def entropy(x):\n nz = np.nonz...
[ "0.8120082", "0.8051938", "0.7987758", "0.7888788", "0.78611964", "0.7834319", "0.78123504", "0.7812234", "0.78021115", "0.77895826", "0.77490956", "0.77038205", "0.76995814", "0.7698922", "0.76933366", "0.76791435", "0.7667407", "0.76640636", "0.7644344", "0.75732183", "0.75...
0.7072014
71
Splits an NDArray into `len(ctx_list)` slices along `batch_axis` and loads each slice to one context in `ctx_list`.
def split_and_load(data, ctx_list, batch_axis=0, even_split=True): if len(ctx_list) == 1: return [d.as_in_context(ctx_list[0]) for d in data] size = len(data) num_slice = len(ctx_list) step = size // num_slice for i in range(num_slice): for k in range(i*step, (i+1)*step): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_and_load(batch, ctx_list):\n num_ctx = len(ctx_list)\n new_batch = []\n for i, data in enumerate(batch):\n new_data = [x.as_in_context(ctx) for x, ctx in zip(data, ctx_list)]\n new_batch.append(new_data)\n return new_batch", "def split_and_load(batch, ctx_list):\n num_ctx =...
[ "0.820198", "0.820198", "0.8023063", "0.6936805", "0.6267669", "0.6234975", "0.6058379", "0.60097516", "0.5822375", "0.5720977", "0.5681358", "0.56802046", "0.56535083", "0.5602212", "0.55869406", "0.5580544", "0.55492103", "0.55294883", "0.5520677", "0.5503875", "0.5493075",...
0.8151281
2
Parse a filename like ``some_idcat1cat2not_cat3.txt`` into ``dict(id='some_id', cats=dict(cat1=True, cat2=True, cat3=False))``
def parse_doc_filename(input_uri): # get filename without extension name_with_ext = posixpath.basename(input_uri) name = name_with_ext[:-len(file_ext(name_with_ext))] parts = name.split('-') doc_id = parts[0] cats = {} for part in parts[1:]: if part.startswith('not_'): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_file_tags_from_file_name(filePath): #TODO untested and unused\n out_dict = {}\n studyid = 'n/a'\n subjectid = 'n/a'\n visitid = '1'\n\n if 'scorefiles' in filePath:\n studyid = filePath.split('scorefiles')[0]\n studyid = studyid.split('\\\\')\n if studyid[-1] == '':\...
[ "0.61573905", "0.6123597", "0.59605956", "0.5880835", "0.5814887", "0.57548404", "0.5728618", "0.55493766", "0.55111724", "0.5509236", "0.5496318", "0.5489123", "0.54652977", "0.543797", "0.5432819", "0.54096884", "0.5384354", "0.53823316", "0.537348", "0.5361721", "0.5360088...
0.55601823
7
Break text down into ngrams, and return a dictionary mapping (n, ngram) to number of times that ngram occurs.
def count_ngrams(text, max_ngram_size, stop_words): if not isinstance(stop_words, set): stop_words = set(stop_words) words = [word.lower() for word in WORD_RE.findall(text) if word.lower() not in stop_words] ngram_counts = defaultdict(int) for i in range(len(words)): for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_ngram_frequencies(text, n):\n\n import re\n\n # Create a new dictionary\n ngram_dict = {}\n\n # Find all sentences\n sentences_list = re.findall(r'[^\\.\\?!\"]+', text)\n\n # Iterate over sentences in the list\n for sentence in sentences_list:\n # Split words by a whitespa...
[ "0.83600706", "0.8229249", "0.799888", "0.78312", "0.7548564", "0.75212526", "0.74975187", "0.7437126", "0.7426748", "0.7416278", "0.72459435", "0.7243828", "0.7214754", "0.71975267", "0.71895534", "0.7151903", "0.7117029", "0.7113935", "0.7030926", "0.7023231", "0.70139813",...
0.69881845
22
Lists the projects on which a user has roles assigned.
def list_user_projects(self, user_id): resp, body = self.get('users/%s/projects' % user_id) self.expected_success(200, resp.status) body = json.loads(body) return service_client.ResponseBodyList(resp, body['projects'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_projects_user_can_view(user):\n if hasattr(user, 'worker'):\n # Workers need to be able to view all data\n projects = Project.objects.all()\n else:\n projects = get_objects_for_user(\n user,\n 'view_project_data',\n ...
[ "0.66826594", "0.6621202", "0.65884846", "0.6576092", "0.6560986", "0.64612156", "0.6427039", "0.63993824", "0.63983685", "0.6358841", "0.6299027", "0.62969065", "0.62837476", "0.6269694", "0.62435335", "0.62189263", "0.6204233", "0.6197566", "0.61967176", "0.6184964", "0.612...
0.61833656
20
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion matrix") else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8194862", "0.80949175", "0.8029915", "0.8019153", "0.79941195", "0.7991258", "0.7980955", "0.7976606", "0.79610753", "0.79590565", "0.79378676", "0.7934962", "0.7934504", "0.79313844", "0.7926313", "0.7924577", "0.79241234", "0.7923211", "0.7923023", "0.7921931", "0.791787...
0.7814644
92
Returns the nth power of x
def power1(x, n): if n == 0: return 1 return x * power1(x, n-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power(x, n):\n if n == 0:\n return 1\n result = power(x, math.floor(n / 2))\n if n % 2 > 0:\n return x * result * result\n else:\n return result * result", "def power(x, n):\n power = 1\n for i in range(abs(n)):\n power = multiply(power, x) \n return power", ...
[ "0.8197165", "0.80931515", "0.8056494", "0.79392886", "0.79392886", "0.7791487", "0.7775012", "0.77181023", "0.76994604", "0.7626151", "0.7610588", "0.76089394", "0.7598106", "0.75688326", "0.75647014", "0.74882454", "0.7484824", "0.7280367", "0.7271908", "0.7251827", "0.7199...
0.7770116
7
Returns the nth power of x
def power2(x, n): if n == 0: return 1 else: partial = power2(x, n // 2) result = partial * partial if n % 2 == 1: result *= x return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power(x, n):\n if n == 0:\n return 1\n result = power(x, math.floor(n / 2))\n if n % 2 > 0:\n return x * result * result\n else:\n return result * result", "def power(x, n):\n power = 1\n for i in range(abs(n)):\n power = multiply(power, x) \n return power", ...
[ "0.8197415", "0.80928904", "0.80563354", "0.77908707", "0.77748567", "0.7769977", "0.7717305", "0.7698866", "0.7625362", "0.76096785", "0.7608224", "0.7597338", "0.75665987", "0.7563639", "0.7486921", "0.74845624", "0.72785807", "0.7271118", "0.7250794", "0.71982574", "0.7195...
0.793899
4
Split array of sentences into array of arrays of words or characters
def split_input(input, mode): if mode == 'characters': return [[c for c in s if c != ' '] for s in input] elif mode == 'words': return [s.split(" ") for s in input]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _split_into_words(sentences):\n return list(itertools.chain(*[_.split(\" \") for _ in sentences]))", "def _split_into_words(sentences):\n return list(itertools.chain(*[_.split(\" \") for _ in sentences]))", "def split_into_words(sentences):\n return list(sentences.split(\" \"))", "def _split_into_wo...
[ "0.7425072", "0.7425072", "0.7384068", "0.7381596", "0.7076488", "0.7033655", "0.7030201", "0.69779915", "0.6896357", "0.6804381", "0.6797299", "0.67810494", "0.6770744", "0.67466396", "0.67295396", "0.66778845", "0.66700214", "0.65632206", "0.65632206", "0.6515724", "0.64990...
0.6031791
69
Convert string, with or without SIUnits, into a float data type.
def SI_string_to_float(inStr, debug = False): func_name = "SI_string_to_float" # Debug print incoming string. if debug: print("DEBUG: (Func = %s): Input-str: %s" %( func_name, inStr )) #Remove all spaces from incoming string. inStr = inStr.replace(" ", ""); if debug: print("DEBUG: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert_to_float(s):\n try:\n return float(s)\n except:\n return s", "def _to_float(self, s: str) -> float:\n return int(s[:-1]) / 1e9 if s.endswith('n') else float(s[:-1])", "def _string_to_float(s):\n try:\n f = float(s)\n return f\n except ValueError:\n ...
[ "0.80620456", "0.8034245", "0.8027477", "0.8014747", "0.79979545", "0.7850695", "0.7784582", "0.7677691", "0.76418775", "0.7567186", "0.750719", "0.7505608", "0.74927133", "0.74827415", "0.74070024", "0.7404268", "0.7365799", "0.7127037", "0.7114455", "0.70833826", "0.7057850...
0.82716626
0
Take girds as input, output a rgb array properly scaled to display the value of the 3 hidden channels
def get_hidden_chan_rgb(grids, ranges=[(-1,1), (-1,1), (-1,1)]): chans_id = [1,4,5] rgb = np.zeros((32,32,3), "float32") for c in range(3): chan= grids[0,:,:, chans_id[c]] chan = (chan-ranges[c][0])/(ranges[c][1]-ranges[c][0]) rgb[:,:,c] = chan rgb = np.clip(rgb, 0,1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grey_to_rgb_imitation(img):\n return np.repeat(img[...,np.newaxis], 3, -1)", "def green_channel(input_image):\n return input_image[:, :, 1]", "def red_channel(img):\n\n red = np.zeros(img.shape,dtype=float)\n\n red[:,:,2] = np.copy(img[:,:,2])\n\n return red", "def blue_channel(img):\n\n ...
[ "0.66204756", "0.65835655", "0.6508726", "0.64962775", "0.6370114", "0.6357669", "0.63325197", "0.63219017", "0.6290745", "0.6148088", "0.6146511", "0.6137864", "0.6082042", "0.6042679", "0.60365987", "0.6026282", "0.6023989", "0.6009184", "0.60070306", "0.59398896", "0.59158...
0.6365533
5
Perform elastic distortion on an image. Here, alpha refers to the scaling factor that controls the intensity of the deformation. The sigma variable refers to the Gaussian filter standard deviation.
def elastic_distort(image, alpha, sigma): random_state = numpy.random.RandomState(None) shape = image.shape dx = gaussian_filter( (random_state.rand(*shape) * 2 - 1), sigma, mode="constant" ) * alpha dy = gaussian_filter( (random_state.rand(*shape) * 2 - 1), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elastic_transform(image, alpha, sigma, random_state=None):\n\n print('image : ', id(image))\n if random_state is None:\n random_state = np.random.RandomState(None)\n\n # print(random_state)\n shape = image.shape\n dx = gaussian_filter((random_state.rand(*shape) * 2 - 1), sigma, mode=\...
[ "0.767731", "0.73596925", "0.7342276", "0.7265619", "0.69903237", "0.69746757", "0.6888772", "0.687518", "0.6828589", "0.68035334", "0.6580666", "0.62497205", "0.5955794", "0.5884255", "0.57746345", "0.57527715", "0.5636542", "0.5568983", "0.5554043", "0.5465214", "0.54155403...
0.78027844
0
Sets the consistency level.
def consistency(self): return self._body.get('scan_consistency', UNBOUNDED)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_level(self, level):\n\n self.sh.setLevel(level)\n\n if self.fh:\n self.fh.setLevel(level)", "def consistency_group(self, consistency_group):\n\n self._consistency_group = consistency_group", "def consistency_group(self, consistency_group):\n\n self._consistency_gr...
[ "0.6077004", "0.60325485", "0.60325485", "0.59941053", "0.59727526", "0.5913543", "0.5828092", "0.57666636", "0.5757657", "0.57503045", "0.5736268", "0.5736268", "0.5736268", "0.5717939", "0.56706303", "0.56360704", "0.56202424", "0.5597552", "0.5595125", "0.55727136", "0.556...
0.4678455
91
Get an encoded representation of the query. This is used internally by the client, and can be useful to debug queries.
def encoded(self): return json.dumps(self._body)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def asString(self):\n q = self.copy()\n q.addFunction(Query.Function.AsString)\n return q", "def __str__(self):\n query = []\n\n if self.root:\n query.append('query')\n\n if self.alias is not None:\n query.append(self.alias + ':')\n\n if self...
[ "0.7266079", "0.7263727", "0.71081996", "0.6760457", "0.66530025", "0.64866406", "0.6393704", "0.6352916", "0.6338598", "0.62828267", "0.6260776", "0.62470776", "0.6242689", "0.6234344", "0.62096035", "0.61738545", "0.61402434", "0.6134713", "0.61313", "0.61282086", "0.612820...
0.0
-1
Set a conv2d, BN and relu layer.
def conv_block( in_channels, out_channels, kernel_size, stride, dilation=1, ): pad_mode = 'same' padding = 0 dbl = nn.SequentialCell( [ nn.Conv2d( in_channels, out_channels, kernel_siz...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, dim, padding_type, norm_layer, use_dropout, use_bias):\r\n super(ResnetBlock, self).__init__()\r\n self.conv_block = self.build_conv_block(dim, padding_type, norm_layer, use_dropout, use_bias)", "def __init__(self, dim, padding_type, norm_layer, use_dropout, use_bias, last=False)...
[ "0.6260912", "0.6213461", "0.6206194", "0.62031853", "0.62031853", "0.62010807", "0.6194336", "0.6104408", "0.6091985", "0.5988848", "0.59863555", "0.5951106", "0.589877", "0.58796424", "0.585363", "0.58532673", "0.5851277", "0.5836106", "0.58259445", "0.58160645", "0.5809766...
0.0
-1
initializes the location object with a row and column.
def __init__(self, row:int, col:int): self.__row = row self.__col = col
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, row = 0, col = 0):\n self.row = row\n self.col = col", "def __init__(self, grid, location):\n self.grid = grid\n self.location = location # Tuple containing (x, y) coordinates.", "def __init__(self, location_id, x=0, y=0):\r\n self.location_id = location_i...
[ "0.7630979", "0.7595884", "0.70848435", "0.70700765", "0.70121354", "0.6912126", "0.688594", "0.68199444", "0.6752333", "0.6707604", "0.6602493", "0.66017276", "0.6577615", "0.6546221", "0.6517948", "0.65150255", "0.64965093", "0.6464304", "0.6462554", "0.64570284", "0.644436...
0.76221836
1
Returns the row of the location
def row(self): return self.__row
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def row(self):\n return self.address.row", "def row(self):\n return self[\"row\"]", "def get_row(self):\n return self._row_number", "def get_row( self, rowIndex ):\n return self.data[rowIndex,:]", "def get_source_row(self, row):\n return self._dataframe.index[row]", "de...
[ "0.7744584", "0.7490429", "0.7374911", "0.71966076", "0.7190049", "0.71445036", "0.70721525", "0.70385593", "0.69017076", "0.69017076", "0.69017076", "0.69017076", "0.69017076", "0.69017076", "0.69017076", "0.69017076", "0.69017076", "0.69017076", "0.69017076", "0.69017076", ...
0.72638583
3
Returns the column of the location
def col(self): return self.__col
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def col(self):\n return self.address.col", "def get_column(self):\n return self._column_number", "def column(self):\n return self[\"column\"]", "def _get_col(self, idx):\n return self.line[self._fwf.column_slices[idx]]", "def get_column(self, pos, **opts):\n lnum, cnum = ...
[ "0.7727741", "0.7700148", "0.7614299", "0.75863117", "0.75523525", "0.7541672", "0.74955016", "0.74103004", "0.7340878", "0.7327143", "0.7327143", "0.7327143", "0.7327143", "0.7327143", "0.7327143", "0.7327143", "0.7327143", "0.7327143", "0.7327143", "0.7327143", "0.7327143",...
0.7247517
24
Improved ellipse drawing function, based on PIL.ImageDraw.
def draw_ellipse(image, bounds, width=1, outline: Color = 'white', antialias=4): # Use a single channel image (mode='L') as mask. # The size of the mask can be increased relative to the imput image # to get smoother looking results. mask = Image.new(size=[int(dim * antialias) for dim in image.size], mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ellipse(self):\n f = self.img\n x = self.x\n y = self.y\n x2 = self.x2\n y2 = self.y2\n xy = self.xy\n self.a2 = (x2+y2) + sqrt(((x2-y2)/2.)**2 + xy**2)\n self.b2 = (x2+y2) - sqrt(((x2-y2)/2.)**2 + xy**2)\n self.a = sqrt(self.a2)\n self.b = sqrt(self....
[ "0.7594967", "0.75175714", "0.72580516", "0.70238596", "0.69945914", "0.6912345", "0.69121283", "0.6861323", "0.6833416", "0.68217605", "0.677438", "0.6755652", "0.6723325", "0.667735", "0.6647634", "0.6628147", "0.6539233", "0.6502672", "0.64960253", "0.6483815", "0.64815503...
0.7275382
2
Tests that a real constraint will only serialize with min and max OR value but not both
def test_real_value_constraint(): prop = "Property Band gap" c_value = RealValueConstraint(name=prop,value=3) mapped_c_value = c_value.to_dict() assert mapped_c_value["name"] == prop assert mapped_c_value["type"] == "real" assert mapped_c_value["options"]["value"] == 3
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_real_range_constraint_validation():\n\n # Test valid values OK\n minimum = 1\n maximum = 2\n c = RealRangeConstraint(name=\"Property Band gap\",minimum=minimum,maximum=maximum)\n\n # Test minimum must be less than maximum\n minimum = 3\n maximum = 2\n try:\n c = RealRangeCon...
[ "0.74138457", "0.70723075", "0.67467606", "0.6711405", "0.6643321", "0.6529813", "0.6463856", "0.64410156", "0.641994", "0.64191425", "0.63627195", "0.6307417", "0.6288768", "0.6257847", "0.62352014", "0.6225528", "0.61964977", "0.61890596", "0.6146708", "0.6118012", "0.61025...
0.0
-1
Tests that minimum and maxmimum values are validated correctly on initialization of RealRangeConstraint
def test_real_range_constraint_validation(): # Test valid values OK minimum = 1 maximum = 2 c = RealRangeConstraint(name="Property Band gap",minimum=minimum,maximum=maximum) # Test minimum must be less than maximum minimum = 3 maximum = 2 try: c = RealRangeConstraint(name="Prop...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_int_range_constraint_validation():\n\n # Test valid values OK\n minimum = 1\n maximum = 2\n IntRangeConstraint(name=\"Ingredient count\", minimum=minimum, maximum=maximum)\n\n # Test minimum must be less than maximum\n minimum = 3\n maximum = 2\n try:\n RealRangeConstraint(n...
[ "0.7696487", "0.6958447", "0.6887343", "0.6885297", "0.6882107", "0.6794887", "0.6770476", "0.6751201", "0.6729289", "0.6667438", "0.66467714", "0.66467714", "0.6613863", "0.6575483", "0.6572535", "0.65572786", "0.65467817", "0.6544825", "0.65139794", "0.64923966", "0.6492396...
0.85519254
0
Initializes an empty Deque
def __init__(self): #Data Members print("Hello I am a Circular Array Deque, What is it that you require?") self.capacity_=4 self.size_ =0 self.data_ = [None]*self.capacity_#Arry self.front_ = -1 self.back_ = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._data = [None]*ArrayQueue.DEFAULT_CAPACITY\n self._size = 0\n self._front = 0", "def __init__(self, size):\n self.q = deque( maxlen=size)", "def __init__(self):\n # initialize an empty node\n emptyNode = Node()\n # empty deque has size...
[ "0.76671284", "0.75882876", "0.7546855", "0.7507368", "0.74243844", "0.74215233", "0.74036276", "0.7394357", "0.7363079", "0.7361049", "0.7339749", "0.7339749", "0.7339749", "0.7339749", "0.72948587", "0.72147566", "0.7201581", "0.71992034", "0.71970624", "0.71920425", "0.718...
0.74869174
4
Inserts an element at the front of the Deque
def push_front(self, e): if(self.size_ >= self.capacity_):#If our Deque is full we need to resize it first self.resize_front() self.data_[self.front_]= e#New Front self.size_+=1 # print("Case 1") elif(self.front_ == -1 and self.size_ ==0) :#If the Deque is ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertFront(self, item):\n self.sentinel.insertAfter(item)\n self.N += 1", "def enqueue_front(self, item):\n self._items.insert(0, item)", "def add_front(self, item):\n\n self.items.insert(0, item)", "def push_front(self, e):\n # initialize new Node with data e\n ...
[ "0.7910944", "0.7558671", "0.74507207", "0.7242314", "0.7137165", "0.7134727", "0.71242225", "0.7124216", "0.7077143", "0.70346093", "0.70263493", "0.70241225", "0.7008436", "0.6974547", "0.69252306", "0.6897937", "0.68882257", "0.6843201", "0.6831269", "0.6817453", "0.680432...
0.76794696
1
Returms max support allowed for this item.
def get_support_max_limit(item, counts): return int(max(counts[item] / MIN_ALL_CONF, MIN_SUPPORT))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_select_all_max_items(self):\n return 1500", "def _checked_maximum(self):\n self._block_signals()\n if self._maximum_length_checkbox.isChecked():\n # Maximum length enabled\n self._level_gen.maximum_length = MAXIMUM_LENGTH\n else:\n # Maximum le...
[ "0.63356185", "0.60461986", "0.59805024", "0.59684885", "0.5959881", "0.59585553", "0.5899185", "0.58980924", "0.5842601", "0.58354604", "0.583012", "0.5772032", "0.57660234", "0.5756487", "0.574953", "0.57203317", "0.5715226", "0.5698363", "0.56676936", "0.5667399", "0.56619...
0.65314865
0
Gets the default_docker_pull_conn_name of this ModelDeploymentConfig.
def default_docker_pull_conn_name(self) -> str: return self._default_docker_pull_conn_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_docker_pull_conn_name(self, default_docker_pull_conn_name: str):\n\n self._default_docker_pull_conn_name = default_docker_pull_conn_name", "def name(self) -> str:\n return self.config_name or self.host_name or self.dev_id or DEVICE_DEFAULT_NAME", "def connection_name(self) -> Optional...
[ "0.7664109", "0.6274015", "0.6261288", "0.61919534", "0.60793525", "0.5909234", "0.5860675", "0.58489734", "0.58489734", "0.5833058", "0.57892346", "0.5780426", "0.573084", "0.56920314", "0.5686719", "0.56496435", "0.5631927", "0.56306684", "0.5609876", "0.55893236", "0.55152...
0.8829741
0