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
Generate a random string of fixed length
def random_string(stringLength=10): letters = string.ascii_lowercase return ''.join(random.choice(letters) for i in range(stringLength))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))", "def generate_random_string(length=6):\n n = int(length / 2 + 1)\n x = binascii.hexlify(os.urandom(n))\n s = x[:length]\n return s.decode(\"utf-8\")",...
[ "0.8680109", "0.85735995", "0.8548082", "0.8529234", "0.85206443", "0.84328127", "0.8431906", "0.8415246", "0.841121", "0.8389049", "0.834501", "0.8343673", "0.83401924", "0.83343834", "0.8323358", "0.8298169", "0.82930076", "0.82820994", "0.8281576", "0.8280769", "0.82640934...
0.79132503
58
Verify the strength of 'password', it returns a dict with bool values for each validation.
def validate_strength(cls, value: str) -> (bool, dict): if value is None: return False, {} length = cls._validate_length(value) digit = cls._validate_digit(value) uppercase = cls._validate_uppercase(value) lowercase = cls._validate_lowercase(value) symbol = c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_password_strength():\r\n\r\n password_regex = re.compile(r'''(\r\n (?=.*[A-Z]{2})\r\n (?=.*[a-z]{3})\r\n (?=.*[/!@#$%^&_*+'\\\"-?.:;<>,])\r\n (?=.*[0-9])\r\n .{8,}\r\n )''', re.VERBOSE)\r\n\r\n get_password(password_regex)", "def password_strength(self, p...
[ "0.7751414", "0.72897744", "0.71726286", "0.69200367", "0.6879134", "0.6842518", "0.6788766", "0.6758529", "0.6718119", "0.67168003", "0.66837317", "0.6647988", "0.6624782", "0.660013", "0.65981686", "0.657248", "0.65474033", "0.65354896", "0.65222746", "0.6503809", "0.649706...
0.7004434
3
Check if there are still unsatisfied citizen.
def _check_satisfied_neighborhood( recursive_counter: int, stop_recursive: int, matrix_size: int ) -> bool: return recursive_counter >= stop_recursive * (matrix_size ** 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_undergrad_student():\n return _is_member('uw_affiliation_undergraduate')", "def offrable(self) -> bool:\n if date.today() > self.cagnotte.fin_achat:\n return False\n return (\n self.beneficiaires == 0\n or self.offre_set.filter(valide=True).count() < self....
[ "0.61854696", "0.588399", "0.5817015", "0.5754213", "0.57140267", "0.5708466", "0.56987554", "0.5697764", "0.569608", "0.5693576", "0.5611918", "0.5601921", "0.5583808", "0.55653006", "0.554894", "0.55458665", "0.55427885", "0.5530968", "0.55282474", "0.55282474", "0.5522166"...
0.0
-1
Return a dictionarylike object representing the current object. This object will be used for indexing and be the basis for display in Holding Pen.
def get_record(cls, obj, **kwargs): if not isinstance(obj.data, dict): return {} return obj.data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict(self):\n return objToDict(self)", "def dict(self):\n return self.__dict__", "def dict(self):\n return self.__dict__", "def dict(self):\n return self.__dict__", "def dict(self):\n return self.__dict__", "def dict(self):\n return self.__dict__", "def dic...
[ "0.73100764", "0.71952856", "0.71952856", "0.71952856", "0.71952856", "0.71952856", "0.71952856", "0.71952856", "0.712926", "0.7105698", "0.69418806", "0.6914343", "0.68763024", "0.6867464", "0.68361914", "0.68361914", "0.6836171", "0.683177", "0.68266875", "0.6804005", "0.67...
0.0
-1
Computing the Sequence order correlation factor with gap equal to k based on [_Hydrophobicity,_hydrophilicity,_residuemass].
def _GetSequenceOrderCorrelationFactor(ProteinSequence,k=1): LengthSequence=len(ProteinSequence) res=[] for i in range(LengthSequence-k): AA1=ProteinSequence[i] AA2=ProteinSequence[i+k] res.append(_GetCorrelationFunction(AA1,AA2)) result=round(sum(res)/(LengthSequence-k),3) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetSequenceOrderCorrelationFactor(ProteinSequence,k=1,AAP=[]):\n\tLengthSequence=len(ProteinSequence)\n\tres=[]\n\tfor i in range(LengthSequence-k):\n\t\tAA1=ProteinSequence[i]\n\t\tAA2=ProteinSequence[i+k]\n\t\tres.append(GetCorrelationFunction(AA1,AA2,AAP))\n\tresult=round(sum(res)/(LengthSequence-k),3)\n\tr...
[ "0.66723317", "0.63414985", "0.6217762", "0.5925693", "0.58364135", "0.58204406", "0.5743175", "0.5741945", "0.55679214", "0.55297285", "0.5393148", "0.53828585", "0.5352503", "0.5330514", "0.53180665", "0.53135884", "0.5310405", "0.53099155", "0.5290392", "0.52890915", "0.52...
0.6904839
0
Computing the Sequence order correlation factor with gap equal to k based on the given properities.
def GetSequenceOrderCorrelationFactor(ProteinSequence,k=1,AAP=[]): LengthSequence=len(ProteinSequence) res=[] for i in range(LengthSequence-k): AA1=ProteinSequence[i] AA2=ProteinSequence[i+k] res.append(GetCorrelationFunction(AA1,AA2,AAP)) result=round(sum(res)/(LengthSequence-k),3) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _GetSequenceOrderCorrelationFactor(ProteinSequence,k=1):\n\tLengthSequence=len(ProteinSequence)\n\tres=[]\n\tfor i in range(LengthSequence-k):\n\t\tAA1=ProteinSequence[i]\n\t\tAA2=ProteinSequence[i+k]\n\t\tres.append(_GetCorrelationFunction(AA1,AA2))\n\tresult=round(sum(res)/(LengthSequence-k),3)\n\treturn res...
[ "0.7176653", "0.6305329", "0.62799937", "0.62064075", "0.6039708", "0.59811264", "0.59071517", "0.5756153", "0.57459986", "0.5705942", "0.555768", "0.55183375", "0.54975617", "0.5497164", "0.5481936", "0.54797035", "0.54542613", "0.5411427", "0.5399502", "0.5333935", "0.53292...
0.7087554
1
In the constructor we instantiate two nn.Linear module
def __init__(self): #initializing super(Model, self).__init__() self.linear = torch.nn.Linear(3, 1) # one input/feature , one output # here where other NN layers are added
{ "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, D_in, H, D_out):\n super(TwoLayerNet, self).__init__()\n self.linear1 = torch.nn.Linear(D_in, H)\n self.linear2 = torch.nn.Linear(H, D_out)", "def __init__(self, linear_args, ...
[ "0.8139916", "0.77856356", "0.7779488", "0.7631713", "0.75710815", "0.7567377", "0.75636655", "0.75636655", "0.75618804", "0.7533823", "0.74972975", "0.7468926", "0.7467439", "0.7427854", "0.74263495", "0.7364112", "0.73462653", "0.72788036", "0.72590977", "0.7220011", "0.721...
0.76740634
3
Adds a marker for an arrowhead of the given color. Returns the marker id, for referencing.
def add_arrowhead(self, color): def arrowhead_id(num): return 'Arrowhead_{num}'.format(num=num) if color in self.arrows: # Reuse old id num, element = self.arrows[color] return arrowhead_id(num) # Add new element num = len(sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMarkerArrow(point,k,n_s,r,g,b,orientation):\n marker = Marker()\n color = ColorRGBA(*[r,g,b,1])\n marker.header.frame_id = \"map\"\n marker.header.stamp = rospy.get_rostime()\n marker.ns = n_s\n marker.id = k\n marker.type = 0\n marker.action = 0\n marker.pose.position=point\n ...
[ "0.6046451", "0.5624229", "0.5553574", "0.5548975", "0.547109", "0.5470021", "0.5460243", "0.53969246", "0.5381032", "0.52889806", "0.52174366", "0.51709074", "0.51484716", "0.513086", "0.5116282", "0.5112678", "0.5084336", "0.507715", "0.506436", "0.5059475", "0.5053606", ...
0.84594554
0
Returns the id for the specified item in the element for linking.
def get_defs_id(self, item): prefix, item_list = self.class_map[item.__class__] return self._get_id(item, prefix, item_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetId(self,item):\r\n id = self.item_itemId.get(item)\r\n if id: return id\r\n #--Else get a new item id.\r\n id = self.nextItemId\r\n self.nextItemId += 1\r\n self.item_itemId[item] = id\r\n self.itemId_item[id] = item\r\n return id", "def get_item_id(...
[ "0.767711", "0.74765706", "0.72391164", "0.7171168", "0.71687895", "0.6505404", "0.6500405", "0.6411086", "0.6405727", "0.6401722", "0.6373272", "0.63238984", "0.62627655", "0.62550646", "0.62458533", "0.6240873", "0.619986", "0.6176382", "0.61674476", "0.6138595", "0.6117767...
0.6524173
5
Performs forward pass of the input. Here an input tensor x is transformed through several layer transformations.
def forward(self, x): ######################## # PUT YOUR CODE HERE # ####################### x = self.pool1(F.relu(self.batch1(self.conv1(x)))) x = self.pool2(F.relu(self.batch2(self.conv2(x)))) x = F.relu(self.batch3a(self.conv3a(x))) x = self.pool3(F.relu(self.batch3b(self.conv3b(x))))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, x_in):\r\n # x_out = torch.zeros_like(x_in)\r\n\r\n for layer in self.layers: #Call forward function of each layer in order\r\n x_out = layer.forward(x_in)\r\n # print(\"Forward pass Seq: \", layer, x_in, x_out)\r\n x_in = x_out ...
[ "0.80996656", "0.7858388", "0.7811728", "0.7800854", "0.77640367", "0.7756037", "0.7741265", "0.7733975", "0.7729323", "0.77009386", "0.76960677", "0.76770157", "0.76742554", "0.7636354", "0.7626165", "0.76097995", "0.75928205", "0.7578879", "0.7550606", "0.7541452", "0.75395...
0.71217
87
Get the next release date after the specified date.
def next_release_date(date): df = get_release_dates() df = df[df['ReleaseDate'] > date] return df['ReleaseDate'].iloc[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_day(date):\n return date + datetime.timedelta(days=1)", "def next_day(date):\n return date + datetime.timedelta(days=1)", "def _get_next_order_date(self, line, start_date):\n self.ensure_one()\n next_date = fields.Date.from_string(self.start_date)\n while next_date <= start_...
[ "0.6225876", "0.6225876", "0.6059941", "0.60121024", "0.5973104", "0.59006184", "0.58393246", "0.58019495", "0.5729679", "0.5728871", "0.57127327", "0.56751704", "0.55847514", "0.55514264", "0.55188847", "0.5503907", "0.5503907", "0.54138136", "0.5395574", "0.53882724", "0.53...
0.80470383
0
get input tensor for imagenet image.
def run_time_operation(self, learning_option, cluster): # whether or not test procedure is_train = tf.placeholder_with_default(True, shape=()) learning_option['is_train'] = is_train # get worker info: worker num, device type, device num device = self.get_attr('device') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tensor_from_input(input_data: Dict[str, Any]) -> torch.Tensor:\n return input_data['img']", "def input_tensor(interpreter):\n tensor_index = interpreter.get_input_details()[0]['index']\n return interpreter.tensor(tensor_index)()[0]", "def set_input_tensor(self, image):\n tensor_inde...
[ "0.76161873", "0.7187113", "0.710328", "0.7089255", "0.7043614", "0.70186675", "0.701356", "0.7009814", "0.69139683", "0.6880734", "0.6880734", "0.6880734", "0.68657374", "0.68575644", "0.6829788", "0.68223035", "0.6808632", "0.6804017", "0.67988455", "0.66829544", "0.6653437...
0.0
-1
calculate the fwhm using the weighted moments after subtracting the weights. This is using the corrected moments calcualtion, i.e., adaptiveMomentsNew
def wfwhm(img,sigma): nrow,ncol=img.shape Isum = img.sum() Icol = img.sum(axis=0) # sum over all rows Irow = img.sum(axis=1) # sum over all cols colgrid = np.arange(ncol) rowgrid = np.arange(nrow) rowmean=np.sum(rowgrid*Irow)/Isum colmean=np.sum(colgrid*Icol)/Isum ROW,COL=np.indices(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_weights_negative(self):\n eta = self.config.eta\n self.w_xh -= eta * (self.x.T @ self.h)\n self.w_th -= eta * (self.t.T @ self.h)\n self.w_ho -= eta * (self.h.T @ self.o) \n self.w_hz -= eta * (self.h.T @ self.z)", "def update_weights(self):\n activation, acti...
[ "0.63208264", "0.61153567", "0.6099415", "0.6097979", "0.6093694", "0.602628", "0.6017134", "0.59187704", "0.5916219", "0.5914839", "0.59034055", "0.586948", "0.58520234", "0.58288056", "0.58258337", "0.5816755", "0.5814543", "0.5791588", "0.57895136", "0.5770486", "0.5749237...
0.5664325
26
Returns a gaussian function with the given parameters
def gaussian(height, center_x, center_y, width_x, width_y): width_x = float(width_x) width_y = float(width_y) return lambda x,y: height*np.exp(-(((center_x-x)/width_x)**2+((center_y-y)/width_y)**2)/2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian(x, *parameters):\n position, sigma, amplitude, background = parameters\n return amplitude * np.exp(-(x - position)**2 / (2.0 * sigma**2)) + background", "def gaussian(pars, x):\n A, b, mu, sigma = pars\n # return b + A/(np.sqrt(2*np.pi)*sigma**2) \\\n return b + A \\\n * np.exp...
[ "0.79345214", "0.7810653", "0.7587596", "0.7489787", "0.74641114", "0.73853296", "0.73745215", "0.7267242", "0.7267242", "0.7267242", "0.7243077", "0.7221817", "0.71300167", "0.7127061", "0.7118297", "0.7089313", "0.70826656", "0.707121", "0.7059532", "0.7031942", "0.7013216"...
0.722654
11
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order.
def twoSum(self, nums: List[int], target: int) -> List[int]: idx1 = 0 idx2 = 1 while (idx1 != len(nums)-1 ): if nums[idx1 ] + nums[idx2] == target : return [idx1, idx2] else : if id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_indices(nums, target):\n indices = []\n i = 0\n number_found = False\n while not number_found:\n my_target = nums[i]\n \n for j in range(i+1,len(nums)):\n my_target += nums[j]\n if my_target == target:\n number_found = True\n ...
[ "0.8630695", "0.8182127", "0.8162885", "0.80111974", "0.7944022", "0.7935057", "0.78279835", "0.78206503", "0.78094244", "0.7787226", "0.7757027", "0.771273", "0.76847094", "0.7684215", "0.76660025", "0.7557399", "0.75416297", "0.74930805", "0.74487436", "0.73431396", "0.7157...
0.77603054
10
Match a pair of peaks finding the closest pair to the given peak.
def matchProfilePeakPair(pkp, cpp): #{ vrbMsg(5, 'matchProfilePeakPair() pkp = ' + str(pkp) + ', cpp = ' + str(cpp)) npp = [None, None] for i in range(0, len(pkp)): #{ if(npp[0] is None): #{ npp[0] = i elif(npp[1] is None): #}{ npp[1] = i else: #{ vrbMsg(5, 'matchProfilePeakPair() i ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_threshold_between_peaks(smoothed, peaks, valleys) :\n # For all pairs of consecutive : find the valley in between\n valleys = valleys\n tresholds = {}\n first_peak_width = peak_widths(smoothed, [peaks[0]])[0][0] # Get peak widths\n first_peak_boundary = int(peaks[0] - first_peak_width)\n ...
[ "0.6498853", "0.63938755", "0.6355522", "0.633105", "0.6326535", "0.6213206", "0.60979664", "0.5971294", "0.59164995", "0.59060395", "0.5828052", "0.5818148", "0.5811235", "0.58063465", "0.5797519", "0.5794616", "0.57837856", "0.57641995", "0.5762287", "0.5759651", "0.5757016...
0.65864044
0
Find the highest two peaks of the given peak array using the given data array to find heights. If there's only one peak then an array with a single element is returned.
def findHighestPkPair(x, pkp): #{ vrbMsg(5, 'findHighestPkPair() x = [...], pkp = ' + str(pkp)) mi = [0,0] mv = x[pkp[0]] for i in range(1, len(pkp)): #{ nv = x[pkp[i]] if(nv > mv): #{ mi[0] = i mv = nv #} #} mv = None for i in range(0, len(pkp)): #{ if(i != mi[0]): #{ nv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peak_finder(thresh=0):\n last = 0 # Track last input value\n ascent_dist = 0 # Distance from last trough.\n ascent_start = None # Last trough height\n\n def detect_peak(data):\n \"\"\" Returns initialized function to detect peaks on live streaming data.\n\n Args:\n ...
[ "0.67298156", "0.65883434", "0.65735245", "0.6532217", "0.64771575", "0.6442599", "0.6338763", "0.6291064", "0.62816346", "0.62811255", "0.62713933", "0.621686", "0.6140347", "0.61255026", "0.60881037", "0.60806245", "0.6076848", "0.6058716", "0.6035907", "0.60221833", "0.602...
0.0
-1
Write the snapshot to a json file
def write_snapshot(self): json.dump(self.snapshot, open(paths.RESULTS_FILE, 'w'), indent=4, sort_keys=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, _filepath=None):\n _json_txt = json.dumps(self.json_dict, indent=2)\n self._write_json_text(_json_txt, _filepath)", "def _write_json(self):\n with open(self._file_path, 'w') as f:\n json.dump(self._content, f, indent=4, separators=None,\n encod...
[ "0.71210146", "0.7116822", "0.6992444", "0.69922435", "0.69171214", "0.6893224", "0.6858178", "0.68446547", "0.6812594", "0.6786679", "0.67856723", "0.67670894", "0.67325157", "0.6728247", "0.67181236", "0.6718072", "0.6700473", "0.66957134", "0.6692032", "0.6673307", "0.6673...
0.8131296
0
The datetime of the snapshot
def date(self) -> datetime: return datetime.strptime(self.snapshot['snapshot_date'], fmt.DATETIME_TRACE_STRING)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_snapshot_time(self) -> float:\n return self._snapshot_time", "def datetime(self):\n return self._datetime", "def timestamp(self) -> datetime:\r\n return self._timestamp", "def creationTime(self):\n \n if not self.logMessage is None :\n return self.logMess...
[ "0.80289817", "0.72927463", "0.7262364", "0.72264564", "0.7212042", "0.71669275", "0.71669275", "0.71669275", "0.71669275", "0.71669275", "0.71669275", "0.71669275", "0.7073419", "0.706547", "0.703226", "0.70299935", "0.6921759", "0.69208944", "0.6912421", "0.6868416", "0.686...
0.7805405
1
Initialize an instance of `TimedRotatingFileMultiProcessHandler`.
def __init__( self, filename, when="h", interval=1, backupCount=1, encoding=None, delay=False, utc=False, atTime=None, ): BaseRotatingHandler.__init__( self, filename, "a", encoding=encodi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, filename, when='h', interval=1, backupCount=0, encoding=None, delay=0, utc=0, maxBytes=0):\n # super(self). #It's old style class, so super doesn't work.\n logging.handlers.TimedRotatingFileHandler.__init__(self, filename, when, interval, backupCount, encoding, delay, utc)\n ...
[ "0.6601591", "0.6342958", "0.6160443", "0.6159686", "0.6139009", "0.6116678", "0.610286", "0.6049039", "0.60294986", "0.6029079", "0.5909352", "0.58578527", "0.58043414", "0.577813", "0.56180096", "0.5605468", "0.5578902", "0.55782354", "0.5578085", "0.55463547", "0.5506078",...
0.5933228
10
Remove all handler classes associated with logger instance.
def clear_prev_handlers(logger: logging.Logger) -> logging.Logger: iter_count = 0 num_handlers = len(logger.handlers) while iter_count < num_handlers: logger.removeHandler(logger.handlers[0]) iter_count = iter_count + 1 return logger
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown_log(self, logger):\n for handler in logger.handlers[:]:\n logger.removeHandler(handler)\n handler.close()", "def destroy_loggers(self) -> \"Logger\":\n\n for logger, level in self.get_next_logger():\n logger.handlers.clear()\n\n delattr(self,...
[ "0.7806808", "0.7765762", "0.75868773", "0.7509207", "0.72949165", "0.724797", "0.72060496", "0.72060496", "0.6912715", "0.68012464", "0.67883325", "0.676798", "0.6683748", "0.66396844", "0.6590849", "0.6590849", "0.6564553", "0.6502085", "0.64056075", "0.6384132", "0.6316549...
0.69367945
8
Return a logger instance with provided name and handlers.
def get_logger_inst(profile: Profile, logger_name) -> logging.Logger: did_ident = get_did_ident(profile) if did_ident: logger_name = f"{logger_name}_{did_ident}" return get_logger_with_handlers( settings=profile.settings, logger=logging.getLogger(logger_name), did_ident=did_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logger(name=None):\r\n\r\n log = logging.getLogger(name or 'logging')\r\n if HANDLER and HANDLER not in log.handlers:\r\n log.addHandler(HANDLER)\r\n\r\n return log", "def get_logger(name: str):\n logger = logging.getLogger(name)\n\n for handler in HANDLERS:\n logger.addHandler(handler)\n\...
[ "0.8064633", "0.796527", "0.7889585", "0.78812015", "0.7859656", "0.7675515", "0.7672287", "0.76496005", "0.7605755", "0.7559575", "0.75446284", "0.7528496", "0.74821824", "0.74497724", "0.74374396", "0.7423376", "0.7410205", "0.73930985", "0.73730516", "0.7361987", "0.736051...
0.0
-1
Return existing Group object if attempting to create group again, otherwise, return None. This called by make_group to check for existing group if abort is False.
def get_existing_group(self, path, id, name): v_id = re.match( r'^<[^>]+>$', id) # True if variable_id (in < >) lookup_name = name if v_id else id full_path = path + "/" + lookup_name node = self.get_node(full_path, False) if node and node.sdef['type'] == 'group': # f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_or_create_group(fw, group_id, group_label):\n\n groups = fw.groups.find(f\"label={group_label}\")\n if len(groups) > 0:\n print(f\"Found group.\")\n group = groups[0]\n print(f\"group.label {group.label}\")\n print(f\"group.id {group.id}\")\n else:\n print(\"Grou...
[ "0.68316305", "0.6537566", "0.65202314", "0.64785564", "0.63845026", "0.6353458", "0.61686647", "0.6149164", "0.5914642", "0.58025444", "0.5799161", "0.5739207", "0.57284653", "0.56941646", "0.56538105", "0.5629973", "0.5627838", "0.5625129", "0.56092995", "0.55545074", "0.55...
0.6501413
3
Creates datasets that are in the top level of the definition structures.
def set_dataset(self, qid, value, name='', path='', attrs={}, dtype=None, compress=False): sdef = self.get_sdef(qid, self.default_ns, "referenced in set_dataset") id = sdef['id'] ns = sdef['ns'] path = self.deduce_path(id, ns, path) link_info = self.extract_link_info(value, None,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_datasets(self):\n self._build_datasets_sis3302()\n self._build_datasets_sis3305()", "def _make_data(self):\n pdf_datasets_all = make_pdf_datasets(self.pdf_list, self.xlims, self.ylims, self.tlims, self.dims, 9)\n self.pdf_dataset = np.concatenate(pdf_datasets_all, axis = 0)...
[ "0.71753", "0.6758871", "0.6476325", "0.6354536", "0.6340494", "0.63179827", "0.61980855", "0.6194608", "0.6184594", "0.61530596", "0.6150274", "0.6144916", "0.6132943", "0.6128501", "0.609702", "0.6085889", "0.60750157", "0.60683507", "0.60567683", "0.60361075", "0.60248095"...
0.0
-1
Creates custom datasets that are in the top level of the definition structures.
def set_custom_dataset(self, qid, value, name='', path='', attrs={}, dtype=None, compress=False): gslash = "" sdef, name, path = self.get_custom_node_info(qid, gslash, name, path) parent = None # no parent since this node created from File object (top level) ds = Dataset(self, sdef, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_datasets(self):\n self._build_datasets_sis3302()\n self._build_datasets_sis3305()", "def _make_data(self):\n pdf_datasets_all = make_pdf_datasets(self.pdf_list, self.xlims, self.ylims, self.tlims, self.dims, 9)\n self.pdf_dataset = np.concatenate(pdf_datasets_all, axis = 0)...
[ "0.70199937", "0.6713405", "0.6599078", "0.65954477", "0.65311027", "0.6511381", "0.64337796", "0.63653666", "0.63632274", "0.63256663", "0.6312197", "0.62917036", "0.62766665", "0.6234073", "0.6203544", "0.61704737", "0.61559606", "0.61267614", "0.6092704", "0.60841906", "0....
0.5598226
98
Creates custom dataset that is inside the current group.
def set_custom_dataset(self, qid, value, name='', path='', attrs={}, dtype=None, compress=False): gslash = "" parent = self sdef, name, path = self.file.get_custom_node_info(qid, gslash, name, path, parent) ds = Dataset(self.file, sdef, name, path, attrs, parent, value, dtype, compres...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dataset(\n self, name, shape=None, dtype=None, data=None, **kwds\n ) -> DatasetBase:\n ancestor, group_names, last_name = self._descend(name)\n parent = ancestor._require_descendant_groups(*group_names)\n if last_name in parent:\n raise FileExistsError(f\"Group ...
[ "0.7222829", "0.71107763", "0.70617056", "0.7027099", "0.69455737", "0.6885243", "0.6838691", "0.68385667", "0.67993647", "0.6648424", "0.6643633", "0.65917057", "0.6477257", "0.6421358", "0.6353232", "0.63458693", "0.63250566", "0.6315733", "0.6310179", "0.6304448", "0.62929...
0.6485886
12
Filters all bonds by the user making the request Filters all bonds by query parameters if parameter keys are Bond fields Returns matching bond data If parameters present, returns 404 is no matching bonds. If no parameters present, returns empty dict if empty
def get(self, request): bonds = Bond.objects.all().filter(user=request.user) query_fields = request.GET.dict() fields = ["isin", "size", "currency", "maturity", "lei", "legal_name"] # ignore anything that is not the name of a field parsed_query_fields = { x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_all_payments():\n parameters = request.args\n filters = {}\n for k, v in parameters.items():\n if v == \"null\":\n filters[k] = None\n else:\n filters[k] = v\n\n app.logger.info(filters)\n payments = pay_service.get_pays(filters)\n\n if payments is Non...
[ "0.56022626", "0.5425107", "0.53626007", "0.52892774", "0.527053", "0.526839", "0.5248593", "0.5231453", "0.51040035", "0.5091796", "0.5091035", "0.50827444", "0.50827444", "0.50685406", "0.50599575", "0.5039296", "0.50116724", "0.49734157", "0.494175", "0.4941095", "0.488539...
0.766457
0
Asks user to specify a city, month, and day to analyze.
def get_filters(): print('='*65) print('Hello! Welcome to explore some US bikeshare data!') print('='*65) # get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs city = '' while city not in CITY_DATA.keys(): print("\nPlease enter ci...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)", "def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f...
[ "0.66714007", "0.65354675", "0.64593667", "0.6374057", "0.6348314", "0.63097656", "0.62868035", "0.6259136", "0.62316", "0.62130964", "0.62050414", "0.6181105", "0.6171822", "0.61686903", "0.6158568", "0.61582303", "0.61532456", "0.61444426", "0.6131269", "0.610484", "0.61025...
0.0
-1
Loads data for the specified city and filters by month and day if applicable.
def load_data(city, month, day): # load data file into a dataframe print("\nLoading data...") df = pd.read_csv(CITY_DATA[city]) # convert the Start Time column to datetime df['Start Time'] = pd.to_datetime(df['Start Time']) # extract month and day of week from Start Time to create new columns ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ...
[ "0.8132329", "0.810954", "0.8046266", "0.80426", "0.8009689", "0.8007761", "0.79993975", "0.79987466", "0.79892075", "0.7979476", "0.79738855", "0.7961629", "0.7956602", "0.7947731", "0.7946376", "0.7908676", "0.7908202", "0.7905006", "0.79009944", "0.7893287", "0.788954", ...
0.76826835
66
Displays statistics on the most frequent times of travel.
def time_stats(df): print('\nCalculating The Most Frequent Times of Travel...\n') start_time = time.time() #Uses mode method to find the most popular month popular_month = df['month'].mode()[0] print(f"Most Popular Month: {popular_month}") #Uses mode method to find the most popular day p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\...
[ "0.80247396", "0.80233026", "0.7915788", "0.78266186", "0.7822246", "0.78143597", "0.77659196", "0.7740343", "0.773628", "0.77344066", "0.76867086", "0.7668633", "0.7651731", "0.7644636", "0.76399267", "0.76367253", "0.7625196", "0.7623158", "0.7612803", "0.76002145", "0.7583...
0.0
-1
Displays statistics on the most popular stations and trip.
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip...\n') start_time = time.time() # Display most commonly used start station common_start_station = df['Start Station'].mode()[0] print("The most commonly used start station: " + common_start_station) # Display most ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m...
[ "0.78161544", "0.7662448", "0.7554318", "0.7492408", "0.7475731", "0.7446882", "0.74294937", "0.7424055", "0.7418374", "0.74011225", "0.7387979", "0.7386244", "0.73660344", "0.7359882", "0.7357412", "0.73557985", "0.73528785", "0.7351991", "0.7351086", "0.73429525", "0.734115...
0.7055366
70
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print('\nCalculating Trip Duration...\n') start_time = time.time() # Display total travel time total_travel_time = df['Trip Duration'].sum() sum_seconds = total_travel_time%60 sum_minutes = total_travel_time//60%60 sum_hours = total_travel_time//3600%60 sum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri...
[ "0.814274", "0.8025143", "0.80041367", "0.79496753", "0.7937415", "0.79312176", "0.7926815", "0.7915187", "0.79142886", "0.7908032", "0.79055744", "0.7900715", "0.7891682", "0.78894734", "0.7886722", "0.78851086", "0.7884266", "0.7882474", "0.78738385", "0.78686154", "0.78664...
0.7592812
89
Center text in window
def draw_pos_text(self, text): fw, fh = self.font.size(text) # fw: font width, fh: font height surface = self.font.render(text, True, (0, 255, 0)) # // makes integer division in python3 self.screen.blit(surface, ((self.width - fw) // 2, (self.height - fh) // 2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def centerTextFor( player, text=\"\", fillchar= \" \" ):\n return centerTextAt( text, fillchar, getUserScreenWidth( player ) )", "def center(self, y, text):\n text_length = len(text)\n center = (self.width - text_length) // 2\n text_end = center + text_length\n\n self.addstr(y, 0, ...
[ "0.7553903", "0.7527678", "0.7218101", "0.7146386", "0.69435656", "0.6837374", "0.6837261", "0.6718087", "0.66151583", "0.6607014", "0.6506975", "0.64674836", "0.64431214", "0.63900375", "0.6383591", "0.6378387", "0.63660145", "0.6363939", "0.63526917", "0.63191307", "0.63125...
0.5897635
56
Represents class object as string
def __repr__(self) -> str: preprocessor_str = f", Preprocessors: {self._pre}" return f"{type(self).__name__} {self.name}{preprocessor_str}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self.__dict__['_obj'])", "def __str__(self):\n return str(self.serialize())", "def __str__(self):\n return bytes_to_str(bytes(self))", "def __str__(self):\n class_dictionary = vars(self)\n out = self.__class__.__name__\n for k,...
[ "0.7466275", "0.7432211", "0.73385006", "0.7317905", "0.7305523", "0.7301399", "0.729316", "0.729316", "0.72922206", "0.72675836", "0.72675836", "0.72675836", "0.7257248", "0.72537607", "0.72275704", "0.72234476", "0.7207766", "0.7164881", "0.7162244", "0.7147945", "0.7143823...
0.0
-1
create a random terminal.
def create_terminal(self): indicator = self.__get_indicator() class_func = self.__get_classifier_function(indicator) classifier_detail = self.__get_classifier_detail(class_func) # class function self.node_data['class_func'] = class_func # map_type map_type_box ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_terminal() -> str:\n ...", "def terminal_init(self):\n pass", "def generateToken():\n length = random.randint(8, 32)\n rdmtoken = ''.join(random.choice(string.printable) for i in range(length))\n return f'{rdmtoken}'", "def random_mac():\n return '\"02:%02x:%02x:%02x:%02x:%02...
[ "0.75150496", "0.61121124", "0.5970329", "0.5901266", "0.58902407", "0.58429337", "0.5820533", "0.5749236", "0.57468545", "0.5706513", "0.5706513", "0.5705067", "0.56881434", "0.5684133", "0.5651014", "0.5649813", "0.56403637", "0.5606259", "0.5601453", "0.5599223", "0.558174...
0.0
-1
Generalized hypergeometric function. Takes single number Y.
def hg1f2(Mu,Y): return float(mpmath.hyp1f2(0.5,2,Mu,-Y**2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def g(x, y=1):\r\n return x ** 2 + y", "def g(self, X):\n\n return (X[0])**2 - 2*X[0] + X[1]**3 - 2", "def N_gfun(self,y):\n return 0.0", "def _g(X, g, n):\n if n == 3:\n n = 3.001 # for numerical stability\n xi = 1 + X**2\n hyp2f1_term = hyp2f1((n - 3) / 2, ...
[ "0.67755723", "0.66119844", "0.64568377", "0.6415367", "0.6204927", "0.60219324", "0.5972794", "0.59348786", "0.5886093", "0.5851515", "0.5851515", "0.5851515", "0.5851515", "0.5851515", "0.5851515", "0.5851515", "0.5851515", "0.5848116", "0.58362454", "0.5836187", "0.5809885...
0.6072325
5
Generalized hypergeometric function. Takes single number Y.
def hg2f3(Mu,Y): return float(mpmath.hyp2f3(0.5,0.5,1.5,2,Mu,-Y**2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def g(x, y=1):\r\n return x ** 2 + y", "def g(self, X):\n\n return (X[0])**2 - 2*X[0] + X[1]**3 - 2", "def N_gfun(self,y):\n return 0.0", "def _g(X, g, n):\n if n == 3:\n n = 3.001 # for numerical stability\n xi = 1 + X**2\n hyp2f1_term = hyp2f1((n - 3) / 2, ...
[ "0.6775584", "0.66100556", "0.6455443", "0.641317", "0.6202254", "0.6073046", "0.60200685", "0.59724694", "0.5933537", "0.58853936", "0.5849113", "0.5849113", "0.5849113", "0.5849113", "0.5849113", "0.5849113", "0.5849113", "0.5849113", "0.5845815", "0.5835804", "0.5834042", ...
0.0
-1
Calculates the cumulative sum corresponding to the numerator in the effective impedance.
def numerator_cumsum(imag_Z_k,Mu,Phi_max,K,G_diag=[]): # Creates G_kk array, takes impedance model array Y = K*Phi_max/h if len(G_diag)==0: G_diag = make_G_diag(Mu,Y,Phi_max) return np.cumsum(G_diag*imag_Z_k/K)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_accumulation(self, i):\n\n #These are just pointer reassignments, not a deep-copy.\n dx = self.dx_arr\n phi = self.porosity\n area = self.res_area\n cf = self.compressibility\n Bw = self.form_volume_factor\n\n return area * dx[i] * phi[i] * cf / Bw", "...
[ "0.6521056", "0.60652244", "0.6030702", "0.602049", "0.60181916", "0.59105223", "0.58749765", "0.5865439", "0.5865439", "0.58218825", "0.5812497", "0.5800992", "0.5715025", "0.56922644", "0.5686658", "0.5683826", "0.56343246", "0.5623156", "0.5577043", "0.556161", "0.5555259"...
0.6236054
1
Return a base91encoded 64bit random number.
def _guid64(): return _base91(random.randint(0, 2**64 - 1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_encode_random(self):\n return os.urandom(16).encode('hex')", "def generate_random_num():\n return (long(hexlify(urandom(7)), 16) >> 3) * 2**(-53)", "def _get_random_number_code(self):\r\n return \"str(random.randint(0, 1e9))\"", "def _random_id():\n return binascii.hexlify(os.ura...
[ "0.7318336", "0.7177195", "0.7129253", "0.69938934", "0.6974165", "0.6960833", "0.6941115", "0.68997633", "0.68656003", "0.68268085", "0.67613316", "0.67203045", "0.67199326", "0.67170715", "0.6659063", "0.6641964", "0.6575221", "0.6559302", "0.6553977", "0.6543876", "0.65241...
0.7735211
0
close Xvfb and unset display
def close(self): if self.proc: self.proc.terminate() self.proc.wait() self.proc = None del os.environ['DISPLAY'] if self.fbdir: os.rmdir(self.fbdir) self.fbdir = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stopxvfb(display):\n\n pid_file = get_xvfb_pid_file(str(display))\n if os.path.isfile(pid_file):\n with open(pid_file) as f:\n pid = int(f.read())\n try:\n os.kill(pid, signal.SIGKILL)\n except OSError:\n logger.info(\"Killing Xvfb pro...
[ "0.8133817", "0.6844089", "0.6800276", "0.6792577", "0.6535036", "0.6491444", "0.6466293", "0.646196", "0.6456127", "0.64499944", "0.6325516", "0.6225968", "0.62171537", "0.61851263", "0.6168334", "0.61639917", "0.6146899", "0.60718477", "0.60464895", "0.6042559", "0.6015098"...
0.7686428
1
Test the endpoint using a single invalid fuel model code.
def test_invalid_model_code(self) -> None: model_code = 90 res = self.app.get('/model-parameters', query_string={"number": model_code}) self.assertEqual(400, res.status_code)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_on_invalid(self):\n assert self.route.on_invalid(str).route[\"on_invalid\"] == str", "def test_valid_non_burnable_model_code(self) -> None:\n model_code = 93\n\n res = self.app.get('/model-parameters', query_string={\"number\": model_code})\n self.assertEqual(200, res.status_...
[ "0.66517025", "0.66150695", "0.63913924", "0.6251", "0.62003434", "0.6097815", "0.6078881", "0.6070256", "0.6038605", "0.5969529", "0.5905369", "0.58359903", "0.58194214", "0.58009803", "0.57879364", "0.57827973", "0.5780395", "0.57760096", "0.5770939", "0.575842", "0.5751495...
0.672314
0
Initializes the Instrument object with instrument specific values.
def init(self): self.acknowledgements = mm_dst.acknowledgements(self.name, self.tag) self.references = mm_dst.references(self.name, self.tag) logger.info(self.acknowledgements) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, instrument, params=None):\n super(InstrumentsCandles, self).__init__(instrument)\n self.params = params", "def __init__(self, instrument):\n endpoint = self.ENDPOINT.format(instrument=instrument)\n super(Instruments, self).__init__(endpoint, method=self.METHOD)", ...
[ "0.7072694", "0.683425", "0.66058713", "0.6587701", "0.6561785", "0.65481573", "0.6502173", "0.6408842", "0.6372175", "0.63451165", "0.63079673", "0.6214997", "0.61947507", "0.61782736", "0.612449", "0.6124269", "0.61203", "0.61203", "0.61203", "0.61203", "0.6024823", "0.60...
0.0
-1
ensure user hash is computed properly when username and salt are provided
def test_user_hash_with_salt(self): self.assertEqual(get_user_hash("johndoe", salt="jane").hex()[:6], "fb0bf4")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_hash_without_salt(self):\n salt_bytes = \"my salt\".encode()\n salt_hex = salt_bytes.hex()\n with set_env(CSCI_SALT=salt_hex):\n expected = hash_str(\"johndoe\", salt=salt_bytes).hex()[:6]\n actual = get_user_hash(\"johndoe\").hex()[:6]\n self.ass...
[ "0.794849", "0.7850907", "0.71418643", "0.7022738", "0.6918304", "0.6887496", "0.6608217", "0.65235305", "0.6519808", "0.6491855", "0.64677423", "0.644417", "0.6433037", "0.63605005", "0.63307375", "0.6285642", "0.6268304", "0.62659574", "0.62278765", "0.62262195", "0.6221992...
0.8276335
0
ensure xlsx can be converted to equivalent parquet file
def test_convert_xlsx_to_parquet(self): # use temp dir where files will be created for testing purposes # the underlying context manager will remove the temp dir and all its content when it closes with TemporaryDirectory() as tmp: # define path to files fp_xlsx = os.path....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_to_parquet(data):\n table = pa.Table.from_pandas(data)\n pq.write_to_dataset(table\n , root_path=os.path.join(os.getcwd(),EXPORT_PATH['PARQUET_BASE_PATH'])\n , partition_cols=['YEAR', 'MONTH', 'DAY'])\n logger.info('Input file has been exported to P...
[ "0.57923603", "0.56611156", "0.5615949", "0.5574728", "0.5539074", "0.53090143", "0.5283849", "0.52837473", "0.52131104", "0.516167", "0.5159886", "0.511388", "0.501376", "0.50037116", "0.49545386", "0.49286398", "0.49168605", "0.49073845", "0.4868425", "0.48452184", "0.48348...
0.7982309
0
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 = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) possible_positives = K.sum(K.round(K.clip(y_true, 0, 1))) recall = true_positives / (possible_positives + K.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.7603752", "0.74474216", "0.7404044", "0.7280462", "0.7208341", "0.7164908", "0.7156751", "0.71443284", "0.71443284", "0.71443284", "0.71443284", "0.71443284", "0.71443284", "0.7130874", "0.71000224", "0.7064815", "0.7063801", "0.706193", "0.706193", "0.706193", "0.706193",...
0.70961666
25
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 = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1))) precision = true_positives / (predicted_positives + K.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.7489052", "0.7288358", "0.7159325", "0.715323", "0.7065856", "0.6984727", "0.6964892", "0.69536865", "0.6912471", "0.68334424", "0.68176156", "0.68093187", "0.6804945", "0.6804945", "0.6804945", "0.6804945", "0.6804945", "0.6804945", "0.67855513", "0.67575085", "0.67575085...
0.675501
36
Gets the reenlightenment of this V1FeatureHyperv. Reenlightenment enables the notifications on TSC frequency changes. Defaults to the machine type setting.
def reenlightenment(self): return self._reenlightenment
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reenlightenment(self, reenlightenment):\n\n self._reenlightenment = reenlightenment", "def getResistence(self):\n return self.resistence", "def get_refractory(self):\n #OnCondition in refractory regime\n rgs = self.dynamics.regimes\n if len(rgs)>2 :\n raise Not...
[ "0.6331732", "0.5573151", "0.5186156", "0.51836395", "0.51713693", "0.5159097", "0.5124675", "0.5082824", "0.503071", "0.5004799", "0.49859738", "0.49855286", "0.4984821", "0.49786246", "0.49492756", "0.49062055", "0.48743874", "0.48663318", "0.48621786", "0.48178154", "0.479...
0.72853327
0
Gets the relaxed of this V1FeatureHyperv. Relaxed instructs the guest OS to disable watchdog timeouts. Defaults to the machine type setting.
def relaxed(self): return self._relaxed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_relax(self):\n raise NotImplementedError", "def SetRelaxType(self, relax_type):\n return _hypre.HypreBoomerAMG_SetRelaxType(self, relax_type)", "def relaxed(self, relaxed):\n\n self._relaxed = relaxed", "def relaxed(self):\n return DataSpace(self.intervals.relaxed,\n ...
[ "0.531516", "0.5274408", "0.519029", "0.48198187", "0.47293106", "0.4628274", "0.45686516", "0.4505915", "0.44891393", "0.44744137", "0.44734573", "0.44420055", "0.44230515", "0.44023544", "0.43827695", "0.43522495", "0.4313463", "0.42981657", "0.42842147", "0.42805612", "0.4...
0.64048105
0
Gets the synic of this V1FeatureHyperv. SyNIC enables the Synthetic Interrupt Controller. Defaults to the machine type setting.
def synic(self): return self._synic
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def synic(self, synic):\n\n self._synic = synic", "def get_SIA(self):\n\n return self.get_POW().getSIA()", "def get_soc(self):\r\n return self.soc", "def get_soc(self):\r\n return self.soc", "def get_soc(self):\r\n return self.soc", "def taxii_client(self) -> 'outputs.T...
[ "0.5522967", "0.5520522", "0.5301288", "0.5301288", "0.5301288", "0.51466846", "0.50862235", "0.49869493", "0.49831885", "0.49732792", "0.490902", "0.48952278", "0.486568", "0.48067325", "0.48018718", "0.48018718", "0.47855973", "0.4768721", "0.4757872", "0.47576326", "0.4747...
0.6805765
0
Gets the vendorid of this V1FeatureHyperv. VendorID allows setting the hypervisor vendor id. Defaults to the machine type setting.
def vendorid(self): return self._vendorid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vendor_id(self):\n return self._device.vendor_id", "def VendorId(self):\n\t\treturn self._get_attribute('vendorId')", "def vendor_id(self):\n return self._vendor_id", "def vendor_name(self):\n return self._device.vendor", "def vendor(self):\n return self._vendor", "def ven...
[ "0.72872984", "0.72223085", "0.72048575", "0.63372964", "0.62036616", "0.6200088", "0.60839576", "0.59517473", "0.5845283", "0.5627844", "0.56028193", "0.555513", "0.5527823", "0.5402925", "0.5345044", "0.5313596", "0.52532035", "0.5209762", "0.5158594", "0.5075085", "0.50750...
0.73214126
0
Sets the vendorid of this V1FeatureHyperv. VendorID allows setting the hypervisor vendor id. Defaults to the machine type setting.
def vendorid(self, vendorid): self._vendorid = vendorid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vendor_id(self, vendor_id):\n\n self._vendor_id = vendor_id", "def vendorid(self):\n return self._vendorid", "def vendor_id(self):\n return self._device.vendor_id", "def vendor_id(self):\n return self._vendor_id", "def VendorId(self):\n\t\treturn self._get_attribute('vendorI...
[ "0.6998208", "0.6228858", "0.6034922", "0.5985965", "0.5744261", "0.5677064", "0.5166787", "0.50424606", "0.50373447", "0.49268553", "0.49205476", "0.48957193", "0.4864995", "0.48012534", "0.47753665", "0.4755299", "0.47174716", "0.46949118", "0.4660145", "0.4642222", "0.4620...
0.71766406
0
Gets the vpindex of this V1FeatureHyperv. VPIndex enables the Virtual Processor Index to help windows identifying virtual processors. Defaults to the machine type setting.
def vpindex(self): return self._vpindex
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vpindex(self, vpindex):\n\n self._vpindex = vpindex", "def get_index(self):\n\t\treturn call_sdk_function('PrlVmDev_GetIndex', self.handle)", "def get_vm_id(self):\n return self.instance_metadata.vm_id", "def compute_vp_type(self,vp_dict):\n try:\n self.vp\n except:...
[ "0.5735464", "0.5577601", "0.5223658", "0.5130698", "0.51095146", "0.51095146", "0.50719196", "0.50158507", "0.50046253", "0.49485913", "0.4948064", "0.49379313", "0.48534435", "0.4849699", "0.4844377", "0.4809694", "0.48002738", "0.47688687", "0.47621593", "0.4759171", "0.47...
0.73757464
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, V1FeatureHyperv): 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.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Classmethod to split a text in lines, dedenting each line. The first line's indentation will assume the minimal indentation.
def _str2lines(cls, text): lines = text.replace('\r', '').split('\n') lines[0] = lines[0].strip() # firts line is always detented if len(lines) > 1: # Get minimal indentation min_indent = 99999 for line in lines[1:]: if line.strip(): # don't ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dedent_lines(lines):\r\n return textwrap.dedent(\"\\n\".join(lines)).split(\"\\n\")", "def dedent_lines(lines):\r\n return textwrap.dedent(\"\\n\".join(lines)).split(\"\\n\")", "def dedent(ind, text):\n text2 = textwrap.dedent(text)\n if ind == 0:\n return text2\n indent_str = \" \" *...
[ "0.7196601", "0.7196601", "0.6648475", "0.6635401", "0.6604039", "0.6515233", "0.6513716", "0.6510151", "0.64039856", "0.6343846", "0.6276922", "0.6266327", "0.6220026", "0.6220002", "0.6197581", "0.6142496", "0.60867405", "0.6041391", "0.60284585", "0.60178745", "0.59758747"...
0.6305919
10
This method returns the number of errors found in the text as an integer.
def num_of_errors(text): tool = language_check.LanguageTool('en-US') matches = tool.check(text) errors = len(matches) return errors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_count(self):\n return len(self.errors)", "def get_error_count(self):\n return sum(1 for outcome in (r.outcome for r in self.values()) if outcome == Result.ERROR)", "def error_count():\n return cpp_style.error_count()", "def count(text):\n return len(text)", "def getNumErrors(s...
[ "0.71852493", "0.7096495", "0.7029913", "0.695737", "0.6810537", "0.6695893", "0.6690581", "0.6543401", "0.6522003", "0.6516004", "0.6453632", "0.6443726", "0.6431881", "0.6367306", "0.63444823", "0.6342631", "0.63260293", "0.632063", "0.6314511", "0.6283959", "0.627962", "...
0.85402757
0
Draw the predicted bboxes on the image.
def draw( self, box_thickness: int = 2, show_confidence: bool = True, color_mapping: Optional[List[Tuple[int, int, int]]] = None, target_bboxes: Optional[np.ndarray] = None, target_bboxes_format: Optional[str] = None, target_class_ids: Optional[np.ndarray] = None,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_bboxes(img, bboxes):\n colors = tf.cast(np.array([[1, 0, 0, 1]] * 10), dtype=tf.float32)\n img_with_bounding_boxes = tf.image.draw_bounding_boxes(\n img,\n bboxes,\n colors\n )\n plt.figure()\n plt.imshow(img_with_bounding_boxes[0])\n plt.show()", "def draw_boxes(i...
[ "0.7137106", "0.7091386", "0.70722735", "0.696793", "0.68840086", "0.6769863", "0.6738212", "0.6635572", "0.6609746", "0.66005665", "0.66005665", "0.6543462", "0.651859", "0.6503847", "0.64442974", "0.64430517", "0.6434237", "0.64227736", "0.63995385", "0.6398618", "0.6358266...
0.65582645
11
Display the image with predicted bboxes.
def show( self, box_thickness: int = 2, show_confidence: bool = True, color_mapping: Optional[List[Tuple[int, int, int]]] = None, target_bboxes: Optional[np.ndarray] = None, target_bboxes_format: Optional[str] = None, target_class_ids: Optional[np.ndarray] = None,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imshow_det_bboxes(img,\r\n bboxes,\r\n labels,\r\n class_names=None,\r\n score_thr=0,\r\n palette=dict(palette='pastel', n_colors=7),\r\n thickness=2,\r\n font_scal...
[ "0.69055545", "0.6734033", "0.66350925", "0.6632307", "0.65656596", "0.6525384", "0.65141684", "0.6502548", "0.6501881", "0.64863276", "0.6484104", "0.64157456", "0.6411611", "0.64089", "0.6379617", "0.6367348", "0.6336504", "0.63218606", "0.6318291", "0.6312332", "0.6309493"...
0.0
-1
Display the predicted bboxes on the images.
def show( self, box_thickness: int = 2, show_confidence: bool = True, color_mapping: Optional[List[Tuple[int, int, int]]] = None, target_bboxes: Optional[Union[np.ndarray, List[np.ndarray]]] = None, target_bboxes_format: Optional[str] = None, target_class_ids: Opt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_precomputed_boxes(self, sample_index, all_boxes):\n image_rois = [class_detections[sample_index]\n for class_detections in all_boxes]\n\n image_rois_list = []\n image_classes = []\n for class_index, class_rois in enumerate(image_rois):\n if len(cl...
[ "0.71750885", "0.6976453", "0.69511974", "0.6930892", "0.67837745", "0.6740159", "0.65995085", "0.6599508", "0.6576295", "0.6518547", "0.6480254", "0.64271563", "0.641723", "0.63795143", "0.6360181", "0.63593954", "0.63567436", "0.63567436", "0.6340284", "0.6334845", "0.63305...
0.6228126
31
Display the predicted bboxes on the images.
def show(self, box_thickness: int = 2, show_confidence: bool = True, color_mapping: Optional[List[Tuple[int, int, int]]] = None) -> None: frames = self.draw(box_thickness=box_thickness, show_confidence=show_confidence, color_mapping=color_mapping) show_video_from_frames(window_name="Detection", frames=f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_precomputed_boxes(self, sample_index, all_boxes):\n image_rois = [class_detections[sample_index]\n for class_detections in all_boxes]\n\n image_rois_list = []\n image_classes = []\n for class_index, class_rois in enumerate(image_rois):\n if len(cl...
[ "0.71750885", "0.6976453", "0.69511974", "0.6930892", "0.67837745", "0.6740159", "0.65995085", "0.6599508", "0.6576295", "0.6518547", "0.6480254", "0.64271563", "0.641723", "0.63795143", "0.6360181", "0.63593954", "0.63567436", "0.63567436", "0.6340284", "0.6334845", "0.63305...
0.0
-1
Evaluate the monomial at the given x.
def eval(self, x): return ( float(self.coeff.nominator) / self.coeff.denominator ) * ( x ** self.expt )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, x):\n return self.function(x)", "def easy_eval(self, x):\n answer = 0\n for i in range(len(self.coefficients)):\n coef = self.coefficients[i]\n degree = len(self.coefficients) - (i+1)\n answer += x ** degree * coef\n return answer", ...
[ "0.69017", "0.683866", "0.66531193", "0.65180665", "0.6436025", "0.63469833", "0.62847173", "0.62830156", "0.62828505", "0.6231691", "0.622047", "0.6218473", "0.61844957", "0.6179753", "0.6146588", "0.61278087", "0.6113633", "0.6113633", "0.6091025", "0.6080851", "0.6063314",...
0.6602863
3
Return an instance of C{RatTerm} that is not a number.
def nan(klass): return RatTerm(RatNum(1, 0), 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anti_differentiate(self):\n if not self.is_nan() :\n return RatTerm(RatNum(self.coeff.nominator,self.expt + 1), self.expt + 1)\n else :\n return RatTerm(RatNum(1, 0), 0)", "def differentiate(self): \n if not self.is_nan() :\n return RatTerm(RatNum(...
[ "0.6520449", "0.6229459", "0.58964807", "0.57946444", "0.56415623", "0.52716315", "0.5229271", "0.51568973", "0.51406", "0.51146185", "0.5110705", "0.509362", "0.50862724", "0.50773746", "0.5041857", "0.5023939", "0.5006816", "0.49502265", "0.49225837", "0.49216247", "0.49093...
0.71437806
0
Return a string representation of C{self}. The string does not show the exponentiation sign and the exponent if the exponent is 1. The string does not show the variable x if the exponent is 0. The string does not show the coefficient if the exponent is at least one, and the coefficient is 1 or 1. Return C{'x'} if the c...
def __str__(self): # special cases if self.is_nan() : return "nan" elif self.coeff == 1 : if self.expt == 1 : return "x" else : return "x^" + str(self.expt) elif self.coeff == -1 : if self.expt == 1 : ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n lstr = \"\"\n\n # String for x term\n if self.a != 0:\n if self.a == 1:\n lstr += \"x\"\n elif self.a == -1:\n lstr += \"-x\"\n else:\n lstr += str(self.a) + \"x\"\n\n # String for y term\...
[ "0.68861824", "0.65985554", "0.6597934", "0.63704205", "0.62533313", "0.61133724", "0.6096888", "0.6096888", "0.6064961", "0.6048182", "0.60457045", "0.5957843", "0.5943419", "0.59413064", "0.5940749", "0.5915396", "0.58793414", "0.5856061", "0.58390486", "0.58329195", "0.582...
0.7608902
0
Return the derivative of C{self}. Recall that the derivative of Cx^E is (CE)x^(E1).
def differentiate(self): if not self.is_nan() : return RatTerm(RatNum(self.coeff * self.expt), (self.expt - 1)) else : return RatTerm(RatNum(1, 0), 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def derivative ( self ):\n return self.__derivative", "def derivative(self, x):\n z = np.asarray(x)\n return (self._der(z.flatten())).reshape(z.shape)", "def GetDerivative(self, *args):\n return _ITKCostFunctionsPython.itkSingleValuedCostFunction_GetDerivative(self, *args)", "def ...
[ "0.798556", "0.7172322", "0.71463245", "0.70400095", "0.70400095", "0.70180726", "0.6873718", "0.6873164", "0.68342084", "0.67876357", "0.67413586", "0.67211455", "0.6719655", "0.66800624", "0.65567577", "0.65283746", "0.6464841", "0.6454227", "0.6448908", "0.644541", "0.6421...
0.0
-1
Return an antiderivative of C{self} with constant 0. Recall that the antiderivative of Cx^E is C/(E+1)x^(E+1) + c, where c is a constant. Here, we use c = 0 in our output.
def anti_differentiate(self): if not self.is_nan() : return RatTerm(RatNum(self.coeff.nominator,self.expt + 1), self.expt + 1) else : return RatTerm(RatNum(1, 0), 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def P0(self):\n if not self.isVaild():\n pass\n temp = ((self.r()**self.C)*self.C) / \\\n (math.factorial(self.C)*(self.C - self.r()))\n temp2 = 0\n for i in range(0, self.C):\n temp3 = ((self.r())**i)/(math.factorial(i))\n temp2 += temp3\n ...
[ "0.63135594", "0.6312132", "0.61153996", "0.60956854", "0.60854816", "0.60850966", "0.6016444", "0.59452784", "0.58691764", "0.5829732", "0.5821452", "0.5807988", "0.57987607", "0.57979214", "0.5787101", "0.57824004", "0.57503825", "0.5738008", "0.5725073", "0.57134944", "0.5...
0.596641
7
lowers and tokenizes the text
def tokenize(text): text = re.sub(r'[^0-9A-Za-z]'," ", text).lower() text = word_tokenize(text) return [w for w in text if not w in stop_words]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(self,text):\n return preprocess.get_tokens(text)", "def tokenize(text):\n return text.split(' ')", "def tokenize(self, raw_text):\n # TODO implement\n raw_tokens = word_tokenize(raw_text.decode('utf8'))\n return self.filter_tokens(raw_tokens)\n # return self.sp...
[ "0.7310186", "0.72696817", "0.7203043", "0.71674526", "0.71115327", "0.7075756", "0.7032391", "0.7026018", "0.702469", "0.7015998", "0.69903976", "0.6960207", "0.6955004", "0.6948873", "0.69483274", "0.69399625", "0.69053656", "0.6900585", "0.68660504", "0.6859073", "0.684425...
0.0
-1
Puts the current key in the set of keys that are being held. You will need to add things here to handle firing the bullet.
def on_key_press(self, key: int, modifiers: int): if self.ship.alive: self.held_keys.add(key) if key == arcade.key.SPACE: bullet = Bullet(self.ship.angle, self.ship.center.x, self.ship.center.y) self.bullets_list.append(bullet)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_key_press(self, key: int, modifiers: int):\r\n if self.ship.alive:\r\n self.held_keys.add(key)\r\n\r\n if key == arcade.key.SPACE:\r\n # TODO: Fire the bullet here!\r\n bullet = Bullet()\r\n bullet.fire(self.ship.angle, self.ship.cent...
[ "0.7319679", "0.7188515", "0.6539089", "0.64814323", "0.64714617", "0.6459628", "0.6402467", "0.6364523", "0.63237983", "0.63204134", "0.6292222", "0.6282333", "0.6253547", "0.6253313", "0.6220077", "0.6220077", "0.6202135", "0.61860055", "0.61712396", "0.6153901", "0.6150968...
0.73014104
1
Return the operator precedence and associativity.
def _op_precedence(op): for i, level in enumerate(Parser._PRECEDENCE): if op.type in level: return i, level[op.type] raise KeyError("Invalid operator '{o}' given.".format(o=op))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precedence(ob):\n return 0", "def precedence(self):\n if self.main_type == \"*\":\n return 0\n elif self.sub_type == \"*\":\n return 1\n return 2", "def getPrecedence(self):\n return _libsbml.ASTNode_getPrecedence(self)", "def precedence_level(): #was ...
[ "0.7508043", "0.720637", "0.71631557", "0.71291775", "0.66582495", "0.6545928", "0.63809067", "0.63598037", "0.6301827", "0.6282553", "0.61018395", "0.59623", "0.59190565", "0.5911454", "0.58929086", "0.58908355", "0.583759", "0.5799164", "0.5786442", "0.5786442", "0.56721115...
0.6843005
4
Sets the original_price of this MarketingPrice.
def original_price(self, original_price): self._original_price = original_price
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_price(self, _price):\n self.price = _price\n return self.price", "def original(self, original):\n self._original = original", "def setOriginal(self,neworiginal):\n\t\tself.original = neworiginal;", "def desired_price(self, new_desired_price):\n self._desired_price = new_de...
[ "0.67917114", "0.6708901", "0.66216874", "0.65787697", "0.6525168", "0.6525168", "0.6525168", "0.6525168", "0.64214486", "0.6361411", "0.6342494", "0.62943363", "0.6291626", "0.6107449", "0.6071715", "0.6062865", "0.60417324", "0.59713966", "0.59512055", "0.5894369", "0.58198...
0.8768599
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, MarketingPrice): 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.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Euclidean distance between two ball
def ball_dist(b1, b2): return math.sqrt((b1.x - b2.x) ** 2 + (b1.y - b2.y) ** 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(a, b):\n return math.sqrt((a.x - b.x) ** 2 + (a.y - b.y) ** 2)", "def _get_distance(a, b):\n return np.sqrt(np.sum((a - b) ** 2))", "def distance(a: Point, b: Point) -> float:\n return math.sqrt(math.pow(b.x - a.x, 2) + math.pow(b.y - a.y, 2))", "def euclidean_distance(a, b):\n r...
[ "0.7617008", "0.7564663", "0.7489006", "0.7406913", "0.7304784", "0.730319", "0.7300716", "0.7297735", "0.7278243", "0.7274614", "0.72452736", "0.72404766", "0.7220719", "0.7211768", "0.7210963", "0.7181406", "0.7164514", "0.7162757", "0.7140162", "0.7136581", "0.7119001", ...
0.8467631
0
Check if upstream source format can be used as orig tarball. This doesn't imply that the tarball is correctly named.
def _check_orig(self): if self.is_dir(): self._orig = False return parts = self._path.split('.') try: if parts[-1] == 'tgz': self._orig = True elif parts[-2] == 'tar': if (parts[-1] in Compressor.Opts or ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_always_unsatisfied(self):\n # If this is a github sha tarball, then it is always unsatisfied\n # because the url has a commit sha in it and not the version\n # number.\n url = self._req.url\n if url:\n filename = filename_from_url(url)\n if filename....
[ "0.62504303", "0.61191434", "0.6041274", "0.59462345", "0.5805408", "0.5720305", "0.56694484", "0.56564033", "0.55889016", "0.5582319", "0.5564186", "0.55640954", "0.5551566", "0.5535655", "0.5502571", "0.5502571", "0.5502571", "0.5502571", "0.54853874", "0.5446451", "0.54103...
0.72991437
0
This ridiculous function returns chunks of n from a linear list. For example, _repack([1, 2, 3, 4, 5, 6], n=3) > [[1, 2, 3], [4, 5, 6]] Good for unravelling ravelled data
def _repack(linear, n=3): return list(zip(*[iter(linear)] * n))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_chunks(l, n):\n return [l[i:i+n] for i in range(0, len(l), n)]", "def get_chunks(lst, n):\n size = int(len(lst) / n)\n output_list = []\n for i in range(0, n):\n sub_list = lst[i*size:i*size + size]\n output_list.append(sub_list)\n if len(lst) % n != 0:\n for i in ran...
[ "0.8134014", "0.8053528", "0.8038739", "0.80329925", "0.7915785", "0.79061455", "0.7875721", "0.7843239", "0.7809871", "0.7805171", "0.7798798", "0.77902186", "0.7774", "0.7766289", "0.774363", "0.774363", "0.77299696", "0.77299696", "0.77299696", "0.77299696", "0.77299696", ...
0.7805597
9
Initialize instance of the network groups dictionary of (node address, group object)
def __init__(self, groups=dict()): self.groups = groups
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\r\n self._empty = EmptyNetworkGroup()\r\n self._groups = {}\r\n self._uid = set()\r\n self._machines = set()\r\n self._iaas = None", "def _initGroups(self):\n defaults = self._getGroupDefaults()\n ddict = self._getDefaultGroupDict(defaults)\n\n...
[ "0.72520036", "0.6515258", "0.61957264", "0.6121983", "0.6042385", "0.5982147", "0.5892882", "0.58651745", "0.5853185", "0.5847529", "0.57568586", "0.5740524", "0.568015", "0.5678307", "0.5654499", "0.5640519", "0.5612564", "0.5601095", "0.55845505", "0.555618", "0.5543761", ...
0.7017831
1
Splits a batch from the dataset into features and labels.
def split_features_labels(self, batch): return batch if not self.unsupervised else (batch, batch)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_features_labels(features, labels, batch_size):\n for start in range(0, len(features), batch_size):\n end = min(start + batch_size, len(features))\n yield features[start:end], labels[start:end]", "def batch_features_labels(features, labels, batch_size):\n for start in range(0, len(fe...
[ "0.7397811", "0.7397811", "0.7397811", "0.7392773", "0.7389308", "0.7369271", "0.7269226", "0.7212842", "0.7189672", "0.70893776", "0.7009736", "0.6906469", "0.6898819", "0.6865417", "0.68624085", "0.6860942", "0.68584496", "0.68584496", "0.6646426", "0.6634188", "0.6600664",...
0.72230524
7
Enable TensorFlow Lite mode for this model.
def enable_tflite_mode(self): layers = [self] + list(self.submodules) for layer in layers: setattr(layer, "_tflite_mode", True) yield for layer in layers: delattr(layer, "_tflite_mode")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_mode_train(self):\n self._set_mode('train')\n return self", "def tflite_mode(self):\n return getattr(self, \"_tflite_mode\", False)", "def train(self, mode: bool = True):\n if self.nn_module.training != mode:\n self.nn_module.train(mode)", "def inference_mode_on...
[ "0.61619633", "0.587894", "0.5744052", "0.57234573", "0.55192995", "0.5472594", "0.54693806", "0.5459217", "0.544422", "0.5431105", "0.5431105", "0.53494024", "0.53359294", "0.5332355", "0.53288233", "0.53231096", "0.52720475", "0.52473694", "0.5246635", "0.52366936", "0.5220...
0.67009014
0
Transfers weights (and optionally optimizer slots) from this model to another.
def transfer_weights( self, new_model, new_optimizer=None, optimizer=None, ignore_weights=None ): if type(self) is not type(new_model): raise ValueError( "Transferring weights to another model type is not supported" ) if ignore_weights is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transfer_weights(self):\n W, target_W = self.model.get_weights(), self.target_model.get_weights()\n for i in range(len(W)):\n target_W[i] = self.tau * W[i] + (1 - self.tau)* target_W[i]\n self.target_model.set_weights(target_W)", "def load_weigths_into_target_network(self):\n ...
[ "0.7207047", "0.6937916", "0.66813797", "0.6387397", "0.63495266", "0.63435686", "0.6330899", "0.6210852", "0.6199461", "0.61663496", "0.6157494", "0.61474466", "0.61458695", "0.61057884", "0.61057884", "0.61057884", "0.6102516", "0.60904676", "0.5893644", "0.5865562", "0.585...
0.7262603
0
Convert a sequence of words to an ngram count dict.
def words_to_ngrams(words, max_order): d = defaultdict(int) # Iterate over word indices as start pointers for i in range(len(words)): # Sliding windows for j in range(min(max_order, len(words) - i)): # Increment counter, keep keys as tuples d[tuple(words[i: i+j+1])] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_ngrams_dict(ngrams_list):\n counts = {}\n\n for t in ngrams_list:\n key = hash_function(t)\n if key in counts:\n counts[key] += 1\n else:\n counts[key] = 1\n return counts", "def count_ngrams(word_list,n):\n ngram_dict = dict()\n for i in xrange(len(word_list)-n+1):\n ...
[ "0.72699445", "0.7078486", "0.70444834", "0.70008034", "0.69844013", "0.69776845", "0.69529605", "0.68539995", "0.6808048", "0.6774885", "0.6769583", "0.67450935", "0.6717684", "0.67170656", "0.67145383", "0.67067385", "0.67030376", "0.6697855", "0.6696996", "0.66906875", "0....
0.67313886
12
Returns if the SAPHostAgent is running or not.
def is_running(self): return all(p.status == 'running' for p in self.values())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_running(self):\n qstat = self._grep_qstat('running')\n if qstat:\n return True\n return False", "def is_running(self):\n\n command = ('ssh {0} -q -o StrictHostKeyChecking=no -o '\n 'UserKnownHostsFile=/dev/null \"pgrep httperf \"').format(self.clien...
[ "0.69732124", "0.69540304", "0.6921871", "0.6921871", "0.6921871", "0.6904843", "0.6899196", "0.686742", "0.6862252", "0.6855022", "0.6855022", "0.68489945", "0.6844677", "0.68141276", "0.68141276", "0.67951125", "0.6776958", "0.6759199", "0.67521006", "0.67371327", "0.673477...
0.62761325
88
Check whether package has been marked for deletion.
def package_marked_deleted(self, package): with self._conn.begin(): return bool(self._conn.scalar( "VALUES (package_marked_deleted(%s))", (package,) ))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete(self):\n self.request.access.allow_delete = [\"everyone\"]\n pkg = make_package(factory=DynamoPackage)\n self._save_pkgs(pkg)\n self.db.delete(pkg)\n count = self.engine.scan(DynamoPackage).count()\n self.assertEqual(count, 0)\n count = self.engine.s...
[ "0.6272412", "0.6246076", "0.624173", "0.6216555", "0.6159863", "0.6159863", "0.615214", "0.61370844", "0.6129408", "0.6111753", "0.6070747", "0.6058733", "0.600173", "0.5967158", "0.5964196", "0.590708", "0.5886693", "0.58696055", "0.5853439", "0.58430904", "0.5830032", "0...
0.78276926
0
Randomizes the order of data samples and their corresponding labels
def randomize(data): permutation = np.random.permutation(data.shape[0]) shuffled_data = data[permutation, :] # shuffled_y = y[permutation] return shuffled_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shuffle_labels(self):\n random.shuffle(self.y_train)\n random.shuffle(self.y_test)", "def inlabel_shuffle(data):\n num_zero_data = np.sum(data[:,-1]==0)\n label_zero_data = data[:num_zero_data,:]\n label_one_data = data[num_zero_data:,:]\n np.random.shuffle(label_zero_data)\n np.random.shu...
[ "0.7610801", "0.72624075", "0.71498376", "0.71094793", "0.7101863", "0.70504063", "0.6969117", "0.6969117", "0.6969117", "0.69373816", "0.69088066", "0.6856464", "0.6789744", "0.6737744", "0.6674642", "0.6634555", "0.6630403", "0.6464263", "0.6435945", "0.6421794", "0.6305728...
0.60995895
30
Create a BasicAuth object from an Authorization HTTP header.
def decode(cls, auth_header: str, encoding: str = "latin1") -> "BasicAuth": try: auth_type, encoded_credentials = auth_header.split(" ", 1) except ValueError: raise ValueError("Could not parse authorization header.") if auth_type.lower() != "basic": raise Val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_authorization(self):\n auth = get_authorization_header()\n\n if not auth:\n return None\n\n auth_type, auth_info = auth\n\n if auth_type != b'basic':\n return None\n\n try:\n username, password = base64.b64decode(auth_info).split(b':', 1)\...
[ "0.70063114", "0.6963404", "0.68979985", "0.6868137", "0.6852679", "0.6771222", "0.66782725", "0.6456421", "0.6408251", "0.63330615", "0.61862254", "0.61743414", "0.6135065", "0.61326635", "0.61161363", "0.6112391", "0.6071629", "0.60195833", "0.5981078", "0.5934171", "0.5913...
0.77695614
0
Convert Unicode > UTF8
def setPrint(): (e,d,sr,sw) = codecs.lookup('utf-8') unicode_to_utf8 = sw(sys.stdout) sys.stdout = unicode_to_utf8
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unicode2utf8(s):\n return s.encode(encoding='utf-8', errors='ignore')", "def to_utf8(self, _string):\n if isinstance(_string, unicode):\n _string = _string.encode(\"UTF-8\")\n return _string", "def unicode2utf8(arg):\n\n try:\n if isinstance(arg, unicode):\n ...
[ "0.79635125", "0.7536292", "0.7487843", "0.74515885", "0.74396086", "0.7336438", "0.72765565", "0.7248197", "0.7246717", "0.7208684", "0.72022057", "0.7195489", "0.7171378", "0.7166831", "0.7155901", "0.71327764", "0.7108567", "0.7103785", "0.71007687", "0.70766723", "0.70498...
0.0
-1
Converts an index (integer) in a token (str) using the vocab.
def _convert_id_to_token(self, index): return self.reverse_vocab.get(index, self.unk_token)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id_to_token(self, index):\r\n return self.decoder.get(index)", "def _convert_id_to_token(self, index):\n if index in self.fairseq_ids_to_tokens:\n return self.fairseq_ids_to_tokens[index]\n return self.sp_model.IdToPiece(index - self.fairseq_offset)", "def token_to_alias(raw...
[ "0.6586574", "0.65737563", "0.6516551", "0.64313483", "0.6417449", "0.6327966", "0.6321964", "0.6321964", "0.62100875", "0.6043412", "0.6042536", "0.5977381", "0.5894357", "0.58943087", "0.5877054", "0.5873445", "0.58590275", "0.5856909", "0.5804215", "0.57876736", "0.5768168...
0.74423885
0
Create the token type IDs corresponding to the sequences passed. [What are token type IDs?](../glossarytokentypeids) Should be overridden in a subclass if the model has a special way of
def create_token_type_ids_from_sequences( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None ) -> List[int]: # called when `add_special_tokens` is True, so align with `build_inputs_with_special_tokens` method if token_ids_1 is None: # [CLS] X [SEP] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_token_type_ids_from_sequences(\n self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None\n ) -> List[int]:\n\n sep = [self.sep_token_id]\n cls = [self.cls_token_id]\n\n if token_ids_1 is None:\n return len(cls + token_ids_0 + sep) * [0]\n re...
[ "0.7497814", "0.70519847", "0.617328", "0.60838264", "0.59909236", "0.5891904", "0.58872324", "0.5884097", "0.58682835", "0.5845807", "0.5828111", "0.57844925", "0.56425345", "0.56197363", "0.5570256", "0.55672604", "0.55538124", "0.5552356", "0.5528289", "0.55124485", "0.550...
0.7348676
1
You are given a list of integers. Move all zeros in the list to the end of it. The order of nonzero elements should not change.
def move_zeros(items: list) -> Iterable[int]: return [x for x in items if x != 0] + [x for x in items if x == 0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moveZeroes(self, nums: List[int]) -> None:\n pos =0\n for i in nums:\n if i==0:\n continue\n else:\n nums[pos]=i\n pos+=1\n nums[pos:] = [0] * (len(nums)-pos)", "def moveZeroes(self, nums: List[int]) -> None:\n\n i...
[ "0.8351995", "0.8313996", "0.829823", "0.8296958", "0.8280068", "0.82494456", "0.8228717", "0.8181354", "0.81777036", "0.8160208", "0.81296813", "0.8129603", "0.81266826", "0.81119436", "0.8104754", "0.81009144", "0.80893564", "0.8083815", "0.8082776", "0.80618006", "0.804337...
0.79474235
30
>>> replace_spelled_numbers('There are TEN sponges') 'There are 10 sponges' >>> replace_spelled_numbers('I got ninety nine problems') 'I got 99 problems' >>> replace_spelled_numbers('He got two million, one hundred and ' ... 'eightytwo thousand, three hundred and twenty five problems') 'He got 2182325 problems' >>> rep...
def replace_spelled_numbers(sentence): def try_spelled_num_to_digits(text): try: return spelled_num_to_digits(text) except NumberError: return text return SPELLED_NUMBER_RE.sub( lambda m: str(try_spelled_num_to_digits(m.group())), sentence)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spelledout_numbers_to_numbers(self, s):\n\t\tnumbers_1to9 = 'one two three four five six seven eight nine'.split() \n\t\tmappings_1to9 = {t[0]: str(t[1]) \n\t\t\t\t\t\t\t for t in zip(numbers_1to9, range(1,10))}\n\t\t\n\t\tmappings_10to19 = {t[0]: str(t[1]) \n\t\t\t\t\t\t\t for t in zip(\"\"\"ten eleven tw...
[ "0.76646054", "0.7023371", "0.7023371", "0.67026746", "0.6657195", "0.6622157", "0.6622157", "0.6622157", "0.6622157", "0.6622157", "0.6622157", "0.6622157", "0.65584785", "0.65063274", "0.6447577", "0.638882", "0.62369674", "0.6158019", "0.61259866", "0.6069722", "0.5930392"...
0.8319275
0
Count the number of lines in a file. file_uri a URI to the file on disk. Returns an int.
def count_lines(file_uri): with open(file_uri) as file_obj: for i, line in enumerate(file_obj): pass num_lines = i + 1 return num_lines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_lines(filename=\"\"):\n counter = 0\n with open(filename, \"r\") as my_file:\n for line in my_file:\n counter += 1\n my_file.close()\n return (counter)", "def number_of_lines(filename=\"\"):\n\n number_lines = 0\n with open(filename) as file_opened:\n for ...
[ "0.7646518", "0.7571567", "0.75624263", "0.75624263", "0.75463575", "0.7539765", "0.7523981", "0.7518493", "0.75114", "0.75032765", "0.7486836", "0.7482571", "0.7466913", "0.73625153", "0.734073", "0.7332589", "0.7303642", "0.72133446", "0.7169554", "0.713662", "0.70083123", ...
0.85428905
0
Randomly permute the weights in `model`, or the given `weights`. This is a fast approximation of reinitializing the weights of a model. Assumes weights are distributed independently of the dimensions of the weight tensors (i.e., the weights have the same distribution along each dimension).
def shuffle_weights(model, layers_to_shuffle, weights=None): if weights is None: weights = model.get_weights() random_weights = [np.random.permutation(w.flat).reshape(w.shape) for w in weights] if layers_to_shuffle >= 0: starting_layer = max(0, len(weights) - layers_to_shuffle - 1) els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shuffle_weights(model, weights=None):\n if weights is None:\n weights = model.get_weights()\n weights = [np.random.permutation(w.flat).reshape(w.shape) for w in weights]\n # Faster, but less random: only permutes along the first dimension\n # weights = [np.random.permutation(w) for w in weig...
[ "0.8797533", "0.8797533", "0.68322605", "0.68135923", "0.6806401", "0.66211635", "0.64720887", "0.64652085", "0.6117667", "0.60819757", "0.6015553", "0.5975807", "0.59646505", "0.59520024", "0.59387785", "0.5938738", "0.59366196", "0.5895395", "0.5892413", "0.5885662", "0.588...
0.7632566
2
Return the softmax values of the given heatmaps. Each heatmap must be the predicted value of one class. Therefore the returned maps will be the softmax predicted value for each class. The softmax function is applied along all class, by pixel.
def heatmaps_softmax(heatmaps): ret = np.zeros(heatmaps.shape, heatmaps.dtype) width, height, _ = heatmaps.shape for w in range(width): for h in range(height): x = heatmaps[w,h] e = np.exp(x - np.max(x)) ret[w,h] = e / np.sum(e, axis=0) return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ...
[ "0.6665202", "0.6599128", "0.65775716", "0.6385615", "0.62997955", "0.6232021", "0.61461985", "0.6086137", "0.60759467", "0.60277957", "0.59850174", "0.5972452", "0.5970767", "0.59632987", "0.5901451", "0.58694726", "0.5860399", "0.5856099", "0.5847108", "0.58382416", "0.5838...
0.8326172
0
Calculates a file sha256 or md5 hash.
def _hash_file(fpath, algorithm='sha256', chunk_size=65535): if (algorithm == 'sha256') or (algorithm == 'auto' and len(hash) == 64): hasher = hashlib.sha256() else: hasher = hashlib.md5() with open(fpath, 'rb') as fpath_file: for chunk in iter(lambda: fpath_file.read(chunk_size), b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_file_hash(filepath):\n with open(filepath, 'rb') as f:\n return md5(f.read()).hexdigest()", "def hashfile(file):\n\n hasher = hashlib.sha256()\n\n with open(file, 'rb') as afile:\n buf = afile.read(BLOCKSIZE)\n hasher.update(buf)\n\n return(hasher.hexdigest())", "def _...
[ "0.77864486", "0.7769969", "0.7739381", "0.7727694", "0.7659397", "0.76106703", "0.7598494", "0.75737983", "0.7573686", "0.75558686", "0.7521696", "0.7516902", "0.74884284", "0.7469031", "0.74439853", "0.7432314", "0.7428574", "0.7422415", "0.7420376", "0.73817885", "0.736151...
0.7761106
2
Test getting a place from an empty conflict places.
def test_emtpy_conflict_places(conflict_places): assert conflict_places.named_place("Woodshop") == None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conflict_places():\n return ConflictPlaces()", "def test_add_containing_place_mixed(conflict_places):\n known_place = \"Metal Shop\"\n conflict_places.add_checked_place(known_place)\n contained_places = [\"Room A\", \"Room B\"]\n conflict_places.add_checked_place(\"Room B\")\n conflict_plac...
[ "0.70858306", "0.6982521", "0.6974628", "0.6537835", "0.6241419", "0.61677617", "0.61231077", "0.60895646", "0.6088507", "0.6032391", "0.6015056", "0.5807931", "0.5759069", "0.572757", "0.5722944", "0.57107884", "0.57026064", "0.5699504", "0.5695146", "0.56922346", "0.5600099...
0.8262752
0
Get the current state of this object as a `dict`
def __getstate__(self): state = self.__dict__.copy() badKeys = ['wm','master','tk','_w','widgetName','plots','_tclCommands','_name','children','scalars','fuelVar','shellVar','totalVar','logVar','BTlabel'] for key in badKeys: if key in state.keys(): del state[key] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getstate__(self):\n return dict(self.items())", "def __getstate__(self):\n return dict(self.items())", "def __getstate__(self):\n return self.__dict__", "def save_state_to_dict(self):\n return self.__dict__.copy()", "def getstate(self):\n return {}", "def __getsta...
[ "0.8738046", "0.8738046", "0.8682291", "0.85248786", "0.8500872", "0.84730613", "0.8422426", "0.8351446", "0.8350658", "0.8336389", "0.8241998", "0.824055", "0.8215", "0.8214183", "0.8174079", "0.8124022", "0.80839187", "0.8074828", "0.8026997", "0.8018707", "0.7972123", "0...
0.0
-1
Get the global Config object
def conf(): global config return config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config(cls) -> GlobalConfig:\n if cls.config is None:\n raise ValueError(\"Config is not loaded\")\n return cls.config", "def get_config(config):\n global _config\n return _config", "def get_config():\n return _config", "def get_config():\n return CONFIG", "def ...
[ "0.8505084", "0.8357029", "0.82801443", "0.82772064", "0.82736135", "0.82362646", "0.80455285", "0.80455285", "0.80455285", "0.80455285", "0.80455285", "0.80455285", "0.80455285", "0.80455285", "0.80455285", "0.80455285", "0.80455285", "0.80455285", "0.80455285", "0.80455285", ...
0.85046995
1
Create an API resource REST client
def get_tenant_id_resource_client(self): __logger__.info("Creating TenantIdResource") return TenantIdResourceClient(protocol=self.api_protocol, host=self.api_host, port=self.api_port, resource=self.api_resource, headers=self.headers)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_resource():\n deserializer = wsgi.JSONRequestDeserializer()\n serializer = wsgi.JSONResponseSerializer()\n return wsgi.Resource(Controller(), deserializer, serializer)", "def api_client() -> APIClient:\n return APIClient()", "def api_client() -> APIClient:\n\n return APIClient()", "...
[ "0.7040603", "0.6911905", "0.6875557", "0.6775693", "0.6720706", "0.6702453", "0.6666208", "0.6660491", "0.65370464", "0.6519536", "0.6445965", "0.6404414", "0.64002645", "0.6348593", "0.6348593", "0.6348593", "0.6348593", "0.634808", "0.6326583", "0.6292085", "0.62884563", ...
0.5723905
84
Unit square sigmoid (for transforming Plike scales)
def unitsq_sigmoid(x, s=0.5): a = x ** s b = (1 - x) ** s return a / (a + b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scaled_sigmoid(self, x):\r\n return (tf.keras.backend.sigmoid(x) * 30 - 5)", "def sigmoid(x):\r\n return 1 / (1 + np.exp(-x))", "def sigmoid(x):\n return 1 / (1 + exp(-x))", "def sigmoid(x):\n return 1 / (1 + exp(-x))", "def sigmoid(x):\n\treturn 1 / (1 + m.exp(-x))", "def sigmoid(t):...
[ "0.77728003", "0.7742055", "0.77383333", "0.77383333", "0.7731928", "0.7730399", "0.7728719", "0.7728657", "0.7726294", "0.77252525", "0.77141887", "0.76995695", "0.7688183", "0.7688183", "0.7688183", "0.7688183", "0.7688183", "0.7688183", "0.76803887", "0.76695955", "0.76518...
0.7398662
56
Harmonic mean of two numbers with a weight ratio. Returns a float
def hmean_weighted(x, y, ratio=1.0): lweight, rweight = ratio2weights(ratio) if x == y: return float(x) elif x == 0.0 or y == 0.0: if lweight == 0.0: return float(x) elif rweight == 0.0: return float(y) else: return 0.0 else: re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def harmonic_mean(numbers):\n return 2 * numbers[0] * numbers[1] / sum(numbers)", "def harmonic_mean(self):\n return self.count() / sum(1/number for number in self.numbers)", "def _harmonic_mean(self, parameters, neq):\n weight = neq.astype(float) / np.sum(neq)\n if np.shape(parameters)...
[ "0.7312181", "0.70545584", "0.6996638", "0.6968903", "0.6849192", "0.6840306", "0.670735", "0.670735", "0.6623665", "0.65191793", "0.64817655", "0.64751834", "0.64401114", "0.63819337", "0.6369738", "0.6337154", "0.6258731", "0.61635375", "0.6121507", "0.6095721", "0.609092",...
0.7630663
0
Convert to NumPy array
def to_array(self, default=0, cpad=False, rpad=False): rows = self.to_rows(default=default, cpad=cpad, rpad=rpad) return np.array(rows)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_numpy_ndarray(cls, data):\n if isinstance(data, np.ndarray):\n return data\n arr = np.array(data, dtype=np.float)\n if len(arr.shape) == 1:\n arr = np.reshape(arr, newshape=(1, arr.shape[0]))\n return arr", "def to_numpy(x):\r\n return x.squeeze().deta...
[ "0.7771455", "0.77618694", "0.76926863", "0.76182556", "0.76110244", "0.7580668", "0.74854016", "0.7433307", "0.73268044", "0.73209983", "0.7312569", "0.7258847", "0.7243353", "0.7171024", "0.71638733", "0.7138867", "0.7138157", "0.71086013", "0.70798403", "0.70798403", "0.70...
0.0
-1
Normalize to maximum with optional centering
def _normalize_measure(value, maximum=1.0, center=0.0): if isiterable(value): value = np.asarray(value) if isiterable(center): center = np.asarray(center) if isiterable(maximum): maximum = np.asarray(maximum) return np.divide(value - center, maximum - ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minmax_normalize(X):\n # X -= X.min()\n # X /= X.max()\n # X -= 0.5\n X = (X-X.min()) / (X.max() - X.min())\n return X", "def centerMeanAndNormalize(df):\n return minMax(df - df.mean(axis=0))", "def normalize_array(a, norm_max=255):\n c = a - np.min(a.flatten())\n c = c / np.max...
[ "0.7222329", "0.71745676", "0.7158077", "0.70922726", "0.6978036", "0.6931842", "0.68275505", "0.679384", "0.67618495", "0.6745279", "0.67398006", "0.6721152", "0.67179316", "0.67070735", "0.67070735", "0.66805893", "0.66805893", "0.6679776", "0.6678106", "0.66750425", "0.664...
0.76305115
0