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
when server is activated, load weight or use joblib or pickle for performance improvement. then, assign pretrained model instance to self.model.
def load(self, filepath=''): sleep(20) pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(self, fl_ctx: FLContext) -> ModelLearnable:\n if os.path.exists(self.save_path):\n self.logger.info(\"Loading server model\")\n model = load(self.save_path)\n else:\n self.logger.info(f\"Initialization, sending global settings: {self.initial_params}\")\...
[ "0.7513821", "0.7489698", "0.7478855", "0.7212139", "0.70114887", "0.6966133", "0.69644463", "0.6957568", "0.6946004", "0.6917416", "0.6904301", "0.6886772", "0.6873792", "0.6843547", "0.67922795", "0.6770596", "0.672967", "0.66816485", "0.6676346", "0.66728187", "0.667176", ...
0.0
-1
Creates a correct path no matter where the test is run from
def _get_nb_path(name: str, suffix: str = "", abs: bool = True, ext: str = ".ipynb") -> str: _local_path = os.path.dirname(__file__) path = f"{_local_path}/testdata/{name}{suffix}{ext}" return os.path.abspath(path) if abs else path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_root() -> Path:\n return TEST_ROOT", "def test_make_new_dir_1(self):\n test_dir = Path(\"test_dir\")\n output_path = basic.make_new_dir(self.base_dir, test_dir)\n exp_dir = \"test_dir\"\n exp_path = Path(self.base_dir, exp_dir)\n with self.subTest():\n se...
[ "0.7541922", "0.75215554", "0.7488188", "0.7374937", "0.7367222", "0.7318101", "0.73051554", "0.73038644", "0.7288415", "0.721187", "0.70553327", "0.7012223", "0.6976073", "0.6903619", "0.689646", "0.6838243", "0.6822362", "0.6813825", "0.6802102", "0.67775834", "0.677625", ...
0.0
-1
Ordena una lista de tiles en un diccionario donde pueden ser accedidos mediante una fila y una columna.
def arrange_tiles(self, layer): # número de tiles en 'x' width = self.width arranged_tiles = layer.arranged_tiles row = -1 # convierte una lista en un diccionario for col, tile in enumerate(layer.tiles): # calcula la ubicación en dos dimensiones (fila y col...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tiles(self):\n\n tiles = []\n for x in range(self.position[0],\n self.position[0] + CAR_LENGTH if self.is_horizontal else self.position[0] + CAR_WIDTH):\n for y in range(self.position[1],\n self.position[1] + CAR_WIDTH if self.is_hori...
[ "0.6678496", "0.6630207", "0.6557136", "0.65312195", "0.6426528", "0.6223165", "0.61086667", "0.6080225", "0.60731256", "0.60001016", "0.5878228", "0.5664136", "0.56525993", "0.5641407", "0.5634587", "0.56290716", "0.56286156", "0.5628193", "0.5623876", "0.55987686", "0.55888...
0.72410774
0
String representation of the BoutDataset. Accessed by print(ds.bout)
def __str__(self): styled = partial(prettyformat, indent=4, compact=True) text = ( "<xbout.BoutDataset>\n" + "Contains:\n{}\n".format(str(self.data)) + "Metadata:\n{}\n".format(styled(self.metadata)) ) if self.options: text += "Options:\n{...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n\n styled = partial(prettyformat, indent=4, compact=True)\n text = \"<xbout.BoutDataset>\\n\" + \\\n \"Contains:\\n{}\\n\".format(str(self.data)) + \\\n \"Metadata:\\n{}\\n\".format(styled(self.metadata))\n if self.options:\n text += \...
[ "0.7738638", "0.68448293", "0.6820169", "0.6812283", "0.6772967", "0.6755283", "0.67315626", "0.66959274", "0.66763437", "0.6670186", "0.6663785", "0.66437835", "0.658378", "0.6578823", "0.65750813", "0.65570045", "0.6543551", "0.653589", "0.6528994", "0.6528994", "0.6521988"...
0.76001686
1
Create a new Dataset with all 3d variables transformed to fieldaligned coordinates, which are shifted with respect to the base coordinates by an angle zShift
def to_field_aligned(self): result = self.data.copy() for v in chain(result, result.coords): da = result[v] # Need to transform any z-dependent variables or coordinates if (result.metadata["bout_zdim"] in da.dims) and ( da.attrs.get("direction_y", Non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform3D(x: float, y: float, z: float, R: np.array) -> np.array:\n T = np.zeros((4, 4))\n T[:3, :3] = R\n T[:, 3] = [x, y, z, 1.0]\n\n return T", "def EncodeMorton3D(x, y, z):\r\n return Expand3D(x) + (Expand3D(y) << 1) + (Expand3D(z) << 2)", "def add_desired_z_axis(df):\n x = pd.Serie...
[ "0.59011894", "0.584848", "0.578346", "0.5717035", "0.57152915", "0.5705876", "0.56149644", "0.54895145", "0.5485159", "0.54805505", "0.547275", "0.5451591", "0.54237884", "0.5406863", "0.5382211", "0.5367371", "0.53520966", "0.53291565", "0.5325628", "0.5318034", "0.53115976...
0.54179764
13
Get bounding surfaces. Surfaces are returned as arrays of points describing a polygon, assuming the third spatial dimension is a symmetry direction.
def get_bounding_surfaces(self, coords=("R", "Z")): return _get_bounding_surfaces(self.data, coords)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_surfaces(idf):\n surfaces = idf.getsurfaces() + idf.getshadingsurfaces() + idf.getsubsurfaces()\n return surfaces", "def surfaces(self):\n return self._surfaces", "def surfaces(self):\n surfaces = []\n for i in range(1000):\n surface = self.surfaceInfo(i)\n ...
[ "0.6530279", "0.6434113", "0.6411715", "0.6280182", "0.6126913", "0.5993448", "0.57987916", "0.57056105", "0.56974256", "0.56121373", "0.556502", "0.55179393", "0.5502502", "0.5479062", "0.54683447", "0.54181874", "0.54075956", "0.5395107", "0.53748316", "0.53256476", "0.5316...
0.704489
0
compute the 2's complement of int value val
def twos_comp(val, bits): if (val & (1 << (bits - 1))) != 0: val = val - (1 << bits) return val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ones_complement(val):\n #mask = (1 << val.bit_length()) - 1\n #return int(hex(val ^ mask), 16)\n b = bin(val)\n b = b.replace('0', 'x')\n b = b.replace('1', '0')\n b = b.replace('x', '1')\n b = b.replace('1b', '0b')\n return int(b, 2)", "def invert(val)...
[ "0.7548196", "0.7474319", "0.74621737", "0.7444895", "0.7372613", "0.7227137", "0.7093456", "0.7083535", "0.6965524", "0.69272786", "0.6796253", "0.6767744", "0.6730829", "0.66353106", "0.6527896", "0.64418924", "0.63548034", "0.63548034", "0.6349893", "0.633111", "0.633111",...
0.5890496
51
Extract the cell and previous output tensors from the given state.
def _extract_states(self, state): conf = self._config # c_prev is `m` (cell value), and # m_prev is `h` (previous output) in the paper. # Keeping c and m here for consistency with the codebase c_prev = [None] * conf.num_dims m_prev = [None] * conf.num_dims # for LSTM : state = memory cel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_hidden_states(self, output):\n # Intermediate hidden states\n output_fw_intermediate = output[:,:-1,0:self._hidden_size]\n output_bw_intermediate = output[:,1:,self._hidden_size:] \n \n # Last hidden states\n output_fw = output[:,-1,0:self._hidden_size]\n ...
[ "0.6254729", "0.621857", "0.62071514", "0.60771316", "0.60678285", "0.603823", "0.5995742", "0.59708154", "0.5964992", "0.59554535", "0.5947492", "0.59370697", "0.5930274", "0.58716804", "0.58503854", "0.58397615", "0.5837682", "0.5797076", "0.5784501", "0.5777019", "0.577603...
0.77416164
0
Total size of the state of the inner cell used in this grid.
def _cell_state_size(self): state_sizes = self._cells[0].state_size if isinstance(state_sizes, tuple): return sum(state_sizes) return state_sizes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state_size(self):\n raise NotImplementedError(\"Please implement this method\")", "def size(self):\n\n # Replace by correct code\n if self.right and self.left:\n return self.left.height() + self.right.height()\n elif not self.right:\n return self.left.size()\...
[ "0.74167323", "0.7394969", "0.7364005", "0.72789454", "0.7233926", "0.72176397", "0.7182249", "0.7145923", "0.714297", "0.7078754", "0.70768565", "0.706027", "0.7049083", "0.69589293", "0.69470435", "0.6859403", "0.68581504", "0.68440723", "0.68406284", "0.6830058", "0.681499...
0.8483224
0
Propagates through all the cells in dim_indices dimensions.
def _propagate(dim_indices, conf, cells, c_prev, m_prev, new_output, new_state, first_call): if len(dim_indices) == 0: return # Because of the way RNNCells are implemented, we take the last dimension # (H_{N-1}) out and feed it as the state of the RNN cell # (in `last_dim_output`). # The i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iterate_indices(self, indices):\n for iD in reversed(range(self.get_n_dimensions())):\n indices[iD] += 1\n if indices[iD] < self.get_n_points_of_dim(iD): return True\n indices[iD] = 0\n return False", "def flattened_indices_from_row_col_indices(row_indices, col_...
[ "0.57592505", "0.5570539", "0.5558024", "0.5444846", "0.53574795", "0.5317625", "0.530076", "0.5242168", "0.5230099", "0.52238643", "0.5221276", "0.52102256", "0.5180341", "0.5174899", "0.5166367", "0.51390105", "0.51300037", "0.51170236", "0.5116153", "0.5102122", "0.5083281...
0.5909939
0
This function renders the 404 error page
def notfound(error): categories = [ "business", "entertainment", "general", "health", "science", "sports", "technology" ] return render_template("notfound.html", categories = categories), 404
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error():\n return render_template(\"404.html\")", "def not_found(e):\n return render_template(\"errors/404.html\"), 404", "def page_not_found(e):\n return render_template(\"404.html\"), 404", "def page_not_found(e):\n return render_template('404.html'), 404", "def page_not_found(e):\n re...
[ "0.8861111", "0.8804941", "0.8779312", "0.87674886", "0.87674886", "0.8756718", "0.87511665", "0.87232023", "0.86958873", "0.8680467", "0.8637485", "0.8631379", "0.86279774", "0.8570346", "0.85587156", "0.85438836", "0.85120314", "0.84958667", "0.8494395", "0.8490128", "0.848...
0.8093695
36
Get the unique DataGrid identifier. Will only exists if the DataGrid has been persisted.
def get_id(self) -> Optional[str]: return self.id_
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getUniqueID(self):\n return self.unique_id", "def unique_id(self) -> str:\n return f\"{self.entry_id}_{self.module_id}_{self.data_id}\"", "def unique_id(self):\n return self._table.id", "def unique_id(self):\n return self._id", "def unique_id(self):\n return self._id"...
[ "0.6836633", "0.6829037", "0.6819352", "0.674742", "0.674742", "0.6684496", "0.66426384", "0.66365415", "0.6628134", "0.6628134", "0.660426", "0.6586553", "0.6578854", "0.6578854", "0.6578854", "0.6578854", "0.6578825", "0.65748423", "0.65732265", "0.657314", "0.65684", "0....
0.0
-1
Opens the DataGrid in the default browser.
def open(self): if self.id_ is None: raise MqValueError('DataGrid must be created or saved before opening.') domain = GsSession.current.domain.replace(".web", "") if domain == 'https://api.gs.com': domain = 'https://marquee.gs.com' url = f'{domain}/s/markets/grids...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_in_browser(self):\n webbrowser.open(self.url)", "def on_OpenExplorer_clicked(self):\n # TODO: not implemented yet\n #raise NotImplementedError\n\n url=\"http://kfc.matrix.io\"\n\n self.browser.openurl(url)\n self.OnlyDisplay(f\"start {url}\")\n #MATRIXWeb...
[ "0.6684423", "0.6295892", "0.60630506", "0.6011398", "0.5945774", "0.5920018", "0.5900473", "0.58411974", "0.5792295", "0.57660633", "0.57613224", "0.57578784", "0.5740384", "0.5725768", "0.5719649", "0.5717693", "0.56893307", "0.5677102", "0.5672921", "0.56497353", "0.563292...
0.77590376
0
Set the sorts parameter of the grid response
def set_sorts(self, sorts: List[DataGridSort]): self.sorts = sorts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sortby(self):\n ...", "def sort_results(self, sort_option):\r\n self.model.sort_data(sort_option)", "def sort_results(self):\n pass", "def sort_by(self, sort_direction: epl_imagery_pb2.SortDirection):\n # TODO if you want to sort by multiple parameters, then this class will ha...
[ "0.6800051", "0.65857226", "0.64096016", "0.6198106", "0.61229455", "0.59775925", "0.595352", "0.5918668", "0.5892415", "0.5884207", "0.58277094", "0.5788118", "0.5744081", "0.5704034", "0.55871105", "0.55828655", "0.558249", "0.55728805", "0.55708957", "0.5558602", "0.555426...
0.64888066
2
initialize the parent class and the face_mesh model.
def __init__(self): am.AbstractMeasurement.__init__(self) self.face_mesh = mp_face_mesh.FaceMesh( min_detection_confidence=0.5, min_tracking_confidence=0.5) self.drawing_spec = mp_drawing.DrawingSpec(thickness=1, circle_radius=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, mesh):\n self._mesh = mesh", "def __init__(self, facePredictor = None):\n self.detector = dlib.get_frontal_face_detector()\n if facePredictor != None:\n self.predictor = dlib.shape_predictor(facePredictor)\n else:\n self.predictor = None", "d...
[ "0.7453505", "0.6851489", "0.6842294", "0.6824078", "0.6807889", "0.6781852", "0.6758116", "0.66532725", "0.66532314", "0.66333944", "0.644714", "0.64381653", "0.6411551", "0.63970214", "0.63875043", "0.6386501", "0.6369439", "0.6361478", "0.6348545", "0.63335305", "0.6315081...
0.71858
1
Given an array of numbers arr. A sequence of numbers is called an arithmetic progression if the difference between any two consecutive elements is the same.Return true if the array can be rearranged to form an arithmetic progression, otherwise, return false. >>> canMakeArithmeticProgression([3,5,1]) True >>> canMakeAri...
def canMakeArithmeticProgression(arr): new_arr = sorted(arr) diff = new_arr[1] - new_arr[0] for idx, num in enumerate(new_arr): if idx == 0: pass elif num - new_arr[idx - 1] != diff: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Progression(arr):\n\n # Check if array is with at least 3 elements\n if len(arr) < 3: return 0\n\n # Calculate difference between numbers in list\n diffAr = arr[1] - arr[0]\n diffGeo = arr[1] / arr[0]\n\n # Temp vars to check if list is in progression\n isA = True\n isG = True\n\n fo...
[ "0.66149616", "0.647907", "0.6376644", "0.6320006", "0.62170225", "0.62060744", "0.60170907", "0.5871938", "0.5855737", "0.5823819", "0.5690678", "0.5627322", "0.5579443", "0.5552384", "0.55418354", "0.5513993", "0.5461593", "0.54601616", "0.5458909", "0.5411442", "0.5406272"...
0.864427
0
Ensure that the sender ID is valid, based on the email's intent. Many emails are only allowed to be sent by a certain user or type of user, e.g. 'admin' or an admin/moderator. This function will raise an exception if the given sender is not allowed to send this type of email.
def _require_sender_id_is_valid(intent, sender_id): if intent not in SENDER_VALIDATORS: raise Exception('Invalid email intent string: %s' % intent) else: if not SENDER_VALIDATORS[intent](sender_id): logging.error( 'Invalid sender_id %s for email with intent \'%s\'' %...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __set_sender_id(self, sender_id):\n if not isinstance(sender_id, int):\n raise TypeError('It has to be an integer identifier')\n if sender_id < 0:\n raise ValueError('There are not negative identifiers')\n self.__sender_id = sender_id", "def is_sender_public_id(self...
[ "0.63011056", "0.60451776", "0.5974665", "0.5636324", "0.55161345", "0.54815364", "0.5412664", "0.5280462", "0.5246744", "0.52253884", "0.5225088", "0.5218983", "0.52032375", "0.5185404", "0.5149468", "0.5148969", "0.51131505", "0.5094248", "0.50170064", "0.5002656", "0.49936...
0.7997367
0
Returns if users can receive email.
def can_users_receive_thread_email( recipient_ids, exploration_id, has_suggestion): users_global_prefs = ( user_services.get_users_email_preferences(recipient_ids)) users_exploration_prefs = ( user_services.get_users_email_preferences_for_exploration( recipient_ids, explorati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_notify(self, last_notification):\n return (\n features.is_enabled(features.EMAIL_NOTIFICATIONS)\n and self.notification_settings.via_email\n and api.can_email_user(self.user)\n and super().can_notify(last_notification)\n )", "def can_send(self):\n...
[ "0.67877007", "0.6707869", "0.65218943", "0.6409309", "0.63130254", "0.6297347", "0.6297347", "0.6206325", "0.62061167", "0.6101321", "0.6101321", "0.60814977", "0.60814977", "0.60814977", "0.60761756", "0.6066136", "0.60443467", "0.60337234", "0.60288686", "0.59087044", "0.5...
0.62996846
5
__init__(itkArray2DD self) > itkArray2DD __init__(itkArray2DD self, unsigned int rows, unsigned int cols) > itkArray2DD __init__(itkArray2DD self, itkArray2DD array) > itkArray2DD __init__(itkArray2DD self, vnl_matrixD matrix) > itkArray2DD
def __init__(self, *args): _itkArray2DPython.itkArray2DD_swiginit(self, _itkArray2DPython.new_itkArray2DD(*args))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args):\n _itkArray2DPython.itkArray2DF_swiginit(self, _itkArray2DPython.new_itkArray2DF(*args))", "def __init__(self, *args):\n _itkArray2DPython.itkArray2DUI_swiginit(self, _itkArray2DPython.new_itkArray2DUI(*args))", "def __init__(self, *args):\n _itkQuadEdgeCellTrait...
[ "0.78698415", "0.7478759", "0.64136213", "0.6410877", "0.63646346", "0.63412094", "0.63412094", "0.63412094", "0.6274328", "0.62616503", "0.6219141", "0.6165293", "0.6112146", "0.60364133", "0.6021272", "0.60208875", "0.60110205", "0.60078305", "0.5997586", "0.59894484", "0.5...
0.84896344
0
__init__(itkArray2DF self) > itkArray2DF __init__(itkArray2DF self, unsigned int rows, unsigned int cols) > itkArray2DF __init__(itkArray2DF self, itkArray2DF array) > itkArray2DF __init__(itkArray2DF self, vnl_matrixF matrix) > itkArray2DF
def __init__(self, *args): _itkArray2DPython.itkArray2DF_swiginit(self, _itkArray2DPython.new_itkArray2DF(*args))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args):\n _itkArray2DPython.itkArray2DD_swiginit(self, _itkArray2DPython.new_itkArray2DD(*args))", "def __init__(self, *args):\n _itkArray2DPython.itkArray2DUI_swiginit(self, _itkArray2DPython.new_itkArray2DUI(*args))", "def __init__(self, *args):\n _itkQuadEdgeCellTrait...
[ "0.7764629", "0.7177791", "0.63070595", "0.624977", "0.62463087", "0.6222416", "0.61589444", "0.6103977", "0.6060324", "0.6058261", "0.6057244", "0.6029068", "0.59877056", "0.5977644", "0.5977644", "0.5977644", "0.5973117", "0.595984", "0.595467", "0.59331894", "0.59264046", ...
0.86677057
0
__init__(itkArray2DUI self) > itkArray2DUI __init__(itkArray2DUI self, unsigned int rows, unsigned int cols) > itkArray2DUI __init__(itkArray2DUI self, itkArray2DUI array) > itkArray2DUI __init__(itkArray2DUI self, vnl_matrixUI matrix) > itkArray2DUI
def __init__(self, *args): _itkArray2DPython.itkArray2DUI_swiginit(self, _itkArray2DPython.new_itkArray2DUI(*args))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args):\n _itkArray2DPython.itkArray2DD_swiginit(self, _itkArray2DPython.new_itkArray2DD(*args))", "def __init__(self, *args):\n _itkArray2DPython.itkArray2DF_swiginit(self, _itkArray2DPython.new_itkArray2DF(*args))", "def __init__(self, *args):\n _itkRGBAPixelPython.itk...
[ "0.80487615", "0.777564", "0.69835806", "0.68892384", "0.68715703", "0.67145765", "0.64858663", "0.64536214", "0.6435996", "0.6420875", "0.6387748", "0.6356113", "0.63242954", "0.6317986", "0.6293345", "0.6236154", "0.6188177", "0.61849767", "0.6184558", "0.61808354", "0.6175...
0.8610839
0
GetElement(itkArray2DUI self, unsigned long long row, unsigned long long col) > unsigned int const &
def GetElement(self, row: 'unsigned long long', col: 'unsigned long long') -> "unsigned int const &": return _itkArray2DPython.itkArray2DUI_GetElement(self, row, col)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetElement(self, row: 'unsigned long long', col: 'unsigned long long') -> \"double const &\":\n return _itkArray2DPython.itkArray2DD_GetElement(self, row, col)", "def GetElement(self, row: 'unsigned long long', col: 'unsigned long long') -> \"float const &\":\n return _itkArray2DPython.itkArray...
[ "0.7785524", "0.7625416", "0.68500215", "0.6774247", "0.670162", "0.644203", "0.63044876", "0.62142974", "0.6013558", "0.5961701", "0.5959366", "0.59231186", "0.59009427", "0.5897651", "0.5849272", "0.5831127", "0.5822153", "0.58043116", "0.5800766", "0.57987154", "0.5794374"...
0.8432618
0
Odd little function to return the number of significant figures in a number. It kills everything to the right of the e and removes the period
def find_sigfigs(x): sigfig_re = re.compile("([0-9.]+)") m = sigfig_re.search("{:e}".format(float(x))) # turn to scientific form if m: val = m.group(1).replace(".", "") while val[-1:] == '0': # remove all trailing zeros val = val[0:-1] return len(val) return 0 # n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def round_sigfigs(num, sig_figs):\n#http://code.activestate.com/recipes/578114-round-number-to-specified-number-of-significant-di/\n if num != 0:\n return round(num, -int(math.floor(math.log10(abs(num))) - (sig_figs - 1)))\n else:\n return 0", "def significand(x):\n\n assert isinstance(x, ...
[ "0.7250692", "0.68816465", "0.6669559", "0.6556427", "0.6467628", "0.6467628", "0.6347691", "0.62990284", "0.62122464", "0.6182709", "0.6169792", "0.6169034", "0.6145245", "0.6109955", "0.6031198", "0.59817976", "0.59817976", "0.59702784", "0.59157544", "0.5914876", "0.589825...
0.8002274
0
Returns n to the nearest number
def nearest(n, number): return math.floor((n / number) + 0.5) * number
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nearest_int(num):\n return int(np.round(num))", "def nearest_square(num):\n\n answer = 0\n while (answer+1)**2 < num:\n answer += 1\n return answer**2", "def _round_to_nearest_multiple_down(x, n=5):\n return n * math.floor(float(x) / n)", "def _round_to_nearest_multiple_up(x, n=5):\...
[ "0.79727787", "0.7289314", "0.7277677", "0.7213795", "0.7167367", "0.7123137", "0.7002838", "0.67128956", "0.67010766", "0.6675226", "0.6635987", "0.6608803", "0.6608738", "0.6587024", "0.65679616", "0.6504897", "0.648127", "0.64677525", "0.64274275", "0.642367", "0.642367", ...
0.86348236
0
Return checkout shipping price. It takes in account all plugins.
def checkout_shipping_price( *, manager: "PluginsManager", checkout_info: "CheckoutInfo", lines: Iterable["CheckoutLineInfo"], address: Optional["Address"], discounts: Optional[Iterable[DiscountInfo]] = None, ) -> "TaxedMoney": calculated_checkout_shipping = manager.calculate_checkout_shippi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_checkout_delivery_price(\n checkout_info: \"CheckoutInfo\",\n lines: Iterable[\"CheckoutLineInfo\"] = None,\n) -> Money:\n currency = checkout_info.checkout.currency\n\n shipping_price = base_checkout_undiscounted_delivery_price(checkout_info, lines)\n\n is_shipping_voucher = (\n che...
[ "0.7024894", "0.67271966", "0.66116214", "0.6588111", "0.6499324", "0.6466315", "0.6371215", "0.6371215", "0.63457894", "0.6332819", "0.62777066", "0.62607366", "0.61951643", "0.6179664", "0.61160535", "0.61160535", "0.61160535", "0.60824025", "0.6081641", "0.60458434", "0.60...
0.7875183
0
Return the total cost of all the checkout lines, taxes included. It takes in account all plugins.
def checkout_subtotal( *, manager: "PluginsManager", checkout_info: "CheckoutInfo", lines: Iterable["CheckoutLineInfo"], address: Optional["Address"], discounts: Optional[Iterable[DiscountInfo]] = None, ) -> "TaxedMoney": calculated_checkout_subtotal = manager.calculate_checkout_subtotal( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkout_line_total(\n *,\n manager: \"PluginsManager\",\n checkout_info: \"CheckoutInfo\",\n lines: Iterable[\"CheckoutLineInfo\"],\n checkout_line_info: \"CheckoutLineInfo\",\n discounts: Iterable[DiscountInfo] = [],\n) -> \"TaxedMoney\":\n address = checkout_info.shipping_address or che...
[ "0.73588604", "0.69469416", "0.6694762", "0.64847225", "0.64227974", "0.63552034", "0.630178", "0.62969834", "0.62609583", "0.62545556", "0.62270117", "0.62178963", "0.62009585", "0.619866", "0.6145637", "0.6144571", "0.6133934", "0.6109146", "0.60690856", "0.60615283", "0.60...
0.6543316
3
Return the total cost of the checkout. Total is a cost of all lines and shipping fees, minus checkout discounts, taxes included. It takes in account all plugins.
def checkout_total( *, manager: "PluginsManager", checkout_info: "CheckoutInfo", lines: Iterable["CheckoutLineInfo"], address: Optional["Address"], discounts: Optional[Iterable[DiscountInfo]] = None, ) -> "TaxedMoney": calculated_checkout_total = manager.calculate_checkout_total( che...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkout_line_total(\n *,\n manager: \"PluginsManager\",\n checkout_info: \"CheckoutInfo\",\n lines: Iterable[\"CheckoutLineInfo\"],\n checkout_line_info: \"CheckoutLineInfo\",\n discounts: Iterable[DiscountInfo] = [],\n) -> \"TaxedMoney\":\n address = checkout_info.shipping_address or che...
[ "0.699066", "0.69352424", "0.67948633", "0.67613196", "0.6739813", "0.67147726", "0.6710645", "0.6695521", "0.6640341", "0.66280836", "0.6603674", "0.6602697", "0.6597623", "0.6572456", "0.65218973", "0.64966685", "0.64876944", "0.6487631", "0.64736366", "0.64667153", "0.6438...
0.7395403
0
Return the total price of provided line, taxes included. It takes in account all plugins.
def checkout_line_total( *, manager: "PluginsManager", checkout_info: "CheckoutInfo", lines: Iterable["CheckoutLineInfo"], checkout_line_info: "CheckoutLineInfo", discounts: Iterable[DiscountInfo] = [], ) -> "TaxedMoney": address = checkout_info.shipping_address or checkout_info.billing_addr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _amount_line(self, cr, uid, ids, prop, unknow_none, unknow_dict):\n res = {}\n tax_obj = self.pool.get('account.tax')\n cur_obj = self.pool.get('res.currency')\n for line in self.browse(cr, uid, ids):\n price = line.price_unit * (1-(line.discount or 0.0)/100.0)\n ...
[ "0.68811136", "0.68807936", "0.6563494", "0.65322506", "0.6364763", "0.61911374", "0.6189038", "0.6171741", "0.6161707", "0.61553276", "0.61261326", "0.6070365", "0.59981155", "0.5983958", "0.5981905", "0.5974914", "0.59643763", "0.5950477", "0.5905625", "0.5893934", "0.58819...
0.733931
0
Computes the forward pass for a layer of rectified linear units (ReLUs).
def relu_forward(x): out = None ########################################################################### # TODO: Implement the ReLU forward pass. # ########################################################################### out = x * (x > 0) ##################...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_relus(self):\n\n def relu_backward_hook_function(module, grad_in, grad_out):\n \"\"\"\n If there is a negative gradient, change it to zero\n \"\"\"\n # Get last forward output\n corresponding_forward_output = self.forward_relu_outputs[-1]\n ...
[ "0.67765754", "0.6630487", "0.6603554", "0.6524658", "0.65097666", "0.64478433", "0.6385381", "0.62672025", "0.62047166", "0.6179713", "0.61535424", "0.61385596", "0.6061572", "0.6055216", "0.6048094", "0.6018342", "0.59974337", "0.59908754", "0.59696555", "0.59634507", "0.59...
0.6047937
15
Computes the backward pass for a layer of rectified linear units (ReLUs).
def relu_backward(dout, cache): dx, x = None, cache ########################################################################### # TODO: Implement the ReLU backward pass. # ########################################################################### dx = dout * (x > 0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relu_backward(self, dUpper, cache):\n x = cache\n #############################################################################\n # TODO: Implement the ReLU backward pass. #\n #########################################################################...
[ "0.70412636", "0.694716", "0.6897693", "0.6847592", "0.6847592", "0.6846935", "0.6841099", "0.68178034", "0.6766849", "0.6754919", "0.67536426", "0.67530656", "0.67419785", "0.6739244", "0.6713423", "0.6708748", "0.6699276", "0.66860896", "0.6665928", "0.6665928", "0.6665928"...
0.6696307
17
Forward pass for batch normalization. During training the sample mean and (uncorrected) sample variance are computed from minibatch statistics and used to normalize the incoming data. During training we also keep an exponentially decaying running mean of the mean and variance of each feature, and these averages are use...
def batchnorm_forward(x, gamma, beta, bn_param): mode = bn_param['mode'] eps = bn_param.get('eps', 1e-5) momentum = bn_param.get('momentum', 0.9) N, D = x.shape running_mean = bn_param.get('running_mean', np.zeros(D, dtype=x.dtype)) running_var = bn_param.get('running_var', np.zeros(D, dtype=x....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(self, x, train=True):\n if train is not None:\n mean, variance = tf.nn.moments(x, [0,1,2])\n assign_mean = self.mean.assign(mean)\n assign_variance = self.variance.assign(variance)\n with tf.control_dependencies([assign_mean, assign_variance]):\n return tf.nn.batch_norm_...
[ "0.7338229", "0.7017974", "0.6941108", "0.6935646", "0.6931301", "0.68716776", "0.6846148", "0.67670196", "0.6757623", "0.6714577", "0.67050827", "0.6647122", "0.6601053", "0.6599012", "0.6576987", "0.6517213", "0.6512478", "0.645963", "0.6453668", "0.64110935", "0.6388228", ...
0.689029
5
A naive implementation of the forward pass for a maxpooling layer.
def max_pool_forward(x, pool_param): out = None ########################################################################### # TODO: Implement the max-pooling forward pass # ########################################################################### N, C, H, W = x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_pool_forward_naive(x, pool_param):\n out = None\n ###########################################################################\n # TODO: Implement the max pooling forward pass #\n ###########################################################################\n N,C,H,W ...
[ "0.78478473", "0.77464086", "0.7588915", "0.75831836", "0.75474185", "0.74050933", "0.7378611", "0.7318571", "0.72232896", "0.71326613", "0.7098723", "0.70758176", "0.6990659", "0.69255495", "0.69221073", "0.68792313", "0.68130654", "0.68058133", "0.6792034", "0.6792034", "0....
0.74184185
5
Check if two objects are equal
def is_equal(o1: object, o2: object) -> bool: if o1 is None and o2 is None: return True if o1 is None: return False return o1 == o2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def equals(self, obj: object) -> bool:\n ...", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\r\n return self.__dict__ == other.__dict__", "def test_equal_on_equal(self):\n ...
[ "0.78094596", "0.7773827", "0.7773827", "0.7751994", "0.7720267", "0.77175474", "0.77175474", "0.77175474", "0.77175474", "0.77175474", "0.77175474", "0.77175474", "0.77175474", "0.77175474", "0.77175474", "0.77175474", "0.77175474", "0.77175474", "0.77175474", "0.77175474", ...
0.7832948
0
Return False if word already in trie, otherwise return True and add
def check_present_and_add(self, word): current_node = self.root_node is_new_word = False # iterate through trie adding missing notes for char in word: if char not in current_node: is_new_word = True current_node[char] = {} current_node = current_node[char] # mark e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, word):\n current_node = self.root\n\n for char in word:\n if char not in current_node.children: # checks if that char does not already exists in the children Trie\n current_node.children[char] = TrieNode() # if it doesnt add it to the children dict\n\n ...
[ "0.79426163", "0.7905646", "0.7855985", "0.7796953", "0.77269894", "0.77027094", "0.7695847", "0.76716083", "0.76421124", "0.7621175", "0.7495033", "0.7321256", "0.73114586", "0.73099375", "0.72996986", "0.7260195", "0.7251777", "0.72487164", "0.72439677", "0.7241073", "0.723...
0.8097152
0
Returns the list of performances for all models associated with this job. The variances of all metrics will be set to 0.
def performances(self) -> list[Performance]: return [ Performance( training_time=Metric(p["training"]["duration"], 0), latency=Metric(self.static_metrics["latency"], 0), num_model_parameters=Metric( self.static_metrics["num_model_pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAllMetrics(self):\n result = self.getReportMetrics()\n result.update(self.getOptimizationMetrics())\n return result", "def metrics(self) -> list[dict[str, dict[str, float | int]]]:\n return self.performance[\"performances\"]", "def get_all_metrics(self):\n up_time = self.uptime()\...
[ "0.6068686", "0.5906195", "0.5847855", "0.5822046", "0.5807015", "0.5726623", "0.57113206", "0.5709921", "0.57070005", "0.567055", "0.5655657", "0.5631146", "0.5530707", "0.5509825", "0.5500033", "0.549014", "0.5486122", "0.548038", "0.54691386", "0.5466722", "0.54654914", ...
0.70373994
0
Retrieves a Keras metric as a `function`/`Metric` class instance. The `identifier` may be the string name of a metric function or class. >>> metric = tf.keras.metrics.get("categorical_crossentropy") >>> type(metric) >>> metric = tf.keras.metrics.get("CategoricalCrossentropy") >>> type(metric) You can also specify `conf...
def get(identifier): if isinstance(identifier, dict): use_legacy_format = "module" not in identifier return deserialize(identifier, use_legacy_format=use_legacy_format) elif isinstance(identifier, str): return deserialize(str(identifier)) elif callable(identifier): return ide...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_metric_function(metric, output_shape=None, loss_fn=None):\n if metric not in ['accuracy', 'acc', 'crossentropy', 'ce']:\n return metrics_module.get(metric)\n\n is_sparse_categorical_crossentropy = (\n isinstance(loss_fn, losses.SparseCategoricalCrossentropy) or\n (isinstance(loss_fn, losses....
[ "0.64331776", "0.5918581", "0.58575666", "0.56548023", "0.56092954", "0.5603099", "0.56016564", "0.55089456", "0.5492291", "0.5395595", "0.5324814", "0.5318652", "0.5310939", "0.5292794", "0.5289496", "0.5235254", "0.5227662", "0.5165119", "0.5161693", "0.5140593", "0.5140334...
0.65417695
0
Activation of a neuron, defined using threshold function.
def activation(h): if(h > 0): return 1 else: return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def threshold(activation):\n if activation >= 0.0:\n return 1\n else:\n return 0", "def activation_function(self, z):\n return 1. / (1. + np.exp(-np.clip(z, -250, 250)))", "def activation(self,z):\n #using the clipping function as there is no need for it becaus...
[ "0.7202802", "0.7172909", "0.6912251", "0.6873214", "0.67690814", "0.6693703", "0.6669316", "0.6660287", "0.66569805", "0.6627929", "0.6624198", "0.660525", "0.64802074", "0.64802074", "0.6447413", "0.6420548", "0.6408398", "0.6391625", "0.6356477", "0.6353994", "0.6353831", ...
0.6057262
48
Update a weight Wij for a misclassified sample, based on a simple error formula and learning rate.
def update_weight(wij, yj, tj, xi, lr = 0.25): new_wij = wij - lr * ((yj - tj) * xi) new_wij = round(new_wij, 3) #print("\t", wij, "-", lr, "* (", yj, "-", tj, ") *", xi, "=", new_wij) return new_wij
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_weights(point_to_weight, misclassified_points, error_rate):\n for p in point_to_weight:\n if p in misclassified_points:\n point_to_weight[p] *= make_fraction(1,2)*make_fraction(1, error_rate)\n else:\n point_to_weight[p] *= make_fraction(1,2)*make_fraction(1, 1-err...
[ "0.70156485", "0.69537055", "0.67131054", "0.663877", "0.6624332", "0.6624332", "0.6562418", "0.64811146", "0.64668864", "0.6356914", "0.63369185", "0.6277679", "0.6265873", "0.625182", "0.6227805", "0.6213026", "0.6190236", "0.6186102", "0.61665684", "0.61655754", "0.6157591...
0.6022994
31
Complete a forward pass for one input sample through the perceptron.
def forward_pass(X, target_Y, W): pred_Y = activation(weighted_sum(W, X)) print("\tI/P:", X, " O/P:", target_Y, " W:", W, " W_Sum:", round(weighted_sum(W, X), 3)) if pred_Y != target_Y: for j in range(len(W)): W[j] = update_weight(W[j], pred_Y, target_Y, X[j]) return W
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, inputs):\n if Dropout.train_flag:\n binomial = bn.Binomial(probs=self.p)\n self.data = binomial.sample(inputs.size())\n return inputs * self.data * (1.0/(self.p))\n return inputs", "def perceptron_learning(train_data, W, epoch = 3):\n \n for ...
[ "0.66141886", "0.64519197", "0.63713896", "0.6370811", "0.63531744", "0.6311084", "0.63019276", "0.6288141", "0.62637824", "0.62491006", "0.6244735", "0.6241942", "0.62399524", "0.62244314", "0.6223819", "0.61948806", "0.6189457", "0.61839896", "0.61742866", "0.61642253", "0....
0.0
-1
This form allows for a staff user to create a new post. It does not publish the post, but it redirects to a page where the post can be reviewed and published.
def new(request): form = PostForm(request.POST or None) if request.method == "POST": if form.is_valid(): instance = form.save(commit=False) instance.user = request.user instance.save() return HttpResponseRedirect(reverse('posts:toggle_publish', args=(ins...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post():\n\n form = forms.PostForm()\n if form.validate_on_submit():\n models.Post.create(title=form.title.data,\n date=form.date.data,\n time_spent=form.time_spent.data,\n details=form.details.data,\n ...
[ "0.79286516", "0.7790115", "0.7599431", "0.7587134", "0.7394764", "0.738566", "0.73643744", "0.7342422", "0.7233937", "0.7230526", "0.72145677", "0.7199045", "0.71644497", "0.71152514", "0.7108066", "0.7101365", "0.7094009", "0.7087318", "0.7075863", "0.7038664", "0.70323056"...
0.7743201
2
Gets altitudes for each point in the dataset.
def get_altitude(points): altitudes = np.zeros((len(points),), dtype="float64") for i, point in tqdm(enumerate(points), desc="GETTING ALTITUDE"): p = Point(point[0], point[1]) altitudes[i] = alt.NM_COTA.iloc[ np.argmin([p.distance(alt.geometry.iloc[j]) for j in range(alt.shape[0])]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def altitude_profile(self, alt):\n # checking if the units entered are km\n if alt.unit == u.km:\n if 150 <= alt.value < 500:\n alt_properties = self._altitude_profile(500)\n else:\n alt_properties = self._altitude_profile(alt.value)\n\n retu...
[ "0.63002145", "0.6118353", "0.6036766", "0.59432745", "0.5901361", "0.5760974", "0.5740872", "0.5735877", "0.5718014", "0.5718014", "0.5513645", "0.54787827", "0.5413163", "0.5357624", "0.5353968", "0.5290058", "0.52800673", "0.52408457", "0.5229023", "0.521252", "0.52060795"...
0.74086666
0
Returns the corrected geopandas df for ruido.
def get_zpae(): zpae = gpd.read_file("./ZPAE/ZPAE/TODAS_ZPAE_ETRS89.shp") mydic = get_lon_lat(zpae, "zpae", ruido=True) mydic["zpae"]["ruido"] = zpae.ZonaSupera return pd.DataFrame(mydic["zpae"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_geopandas(df):\n df['geometry'] = [Point(xy) for xy in zip(df.latitude, df.longitude)]\n crs = {'init': 'epsg:4326'}\n df = gpd.GeoDataFrame(df, crs=crs, geometry=df['geometry'])\n\n return df", "def get_countries_geo_df() -> geopandas.GeoDataFrame:\n\n geo_df: geopandas.GeoDataFram...
[ "0.6548063", "0.6490673", "0.63116944", "0.60756516", "0.5959022", "0.59559715", "0.59439325", "0.5891471", "0.58897126", "0.5877445", "0.5872587", "0.57912934", "0.57821393", "0.5766436", "0.57658875", "0.5742322", "0.5710453", "0.5685683", "0.5681982", "0.5672761", "0.56706...
0.5889741
8
Creates a df with the subdictionary of that variable (name).
def get_individual_df(nombre): clusters = [] contadores = [] for k, v in mydic[nombre]["contador"].items(): clusters.append(k) contadores.append(v) return pd.DataFrame({"CODIGO_POSTAL": clusters, f"contadores_{nombre}": contadores})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dataframe(data: dict) -> pd.DataFrame:\n df = pd.DataFrame(data)\n df.index.name = 'coin_name'\n return df", "def get_pandas(self, name):\n val = self.get(name)\n if isinstance(val, dict):\n df = pandas.DataFrame(val)\n return df", "def to_df(thisdict, na...
[ "0.669707", "0.65590453", "0.6476345", "0.6387227", "0.62743527", "0.6246774", "0.60631156", "0.6041356", "0.5965891", "0.5887306", "0.58411694", "0.581768", "0.58128387", "0.5803478", "0.5788514", "0.57829964", "0.5765014", "0.57620895", "0.5761268", "0.57274526", "0.5718506...
0.60856134
6
Constructor for the GridPerslayWeight class.
def __init__(self, grid, grid_bnds, **kwargs): super().__init__(dynamic=True, **kwargs) self.grid = tf.Variable(initial_value=grid, trainable=True) self.grid_bnds = grid_bnds
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, weight: float = 1.0):\n\n super().__init__()\n self.weight = weight", "def __init__(self, weights):\n self._weights = weights", "def __init__(self, alpha=80, beta=13, gamma=3, spatial_ker_weight=3, bilateral_ker_weight=10):\n self.alpha = alpha\n self.beta ...
[ "0.7288295", "0.70269555", "0.67524683", "0.6720217", "0.6693398", "0.6499695", "0.6480581", "0.64385366", "0.64092577", "0.63991016", "0.6376484", "0.63614315", "0.63444906", "0.63351786", "0.6313429", "0.6297171", "0.62740016", "0.6259921", "0.6207", "0.61881584", "0.616264...
0.0
-1
Constructor for the GridPerslayWeight class.
def __init__(self, gaussians, **kwargs): super().__init__(dynamic=True, **kwargs) self.W = tf.Variable(initial_value=gaussians, trainable=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, weight: float = 1.0):\n\n super().__init__()\n self.weight = weight", "def __init__(self, weights):\n self._weights = weights", "def __init__(self, alpha=80, beta=13, gamma=3, spatial_ker_weight=3, bilateral_ker_weight=10):\n self.alpha = alpha\n self.beta ...
[ "0.7288295", "0.70269555", "0.67524683", "0.6720217", "0.6693398", "0.6499695", "0.6480581", "0.64385366", "0.64092577", "0.63991016", "0.6376484", "0.63614315", "0.63444906", "0.63351786", "0.6313429", "0.6297171", "0.62740016", "0.6259921", "0.6207", "0.61881584", "0.616264...
0.0
-1
Provide helpful representation when printed.
def __repr__(self): return f"<User user_id={self.user_id} email={self.email}>"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return self.pretty_print(self.__dict__)", "def nice_output(self):\n return self.des", "def nice_output(self):\n return self.des", "def __str__(self):\n return self.printable()", "def _printable(self):\n toPrint = \"Qubit ID: \" + str(self.qubit_id) +...
[ "0.7529561", "0.7511525", "0.7511525", "0.74975544", "0.7394847", "0.72965956", "0.7293301", "0.7226869", "0.7225389", "0.7205555", "0.71771973", "0.71743053", "0.7146052", "0.7134735", "0.71325094", "0.71289283", "0.7126178", "0.71148866", "0.7109676", "0.7082562", "0.707800...
0.0
-1
Predict user's rating of a movie.
def predict_rating(self, movie): # # option 1: SQLAlchemy ORM # UserMovies = db.aliased(Rating) MovieUsers = db.aliased(Rating) query = (db.session.query(Rating.user_id, Rating.score, UserMovies.score, MovieUsers.score) .join(UserMovies, UserMovies.movi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predictOnMovie(self,user,movie,neibor_list,user_rating,user_aver_rating):\n predict = user_aver_rating[user]\n numerator, denominator = 0.0,0.0\n for sim, neighbor in neibor_list:\n if movie in user_rating[neighbor]:\n numerator += sim*(user_rating[neighbor][movie...
[ "0.78892064", "0.7792879", "0.74371594", "0.7412951", "0.7374177", "0.7269824", "0.7124", "0.6878768", "0.68674034", "0.684111", "0.68178344", "0.68040067", "0.67578256", "0.6705585", "0.6636941", "0.6573993", "0.6565604", "0.65183765", "0.64657164", "0.6458849", "0.6446155",...
0.74766874
2
Provide helpful representation when printed.
def __repr__(self): return f"<Movie movie_id={self.movie_id} title={self.title}>"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return self.pretty_print(self.__dict__)", "def nice_output(self):\n return self.des", "def nice_output(self):\n return self.des", "def __str__(self):\n return self.printable()", "def _printable(self):\n toPrint = \"Qubit ID: \" + str(self.qubit_id) +...
[ "0.7529561", "0.7511525", "0.7511525", "0.74975544", "0.7394847", "0.72965956", "0.7293301", "0.7226869", "0.7225389", "0.7205555", "0.71771973", "0.71743053", "0.7146052", "0.7134735", "0.71325094", "0.71289283", "0.7126178", "0.71148866", "0.7109676", "0.7082562", "0.707800...
0.0
-1
Provide helpful representation when printed.
def __repr__(self): return f"""<Rating rating_id={self.rating_id} movie_id={self.movie_id} user_id={self.user_id} score={self.score}>"""
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return self.pretty_print(self.__dict__)", "def nice_output(self):\n return self.des", "def nice_output(self):\n return self.des", "def __str__(self):\n return self.printable()", "def _printable(self):\n toPrint = \"Qubit ID: \" + str(self.qubit_id) +...
[ "0.7529561", "0.7511525", "0.7511525", "0.74975544", "0.7394847", "0.72965956", "0.7293301", "0.7226869", "0.7225389", "0.7205555", "0.71771973", "0.71743053", "0.7146052", "0.7134735", "0.71325094", "0.71289283", "0.7126178", "0.71148866", "0.7109676", "0.7082562", "0.707800...
0.0
-1
Returns the PE header TimeDateStamp timestamp as a datetime
def getCreationDate(filename): path = cachePath(filename) pe = pefile.PE(path) return datetime.fromtimestamp(pe.FILE_HEADER.TimeDateStamp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timestamp(self):\n return parse_windows_timestamp(self.unpack_qword(0x4))", "def getTimestamp(self):\r\n\t\treturn self.pair.data['timestamp']", "def get_timestamp(self):\n p = self._get_sub_text('timestamp')\n if not p:\n return None\n else:\n return xep_0...
[ "0.6832173", "0.67735803", "0.67274374", "0.6611854", "0.6602513", "0.65818363", "0.65330577", "0.6511616", "0.64462173", "0.6416544", "0.6368149", "0.63491523", "0.6342346", "0.63253987", "0.63169414", "0.62999403", "0.629035", "0.62888193", "0.6261896", "0.61841553", "0.618...
0.6180562
26
Takes the conditions in tuple format and converts it to a proper SQL WHERE clause
def __convert_to_sql_where(conditions : List[Tuple[Any, RelationalOperator, Any]]) -> str: formatted_identifiers = [] for identifier in conditions: col_name, relation, value = identifier if relation == RelationalOperator.Between and len(value) != 2: raise ValueError("Between relational op...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_where_clause(**kwds_filter):\n clause = []\n params = []\n items = kwds_filter.items()\n items = sorted(items, key=lambda x: x[0]) # Ordered by key.\n for key, val in items:\n if nonstringiter(val):\n clause.append(key + ' IN (%s)' % (', '.jo...
[ "0.75511324", "0.751034", "0.7240489", "0.72299075", "0.719078", "0.7017938", "0.6985508", "0.6978745", "0.6949176", "0.67960805", "0.6721013", "0.66881025", "0.66401166", "0.6640089", "0.6536709", "0.6489517", "0.64729446", "0.64506096", "0.64329875", "0.64316744", "0.639672...
0.81629884
0
Tests if customer credit is updated properly
def test_update_customer_credit(self): create_empty_db() add_customer(**user_1) update_customer_credit(user_1['customer_id'], 5000.00) query = Customer.get(Customer.customer_id == user_1['customer_id']) self.assertEqual(5000.00, query.customer_limit) # Test for no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_customer(self):\n set_up_db()\n add_customer(*self.test_customer)\n update_customer_credit(1, 500000.00)\n self.assertEqual(500000.00, Customer.get_by_id(1).credit_limit)", "def test_update_customer_credit(_update_customer_credit):\n for customer in _update_customer...
[ "0.8305819", "0.80290574", "0.75516087", "0.7267804", "0.7253308", "0.7070037", "0.69136304", "0.6900081", "0.68455887", "0.6795171", "0.6761935", "0.67578834", "0.6740684", "0.6669304", "0.66241044", "0.65113044", "0.65072", "0.6483263", "0.6420876", "0.642009", "0.63513494"...
0.79188365
2
Recall metric. Only computes a batchwise average of recall. Computes the recall, a metric for multilabel classification of how many relevant items are selected.
def recall(y_true, y_pred): true_positives = backend.sum(backend.round(backend.clip(y_true * y_pred, 0, 1))) possible_positives = backend.sum(backend.round(backend.clip(y_true, 0, 1))) recall = true_positives / (possible_positives + backend.epsilon()) return recall
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recall(y_true, y_pred, average, labels):\n\n y_true, y_pred = check_metric_args(y_true, y_pred, average, labels)\n\n result = None\n\n m = len(y_true)\n n = len(labels)\n\n confusion_matrix = get_confusion_matrix(y_true, y_pred, labels).T\n\n if average == \"micro\":\n numerator = np.t...
[ "0.7605524", "0.74488467", "0.7404089", "0.7280915", "0.72097343", "0.7165874", "0.7157609", "0.7145226", "0.7145226", "0.7145226", "0.7145226", "0.7145226", "0.7145226", "0.71317255", "0.71007556", "0.70970625", "0.70970625", "0.70970625", "0.70970625", "0.70970625", "0.7097...
0.7064473
35
Precision metric. Only computes a batchwise average of precision. Computes the precision, a metric for multilabel classification of how many selected items are relevant.
def precision(y_true, y_pred): true_positives = backend.sum(backend.round(backend.clip(y_true * y_pred, 0, 1))) predicted_positives = backend.sum(backend.round(backend.clip(y_pred, 0, 1))) precision = true_positives / (predicted_positives + backend.epsilon()) return precision
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(self):\n self.overall_precision = precision_score(\n self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)\n self.classes_precision = precision_score(\n self.y_true, self.y_pred, average = None).round(self.digits_count_fp)", "def comp...
[ "0.7490099", "0.7288635", "0.7159222", "0.71532124", "0.7065768", "0.69861007", "0.6965821", "0.695451", "0.6912438", "0.68347067", "0.6817215", "0.68093604", "0.6804893", "0.6804893", "0.6804893", "0.6804893", "0.6804893", "0.6804893", "0.6785599", "0.6757522", "0.6757522", ...
0.666084
50
resize image into (target_width,target_height) target_width/target_height = ow/oh raise ValueError, if target_height<=0 or target_width<=0
def __scale_width_height(img, target_width=None, target_height=None, method=Image.BICUBIC): if target_height > 0 and target_width: raise ValueError( f"Expected target_width>0 and target_height>0, but got target_width={target_width}, target_height={target_height}") ow, oh = img.size if t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_image_scale(source_width, source_height, target_width, target_height):\n if source_width == target_width and source_height == target_height:\n return 1.0\n\n source_ratio = source_width / source_height\n target_ratio = target_width / target_height\n\n if target_ratio < source_ratio...
[ "0.69097227", "0.6889423", "0.68845344", "0.68554175", "0.65885615", "0.6567776", "0.656434", "0.65358025", "0.65114975", "0.6474362", "0.6377472", "0.6357848", "0.6300716", "0.6294298", "0.62883276", "0.6286805", "0.62836665", "0.62668663", "0.62576365", "0.6256997", "0.6242...
0.7334319
0
A collection of methods for retrieving or updating data about organizations in the Code42 environment.
def orgs(self): return self._sdk_dependencies.org_client
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def organizations(self):\n return self.get('{}/orgs'.format(ApiVersion.A1.value))", "def organizations(self):\n self.elements('organizations')", "def organizations(self):\r\n return organizations.Organizations(self)", "def test_retrieve_l_organizations(self):\n pass", "def test_get_...
[ "0.7770788", "0.7441841", "0.71230346", "0.70017755", "0.69816107", "0.6894589", "0.6852633", "0.68488604", "0.6838045", "0.67236596", "0.66748446", "0.66748446", "0.66183585", "0.65913135", "0.6523041", "0.65115166", "0.6468701", "0.64438", "0.6426665", "0.64244294", "0.6384...
0.5501677
81
The 'run' part of the course_id.
def course_run(self): return self.course_key.run
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_id(self) -> str:\n return self._step_execution_context.run_id", "def getRunId(self):\n return self.runid", "def run_id() -> int:\n return sg_covid_impact.config[\"flows\"][\"glass\"][\"run_id\"]", "def run_id(self):\n if self._run_id is not None:\n return self._run_...
[ "0.69273543", "0.6729144", "0.6449546", "0.63787335", "0.6318323", "0.6145828", "0.61315894", "0.6059584", "0.6059379", "0.5939561", "0.59369683", "0.5874441", "0.58349293", "0.58319956", "0.5768009", "0.5733007", "0.5631648", "0.5627364", "0.5596727", "0.55490065", "0.554147...
0.80205244
0
Accessor for a setting specific to the current course.
def _get_course_setting(self, setting): return settings.data['courses'][self.course_id][setting]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_setting(self, id):\n return __settings__.getSetting(id)", "def setting(setting_name):\n\n return getattr(settings, setting_name)", "def get_setting_value(self, title, setting):\r\n return self.parser.get(title, setting)", "def get_setting(self, setting):\n return self.do_rpc(\...
[ "0.65132785", "0.636397", "0.6298962", "0.6220281", "0.61941284", "0.60064334", "0.5998761", "0.59896207", "0.59571224", "0.5849541", "0.58394676", "0.5810019", "0.580563", "0.5740989", "0.5691655", "0.566663", "0.56624395", "0.5644879", "0.5626616", "0.5624554", "0.5621901",...
0.8053865
0
Assert that resolution is calculated correctly when using the xarray rasterio backend.
def test_calc_res(): with xr.open_rasterio(TEST_RASTER_PATH) as src: xr_res = ds.utils.calc_res(src) with rasterio.open(TEST_RASTER_PATH) as src: rio_res = src.res assert np.allclose(xr_res, rio_res)
{ "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 test_change_resolution(self):\n\n def test(grid, *desired_resolution):\n ...
[ "0.6372065", "0.6015322", "0.59938735", "0.59033257", "0.5852334", "0.58278245", "0.57994336", "0.5751685", "0.57348406", "0.5724172", "0.5697906", "0.56943977", "0.56537974", "0.5647166", "0.5645956", "0.56367785", "0.5599529", "0.55876565", "0.5581748", "0.5569151", "0.5512...
0.67046434
0
Assert that bounding boxes are calculated correctly when using the xarray rasterio backend.
def test_calc_bbox(): with xr.open_rasterio(TEST_RASTER_PATH) as src: xr_res = ds.utils.calc_res(src) xr_bounds = ds.utils.calc_bbox(src.x.values, src.y.values, xr_res) with rasterio.open(TEST_RASTER_PATH) as src: rio_bounds = src.bounds assert np.allclose(xr_bounds, rio_bounds, atol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_bounding_box(self):\n\n # Note there are two possible correct values of bbox depending on\n # the version of gdal:\n # http://trac.osgeo.org/gdal/wiki/rfc33_gtiff_pixelispoint\n\n # Get gdal version number\n x = gdal.VersionInfo('').replace('dev', '').split()\n ...
[ "0.69227684", "0.6805225", "0.6798895", "0.6790871", "0.6737685", "0.6674402", "0.66645247", "0.65982324", "0.6555925", "0.6520993", "0.6493282", "0.6447653", "0.6408337", "0.6389575", "0.6373378", "0.636101", "0.6274943", "0.6265265", "0.6229025", "0.62180036", "0.6209007", ...
0.7428076
0
Ensure that the padding values respect the supplied nan_value.
def test_raster_integer_nan_value_padding(): cvs = ds.Canvas(plot_height=3, plot_width=3, x_range=(0, 2), y_range=(0, 2)) array = np.array([[9999, 1, 2, 3], [4, 9999, 6, 7], [8, 9, 9999, 11]]) xr_array = xr.DataArray(array, coords={'x': np.linspace(0, 1, 4), 'y': np.linspace(0, 1, 3)}, dims=['y', 'x']) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(input_data):\n # source : https://stackoverflow.com/questions/6518811/interpolate-nan-values-in-a-numpy-array \n data = input_data.copy()\n bad_indexes = np.isnan(data)\n good_indexes = np.logical_not(bad_indexes)\n good_data = data[good_indexes]\n ...
[ "0.6362923", "0.6118399", "0.6104213", "0.60608983", "0.5984181", "0.5929942", "0.58872026", "0.5882277", "0.5866498", "0.5788626", "0.5778013", "0.57249594", "0.56639737", "0.5657834", "0.5648293", "0.5603864", "0.5603864", "0.5585006", "0.5581461", "0.5573491", "0.5542404",...
0.5690284
12
Ensure that the padding values respect the supplied nan_value.
def test_raster_float_nan_value_padding(): cvs = ds.Canvas(plot_height=3, plot_width=3, x_range=(0, 2), y_range=(0, 2)) array = np.array([[np.nan, 1., 2., 3.], [4., np.nan, 6., 7.], [8., 9., np.nan, 11.]]) xr_array = xr.DataArray(array, coords={'x': np.linspace(0, 1, 4), 'y': np.linspace(0, 1, 3)}, dims=['...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(input_data):\n # source : https://stackoverflow.com/questions/6518811/interpolate-nan-values-in-a-numpy-array \n data = input_data.copy()\n bad_indexes = np.isnan(data)\n good_indexes = np.logical_not(bad_indexes)\n good_data = data[good_indexes]\n ...
[ "0.6362923", "0.6118399", "0.6104213", "0.5984181", "0.5929942", "0.58872026", "0.5882277", "0.5866498", "0.5788626", "0.5778013", "0.57249594", "0.5690284", "0.56639737", "0.5657834", "0.5648293", "0.5603864", "0.5603864", "0.5585006", "0.5581461", "0.5573491", "0.5542404", ...
0.60608983
3
Center a Tkinter window
def center(window): window.update_idletasks() # Find the screen resolution screen_width = window.winfo_screenwidth() screen_height = window.winfo_screenheight() # Find new (x, y) coordinates size = tuple(int(_) for _ in window.geometry().split('+')[0].split('x')) x = screen_width/2 - 7 * s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center(win):\n win.update_idletasks()\n width = 1120\n frm_width = win.winfo_rootx() - win.winfo_x()\n win_width = width + 2 * frm_width\n height = 630\n titlebar_height = win.winfo_rooty() - win.winfo_y()\n win_height = height + titlebar_height + frm_width\n x = win.winfo_screenwidth()...
[ "0.8368151", "0.82453644", "0.80583024", "0.7998017", "0.79803646", "0.77359706", "0.7735821", "0.76757854", "0.7672477", "0.76220495", "0.75433594", "0.75433594", "0.7457788", "0.7398319", "0.73812884", "0.7374819", "0.7374819", "0.7361669", "0.73200536", "0.73154825", "0.73...
0.8301223
1
Reset the main window back to its normal form
def reset(): for frame in added_items_frames: frame.destroy() added_item_comboboxes.clear() added_item_quantity_spinboxes.clear() hour_end_spinbox.delete(0, END) hour_end_spinbox.insert(0, '1') hour_start_spinbox.delete(0, END) hour_start_spinbox.insert(0, '1') minute_end_spinbox...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def back_window(self):\n\n self.controller.set_new_model_running(False)\n self.controller.show_frame(\"MainWindow\")", "def reset(self, window, context):\n pass", "def reset(self, window):\n self.__close_preview(window)\n self.__clear_context()", "def clearScreen(self):\n ...
[ "0.7170496", "0.71491414", "0.71396357", "0.7086003", "0.70491433", "0.7047483", "0.69494206", "0.68865824", "0.6855393", "0.66847247", "0.6682493", "0.66793257", "0.65595937", "0.6546918", "0.65085506", "0.64938176", "0.6483989", "0.64576966", "0.64576966", "0.64576966", "0....
0.6070226
56
Returns the xst output directory location
def get_xst_dir(config, absolute = False): build_dir = utils.get_build_directory(config, absolute) xst_dir = os.path.join(build_dir, XST_DIR) return xst_dir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_dir(self):\n return os.path.join(self._sandbox, 'output' + os.path.sep)", "def outputdir():\n return __OUTPUT_DIR__", "def get_output_path():\n return os.getcwd() + \"/output/\"", "def create_xst_dir(config):\n #Create a output directory if it does not exist\n build_dir = utils....
[ "0.77528447", "0.75811684", "0.72909534", "0.7255375", "0.7193283", "0.71428543", "0.7055263", "0.70138097", "0.6954999", "0.6911982", "0.68772864", "0.6844121", "0.6839963", "0.68019074", "0.6775591", "0.675935", "0.6717077", "0.6663757", "0.66097856", "0.65427166", "0.65425...
0.7388661
2
A missing email display an appropriate message.
def test_no_email(self): user = self.make_user() data: dict = {} with self.login(user): response = self.post("referrals:create", data=data) message = list(get_messages(response.wsgi_request))[0] assert str(message) == "'missing email' is an invalid email address."
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_missing_email_address(self):\n addr = SpokeEmailAddress(self.org_name, self.user_id)\n email_addr = 'missing@' + self.email_dom\n result = addr.get(email_addr)['data']\n expected_result = []\n self.assertEqual(result, expected_result)", "def test_get_missing_email_...
[ "0.6928912", "0.6731997", "0.6649233", "0.64417475", "0.6429581", "0.62306696", "0.62065804", "0.61677516", "0.61022824", "0.60859764", "0.60510504", "0.6042622", "0.60390025", "0.6019587", "0.60085803", "0.60079044", "0.5975839", "0.5964878", "0.59508574", "0.59180194", "0.5...
0.6705873
2
Generates a new access key on behalf of the user and stores the new access key in secrets manager. Then, send a notification email to users to notify them to rotate the key for their applications. It returns a JSON with status 200 if successful and 500 if error occurs.
def create_key(iam_username): try: response = iam.create_access_key(UserName=iam_username) access_key = response["AccessKey"]["AccessKeyId"] secret_key = response["AccessKey"]["SecretAccessKey"] json_data = json.dumps({"AccessKey": access_key, "SecretKey": secret_key}) secre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def generate_new_refesh_key(payload: dict = Depends(get_jwt_payload)):\n if payload[\"type\"] != \"refresh\":\n raise HTTPException(\n status_code=status.HTTP_401_UNAUTHORIZED,\n detail=\"You gave the access key, but we need the refresh key\",\n headers={\"WWW-Authe...
[ "0.67813015", "0.6723537", "0.63754004", "0.62938106", "0.62400305", "0.6215626", "0.61407065", "0.60760754", "0.59956634", "0.5931377", "0.5928745", "0.58910877", "0.58691543", "0.58685136", "0.5854402", "0.5829179", "0.58209795", "0.58133996", "0.5811484", "0.5800694", "0.5...
0.72491354
0
Applies Link notes in the given DataFrame, adding the value of each linked transaction onto the one it targets The DataFrame needs to include both the original transactions and the ones linked to them. The values of the linked transactions will be set to 0 as they are added onto the target transaction
def apply_linked(self, df: pd.DataFrame) -> pd.DataFrame: link_notes = self.get_notes_by_type(note.Link) source_in_df = link_notes.apply(lambda n: n.id in df['id'].values) target_in_df = link_notes.apply(lambda n: n.target in df['id'].values) # assert (target_in_df & ~source_in_df).any(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join_target(self):\n df = self.get_all_data()\n target_df = self.get_target_df().copy(deep=True)\n target_df['ft_data_dt'] = target_df['ft_data_dt'].astype('datetime64[M]') - pd.DateOffset(months=2) + MonthEnd(1)\n df = df.merge(target_df, on=['idd', 'ft_data_dt'], how='left')\n ...
[ "0.57571226", "0.56453544", "0.55956817", "0.52005714", "0.5119747", "0.50915694", "0.5087886", "0.5079737", "0.50389576", "0.50111914", "0.49917713", "0.49096105", "0.48220557", "0.48141253", "0.47970462", "0.47765523", "0.4753686", "0.47471696", "0.47465235", "0.47281483", ...
0.83887
0
splits array into subarrays of manageable size
def subdivide(R, C, max_size = 36): def size(y1, x1, y2, x2): return (y2 - y1 + 1) * (x2 - x1 + 1) def helper(y1, x1, y2, x2): nonlocal max_size if size(y1, x1, y2, x2) <= max_size: return [(y1, x1, y2, x2)] # divide along horizontal ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_array(array, size):\n arrays = []\n while len(array) > size:\n pice = array[:size]\n arrays.append(pice)\n array = array[size:]\n arrays.append(array)\n return arrays", "def split_array(arr, num_of_splits):\n # TODO Replace this function with gluon.utils.split_data()...
[ "0.8016469", "0.79614633", "0.79138887", "0.7440732", "0.73997337", "0.7187824", "0.7152501", "0.714002", "0.713293", "0.7023754", "0.7019663", "0.6934593", "0.68764275", "0.6829127", "0.6773426", "0.674591", "0.6696536", "0.66604143", "0.66232187", "0.6603562", "0.65704185",...
0.0
-1
Get API_KEY that is set environment variant
def get_apikey(cls) -> str: dotenv_path = Path(__file__).absolute().parents[2] / '.env' if dotenv_path.exists(): load_dotenv(dotenv_path) try: apikey: str = os.environ["API_KEY"] except KeyError: print("API_KEY doesn't exist") raise...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_api_key():\n if not os.getenv(\"SPOON_API_KEY\"):\n raise RuntimeError(\"SPOON_API_KEY is not set\")\n return os.getenv(\"SPOON_API_KEY\")", "def get_api_key():\n try:\n return os.environ[\"GOOGLE_APPLICATION_CREDENTIALS\"]\n except Exception:\n raise EnvErro...
[ "0.8036626", "0.801071", "0.79444003", "0.7788649", "0.7664907", "0.7644209", "0.7598372", "0.7510571", "0.73695594", "0.7326174", "0.7326174", "0.73016196", "0.72453666", "0.7241101", "0.7237927", "0.7237927", "0.7237927", "0.7237927", "0.72267175", "0.71169055", "0.71147156...
0.8249006
0
Get your current location (from communication information, not GPS) Retrun
def get_current_locate(self) -> dict: geolocate: dict = self.gmaps.geolocate() return geolocate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLocation(self):\n send_url = 'https://ipinfo.io'\n r = requests.get(send_url)\n resp = json.loads(r.text)\n logging.info(\"GeoLoc: {}\".format(resp))\n return resp", "def get_location(self):\n # h = b'\\r\\nAT-MSGEO\\r\\r\\n-MSGEO: -3936,3464,-3612,7402d50c\\r\\n\\r\\...
[ "0.7818189", "0.7763614", "0.7342305", "0.7308877", "0.72012997", "0.7174754", "0.7170001", "0.7141341", "0.7062528", "0.7005175", "0.6923108", "0.69004935", "0.6854951", "0.6824511", "0.6766033", "0.67655355", "0.6760595", "0.67200446", "0.6687575", "0.6671531", "0.66587687"...
0.7245154
4
Returns the distances between all ndimensional vectors in X and ndimensional vector y.
def euclidean_dist(X, y): return np.sqrt(np.sum((X - y) ** 2, 1)) # broadcasted calculations
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euclidean_distances(X, Y):\r\n\r\n D = np.zeros((X.shape[0],Y.shape[0]))\r\n \r\n for X_idx in range(X.shape[0]):\r\n for Y_idx in range(Y.shape[0]): \r\n \r\n D[X_idx,Y_idx] = np.sqrt(np.sum((X[X_idx,:]-Y[Y_idx,:])**2))\r\n \r\n return D", "def _calc_distance(sel...
[ "0.74059653", "0.6929111", "0.6926564", "0.6815422", "0.68040687", "0.6800284", "0.67897314", "0.6781078", "0.67199755", "0.67070866", "0.67065346", "0.65892094", "0.65764457", "0.6501597", "0.64582014", "0.64434946", "0.64303213", "0.6429057", "0.63746005", "0.63658524", "0....
0.68727297
3
Test that viewlist does not show when not signed in
def testviewlist(self): rv = self.app.get('/viewcategory') self.assertEqual(rv.status_code, 302, "viewlist page should not load unless signed in")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_show_list_not_signed_in(self):\n with self.client as c:\n\n res = c.get(\"/lists/111111\")\n html = res.get_data(as_text=True)\n\n self.assertEqual(res.status_code, 200)\n self.assertIn(\"title1\", html)\n self.assertIn(\"tester1\", html)\n ...
[ "0.74585307", "0.7115753", "0.67430013", "0.6679924", "0.6672844", "0.66420466", "0.659895", "0.6596849", "0.65905243", "0.65247446", "0.6443451", "0.6420938", "0.64023024", "0.63713837", "0.6369523", "0.6331869", "0.632814", "0.632814", "0.632814", "0.632814", "0.6324371", ...
0.7162531
1
Perform a left AVL rotation on the node. Returns new root of the subtree.
def __rotate_left(self) -> "Node": lower = self.right # add left subtree of lower to upper (self) as right child and update links self.right = lower.left if self.right is not None: self.right.parent = self self.__update_all() # update lower and upper links ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __left_rotation(self, node: _AVLTreeNode) -> _AVLTreeNode:\n\n right_node = node.right\n\n if right_node.left is not None:\n right_node.left.parent = node\n\n node.right = right_node.left\n right_node.left = node\n\n right_node.parent = node.parent\n node.pa...
[ "0.823624", "0.812622", "0.80962366", "0.80546755", "0.7587448", "0.7493736", "0.74702257", "0.74329686", "0.741219", "0.7404897", "0.73054975", "0.72558427", "0.71970874", "0.7146071", "0.7045855", "0.7014996", "0.6885685", "0.6872428", "0.68049574", "0.68011016", "0.6787932...
0.76611906
4
Perform a right AVL rotation on the node. Returns new root of the subtree.
def __rotate_right(self) -> "Node": lower = self.left # add right subtree of lower to upper (self) as left child and update links self.left = lower.right if self.left is not None: self.left.parent = self self.__update_all() # update lower and upper links ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __right_rotation(self, node: _AVLTreeNode) -> _AVLTreeNode:\n \n left_node = node.left\n\n if left_node.right is not None:\n left_node.right.parent = node\n\n node.left = left_node.right\n left_node.right = node\n\n left_node.parent = node.parent\n no...
[ "0.81320274", "0.7924442", "0.77287066", "0.7605345", "0.74074155", "0.72882193", "0.7284075", "0.72831017", "0.72699213", "0.7263043", "0.7248768", "0.722771", "0.7189504", "0.7180443", "0.7096929", "0.70909923", "0.7081724", "0.7043513", "0.6995719", "0.6993479", "0.6941867...
0.72508013
10
Add left child, return new root. Raises an exception when such child exists.
def add_left(self, key: int) -> "Node": if self.left is None: if key >= self.key: raise ValueError("Key isn't less than parent's key") self.left = Node(key=key) self.left.parent = self else: raise ValueError("Left child exists") ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_left(self, p, e):\n node = self._validate(p)\n if node._left is not None:\n raise ValueError('Left child exists')\n self._size += 1\n node._left = self._Node(e, node) # node is its parent\n return self._make_position(node._left)", "def _add_left(self, p, e):\n ...
[ "0.8026997", "0.79748166", "0.7903746", "0.7896721", "0.7884345", "0.7800504", "0.74801576", "0.74304515", "0.740037", "0.7077946", "0.70299447", "0.69355273", "0.6933015", "0.68624973", "0.68349683", "0.6831818", "0.67962545", "0.6777617", "0.6777617", "0.6767131", "0.676518...
0.74754745
7
Add right child, return new root. Raises an exception when such child exists.
def add_right(self, key: int) -> "Node": if self.right is None: if key <= self.key: raise ValueError("Key isn't bigger than parent's key") self.right = Node(key=key) self.right.parent = self else: raise ValueError("Right child exists") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_right(self, p, e):\n node = self._validate(p)\n if node._right is not None:\n raise ValueError('Right child exists')\n self._size += 1\n node._right = self._Node(e, node) # node is its parent\n return self._make_position(node._right)", "def _add_right(self, p, e):\n ...
[ "0.74777585", "0.7392239", "0.7312011", "0.7263651", "0.722797", "0.7161967", "0.7052025", "0.70148784", "0.68271995", "0.6816213", "0.68017006", "0.6742966", "0.6742966", "0.6734805", "0.6597567", "0.6581646", "0.64369655", "0.6433921", "0.635994", "0.63588625", "0.6315375",...
0.69075346
8
Return element with minimal key in this subtree.
def min(self) -> "Node": current = self while current.left is not None: current = current.left return current
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min(self):\n if not self.root:\n return None\n\n node, parent = Treap._traverse(self.root, 'left')\n return node.key", "def get_min(self):\n if self.root is None: # BC1\n return float('+inf')\n\n current = self.root\n while current.left is not ...
[ "0.79236364", "0.7705381", "0.7569925", "0.7567042", "0.7528494", "0.73429924", "0.72934717", "0.7246371", "0.7239702", "0.70945776", "0.7030463", "0.7024217", "0.7019277", "0.6956292", "0.6930639", "0.69278634", "0.6922238", "0.6914457", "0.69040287", "0.68854064", "0.687283...
0.66461504
35
Return element with next key.
def successor(self) -> Union["Node", None]: if self.right is not None: # case 1: the node has a right child return self.right.min() else: # case 2: the node does not have a right child current = self while current.parent is not None: # traverse up ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __next__(self):\n\n nxt = next(self.tree)\n if nxt is not None:\n return nxt.key", "def next(self):\n self.iterator.next()\n return self.iterator.prevKey", "def __next__(self):\n if self._idx < len(self._rib):\n key_result = self._rib.get_key...
[ "0.74874026", "0.74018556", "0.68905276", "0.6866874", "0.67324036", "0.67118484", "0.6613288", "0.65915877", "0.658028", "0.6493138", "0.64679515", "0.6467849", "0.646503", "0.6458305", "0.6456633", "0.6425064", "0.6425064", "0.6424453", "0.64010406", "0.6393898", "0.6368315...
0.0
-1
Return the number of nodes in the tree.
def size(self) -> int: return self.root.size if not self.empty() else 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self):\n return self.__tree.node_count", "def node_count(self):\n return self._root.count()", "def count_nodes(self):\n if self.is_empty():\n return 0\n elif self.is_leaf():\n return 1\n else:\n if self.get_left():\n i...
[ "0.8657407", "0.86321473", "0.8440881", "0.8408121", "0.83953786", "0.83919847", "0.8296218", "0.8293678", "0.8292415", "0.8275337", "0.8275337", "0.8275212", "0.8231219", "0.8218265", "0.8179485", "0.81324744", "0.80809873", "0.80389524", "0.7983352", "0.796868", "0.79305387...
0.72755015
72
Dot product between two vectors. >>> dot_product([1,2,3], [4,5,6]) 32 >>> dot_product([1,2], [10, 30]) 70
def dot_product(row, column): return reduce(lambda x, y: x + y, [x * y for x, y in zip(row, column)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dotproduct(vec1, vec2):\n return sum((a*b) for a, b in zip(vec1, vec2))", "def vec_dot(x, y):\r\n return sum(a * b for a, b in zip(x, y))", "def dotProduct(v1, v2):\n return sum((a * b) for a, b in zip(v1, v2))", "def dotproduct(vec1, vec2):\n import operator\n return sum(map(operator.mul, v...
[ "0.8571262", "0.8506308", "0.84716433", "0.84622484", "0.8362988", "0.8359964", "0.83132523", "0.82927454", "0.8287948", "0.8285501", "0.82436854", "0.8237967", "0.8227244", "0.81958866", "0.8184732", "0.8119292", "0.80656284", "0.80418396", "0.801797", "0.7958846", "0.793099...
0.0
-1
Matrix equality. >>> m = Matrix(2,3, data=[1,2,3,4,5,6]) >>> n = Matrix(2,3, data=[1,2,3,4,5,6]) >>> m == n True >>> m = Matrix(2,3, data=[1,2,3,4,5,6]) >>> n = Matrix(3,2, data=[1,2,3,4,5,6]) >>> m == n False >>> m = Matrix(2,3, data=[1,2,3,4,5,6]) >>> n = Matrix(2,3, data=[1,5,3,4,2,1]) >>> m == n False
def __eq__(self, other): if not issubclass(type(other), Matrix): return False if self.rows != other.rows or self.columns != other.columns: return False return self.data == other.data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n if isinstance(other, Matrix):\n return self.data == other.data\n else:\n raise TypeError('other is not a Matrix')", "def __eq__(self, other):\n if not isinstance(other, Matrix):\n return NotImplemented\n\n if self.num_cols !=...
[ "0.77442706", "0.7616774", "0.7541274", "0.73873246", "0.7328286", "0.7172422", "0.7158907", "0.70418817", "0.69518113", "0.6880581", "0.6836746", "0.67580706", "0.6729691", "0.66712886", "0.66344106", "0.6621957", "0.65759283", "0.65587467", "0.65123016", "0.64831966", "0.64...
0.7703764
1
Apply the Gaussian Algorithm to produce a matrix in row echelon form. Returns the resulting matrix and a list of the elementary operations applied. >>> x = Matrix(4, 6, data = [0, 0, 0, 2, 1, 9, 0, 2, 6, 2, 0, 2, 0, 2, 6, 2, 2, 0, 0, 3, 9, 2, 2, 19]) >>> x.is_row_echelon() False >>> x.is_reduced_row_echelon() False >>>...
def to_reduced_row_echelon(self): return self._to_row_echelon(fully_reduce = True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rowReduce(self):\n myMatrix = Matrix(self.Matrix)\n print(\"This is the row reduced echelon form of your matrix: \\n\", myMatrix.rref())", "def to_reduced_echelon(self, return_ops=False):\n matrix, ops = reduce_to_red_echelon(self.data.copy(), True)\n if return_ops:\n r...
[ "0.6142419", "0.5927133", "0.5843437", "0.58102345", "0.5803057", "0.574778", "0.57285506", "0.56704384", "0.5545705", "0.5516162", "0.5460262", "0.54235905", "0.53553396", "0.52844626", "0.5037948", "0.50374824", "0.4956029", "0.49052173", "0.48710987", "0.48451102", "0.4820...
0.6018045
1
Apply the Gaussian Algorithm to produce a matrix in row echelon form. Returns the resulting matrix and a list of the elementary operations applied. >>> x = Matrix(4, 6, data = [0, 0, 0, 2, 1, 9, 0, 2, 6, 2, 0, 2, 0, 2, 6, 2, 2, 0, 0, 3, 9, 2, 2, 19]) >>> x.is_row_echelon() False >>> y, ops = x.to_row_echelon() >>> y.is...
def to_row_echelon(self): return self._to_row_echelon(fully_reduce = False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_echelon(self, return_ops=False):\n matrix, ops = reduce_to_echelon(self.data.copy(), True)\n if return_ops:\n return Matrix(matrix), ops\n else:\n return Matrix(matrix)", "def row_echelon(self):\n # TODO: This can be refactored for better efficiency\n ...
[ "0.5780302", "0.5641073", "0.56297666", "0.5594284", "0.5564156", "0.55236244", "0.5496969", "0.54073936", "0.53759384", "0.53267175", "0.53152555", "0.5219486", "0.52194047", "0.5208904", "0.514854", "0.5139676", "0.51020676", "0.50896704", "0.5068453", "0.5015525", "0.49995...
0.57338876
1
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): plt.imshow(cm, interpolation='nearest', cmap=cmap) plt.title(title) plt.colorbar() tick_marks = np.arange(len(classes)) ...
{ "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.81920755", "0.8093736", "0.8028212", "0.8017333", "0.79923165", "0.7989431", "0.79789335", "0.7974398", "0.795948", "0.79555666", "0.7935652", "0.7932704", "0.7932632", "0.7929465", "0.7924336", "0.7922666", "0.79221356", "0.7921299", "0.79209703", "0.7920307", "0.7916008"...
0.0
-1
In the constructor we instantiate two nn.Linear modules and assign them as member variables.
def __init__(self, D_in, H, D_out): super(TwoLayerNet, self).__init__() self.linear1 = torch.nn.Linear(D_in, H) self.linear2 = torch.nn.Linear(H, D_out)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args):\n super(LinearND, self).__init__()\n self.fc = nn.Linear(*args)", "def __init__(self, linear_args, activation_functions, softmax=False):\n super(NN, self).__init__()\n assert len(activation_functions) == len(linear_args) - 1\n k = len(linear_args)\n ...
[ "0.77401125", "0.75483596", "0.75074446", "0.74346", "0.7366003", "0.7335429", "0.73152226", "0.7286699", "0.7273464", "0.7268201", "0.72429734", "0.72211164", "0.72030157", "0.7167753", "0.7111596", "0.7077496", "0.7065618", "0.7063983", "0.7053454", "0.7018263", "0.70144415...
0.72729063
10
Sets the _from of this CampaignResults.
def _from(self, _from): self.__from = _from
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _from(self, _from):\n if _from is None:\n raise ValueError(\"Invalid value for `_from`, must not be `None`\") # noqa: E501\n\n self.__from = _from", "def set_from(self, a_from):\n if isinstance(a_from, (str, )):\n self.set_parameter('from', a_from)\n if isin...
[ "0.7719465", "0.7172963", "0.6993555", "0.6008711", "0.6008711", "0.5949448", "0.59235334", "0.5904632", "0.58908695", "0.58452606", "0.5829207", "0.5807383", "0.5807383", "0.5807383", "0.5803843", "0.5799895", "0.5795903", "0.5749504", "0.5740872", "0.5683139", "0.5594621", ...
0.69589686
5
Sets the last_page of this CampaignResults.
def last_page(self, last_page): self._last_page = last_page
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_last_page(self, page):\n self.last_page = page\n if self.get_page() > page:\n self.set_page(page)", "async def last_page(self):\n await self.show_page(self.maximum_pages)", "def set_max_per_page(self, max_per_page):\n if max_per_page > 0:\n self.max_per...
[ "0.7550727", "0.6282344", "0.61206865", "0.59512246", "0.5883743", "0.5856963", "0.58023655", "0.56850874", "0.566858", "0.56101155", "0.55056155", "0.5464263", "0.5453732", "0.5417057", "0.53806823", "0.535176", "0.52850085", "0.5262985", "0.5236791", "0.5229718", "0.5226469...
0.8125105
0
Sets the prev_page_url of this CampaignResults.
def prev_page_url(self, prev_page_url): self._prev_page_url = prev_page_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setPrev(self, prev):\n\t\t\tself.prev = prev", "def prev_page(self):\n if self._start == 0:\n raise ValueError('Already at the first page.')\n self._start = (self._start - self._num) if self._start > self._num else 0", "def prev(self, prev):\n\n self._prev = prev", "def pr...
[ "0.6999146", "0.6881566", "0.68198353", "0.65889996", "0.6501186", "0.6464601", "0.6144432", "0.6135618", "0.61000425", "0.60942054", "0.60596913", "0.59559035", "0.5934246", "0.59099567", "0.5888289", "0.5879898", "0.5819527", "0.5816416", "0.5723854", "0.5703113", "0.566889...
0.8607853
0
Sets the to of this CampaignResults.
def to(self, to): self._to = to
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def results(self, results):\n self._results = results", "def results(self, results):\n self._results = results", "def results(self, results):\n\n self._results = results", "def results(self, results):\n\n self._results = results", "def results(self, results):\n\n self._re...
[ "0.57430834", "0.57430834", "0.57361543", "0.57361543", "0.57361543", "0.57361543", "0.57361543", "0.5642243", "0.5534631", "0.5256359", "0.5178283", "0.5048085", "0.5048085", "0.50193495", "0.49595615", "0.4937751", "0.49203742", "0.49203742", "0.48180714", "0.48172152", "0....
0.5006281
14
Sets the total of this CampaignResults.
def total(self, total): self._total = total
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total(self, total):\n if self.local_vars_configuration.client_side_validation and total is None: # noqa: E501\n raise ValueError(\"Invalid value for `total`, must not be `None`\") # noqa: E501\n\n self._total = total", "def total_hits(self, total_hits):\n\n self._total_hits ...
[ "0.7075226", "0.67510086", "0.6703441", "0.66641736", "0.665505", "0.65984243", "0.6525502", "0.64461493", "0.6331838", "0.6308661", "0.6305285", "0.6245067", "0.6214662", "0.617007", "0.6129666", "0.60962206", "0.60649616", "0.60427755", "0.59653556", "0.5922873", "0.5907423...
0.749527
6
Sets the results of this CampaignResults.
def results(self, results): self._results = results
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def results(self, results):\n self._results = results", "def results(self, results):\n self._results = results", "def update_results(self, results):\n pass", "def addResults(self, results):\n if results is None or len(results) == 0:\n self._results = None\n else:...
[ "0.7884495", "0.7884495", "0.68379533", "0.66841173", "0.6682566", "0.6517576", "0.6409468", "0.6209654", "0.61726713", "0.6151921", "0.6151921", "0.61044806", "0.60944104", "0.6093786", "0.6015532", "0.6015532", "0.59821796", "0.59821796", "0.58353394", "0.5809639", "0.57756...
0.7906392
2
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, CampaignResults): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.84568954", "0.83923674", "0.81447554", "0.81407183", "0.81326675", "0.80941343", "0.8092415", "0.8092415", "0.8092415", "0.8085536", "0.8085536", "0.8076502", "0.8076502", "0.8066026" ]
0.0
-1
Given any number of dicts, shallow copy and merge into a new dict, same valued added to a same key
def merge_dicts(*dict_args): result = collections.defaultdict(list) for dictionary in dict_args: for k in dictionary.keys(): result[k].append(dictionary.get(k)) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _append_dicts(x, y):\n z = x.copy() # start with x's keys and values\n z.update(y) # modifies z with y's keys and values & returns None\n return z", "def _merge(old_dict, new_dict):\n dict3 = old_dict.copy()\n for k, v in new_dict.items():\n if k in dict3:\n dict3[k].app...
[ "0.73747516", "0.73708177", "0.7368447", "0.7322814", "0.7322814", "0.7322814", "0.7270092", "0.71929705", "0.7125913", "0.71019256", "0.7082811", "0.7041538", "0.70241237", "0.7020566", "0.7020566", "0.70176697", "0.7003488", "0.6998595", "0.69811296", "0.69748175", "0.69735...
0.6473379
97
test support for method references to 'new'.
def test_method_reference_to_the_new_method(self): self.assert_contains_method_reference_expression_in_m( parse.parse(setup_java_class("String::new;")))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __new__(*args, **kwargs): # real signature unknown\n pass", "def __new__(*args, **kwargs): # real signature unknown\n pass", "def __new__(*args, **kwargs): # real signature unknown\n pass", "def __new__(*args, **kwargs): # real signature unknown\n pass", "def __new__(*args, **kwargs): # rea...
[ "0.74459124", "0.74459124", "0.74459124", "0.74459124", "0.74459124", "0.74459124", "0.73973083", "0.73797446", "0.73705107", "0.73705107", "0.73705107", "0.73705107", "0.73705107", "0.73705107", "0.73705107", "0.73705107", "0.73705107", "0.73705107", "0.73705107", "0.73705107"...
0.7648247
0
Restores network parameters to last saved values
def restore(self): if os.path.isfile( \ os.path.join(self.network_path,'net_parameters.nnprm.index')): self.load_network_parameters( file_name='net_parameters', file_path=self.network_path) else: self.log("Could not load previous network parameters fro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore(self):\n pert_params = list(self.net.parameters())\n saved_params = list(self.saved_net.parameters())\n for perturbed, saved in zip(pert_params, saved_params):\n perturbed_shape = perturbed.shape\n saved_shape = saved.shape\n perturbed = perturbed.f...
[ "0.7624994", "0.7181976", "0.68304336", "0.67606837", "0.66665417", "0.6624656", "0.66192657", "0.660528", "0.65803695", "0.65579176", "0.65551466", "0.654185", "0.6491765", "0.6453688", "0.64398676", "0.6435174", "0.6413157", "0.640428", "0.6402615", "0.6373396", "0.6373396"...
0.79007125
0
return a full name neatly formatted
def get_formatted_name(first_name,last_name): full_name = f"{first_name} {last_name}" return full_name.title()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_name(self):\n\t\tself.full_name = self.first + \" \" + self.last", "def get_formatted_name(first, last):\n\tfull_name = first + ' ' + last\n\treturn full_name.title()", "def get_formatted_name(first_name, last_name): \r\n full_name = f\"{first_name} {last_name}\"\r\n return full_name.title()",...
[ "0.8597531", "0.8530935", "0.85293806", "0.85130614", "0.8495344", "0.8480073", "0.8445132", "0.840572", "0.840572", "0.840572", "0.8397775", "0.8366714", "0.83608186", "0.835093", "0.835093", "0.8342666", "0.8342666", "0.8342666", "0.83416414", "0.83273774", "0.83023435", ...
0.8451673
6
Return a friendly HTTP greeting.
def hello(): # proj_service = build('cloudresourcemanager','v1beta1',credentials=oauth2.credentials) # projects_raw=proj_service.projects().list().execute() # if projects_raw: # session['projects'] = [i['projectId'] for i in projects_raw['projects']] # else: # session['projects']='None' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_greeting(name):\n\n greeting = (f\"Hello, {name.title()}. It's nice to meet you!\")\n return greeting", "def welcome():\n return 'Welcome to Flask!'", "def greeting_message(name):\n print('My name is ' + name)", "def Welcome():\n return (\n f\"Welcome to the Surf's Up API!\...
[ "0.67860854", "0.6719625", "0.67095745", "0.6680697", "0.6663219", "0.6638394", "0.6633062", "0.6628187", "0.6556032", "0.6536937", "0.64776874", "0.6477268", "0.64715713", "0.64644194", "0.6443056", "0.6435385", "0.6400719", "0.6400167", "0.637615", "0.637615", "0.6367243", ...
0.0
-1
Return a custom 404 error.
def page_not_found(e): return "Hey Bozo. You don't belong here -- scramo.", 403
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_found():\n return HttpError(404)", "def error_404(error):\n return '404 Error'", "def error_404(error):\n return 'Bummer, there is nothing at this URL.'", "def error_not_found(error):\n return 'No page here, dood. 404!', 404", "def not_found(self, error):\n return jsonify({'error': 'NO...
[ "0.81159586", "0.80410045", "0.7738874", "0.77369535", "0.77182025", "0.7689595", "0.7670471", "0.76112473", "0.7602477", "0.7570698", "0.75528365", "0.7545827", "0.751882", "0.74745256", "0.7458403", "0.7455682", "0.74548143", "0.74505144", "0.7442062", "0.7428278", "0.74065...
0.0
-1