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
Gets the position of this CatalogDataCategoryTreeInterface. Category position
def position(self) -> int: return self._position
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def position(self):\n # (this to be able to let the model know my 'row')\n if self.parent and self in self.parent.children:\n return self.parent.children.index(self)\n return 0", "def position(self) -> int:\n return self.__pos", "def position(self):\r\n return self...
[ "0.6520411", "0.6493821", "0.6330174", "0.6327624", "0.63201827", "0.63201827", "0.63201827", "0.6299643", "0.6290675", "0.6288138", "0.6288138", "0.6288138", "0.6288138", "0.6288138", "0.6288138", "0.6288138", "0.6288138", "0.6288138", "0.6288138", "0.6288138", "0.6288138", ...
0.64561224
3
Sets the level of this CatalogDataCategoryTreeInterface. Category level
def level(self, level: int): if level is None: raise ValueError("Invalid value for `level`, must not be `None`") self._level = level
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories_level(self, categories_level):\n\n self._categories_level = categories_level", "def setLevel(self, level):\n self.lvl = level", "def setLevel(self, level):\n self.level = level", "def __set_level(self,L):\n assert isinstance(L,level)\n self.__level = L", "d...
[ "0.67119396", "0.65500873", "0.64895517", "0.62490404", "0.6130406", "0.6130406", "0.6130406", "0.6073065", "0.60715747", "0.5771407", "0.5718296", "0.5693593", "0.56295675", "0.5608405", "0.5569411", "0.5484242", "0.54825664", "0.5398048", "0.53969574", "0.5367131", "0.53227...
0.5863809
9
Gets the product_count of this CatalogDataCategoryTreeInterface. Product count
def product_count(self) -> int: return self._product_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_product_count(self):\n return self.products.count()", "def getNumProducts(self):\n return _libsbml.Reaction_getNumProducts(self)", "def count(self):\n return self.__tree.node_count", "def getNumGeneProducts(self):\n return _libsbml.ListOfGeneProducts_getNumGeneProducts(sel...
[ "0.76092654", "0.6622111", "0.6489218", "0.6343734", "0.60831386", "0.60731477", "0.6059927", "0.6052668", "0.6041682", "0.6041682", "0.5993296", "0.59918356", "0.59863335", "0.59818643", "0.5957203", "0.5957203", "0.59537387", "0.5945011", "0.591774", "0.591439", "0.59076035...
0.742521
1
Sets the product_count of this CatalogDataCategoryTreeInterface. Product count
def product_count(self, product_count: int): if product_count is None: raise ValueError("Invalid value for `product_count`, must not be `None`") self._product_count = product_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_count(self, count, asset=None):\n self._set_property('pc:count', count, asset)", "def product_count(self) -> int:\n return self._product_count", "def set_count(self, count):\n self._count = count", "def setCount(self, num):\n self.count=num", "def node_count(self, node_c...
[ "0.6202557", "0.61949056", "0.6157358", "0.59965014", "0.590654", "0.58302146", "0.581746", "0.581746", "0.581746", "0.581746", "0.57537264", "0.57172596", "0.5701288", "0.5697079", "0.5625625", "0.5572523", "0.5532339", "0.5504789", "0.55039895", "0.54900897", "0.5476618", ...
0.73674226
0
Gets the children_data of this CatalogDataCategoryTreeInterface.
def children_data(self) -> List[CatalogDataCategoryTreeInterface]: return self._children_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def children_data(self, children_data: List[CatalogDataCategoryTreeInterface]):\n if children_data is None:\n raise ValueError(\"Invalid value for `children_data`, must not be `None`\")\n\n self._children_data = children_data", "def get_children(self):\n return self._children", ...
[ "0.6901165", "0.67760825", "0.67727214", "0.6759121", "0.6759121", "0.6759121", "0.66929054", "0.66248626", "0.65820545", "0.65661037", "0.65622455", "0.6526736", "0.6471481", "0.6471481", "0.64566386", "0.6423364", "0.641077", "0.6318962", "0.62834007", "0.6268242", "0.62352...
0.8858066
0
Sets the children_data of this CatalogDataCategoryTreeInterface.
def children_data(self, children_data: List[CatalogDataCategoryTreeInterface]): if children_data is None: raise ValueError("Invalid value for `children_data`, must not be `None`") self._children_data = children_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def children_data(self) -> List[CatalogDataCategoryTreeInterface]:\n return self._children_data", "def children(self, children):\n\n self._children = children", "def children(self, children: List[str]):\n self._children = children", "def __init__(self, data):\n\n super(DataNode, s...
[ "0.64545685", "0.6321724", "0.6087012", "0.59329635", "0.59010357", "0.5692913", "0.5222109", "0.5205171", "0.51407236", "0.49717423", "0.49410522", "0.49386463", "0.49025235", "0.48784256", "0.48784256", "0.48784256", "0.48700255", "0.48651484", "0.48649752", "0.48339596", "...
0.8265898
0
SKU of the chip
def chip_sku(self) -> str: return pulumi.get(self, "chip_sku")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sku(self):\n return self._sku", "def sku(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"sku\")", "def sku(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"sku\")", "def os_sku(self) -> Optional[pulumi.Input[Union[str, 'OSSKU']]]:\n return pu...
[ "0.7370744", "0.72496444", "0.72496444", "0.71808004", "0.71356356", "0.69699764", "0.69699764", "0.6947569", "0.69468087", "0.69468087", "0.68561363", "0.68420005", "0.6819522", "0.6819522", "0.67283636", "0.67283636", "0.67283636", "0.6709464", "0.66590977", "0.66499907", "...
0.8154291
0
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
def type(self) -> str: return pulumi.get(self, "type")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")", "def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")", "def resource_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource_type\")", "def ...
[ "0.7919035", "0.7919035", "0.78672034", "0.78672034", "0.78672034", "0.78672034", "0.78672034", "0.77074885", "0.7553605", "0.72829276", "0.7059477", "0.69799143", "0.69213367", "0.68692446", "0.67299867", "0.67052966", "0.66552657", "0.66466856", "0.6551874", "0.65421367", "...
0.6640344
41
returns the list of models supported by this driver. The model is the string between the first and second "," in the IDN? query reply.
def supported_models(cls): models = [] for subclass in cls.__subclasses__(): models+=subclass.supported_models() return models
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_supported_models() -> Sequence[str]:\r\n return list(_MODELS)", "def get_supported_models(self):\n # type: () -> list\n return [model for model in self.__MODELS]", "def get_available_entities_models():\n return ['concat', 'bahdanau', 'luong']", "def models() -> list[str]:\n re...
[ "0.764639", "0.725779", "0.66339195", "0.6596997", "0.65960157", "0.64882684", "0.64064914", "0.6363596", "0.6363596", "0.6280011", "0.62794495", "0.61252713", "0.609558", "0.6086188", "0.60730445", "0.6051094", "0.6016844", "0.5990613", "0.5949366", "0.5936982", "0.59127134"...
0.644127
6
Convert Molden style number formatting to scientific notation. 0.9910616900D+02 > 9.910617e+01
def scinotation(self, num): num = num.replace("D", "e") return f"{decimal.Decimal(num):.9e}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scientific(x):\n return '{:.2e}'.format(x)", "def convert_to_scientific_notation(number):\n\n number = \"%.2e\" % number\n if \"+\" in number:\n positive_exponent = True\n number, exponent = number.split(\"+\")\n else:\n positive_exponent = False\n number, exponent = n...
[ "0.77649057", "0.74459493", "0.74242043", "0.7417169", "0.68923146", "0.68546087", "0.66420203", "0.65555173", "0.64765114", "0.6396097", "0.6369339", "0.62390614", "0.61920524", "0.6176748", "0.61340547", "0.6044619", "0.603233", "0.60148984", "0.60021883", "0.59925157", "0....
0.689039
5
Get the value of a specific variable in the self.env dict
def get_conn_env_var(self, connector, key): return self.env[connector]['vars'][key]['value']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, key):\n return os.environ[key]", "def __getattr__(self, attr):\n\n if attr in self._vars.keys():\n return self._vars[attr]\n else:\n raise EnvError(\"Unknown environment variable: \" + attr)", "def __getitem__(self, name):\n return os.envi...
[ "0.77850544", "0.77263165", "0.7528232", "0.75049055", "0.74160475", "0.72984403", "0.72892636", "0.7251165", "0.7217257", "0.7178609", "0.7154409", "0.710218", "0.71008503", "0.71004486", "0.7070604", "0.7064366", "0.7058863", "0.6994971", "0.69867206", "0.6940577", "0.68682...
0.72417897
8
Create and returns tap mongodb database instance to run queries on
def get_tap_mongodb_connection(self): return db.get_mongodb_connection( host=self.get_conn_env_var('TAP_MONGODB', 'HOST'), port=self.get_conn_env_var('TAP_MONGODB', 'PORT'), user=self.get_conn_env_var('TAP_MONGODB', 'USER'), password=self.get_conn_env_var('TAP_MON...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mongo_db():\n\n if not hasattr(g, 'mongodb'):\n g.mongodb = connect_mongo_db()\n\n g.mongodb.register([Testimonial])\n g.mongodb.register([Town])\n\n return g.mongodb", "def get_db():\n from pymongo import MongoClient\n client = MongoClient('localhost:27017')\n db = client.sea...
[ "0.7716839", "0.740199", "0.73433536", "0.72637284", "0.7200985", "0.7175258", "0.7157866", "0.709372", "0.7087331", "0.70805556", "0.7069523", "0.7056645", "0.7019416", "0.69814974", "0.69814557", "0.6946594", "0.6944555", "0.6943889", "0.69399464", "0.6828267", "0.68206155"...
0.7244915
4
Clean postgres target database and prepare for test run
def setup_target_postgres(self): self.run_query_target_postgres('CREATE EXTENSION IF NOT EXISTS pgcrypto') self.run_query_target_postgres( 'DROP SCHEMA IF EXISTS ppw_e2e_tap_postgres CASCADE' ) self.run_query_target_postgres( 'DROP SCHEMA IF EXISTS ppw_e2e_tap_pos...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_up():\n drop_all_tables()\n create_all()", "def reset_db():\n \n if not env.environment == 'staging':\n abort('reset_db requires the staging environment.')\n answer = prompt('Are you sure you want to drop and re-create the database?', default='n')\n if answer == 'y':\n ...
[ "0.72016835", "0.71762145", "0.70275855", "0.7010526", "0.6975757", "0.6924393", "0.6920437", "0.6904922", "0.6904922", "0.6885099", "0.6877747", "0.68707055", "0.68456036", "0.68265396", "0.680096", "0.6777835", "0.6756316", "0.6753695", "0.6753348", "0.6730228", "0.6722768"...
0.7705666
0
Clean bigquery target database and prepare for test run
def setup_target_bigquery(self): self.delete_dataset_target_bigquery('ppw_e2e_tap_postgres') self.delete_dataset_target_bigquery('ppw_e2e_tap_postgres_public2') self.delete_dataset_target_bigquery('ppw_e2e_tap_postgres_logical1') self.delete_dataset_target_bigquery('ppw_e2e_tap_postgres_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def clean_up():\n drop_all...
[ "0.67920667", "0.67920667", "0.67920667", "0.67920667", "0.67920667", "0.67920667", "0.6758705", "0.6644027", "0.6618105", "0.6618105", "0.6618105", "0.6618105", "0.6618105", "0.6618105", "0.6618105", "0.6618105", "0.6618105", "0.6598494", "0.65853643", "0.6560878", "0.656087...
0.75868404
0
Clean up temp folder to ensure tests behave the same every time
def clean_up_temp_dir(): files = glob.glob(f'{CONFIG_DIR}/tmp/*') for f in files: try: os.remove(f) except Exception: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\r\n shutil.rmtree(self.temp_dir_path)", "def tearDown(self):\n print(\n \"\\nDeleting temporary files...\\n\")\n try:\n shutil.rmtree(TEST_DIR)\n except OSError:\n pass", "def tearDown(self):\n for root, dirs, files in os.walk(...
[ "0.8399391", "0.8278388", "0.82301015", "0.8203942", "0.81875724", "0.8181194", "0.81562257", "0.81562257", "0.81408715", "0.8085779", "0.8045241", "0.80287194", "0.79661626", "0.7953712", "0.7944333", "0.79336154", "0.7921241", "0.7909137", "0.7897728", "0.7879657", "0.78702...
0.8058344
10
The HasSignals instance that this signal is associated with (stored as a weak reference internally). None for plain signals.
def __self__(self): if self._ob is not None: return self._ob()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_signal_active(self):\n return self.signal_active", "def has_signal(self, signal_type):\n if signal_type in self.signals:\n return True\n return False", "def __get__(self, obj, cls):\n if obj is None:\n msg = 'Signals can only be accessed through an inst...
[ "0.6366388", "0.62727666", "0.6020616", "0.5963936", "0.59248936", "0.57740515", "0.54300165", "0.53752965", "0.5350925", "0.5328825", "0.53277", "0.52101177", "0.52080774", "0.5132844", "0.5090438", "0.5053346", "0.50388694", "0.5015217", "0.49712414", "0.49022081", "0.48967...
0.0
-1
The name of this signal, usually corresponding to the name of the function that this signal wraps.
def name(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return signal_base_get_name(self.obj)", "def getName(self):\n return signal_base_get_name(self.obj)", "def name(self):\n\t\treturn self._func_name", "def name(self):\n return f'{self._vehicle.name} {self.wan_name} Signal'", "def getSignalName(sig):\n try:\n ...
[ "0.88937336", "0.8554367", "0.78879", "0.7865356", "0.7661289", "0.7661289", "0.7562152", "0.74602175", "0.7347565", "0.7280338", "0.72616214", "0.72602105", "0.7259291", "0.71667886", "0.71667886", "0.7159617", "0.7159617", "0.715113", "0.715113", "0.715113", "0.715113", "...
0.0
-1
This is like ``self._value = value``, but with bookkeeping.
def _set_value(self, value): if value is undefined: self._status = 3 if (self._count == 0) else 0 return # new tick, but no update of value self._last_value = self._value self._value = value self._count += 1 self._last_timestamp = self._timestamp ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value(self, value):\n\n\t\tself.__value = value", "def assign(self, value):\n self.value = value", "def value(self, value):\n\n self._value = value", "def value(self, value):\n\n self._value = value", "def value(self, value):\n\n self._value = value", "def value(self, valu...
[ "0.85682136", "0.82697386", "0.81096643", "0.81096643", "0.81096643", "0.81096643", "0.81096643", "0.81096643", "0.79506236", "0.7912013", "0.770381", "0.7690265", "0.76845545", "0.7661526", "0.7661526", "0.7661526", "0.7596274", "0.75642073", "0.75642073", "0.75491774", "0.7...
0.7324291
30
Get the current value. Some overhead is put here to keep update_value compact.
def _get_value(self): if self._not_connected: self.connect(False) if self._status == 1: self._update_value() elif self._status == 2: raise SignalValueError('The signal %r is not initialized.' % self._name) elif self._status == 3: raise Sign...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_value(self):\n assert(self.is_started())\n return self.currValue", "def _get_value(self):\n \n return self._value", "def _get_value(self):\n return self.__value", "def get(self):\n now = datetime.datetime.utcnow()\n if now > self.time_of_next_u...
[ "0.8037099", "0.7759936", "0.77554256", "0.77002764", "0.7457468", "0.7457468", "0.7454937", "0.7448639", "0.7432721", "0.7431743", "0.74228454", "0.7403931", "0.73697925", "0.7360366", "0.73238677", "0.7302425", "0.7302425", "0.7302425", "0.72976696", "0.7292625", "0.7292625...
0.0
-1
Associate normalization layers to their preceding weighted layer for eventual later pruning action
def associate_normalization_layers(self, model): if (len(self.leaf_modules) == 0): self.retrieve_leaf_modules(model) # Association list self.norm_modules = [] self.prune_modules = [] # Current weighted layer cur_weighted = None # Associate norm lay...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_post_process_layer(prev_out, out, process_cmd, dropout_rate=0.):\n for cmd in process_cmd:\n if cmd == \"a\": # add residual connection\n out = out + prev_out if prev_out else out\n elif cmd == \"n\": # add layer normalization\n out = layers.layer_norm(\n ...
[ "0.63266104", "0.6306807", "0.62964475", "0.62906265", "0.62355274", "0.62355274", "0.6197351", "0.61900085", "0.61175185", "0.6115859", "0.61085224", "0.6076835", "0.60599923", "0.6049997", "0.6019177", "0.5984073", "0.5980041", "0.59700394", "0.5969618", "0.59523296", "0.59...
0.71442246
0
Return the ``q``th percentile of the flattened input tensor's data.
def torch_percentile(t, q): # Note that ``kthvalue()`` works one-based, i.e. the first sorted value # indeed corresponds to k=1, not k=0! Use float(q) instead of q directly, # so that ``round()`` returns an integer, even if q is a np.float32. k = 1 + round(.01 * float(q) * (t.numel() - 1)) result = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percentile(t: torch.tensor, q: float):\n # Note that ``kthvalue()`` works one-based, i.e. the first sorted value\n # indeed corresponds to k=1, not k=0! Use float(q) instead of q directly,\n # so that ``round()`` returns an integer, even if q is a np.float32.\n k = 1 + round(.01 * float(q) * (t.num...
[ "0.802458", "0.77174544", "0.77174544", "0.7706333", "0.76507", "0.76453716", "0.73305327", "0.7006668", "0.6945124", "0.69359267", "0.6853341", "0.6850928", "0.68455553", "0.6844253", "0.6713556", "0.66916794", "0.6688679", "0.6682355", "0.6682355", "0.6682355", "0.6679008",...
0.765127
4
Function to add forward hooks to the model that will keep the inputs and outputs for each prunable layer. The resulting structure will be a list of tensors stored in each layer
def register_activation_hooks(self, model): self.outputs = [] self.hooks = [] b = None self.list_mods = self.prune_modules if ('norm' in self.prune_selection): self.list_mods = self.norm_modules for l in self.list_mods: if ('norm' in self.list_mods...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(model, layers, input_tensor):\n outs = []\n handles = []\n for layer in layers:\n handle = layer.register_forward_hook(lambda module, inp, out: outs.append(out))\n handles.append(handle)\n output = model.forward(make_var(input_tensor, volatile=True))\n unregister_hooks(hand...
[ "0.7488996", "0.6441719", "0.6343538", "0.6331328", "0.63077337", "0.6302839", "0.6266985", "0.6263057", "0.6253892", "0.6225428", "0.62183654", "0.62146276", "0.62048864", "0.61928535", "0.6167618", "0.61413133", "0.6135445", "0.61263716", "0.61257863", "0.6122607", "0.61065...
0.68668616
1
Reorganize weights in a recurrent layer to reflect the unitbased structure in LSTM and GRU.
def reorganize_weights(self, layer, cur_w): if (layer.__class__ == nn.LSTM): w_ii, w_if, w_ic, w_io = cur_w.chunk(4, 0) cur_w = torch.cat((w_ii, w_if, w_ic, w_io), axis=1) if (layer.__class__ == nn.GRU): w_ii, w_if, w_ic = cur_w.chunk(3, 0) cur_w = torch.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_weights(self):\n\n self.weights -= self.loss_grads\n self.loss_grads = np.zeros(self.weights.shape)", "def update_recurrent_weights_step(self):\n \n # update weights: hebbian term\n self.delta_Wee=self.learn_rate*(self.rr[0:self.N_e]-self.input_mean)*\\\n (self.rr[0:self.N_e]....
[ "0.6262342", "0.6188161", "0.60763454", "0.5970655", "0.5845537", "0.5833333", "0.5831372", "0.5801108", "0.57688564", "0.5763315", "0.57517606", "0.57484937", "0.570217", "0.5687758", "0.5680946", "0.56771743", "0.56766146", "0.56743693", "0.56743693", "0.5672087", "0.565825...
0.78573006
0
Generator for a specific discrete distribution
def get_discrete_distribution(): random_int = random.randint(1, 4) if (random_int == 1) | (random_int == 2): return 0 if random_int == 3: return 3 if random_int == 4: return 5 raise ValueError("Unable to generate discrete distribution with ", random_int)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_discrete_distribution():\n rng = utils.RandomState(0)\n distribution = dist.DiscreteDistribution(rng)\n with pytest.raises(NotImplementedError):\n distribution.sample([])\n with pytest.raises(NotImplementedError):\n distribution.log_probability([], None)\n with pytest.raises(NotImplementedError...
[ "0.720498", "0.67211354", "0.65985286", "0.6553857", "0.63354474", "0.6266083", "0.62360346", "0.60914654", "0.6056733", "0.604632", "0.6037922", "0.59875935", "0.5979464", "0.59711045", "0.5964844", "0.5942032", "0.59419215", "0.5939492", "0.5914564", "0.5911196", "0.5905951...
0.7602032
0
Gets the label of this ServiceInfo.
def label(self) -> str: return self._label
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_label(self):\n return self._label", "def get_label(self):\n\n return self._label", "def GetLabel(self) -> str:\n return self._label", "def get_label(self):\n return self.label", "def get_label(self):\n return self.label", "def get_label(self):\n return se...
[ "0.7494217", "0.7487241", "0.74246764", "0.74023265", "0.74023265", "0.74023265", "0.74023265", "0.73852706", "0.7378827", "0.7355431", "0.73300064", "0.73300064", "0.72996926", "0.72656715", "0.72656715", "0.72656715", "0.72656715", "0.72656715", "0.72656715", "0.72656715", ...
0.72160906
27
Gets the version of this ServiceInfo.
def version(self) -> str: return self._version
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version(self):\n return self.__make_api_call('get/version')", "def version(self):\n return self._get(\"version\")", "def get_version(self):\n return self._version", "def get_version(self):\n return self._version", "def version_info(self):\n\n return __version_info...
[ "0.77735996", "0.76691884", "0.7644472", "0.7644472", "0.7644045", "0.7640147", "0.76153207", "0.7569689", "0.75674635", "0.75304115", "0.7512425", "0.74939924", "0.74756485", "0.74595463", "0.74595463", "0.7444559", "0.74292904", "0.73874927", "0.73800707", "0.7335927", "0.7...
0.71053
61
create ngrams from the
def char_ngram_split(infname, outfname, n=1,overlap=False,space_delim=u"^"): if type(n)==str: n=int(n) if type(overlap)==str: if overlap=='True': overlap=True elif overlap=='False': overlap=False with codecs.open(infname,'r','utf-8') as in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_ngrams(word_list, n):\n yield zip(*[word_list[i:] for i in range(n)])", "def make_ngrams(texts,n,ngram_mod):\r\n return [turnmod(doc,n,ngram_mod) for doc in texts]", "def __makeNgrams(self, n):\n # start_time = time.time()\n ngrams = dict()\n itergrams = dict()\n\n ...
[ "0.76913106", "0.76810825", "0.76578724", "0.759224", "0.7558377", "0.7446399", "0.7399163", "0.7367208", "0.7350071", "0.7348104", "0.728345", "0.7267781", "0.7237457", "0.72314954", "0.71968186", "0.7194518", "0.7108417", "0.7070243", "0.7064399", "0.70578873", "0.69316167"...
0.0
-1
Return a shallow copy of a dict.
def shallow(dict, exclude=None): new_dict = {} for key in dict: if not exclude or key not in exclude: new_dict[key] = dict[key] return new_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __copy__(self):\n d = dict()\n d.update(self.items())\n return d", "def copy(self):\n return pdict(dict.copy(self))", "def copy(self):\n return self.from_dict(self.to_dict(True))", "def copy_dict(source_dict, diffs):\n result = dict(source_dict)\n result.update(diffs)...
[ "0.77973694", "0.7753472", "0.7653771", "0.7178702", "0.71425205", "0.7106355", "0.70180255", "0.69349194", "0.6933654", "0.6926355", "0.69010025", "0.68931735", "0.68843526", "0.6849732", "0.6762243", "0.67535245", "0.664406", "0.6598092", "0.6555214", "0.6531192", "0.652371...
0.7281112
3
Do not return anything, modify head inplace instead.
def reorderList(self, head: ListNode) -> None: if not head or not head.next: return # Split the list first, second = head, head while first and first.next: first, second = first.next.next, second.next mid, p = second.next, second.next second.next =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def head(self, head):\n\n self._head = head", "def move_to_head(self, node):\n if node is self.head:\n return\n value = node.value\n self.delete(node)\n self.add_to_head(value)", "def _move_to_head(self, node):\n self._remove_node(node)\n self._add_no...
[ "0.7220717", "0.6802125", "0.6732507", "0.6623409", "0.6519967", "0.6464965", "0.64550555", "0.6356954", "0.63504815", "0.63075596", "0.6290726", "0.62324375", "0.6226244", "0.6201695", "0.6201695", "0.6201695", "0.6201695", "0.6199955", "0.6192911", "0.6174009", "0.6150575",...
0.5904242
48
Return the current max sid from the `current_propsheet` table. Not specific to a given uuid (i.e. rid). If no sid found, return 0
def get_max_sid(self): session = self.DBSession() # first element of the first result or None if no rows present. # If multiple rows are returned, raises MultipleResultsFound. data = session.query(func.max(CurrentPropertySheet.sid)).scalar() or 0 return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_sid(cursor):\n cursor.execute('SELECT count(sid) FROM sessions')\n return int(cursor.fetchall()[0][0])", "def get_current_id(self) -> int:\n try:\n return self.cursor.execute(f\"SELECT MAX(id) FROM {table_locations};\").fetchone()\n except Exception as e:\n ...
[ "0.6015041", "0.58723885", "0.55876094", "0.55259997", "0.5499162", "0.5486106", "0.5453105", "0.5433816", "0.5421356", "0.5415281", "0.5394431", "0.5382008", "0.53746563", "0.533978", "0.5334", "0.52532107", "0.5242507", "0.522076", "0.52140063", "0.51504177", "0.51357067", ...
0.78743577
0
Instantiate a connection to the InfluxDB.
def main(temp, humid): user = 'root' password = 'root' dbname = 'iot' dbuser = 'raspberry' dbuser_password = 'password' query = 'select temp_value,humid_value from temp_humid;' json_body = [ { "measurement": "temp_humid", "fields": { "temp_valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def influx_get_conn(self):\n self.influx = InfluxDB(server=self.influx_server,\n user=self.influx_user,\n password=self.influx_password,\n measurement=self.work_group)", "def __init__(self, host: str = None, port: in...
[ "0.7887343", "0.7794341", "0.69363874", "0.6807377", "0.6246872", "0.62306523", "0.6127974", "0.5941498", "0.5867613", "0.58418757", "0.57898223", "0.578923", "0.57755387", "0.57744116", "0.57442695", "0.57235694", "0.57014036", "0.5694867", "0.56927735", "0.5678675", "0.5649...
0.55059016
31
Erase data after N from nonconverged cases
def popUnsetData(self,N): self.r_Vm = self.r_Vm[:N] self.r_Va = self.r_Va[:N]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prune(self, min_count):\n if not self.sorted:\n self.sort()\n for k, count in enumerate(self.Nx):\n if count < min_count:\n self.truncate(k)\n break", "def erase(self, n=1):\n if len(self.x) < n:\n raise IndexError('Does not ...
[ "0.646357", "0.6297699", "0.62723166", "0.62098414", "0.6191153", "0.5985664", "0.59084326", "0.5898871", "0.5756645", "0.57473093", "0.5730065", "0.5730065", "0.570196", "0.56923795", "0.5677832", "0.567084", "0.5667441", "0.56410205", "0.56355375", "0.5633393", "0.56297797"...
0.54882604
28
extracts the event_record attributes, attrs, for serializing to JSON
def set_event_records(self, event_records): self.attrs[EVENT_PROPS['EVENTS']] = event_records
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_record(self, record: etree.ElementTree, name=\"\") -> dict:\n\n out = {}\n for node in record:\n parent = node.tag.split(\"}\")[-1]\n for child in node:\n if parent == \"EventData\":\n event_data_type = child.attrib[\"Name\"]\n ...
[ "0.65319574", "0.6393216", "0.61198676", "0.6083657", "0.60798115", "0.6063593", "0.6010384", "0.59532326", "0.591726", "0.59078485", "0.58384585", "0.5791614", "0.57881117", "0.5783285", "0.57816863", "0.5754394", "0.57268035", "0.5721521", "0.5703069", "0.5657795", "0.56518...
0.0
-1
Get a copy of the default config.
def get_cfg(): return defcfg._assert_and_infer_cfg(defcfg._C.clone())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_config(self):\n return config.read(pathlib.Path(__file__).parent / \"ext.conf\")", "def get_cfg_defaults():\n # Return a clone so that the defaults will not be altered\n # This is for the \"local variable\" use pattern recommended by the YACS repo.\n # It will be subsequently overwritte...
[ "0.78974265", "0.77935153", "0.76726645", "0.7574646", "0.75690144", "0.75503", "0.7538067", "0.7511098", "0.7511098", "0.7499726", "0.7496576", "0.7496576", "0.74924856", "0.7472023", "0.7456844", "0.7384831", "0.7347957", "0.7251256", "0.72320575", "0.7217026", "0.71872216"...
0.0
-1
Expect an upload card to require a rubric.
def test_upload_rubric(db_conn, cards_table): card, errors = UploadCard.insert(db_conn, { 'unit_id': 'RUF531', 'name': 'What is?', 'body': 'Testing 1234', 'file_extensions': ['jpg'], }) assert len(errors) == 1 card, errors = card.update(db_conn, {'rubric': None}) ass...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_recipe_card(self):\n pass", "def test_upload_file_attachment_to_card(self):\n card_values = {\n \"uuid\": \"GLhV7iK2Rm6qyOjbPaHIO9\",\n \"title\": \"title string\",\n \"query\": \"query string\",\n \"answer\": \"answer string\",\n }...
[ "0.57423234", "0.5315777", "0.5236495", "0.51775634", "0.5149817", "0.5031138", "0.5021816", "0.49693483", "0.496643", "0.4949153", "0.49305367", "0.4926277", "0.4878603", "0.4853996", "0.48510283", "0.48437142", "0.48364672", "0.48336953", "0.48271304", "0.48046598", "0.4803...
0.6667272
0
Preprocess the body of an email and return a list of word_indices.
def processEmail(email_contents): # Lower case email_contents = email_contents.lower() # Strip all HTML email_contents = re.sub('<[^<>]+>', ' ', email_contents) # Handle Numbers email_contents = re.sub('[0-9]+', 'number', email_contents) # Handle URLS email_contents = re.sub('(http|https...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_email(email_contents):\n\n # Load Vocabulary\n vocab_list = get_vocab_list();\n\n # Init return value\n word_indices = [];\n\n # ========================== Preprocess Email ===========================\n\n # Find the Headers ( \\n\\n and remove )\n # Uncomment the following lines if you are worki...
[ "0.69000286", "0.6720868", "0.6509217", "0.60303456", "0.5972339", "0.58869916", "0.5762675", "0.55950445", "0.54901445", "0.54876786", "0.54679334", "0.54653746", "0.5457258", "0.5424899", "0.5359242", "0.53550494", "0.5339207", "0.5330621", "0.5314427", "0.53094876", "0.514...
0.6866464
1
returns true if hp below 1
def isDead(self): if self.mCurrentHealthPoints < 1: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_high(speed: dict) -> dict:\n if speed['speed'] >= 100 or speed['speed'] <= 90:\n speed['exceeds'] = True\n else: \n speed['exceeds'] = False\n return speed", "def is_hungry(self):\r\n if self._hunger > 0:\r\n return True\r\n else:\r\n return False...
[ "0.6394273", "0.6379324", "0.6334617", "0.63325095", "0.6306139", "0.6262449", "0.6246168", "0.6151696", "0.60934293", "0.60850996", "0.6081647", "0.605643", "0.6051574", "0.600993", "0.5994793", "0.598496", "0.5956026", "0.59552073", "0.59146523", "0.5862419", "0.58550876", ...
0.5546151
71
Provides a configuration object as a proxy to environment variables.
def cloud_config(): return Namespace( project=os.environ.get('GCLOUD_PROJECT'), storage_bucket=os.environ.get('CLOUD_STORAGE_BUCKET'), client_secrets=os.environ.get('GOOGLE_CLIENT_SECRETS'), bigtable_instance=os.environ.get('BIGTABLE_CLUSTER'), api_key=os.environ.get('API_KEY...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_environment_configuration():\n\n try:\n time_limit = int(os.getenv('AUTOBOT_POST_TIMELIMIT'))\n except TypeError:\n time_limit = None\n\n # if we're using Redis Labs\n redis_cloud_url = os.getenv('REDISCLOUD_URL')\n\n if redis_cloud_url:\n url = urlparse.urlparse(redis_c...
[ "0.6913792", "0.6632904", "0.6505199", "0.64836", "0.64557546", "0.6448321", "0.6439535", "0.6384536", "0.6367771", "0.62930864", "0.6280995", "0.62798774", "0.6240056", "0.62313527", "0.62203234", "0.62180567", "0.62171054", "0.6212888", "0.62036556", "0.6198277", "0.6188177...
0.0
-1
Provides a function that returns the full path to a local or global testing resource
def resource(request): local_path = os.path.dirname(request.module.__file__) return lambda *args: get_resource_path(args, local_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_resource_path(filename, path=Path.TEST):\n return os.path.normpath(os.path.join(path.value, filename))", "def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep", "def _localfile(name):\n return os.path.abspath(resource_filename(__name__, na...
[ "0.7640928", "0.74224883", "0.71623474", "0.7122357", "0.7101687", "0.7064088", "0.7064088", "0.70519364", "0.6972261", "0.6923247", "0.69050664", "0.69025695", "0.68198496", "0.6815445", "0.67917573", "0.6786803", "0.67356884", "0.6678719", "0.6672974", "0.66704315", "0.6656...
0.71467847
3
Initialize the Particle class and populate the attributes
def __init__(self, mass, x, y,px=0.0,py=0.0): self.mass = mass self.position = np.array([x,y]) self.momentum = np.array([px,py])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, particles):\n self.particles = particles", "def __init__(self,particle):\n self.par = particle", "def __init__(self, init_pos_1, init_pos_2, M_1, M_2, spring_cos, equi_len):\n self.p1 = Particle(init_pos_1, M_1)\n self.p2 = Particle(init_pos_2, M_2)\n self....
[ "0.8151925", "0.76764035", "0.7498883", "0.7264336", "0.70335025", "0.69944227", "0.6983767", "0.67723113", "0.67382103", "0.67243445", "0.66816777", "0.66720194", "0.66720194", "0.66509145", "0.653122", "0.6526887", "0.6442973", "0.6428924", "0.63820213", "0.6354695", "0.634...
0.60396993
48
Initialize the ParticleList class and populates the attributes
def __init__(self,nparticles,initial_condition): self.nparticles = nparticles self.particles = np.array([Particle(mass,x,y) for x,y,mass in initial_condition]) self.mass = np.array([self.particles[i].mass for i in range(len(self.particles))]) self.position = np.array([self.particles[i].p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, particles):\n self.particles = particles", "def __init__(self, **attrs):\n \n self.list_id = None\n self.name = None\n self.pieces = None\n \n super().__init__(**attrs)", "def __init__(self,particle):\n self.par = particle", "def __in...
[ "0.75633943", "0.6850366", "0.68004405", "0.67810076", "0.6770565", "0.6679556", "0.6639329", "0.65491843", "0.6426178", "0.6401137", "0.6399527", "0.6399527", "0.63395727", "0.631982", "0.63117814", "0.62981844", "0.6283602", "0.6272043", "0.62669396", "0.6240496", "0.623054...
0.6751339
5
Computes the energy of the system using E = V+0.5mv2
def energy(self): energy = -0.5*np.sum(self.phi)+0.5*np.sum(self.mass*np.sqrt(self.particles.momentum[:,0]**2+self.particles.momentum[:,1]**2)**2) return energy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def V2E(V):\n# for v in m/s returns energy in meV\n return 5.227e-6*V*V", "def energy(self):\n self.E = - np.sum(self.phi) + 0.5 * self.mass * np.sqrt((self.v_x ** 2 + self.v_y **2))", "def E2V(E):\n# for energy in mev returns velocity in m/s\n return sqrt(E/5.227e-6)", "def energy_function(se...
[ "0.818243", "0.7863225", "0.7791894", "0.72778314", "0.7244711", "0.7189924", "0.7175333", "0.7171674", "0.716587", "0.71492624", "0.7112354", "0.71121895", "0.70471144", "0.7022039", "0.68822867", "0.6833997", "0.683354", "0.68059224", "0.67995447", "0.679425", "0.67870885",...
0.68361837
15
Creates a binary tensor to mask out padded tokens.
def get_padding_mask(inputs, padding_value=0): mask = tf.cast(tf.equal(inputs, padding_value), 'float32') mask = mask[:, tf.newaxis, tf.newaxis, :] return mask
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_padding_mask(seq):\r\n seq = tf.cast(tf.math.equal(seq, 0), tf.float32)\r\n return seq[:, tf.newaxis, tf.newaxis, :] # (batch_size, 1, 1, seq_len)\r", "def _get_token_mask(input_ids: Tensor, pad_token_id: int, sep_token_id: int, cls_token_id: int) ->Tensor:\n token_mask = input_ids.eq(pad_to...
[ "0.6809627", "0.65049654", "0.640666", "0.6281229", "0.61530036", "0.60986614", "0.6019729", "0.60120386", "0.59430844", "0.58862317", "0.5885222", "0.58671737", "0.58514863", "0.58341146", "0.5788796", "0.5779334", "0.57363", "0.57341725", "0.5702979", "0.57028997", "0.55628...
0.6002443
8
Creates a tensor to mask out future tokens in the target sequences when in training mode. Given sequence length `L` of target sequence, the mask would be a L x L matrix (when `tf.squeeze`'ed) where upper diagonal entries are ones and all other entries zeros. 0, 1, 1, ..., 1 0, 0, 1, ..., 1 ... ... 0, 0, 0, ..., 0
def get_look_ahead_mask(seq_len): mask = 1 - tf.linalg.band_part(tf.ones([seq_len, seq_len]), -1, 0) mask = mask[tf.newaxis, tf.newaxis, :, :] return mask
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_padding_mask(seq):\r\n seq = tf.cast(tf.math.equal(seq, 0), tf.float32)\r\n return seq[:, tf.newaxis, tf.newaxis, :] # (batch_size, 1, 1, seq_len)\r", "def generate_mask(input_tensor: torch.Tensor, sequence_lengths: torch.LongTensor) -> torch.Tensor:\n assert input_tensor.size()[0] == sequen...
[ "0.7052883", "0.693497", "0.64004403", "0.63831544", "0.63297635", "0.6225015", "0.620793", "0.6206988", "0.61009216", "0.60825855", "0.6067424", "0.6064462", "0.6045257", "0.60053843", "0.60044014", "0.5982106", "0.5982106", "0.59780604", "0.58937943", "0.58751684", "0.57943...
0.6077979
10
adds a customer to legal random position inside a legal random route. creates a new route if no existing route allows the insertion
def random_interroute_insertion(customer, solution, customers): posbyroute = factible_positions_in_routes(customer, solution, customers) #print("posbyroute = ",posbyroute) if posbyroute: nroute,positions = random.choice(posbyroute) ripos = random.choice(positions) solution.routes[nro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_intraroute_insertion(customer, route, customers):\n fpositions = factible_route_positions(customer, route, customers)\n #print(\"customer, factibles = \",customer, fpositions)\n if fpositions:\n npos = random.choice(fpositions)\n route.insert(npos, [customer], customers)\n ...
[ "0.8231294", "0.7513324", "0.73723006", "0.72678983", "0.65585166", "0.6489199", "0.60412884", "0.586483", "0.58647895", "0.5757534", "0.57427156", "0.5673614", "0.563829", "0.55878884", "0.5582253", "0.557682", "0.55274075", "0.5483027", "0.5455102", "0.54441726", "0.5426359...
0.7960228
1
L2normalize columns of X
def l2norm(X): norm = torch.pow(X, 2).sum(dim=1, keepdim=True).sqrt() X = torch.div(X, norm) return X
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def l2_normalize(data, eps, axis=None):\n return cpp.nn.l2_normalize(data, eps, axis)", "def normalize_l2(x):\n return x / (npla.norm(x))", "def L2_normalize(xx):\r\n\tZx = compute_L2_normalization(xx)\r\n\treturn xx / np.sqrt(Zx[:, np.newaxis])", "def normalizeRows(x):\n\n ### YOUR CODE HERE\n #...
[ "0.76127386", "0.74197316", "0.72367084", "0.7202008", "0.7162083", "0.7133827", "0.70338094", "0.69962883", "0.6908121", "0.69054306", "0.6894549", "0.6815722", "0.6789521", "0.6779976", "0.67509", "0.6738499", "0.6678439", "0.66768813", "0.6676479", "0.66763866", "0.665484"...
0.66025686
25
Index of home page.
def index(self): return render_template( 'home_page/index.html', **locals() )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)", "def index():\n return render_template('index.html', title='Home')", "def index():\n\treturn render_template(\"index.html\", title=\"Home\")", "def home():\r\n return render_template...
[ "0.8157105", "0.78858674", "0.787548", "0.7843125", "0.7769308", "0.77631444", "0.77631444", "0.77631444", "0.77631444", "0.77631444", "0.77631444", "0.77631444", "0.77631444", "0.77631444", "0.77631444", "0.7750371", "0.7720239", "0.7710078", "0.770372", "0.76865697", "0.765...
0.81678367
0
Create the table to save the temporary data.
def create_table(self): db = self.connection(database="imdb") try: cur = db.cursor() sql = """ CREATE TABLE film (id INT(3) NOT NULL PRIMARY KEY AUTO_INCREMENT, title VARCHAR(256) NOT NULL COLLATE utf8_spanish2_ci, film_id VARCHA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_table(self):\n pass", "def create_table(self):\n Engine.create_table(self)\n self.connection.commit()", "def createTable(self):\n results = self.db.table_create(self.entity).run(self.r)\n time.sleep(5)\n return results", "def setupTempTables(self):\n ...
[ "0.7651946", "0.75051725", "0.7436246", "0.74257094", "0.73674506", "0.7316724", "0.7307554", "0.7251936", "0.72254014", "0.72110397", "0.71979207", "0.7184281", "0.71350867", "0.71208304", "0.7114393", "0.7096586", "0.70836926", "0.7058", "0.70359695", "0.70239806", "0.70004...
0.0
-1
Format the names of the social media links.
def get_social_media_text(self, site): text = "" if not "Official Site" in site.title(): text = site.replace("Official ", "") else: text = site if len(text) > 20: text = site[:14] + "..." else: text = text return text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_social_link(platform_name, new_social_link):\n # Blank social links should return '' or None as was passed in.\n if not new_social_link:\n return new_social_link\n\n url_stub = settings.SOCIAL_PLATFORMS[platform_name]['url_stub']\n username = _get_username_from_social_link(platform_na...
[ "0.6775797", "0.63959664", "0.60966253", "0.5976239", "0.5945483", "0.59319276", "0.5894225", "0.58596575", "0.58181936", "0.5795494", "0.57625854", "0.57345057", "0.5733078", "0.5668569", "0.565", "0.5602983", "0.55957615", "0.5587727", "0.55729425", "0.55641866", "0.5561068...
0.5628676
15
Initializes the Encoder object and sets internal tokenizer, labelEncoder and vectorizer using predefined objects.
def __init__(self): self.tokenizer = BOWTokenizer( English() ) # the tokenizer must have a tokenize() and parse() function. self.labelEncoder = LabelEncoder() self.vectorizer = CountVectorizer( tokenizer=self.tokenizer.tokenize, ngram_range=(1, 1) ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, encoded_dataset):\n self._encoded_dataset = encoded_dataset\n\n self._model = None\n self._encoder_model = None\n self._encoder_model_inf = None\n self._decoder_model = None\n self._decoder_model_inf = None", "def __init__(self):\n self.scaler =...
[ "0.65088874", "0.64333993", "0.62766093", "0.62723655", "0.6132901", "0.61106724", "0.6048702", "0.60411876", "0.60336655", "0.602059", "0.597665", "0.59699106", "0.5961293", "0.59396935", "0.5939479", "0.5930837", "0.5894931", "0.5875051", "0.5871842", "0.58693564", "0.58468...
0.7767875
0
Plot top 20 global importances as a matplotlib bar graph.
def plot_global_imp(top_words, top_importances, label_name): plt.figure(figsize=(14, 7)) plt.title("most important words for class label: " + str(label_name), fontsize=18) plt.bar(range(len(top_importances)), top_importances, color="r", align="center") plt.xticks(range(len(top_importances)), top_words, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_importance(tree, X_tr, top_n=10, figsize=(10,10), ax=None):\n \n import pandas as pd\n import matplotlib as plt\n\n imps = pd.Series(tree.feature_importances_,index=X_tr.columns)\n imps.sort_values(ascending=True).tail(top_n).plot(kind='barh',figsize=figsize, ax=ax)\n return imps", "de...
[ "0.71347415", "0.6907322", "0.6694443", "0.6602972", "0.65203667", "0.6492253", "0.63695943", "0.6333636", "0.626248", "0.61815345", "0.6181005", "0.61441827", "0.6117215", "0.6110321", "0.6057258", "0.6045679", "0.60412174", "0.6034102", "0.602863", "0.6022999", "0.59796417"...
0.7388565
0
Get the background color.
def bgColor(self): return self.__bgColor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def background_color(self):\n return Color(self.GetBackground())", "def GetBackgroundColour(self):\r\n\r\n return self._colBack", "def getBgColor(self):\n return self.bgColor", "def background_color(self):\n return rgba(self.value_of_css_property('background-color'))", "def get_...
[ "0.8666513", "0.84349257", "0.83671486", "0.82855195", "0.8220778", "0.8178541", "0.81747925", "0.81653947", "0.79874694", "0.76303697", "0.73987234", "0.736256", "0.7220804", "0.71943396", "0.7032753", "0.6994534", "0.69483584", "0.6942862", "0.69400954", "0.68967015", "0.68...
0.81831443
5
Rotation about the yaxis.
def roty(t): c = np.cos(t) s = np.sin(t) return np.array([[c, 0, s], [0, 1, 0], [-s, 0, c]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rot_y_deg(self):\n # TODO describe which axis this is\n return math.degrees(self._rot_y_rad)", "def rot_y_rad(self):\n return self._rot_y_rad", "def rotation_center_y(self, *args, **kwargs) -> Any:\n pass", "def rotate_y(self, angle):\n angle *= np.pi / 180\n ret...
[ "0.75396633", "0.7354722", "0.7102622", "0.7064357", "0.7036538", "0.6986756", "0.6895528", "0.6895528", "0.68484044", "0.68028474", "0.6717387", "0.66640604", "0.66279566", "0.6614649", "0.658053", "0.6575346", "0.6554816", "0.6505504", "0.63935125", "0.6393029", "0.63855916...
0.0
-1
Transforation matrix from rotation matrix and translation vector.
def transform_from_rot_trans(R, t): R = R.reshape(3, 3) t = t.reshape(3, 1) return np.vstack((np.hstack([R, t]), [0, 0, 0, 1]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transformation_matrix(self):\n t = np.array([[0.0], [0.0], [0.0]])\n Rt = np.hstack([self.rotation_matrix, t])\n return np.vstack([Rt, np.array([0.0, 0.0, 0.0, 1.0])])", "def rotation_to_transformation_matrix(R):\n R = Matrix(R)\n T = R.col_insert(3, Matrix([0., 0., 0.]))\n T = ...
[ "0.77170056", "0.7399434", "0.7178414", "0.7170596", "0.70914817", "0.70642626", "0.696672", "0.69636685", "0.6960209", "0.69518274", "0.6869197", "0.6853872", "0.6838569", "0.68219584", "0.6796785", "0.67959565", "0.675783", "0.6752801", "0.6735544", "0.67316866", "0.6726265...
0.6602867
32
Constructs an ELAConvexity instance from samples on the spheroid. We made this a fixture because building ELAConexity requires some computation, so we want to reuse a single instance in different tests.
def spheroid_convex(): problem, representation, initial_sample = spheroid_sample() return exploratory.ELAConvexity(problem, representation, design_individuals=initial_sample)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cvae_init(self):\n torch.manual_seed(0)\n cvae = VAE(\n in_dim=20,\n nb_classes=2,\n latent_dim=16,\n p_dropout=0.1,\n hidden_dims=[64, 32])\n rng = np.random.default_rng(seed=0)\n x = torch.tensor(rng.random(size=(10, 20))...
[ "0.5674476", "0.5449792", "0.54216564", "0.5369581", "0.5343131", "0.52247494", "0.51225173", "0.5116834", "0.5092648", "0.50826824", "0.50825614", "0.50784045", "0.5073955", "0.5020647", "0.50144583", "0.5005413", "0.5001476", "0.49879295", "0.4982558", "0.49372545", "0.4934...
0.5622399
1
Post a new license to server.
def set_license(self, license_code: str) -> PrivXAPIResponse: response_status, data = self._http_post( UrlEnum.LICENSE.LICENSE, body=license_code, ) return PrivXAPIResponse(response_status, HTTPStatus.OK, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fusion_api_add_license(self, key=None, license_type='LicenseV500', api=None, headers=None):\n return self.license.add(key, license_type, api, headers)", "def put(self, license_handler):\n\n full_license = request.data\n return license_handler.upload_license(full_license)", "def upl...
[ "0.68740165", "0.6844653", "0.66234815", "0.62756926", "0.6235217", "0.59233356", "0.5894067", "0.5761338", "0.57092166", "0.56992424", "0.56577927", "0.5644367", "0.55981666", "0.5587379", "0.5577571", "0.5554993", "0.5531332", "0.55020803", "0.54849863", "0.548382", "0.5478...
0.62644726
4
Randomly distort image color space. Note that input image should in original range [0, 255].
def random_color_distort(src, brightness_delta=32, contrast_low=0.5, contrast_high=1.5, saturation_low=0.5, saturation_high=1.5, hue_delta=18): def brightness(src, delta, p=0.5): """Brightness distortion.""" if np.random.uniform(0, 1) > p: delta = np.random.uniform(-delta, delt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distort_image(image):\n # Randomly flip horizontally.\n with tf.name_scope(\"flip_horizontal\", values=[image]):\n image = tf.image.random_flip_left_right(image)\n\n # Randomly distort the colors based on thread id.\n with tf.name_scope(\"distort_color\", values=[image]):\n image = tf.image.random_br...
[ "0.7806559", "0.75968546", "0.7242593", "0.7211814", "0.7204796", "0.7056448", "0.7042595", "0.66784173", "0.6532393", "0.64647716", "0.6401893", "0.62900025", "0.62878233", "0.62242717", "0.62177587", "0.61877227", "0.6179446", "0.6047737", "0.60366285", "0.60033065", "0.598...
0.7415471
2
Returns the maximumlikelihood value for a given distribution.
def _graph_fn_sample_deterministic(self, distribution): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_log_likelihood(data):\n # Assume data is given as counts\n tot = sum(data)\n return _np.sum([nlogp(n, n / tot) for n in data if n > 0])", "def get_max_density(self):\n max_density = str(self.density.index(min(self.density)) + 1)\n print(max_density)\n return max_density", ...
[ "0.68265", "0.6406084", "0.63737065", "0.63534325", "0.63278127", "0.6292287", "0.6234873", "0.62300104", "0.6211527", "0.62027836", "0.6192052", "0.61727816", "0.61626166", "0.6148021", "0.61345285", "0.6101004", "0.6087676", "0.60696423", "0.606561", "0.60493815", "0.603168...
0.0
-1
Returns an actual sample for a given distribution.
def _graph_fn_sample_stochastic(distribution): return distribution.sample()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_sample(self):\n mu = self._get_mean()\n sample = self.random.normal(mu)\n return sample", "def sample_one(self):\n # x = self.mean + self.sigma * np.random.normal()\n x = self.dist.sample(1)\n return x", "def _get_sample(self):\n mu = self._get_mean().r...
[ "0.7350696", "0.7093008", "0.6980355", "0.69725186", "0.6932983", "0.6876551", "0.6872172", "0.68304807", "0.6765704", "0.6735336", "0.67154396", "0.6671825", "0.6667177", "0.663109", "0.6594111", "0.65872115", "0.65808773", "0.6554112", "0.65446943", "0.654159", "0.6516709",...
0.6631885
13
Creates and fills self._dictionary, which is a dictionary representation of the commute.
def _build_directions(self): d = {'start': self.get_start(), 'end': self.get_end(), 'duration': self.get_duration(), 'mode': self.get_primary_mode(), 'price_range': self.get_price_range(), 'legs': self.get_legs(), 'start_location': self.get_start_location(), 'end_location': self.get_en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createDictionary(self):\n\t\tdictionary: dict = {}\n\t\tdictionary.update({'deckname': self.mDeckName})\n\t\tdictionary.update({'filename': self.autoFilename})\n\t\tdictionary.update({'creatorname': str(self.mCreatorname)})\n\t\tdictionary.update({'maxAttrPoints': str(self.mMaxAttributePoints)})\n\t\tminionLis...
[ "0.6262795", "0.5879528", "0.58333373", "0.5807364", "0.5798142", "0.5507694", "0.5464662", "0.5443628", "0.54146373", "0.5386267", "0.5384996", "0.5384996", "0.5384996", "0.5384996", "0.5384996", "0.5384996", "0.5384996", "0.5384996", "0.5384996", "0.5384996", "0.5375297", ...
0.0
-1
Returns a copy of this field with `values` replaced.
def with_values(self, values): raise NotImplementedError(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n new = self.__class__()\n new.values = self.values.copy()\n return new", "def values(self) -> 'ValuesView[str]':\n return _EntityFixupValues(self)", "def replace(self, **kwargs) -> FactorValuesMetadata:\n if not kwargs:\n return self\n return replace(se...
[ "0.6695092", "0.65171164", "0.61321795", "0.61242884", "0.6068073", "0.5991824", "0.59741527", "0.59487116", "0.5936098", "0.5930633", "0.59246707", "0.59130245", "0.58371353", "0.5800162", "0.5759411", "0.5759329", "0.56549186", "0.56384355", "0.5634687", "0.56239754", "0.56...
0.55180717
35
Returns a copy of this field with `values` replaced.
def with_extrapolation(self, extrapolation: math.Extrapolation): raise NotImplementedError(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n new = self.__class__()\n new.values = self.values.copy()\n return new", "def values(self) -> 'ValuesView[str]':\n return _EntityFixupValues(self)", "def replace(self, **kwargs) -> FactorValuesMetadata:\n if not kwargs:\n return self\n return replace(se...
[ "0.66949177", "0.65186954", "0.6131189", "0.6125315", "0.60666317", "0.5990924", "0.5973108", "0.5949107", "0.59350127", "0.59302676", "0.5924709", "0.5913019", "0.58377033", "0.5799566", "0.5761395", "0.5761319", "0.56543136", "0.56389046", "0.5633458", "0.56255406", "0.5603...
0.0
-1
Test legend fails with invalid spec.
def test_legend_fails(): fig = Figure() with pytest.raises(GMTInvalidInput): fig.legend(spec=["@Table_5_11.txt"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_manual_legend_uneven_colors():\n with pytest.raises(YellowbrickValueError, match=\"same number of colors as labels\"):\n manual_legend(None, (\"a\", \"b\", \"c\"), (\"r\", \"g\"))", "def test_manual_legend(self):\n # Draw a random scatter plot\n random = np.random.RandomState(42)...
[ "0.7953644", "0.6784159", "0.64998466", "0.6459292", "0.6446849", "0.63817906", "0.63687044", "0.62606883", "0.620925", "0.6184597", "0.613788", "0.6127688", "0.6118682", "0.6116525", "0.6108895", "0.60786223", "0.6070676", "0.60605836", "0.6058303", "0.6049167", "0.6018263",...
0.8527874
0
Check whether values in array are constant. Params a Array to check axis Axis to reduce over. Returns Boolean array, True values were constant. Example >>> a = np.array([[0, 1], [0, 0]]) >>> a array([[0, 1], [0, 0]]) >>> is_constant(a) False >>> is_constant(a, axis=0) array([ False, True]) >>> is_constant(a, axis=1) ar...
def is_constant(a, axis=None) -> np.ndarray: raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_constant(x):\n x = np.array(x)\n result = np.all(x == x[1])\n return result", "def _confirm_constant(a):\n a = np.asanyarray(a)\n return np.isclose(a, 1.0).all(axis=0).any()", "def is_not_constant(series: np.ndarray) -> bool:\n #print(\"enter bartpy/bartpy/data.py is_not_constant\")\n ...
[ "0.7417353", "0.6946154", "0.6737074", "0.6475178", "0.6028018", "0.5893941", "0.5726526", "0.56684655", "0.563", "0.56209356", "0.55871564", "0.5487328", "0.54707575", "0.5452444", "0.54463303", "0.54052454", "0.5336649", "0.5231586", "0.5226835", "0.5225464", "0.5207589", ...
0.8230769
0
Returns a color triplet. Note that if total is not set then it is assumed to be one. N is described as the ratio of the value to get a color for out of the total number of possible values.
def getColor(n, total = 255, decimal = False): value = round(255*n/(total * 1.0)) #red value if value < 96: red = 0 elif value < 160: red = 255/((160 - 96)*1.0) * (value - 96) elif value < 224: red = 255 else: red = 255 - ((255 - 128)/((255 - 224) * 1.0) * (valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_colors(n):\n color = cm.rainbow(np.linspace(0, 1, n))\n return color", "def uniquecolors(n):\n hues = [360.0 / n * i for i in range(n)]\n hs = [math.floor(hue / 60) % 6 for hue in hues]\n fs = [hue / 60 - math.floor(hue / 60) for hue in hues]\n return [('rgb({}%, {}%, {}%)'.format(*tupl...
[ "0.6254767", "0.59971505", "0.5807549", "0.5793174", "0.5685378", "0.5594444", "0.55571234", "0.5499247", "0.5452345", "0.5443408", "0.53519994", "0.534216", "0.53199655", "0.5287709", "0.5270011", "0.52456415", "0.5226129", "0.52253085", "0.5205423", "0.5204298", "0.5203638"...
0.6675938
0
Yield new Redditors as they are created. Redditors are yielded oldest first. Up to 100 historical Redditors will initially be returned.
def stream(self, **stream_options): return stream_generator(self.new, **stream_options)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n return self.new_generator()", "def iterator(self):\n yield", "def __iter__(self):\n for r in self.cursor:\n yield r", "def __iter__(self):\n buff = self.__buffer\n buff_size = self.__buffer_size\n\n # Create iterators\n readers...
[ "0.5600441", "0.54892206", "0.5480385", "0.54428196", "0.54060733", "0.5289301", "0.52856016", "0.52300197", "0.52239954", "0.519066", "0.5168481", "0.5152806", "0.5151495", "0.5137031", "0.5136154", "0.5117704", "0.50797397", "0.50537884", "0.50330484", "0.50230825", "0.5017...
0.0
-1
Given a forcefield name, it returns the corresponding force field class.
def get_by_name(self, forcefield_name): from peleffy.utils import Logger log = Logger() log.info(' - Loading \'{}\''.format(forcefield_name)) from .forcefield import (OpenForceField, OPLS2005ForceField) if forcefield_name.upper() in self._FF_TYPES['OPLS2005']: retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_field_class_name(field):\n return field.capitalize() + \"Field\"", "def get_field(self, field_name):\n for f in self.fields:\n if f.name.lower() == field_name.lower():\n return f\n return None", "def get_field_type(self, table_name, field_name):\n \...
[ "0.75279593", "0.62375474", "0.61091673", "0.6037874", "0.60087", "0.59710765", "0.5961296", "0.59305394", "0.5912571", "0.5811508", "0.5786734", "0.57716495", "0.57634115", "0.5753939", "0.5746518", "0.5688187", "0.5675136", "0.566677", "0.55470085", "0.5542229", "0.5536063"...
0.67151564
1
Takes in string and returns concatenated string capitalized.
def question_2(name: str) -> str: return "Hello my name is" + " " + name.capitalize()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capitalcase(string):\n\n string = str(string)\n if not string:\n return string\n return uppercase(string[0]) + string[1:]", "def capify(text):\n return text[0].upper() + text[1:]", "def uppercase(string):\n\n return str(string).upper()", "def capitalize1(s):\n return s[:1].upper(...
[ "0.84924567", "0.8113152", "0.8068438", "0.8057468", "0.80443716", "0.7968445", "0.791916", "0.7905979", "0.78887635", "0.78209317", "0.78107154", "0.7803645", "0.77984697", "0.7692015", "0.76811326", "0.7672464", "0.7600253", "0.7555346", "0.7536399", "0.752437", "0.75082713...
0.0
-1
Takes in string and returns concatenated and capitalized string.
def question_4(name: str) -> str: return "My first name is" + " " + name.capitalize()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capitalcase(string):\n\n string = str(string)\n if not string:\n return string\n return uppercase(string[0]) + string[1:]", "def camelcase(string):\r\n return ''.join(word.capitalize() for word in string.split('_'))", "def capify(text):\n return text[0].upper() + text[1:]", "def camel...
[ "0.8376618", "0.81569207", "0.81537294", "0.804704", "0.79866505", "0.790669", "0.78829646", "0.7880647", "0.7869899", "0.78662294", "0.7855617", "0.77627003", "0.7731298", "0.7694619", "0.7675043", "0.7616351", "0.7598102", "0.75338566", "0.751582", "0.750458", "0.7475985", ...
0.6528027
98
Takes a string and returns the indices of the string that are upper case.
def question_8(upper_string: str) -> str: newString = [] for i,n in enumerate(upper_string): if n.isupper(): newString.append(str(i)) return newString
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_upper(s, start):\n for i in range(start, len(s)):\n if s[i].isupper():\n return i\n return i", "def upper(string):\n new_string = '' # Empty string to append to\n for char in string: # Itterate over each character in user's string\n if char.isalph...
[ "0.6989697", "0.66698426", "0.653121", "0.6494432", "0.646334", "0.6422587", "0.6405261", "0.640454", "0.6333351", "0.6332599", "0.6314462", "0.62402123", "0.62179536", "0.6163403", "0.6138334", "0.6088865", "0.60722023", "0.6067895", "0.60664636", "0.6060052", "0.6050253", ...
0.7523635
0
Takes in a string and returns indices of string that are white spaces.
def question_9(white_string: str) -> str: newString = [] for i,n in enumerate(white_string): if n.isspace(): newString.append(str(i)) return newString
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def words_before_index(text, idx):\n while text[idx] != ' ':\n idx -= 1\n if idx <= 0:\n return 0\n n_words = len(text[:idx].split(' '))\n return n_words", "def word_index_separator(input_str_ws):\r\n\r\n word_index_list = []\r\n\r\n \"\"\" Loops over matches for words in input st...
[ "0.6125475", "0.6071096", "0.6051752", "0.59823704", "0.5952095", "0.5894559", "0.58822626", "0.5846883", "0.58357286", "0.58220774", "0.58203346", "0.5776943", "0.57390887", "0.5646249", "0.56109494", "0.5610846", "0.55821043", "0.5569512", "0.55279386", "0.55090076", "0.549...
0.69405186
0
Takes in a string and returns the number of integers in the string.
def question_11(int_string: str) -> int: counter = 0 for i in int_string: if i.isdigit(): counter += 1 else: continue return counter
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def length(s: str) -> int:\n count = 0\n for i in s:\n count += 1\n return count", "def count_numeric(word):\n\n alpha = re.compile(r'[0-9]')\n return len(alpha.findall(word))", "def getNumFromString(self, string):\n \n m = re.search(r'\\d+$', string)\n if m is not None:\...
[ "0.7614991", "0.7358148", "0.7267945", "0.71766126", "0.71427506", "0.68485665", "0.67694473", "0.66365975", "0.6594914", "0.65847486", "0.6541153", "0.6512332", "0.64831215", "0.64235836", "0.64203525", "0.6414196", "0.636026", "0.6338791", "0.6329311", "0.6316897", "0.63151...
0.7982146
0
Takes in two strings and capitalizes and concatenates them.
def question_13(one_string: str, two_string: str) -> str: return one_string.capitalize() + two_string.capitalize()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capitalize(result):\n\treturn result.upper()", "def capify(text):\n return text[0].upper() + text[1:]", "def capitalize(self) -> String:\n pass", "def test_capitalize(self):\n self.assertEqual(\n minerals_extras.capitalize('mohs scale hardness'),\n 'Mohs Scale Hardness'...
[ "0.67545193", "0.66896164", "0.65714496", "0.6571116", "0.6464473", "0.63771963", "0.6362848", "0.6351783", "0.6309394", "0.63056105", "0.62811047", "0.6255931", "0.6244889", "0.62079376", "0.6092871", "0.6059816", "0.6056787", "0.6038268", "0.5982098", "0.5965452", "0.594690...
0.7610796
0
Takes in a string and replaces spaces with "_"
def question_14(replace_string: str) -> str: return replace_string.replace(" ", "_")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def underscore(text):\n # return '__'+text.replace(' ','__') + '__'\n return text.replace(' ', '__')", "def unscorize(s):\n return s.replace(\" \", \"_\")", "def descorize(s):\n return s.replace(\"_\", \" \")", "def sanitize(s):\n s = s.replace(\"_\", \"\\\\_\")\n return s", "def undersco...
[ "0.81255126", "0.80963784", "0.8082687", "0.79903233", "0.77434295", "0.7638784", "0.7541411", "0.7540998", "0.7529884", "0.7472024", "0.7378311", "0.7217187", "0.72070265", "0.71977353", "0.71958154", "0.71171665", "0.70826876", "0.7054959", "0.7019377", "0.7005306", "0.6965...
0.7770015
4
Takes in list of numbers and returns cumulative sum.
def question_26(list_num: int) -> int: return sum(list_num)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cumulative_sum(x):\n total = 0\n sum = []\n for num in x:\n total += num\n sum.append(total)\n return sum", "def cumulative_sum(self, lis):\n new_list = []\n for i in range(len(lis)):\n if i == 0:\n new_list.append(lis[i])\n else:\n new_list.append(new_...
[ "0.8249477", "0.81865704", "0.7922655", "0.7742116", "0.7725541", "0.77142954", "0.76589763", "0.76186985", "0.75917375", "0.68407255", "0.6829347", "0.681542", "0.6781739", "0.6707773", "0.65918344", "0.65918344", "0.65918344", "0.65596986", "0.65099907", "0.6480784", "0.643...
0.0
-1
A recursive function that returns F[n1] F[n2] F[n3] ... 2 1
def question_29(x: int) -> int: # Base case below: if x == 0: return 1 # Recursive function below: else: result = 1 while x > 0: for i in range(x): result *= question_29(i) x -= 1 return result * 2 * 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repeated(f, n, x):\n if n == 1:\n return f(x)\n else:\n return repeated(f,n-1,f(x))", "def fn(n):\n if n == 0: return 1\n return sum(fn(i)*fn(n-i-1) for i in range(n))", "def fn(n):\n if n == 1: return 1\n return max(max(i, fn(i))*max(n-i, fn(...
[ "0.7553268", "0.72917557", "0.7189128", "0.7134301", "0.7091986", "0.7055933", "0.704876", "0.7040265", "0.7040265", "0.7040265", "0.7040265", "0.7040206", "0.70333666", "0.7009656", "0.70039773", "0.6970976", "0.69687927", "0.6959997", "0.6956929", "0.6956182", "0.69464564",...
0.0
-1
Returns the minimax action using self.depth and self.evaluationFunction
def getAction(self, gameState): "*** YOUR CODE HERE ***" def maxvalue(gameState, alpha, beta, depth): if gameState.isWin() or gameState.isLose() or depth == 0: return self.evaluationFunction(gameState) v = -(float("inf")) legalActions = gameState.getLegalActions(0) fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = minimax(self.evaluationFunction, 1, 0,\n gameState.generateSuccessor(0, move), self.depth)\n if util > _max o...
[ "0.748369", "0.7383896", "0.7181745", "0.71096647", "0.7087986", "0.7069122", "0.70682377", "0.7047898", "0.7004913", "0.69652057", "0.69639593", "0.6961861", "0.6945518", "0.6898887", "0.68955636", "0.6885638", "0.6827023", "0.67669904", "0.67572993", "0.6753353", "0.6707042...
0.0
-1
Get values in given row
def getColVals(self, col=None, include_nones=None): if col is None or col < 1 or col > self.nCol: raise SelectError(f"bad col number {col}") vals = [] for ri in range(self.nRow): row = ri + 1 val = self.getCellVal(row=row, col=col) if incl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_xls_row_vals(self, row):\n return [v.value for v in row]", "def getRow(self, row):\n returnvalue = list()\n for item in self._value[row]:\n returnvalue.append(item)\n return returnvalue", "def getRowVals(self, row=None, include_nones=None): # Returns: row v...
[ "0.7788967", "0.7715673", "0.7522421", "0.70046425", "0.69242394", "0.68914175", "0.6771282", "0.66786325", "0.66675425", "0.6621923", "0.6564237", "0.6481568", "0.6365205", "0.63382363", "0.6327802", "0.63240176", "0.6314559", "0.62858087", "0.62832344", "0.62670594", "0.625...
0.0
-1
Get values in given row
def getRowVals(self, row=None, include_nones=None): # Returns: row values if row is None or row < 1 or row > self.nRow: raise SelectError(f"bad row number :{row}") vals = [] for ci in range(self.nCol): col = ci + 1 val = self.getCellVal(row=row...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_xls_row_vals(self, row):\n return [v.value for v in row]", "def getRow(self, row):\n returnvalue = list()\n for item in self._value[row]:\n returnvalue.append(item)\n return returnvalue", "def obtenerValoresItem(self,row):\n values=[]\n for col in r...
[ "0.7788967", "0.7715673", "0.70046425", "0.69242394", "0.68914175", "0.6771282", "0.66786325", "0.66675425", "0.6621923", "0.6564237", "0.6481568", "0.6365205", "0.63382363", "0.6327802", "0.63240176", "0.6314559", "0.62858087", "0.62832344", "0.62670594", "0.6252447", "0.622...
0.7522421
2
Returns an object representing the parameters for delay in tau units. Optional is_rise refers to the input direction rise/fall. Input inverted by this stage.
def get_stage_effort(self, cout, inp_is_rise=True): parasitic_delay = 2 return logical_effort(self.name, self.size, self.input_load(), cout, parasitic_delay, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTimeDelay(*args):\n return args[0].TimeState.TimeDelay.time_delay", "def mv_delay(self):\n return self._TERRAINS[self.terrain]['delay']", "def delay(self):\r\n p_shape = self.phase.shape[:-1]\r\n delay = np.zeros(self.phase.shape)\r\n for i in range(p_shape[0]):\r\n ...
[ "0.56587124", "0.56357163", "0.5515059", "0.54345447", "0.54345447", "0.5225596", "0.52071196", "0.51973397", "0.51346165", "0.51217854", "0.51090086", "0.50976014", "0.5067151", "0.5058692", "0.50055873", "0.50053173", "0.49821112", "0.49582136", "0.49284464", "0.4912795", "...
0.55190593
2
Fixture for mocking a failed login response from the api.
def mock_api_stage_fail_login() -> str: return DUMMY_LOGIN_RESPONSE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_login_failure(self):\n # register a user\n register_user(self, 'some', 'name', 'the@user.com', 'aaaAAA111')\n\n # test logging in failure of a registered user - wrong password\n with self.client:\n response = login_user(self, 'the@user.com', 'Pa4s283dDI!')\n ...
[ "0.76499224", "0.7500309", "0.72704345", "0.72321296", "0.7152635", "0.7053956", "0.7031776", "0.698945", "0.6973733", "0.6967048", "0.6959513", "0.6957654", "0.6957168", "0.692365", "0.68877274", "0.6882646", "0.68821305", "0.6867525", "0.68616915", "0.68381995", "0.683549",...
0.73627293
2
Fixture for mocking a success delete_schedule response from the api.
def mock_api_stage_success_delete_schedule() -> List[bytes]: return create_standard_packets_list(DUMMY_DELETE_SCHEDULE_RESPONSE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_schedule(self):\n response = self.client.open('/v1/schedule/{id}'.format(id=56),\n method='DELETE',\n content_type='application/json')\n self.assert200(response, \"Response body is : \" + response.data.decode('utf-8...
[ "0.789829", "0.6660969", "0.65979946", "0.653018", "0.64081895", "0.63846886", "0.63472563", "0.634404", "0.6324087", "0.631111", "0.6307303", "0.62794805", "0.6277149", "0.6268479", "0.62635225", "0.6249147", "0.62400526", "0.6206919", "0.61865485", "0.6173116", "0.6162636",...
0.73445493
1
Decode JSON data from a file.
def read_json(filepath: str): if not filepath: raise ValueError if not os.path.isfile(filepath): raise FileNotFoundError with open(filepath) as f: return json.load(f)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_json(file):\n with open(file, \"r\") as fid:\n return json.load(fid)", "def read_json(f):\n with open(f, \"r\") as fin:\n return json.loads(fin.read())", "def json_loader(filename):\n\n with open(filename, \"r\", encoding=\"UTF-8\") as source:\n data = json.load(s...
[ "0.7370777", "0.72599494", "0.7218291", "0.7192138", "0.7181873", "0.7158256", "0.7151527", "0.71475995", "0.710816", "0.7096995", "0.70958143", "0.70931727", "0.7082482", "0.7067956", "0.7067956", "0.70648223", "0.70586675", "0.7053357", "0.70497954", "0.7049261", "0.7045552...
0.0
-1
add a shadow to the objectPath, which is cast on the groundPath from the lightPos
def objectShadowClass( objectPath, groundPath ): # define the source position of the light, relative to the objectPath lightPos = Vec3( 0,0,100 ) # add shadows to the object sc = ShadowCasterClass(objectPath, groundPath, lightPos) from direct.task import Task import math d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __generate_shadows(self):\n glEnable(GL_POLYGON_OFFSET_FILL)\n glPolygonOffset(3, 0)\n self.__sh.change_shader(vertex=1, fragment=1)\n\n light = self.__face.directed_light_cartesian\n self.__light_matrix = self.__get_rotation_matrix(\n (light[0], light[1], -light[2...
[ "0.61753106", "0.59453595", "0.57761776", "0.57689416", "0.5681264", "0.5530153", "0.5378886", "0.5323586", "0.52430755", "0.52162254", "0.51669246", "0.5121335", "0.5096632", "0.50839525", "0.5079446", "0.50744843", "0.50493586", "0.4981658", "0.4980569", "0.4941107", "0.493...
0.7056805
0
Complement to encode_model_instance that returns None instead of raising an error.
def decode_model_instance(hashid): try: return get_encoded_object_or_404(hashid).obj except Http404: # pragma: no cover return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _encode_nullable(data_type, obj, alias_validators, old_style, for_msgpack):\n if obj is not None:\n return _json_compat_obj_encode_helper(\n data_type.validator, obj, alias_validators, old_style, for_msgpack)\n else:\n return None", "def test_serialize_none(self):\n self...
[ "0.61686605", "0.5796278", "0.56402856", "0.56364673", "0.55870956", "0.55764633", "0.5556989", "0.5553797", "0.54717404", "0.5464645", "0.5401648", "0.5378851", "0.53758466", "0.53659433", "0.5302316", "0.526212", "0.5244107", "0.5244107", "0.52436095", "0.5223933", "0.52228...
0.5242756
19
given a sklearn confusion matrix (cm), make a nice plot Arguments
def plot_confusion_matrix(cm, target_names, title='Confusion matrix', cmap=None, normalize=True): import matplotlib.pyplot as plt import numpy as np import itertools accuracy = np.trace(cm) / float(n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, class_names):\n figure = plt.figure(figsize=(10, 10))\n plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)\n plt.title(\"Confusion matrix\")\n plt.colorbar()\n tick_marks = np.arange(len(class_names))\n plt.xticks(tick_marks, class_names, rotation=45)\n plt.yticks(tick_...
[ "0.79997694", "0.79955804", "0.7947871", "0.79360676", "0.79129595", "0.7897813", "0.7879448", "0.786082", "0.786082", "0.78540397", "0.78501374", "0.78499055", "0.78404397", "0.7835427", "0.7828328", "0.78253037", "0.78049725", "0.78017557", "0.77822274", "0.77789044", "0.77...
0.0
-1
In RPN generation metric computation is happening for all valid anchor boxes, so it is done beforehand in this decorator PositiveOverlapMetric is a part of IoU metric. It is computed as a ratio of intersection area to positive region area (groundtruth box)
def create_pos_overlap_metric(anchor_boxes): y, x, h, w = np.transpose(anchor_boxes) y0 = y - h // 2 x0 = x - w // 2 y1 = y + h // 2 x1 = x + w // 2 def pos_overlap(gt_boxes): pos_overlaps = [] for gt_box in gt_boxes: gt_y0, gt_x0, gt_y1, gt_x1 = gt_box g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_overlap_metric(anchor_boxes):\n y, x, h, w = np.transpose(anchor_boxes)\n ab_area = w * h\n y0 = y - h // 2\n x0 = x - w // 2\n y1 = y + h // 2\n x1 = x + w // 2\n\n def overlap(gt_boxes):\n overlaps = []\n for gt_box in gt_boxes:\n gt_y0, gt_x0, gt_y1, gt_x...
[ "0.6898491", "0.60279834", "0.5950397", "0.59494156", "0.59282064", "0.5918695", "0.5918695", "0.58001614", "0.5778973", "0.5770592", "0.57698", "0.5685143", "0.5662844", "0.55979794", "0.5583038", "0.5565804", "0.55396116", "0.55107677", "0.5501091", "0.5501091", "0.5501091"...
0.72464293
0
In RPN generation metric computation is happening for all valid anchor boxes, so it is done beforehand in this decorator IoU is computed as a ratio of intersection area to a regions union area
def create_iou_metric(anchor_boxes): y, x, h, w = np.transpose(anchor_boxes) ab_areas = w * h y0 = y - h // 2 x0 = x - w // 2 y1 = y + h // 2 x1 = x + w // 2 def iou(gt_boxes): ious = [] for gt_box in gt_boxes: gt_y0, gt_x0, gt_y1, gt_x1 = gt_box gt_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_iou(prediction_box, gt_box):\n if is_overlapping(prediction_box, gt_box):\n overlap_box = get_overlap_box(prediction_box, gt_box)\n\n intersection = calculate_box_area(overlap_box)\n pred_box_area = calculate_box_area(prediction_box)\n gt_box_area = calculate_box_area(g...
[ "0.7523569", "0.70970964", "0.70970964", "0.70970964", "0.70796466", "0.7037793", "0.7024696", "0.6924886", "0.6875484", "0.6757385", "0.6744039", "0.672848", "0.6723848", "0.67069244", "0.6636492", "0.6629832", "0.6625173", "0.6615796", "0.6597809", "0.65896064", "0.65896064...
0.72829145
1
Take an array of masstocharge ratio, generate mass spec.
def gen_mass_spec(self, mz_lst, bin_num=20000): # m2z is from [MZ_MIN, MZ_MAX], with bin_num bins. Note its length is len(hist) + 1 # intensity: counts from samples in that bin. self.intensity, self.m2z = np.histogram(mz_lst, bins=bin_num, range=(MZ_MIN, MZ_MAX))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_mass(self):\n self.assertEqual(get_element_mass(1), (1.00782503224, 1)) # test input by integer\n self.assertEqual(get_element_mass('Si'), (27.97692653465, 14)) # test string input and most common isotope\n self.assertEqual(get_element_mass('C', 13), (13.00335483507, 6)) # test...
[ "0.59702414", "0.5933389", "0.58391374", "0.57915306", "0.57772094", "0.57390416", "0.5714326", "0.5702137", "0.5679425", "0.561596", "0.5615728", "0.5588039", "0.5551463", "0.55431175", "0.5465612", "0.5447286", "0.5436856", "0.53830236", "0.53635836", "0.53346723", "0.53262...
0.490757
77
Checks that a given object is an RNNCell by using duck typing.
def _like_rnncell(cell): conditions = [hasattr(cell, "output_size"), hasattr(cell, "state_size"), hasattr(cell, "zero_state"), callable(cell)] return all(conditions)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _isinstance(self, obj, raise_error=True):\n rv = isinstance(obj, self.__model__)\n if not rv and raise_error:\n raise ValueError('%s is not of type %s' % (obj, self.__model__))\n return rv", "def do_type_checking(self, node):\r\n\r\n if not isinstance(node.inputs[0].typ...
[ "0.6029004", "0.56598824", "0.56549186", "0.5630616", "0.5591765", "0.5423786", "0.5405492", "0.5361433", "0.53274363", "0.52855355", "0.52702826", "0.52610856", "0.52565855", "0.5247487", "0.5212025", "0.5208239", "0.5203979", "0.51924574", "0.51732737", "0.51235473", "0.511...
0.5439876
5
Concat that enables int, Tensor, or TensorShape values. This function takes a size specification, which can be an integer, a TensorShape, or a Tensor, and converts it into a concatenated Tensor (if static = False) or a list of integers (if static = True).
def _concat(prefix, suffix, static=False): if isinstance(prefix, ops.Tensor): p = prefix p_static = tensor_util.constant_value(prefix) if p.shape.ndims == 0: p = array_ops.expand_dims(p, 0) elif p.shape.ndims != 1: raise ValueError("prefix tensor must be either a scalar or vector, " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scalar_concat(x, scalar):\n s = tf.shape(x)\n return tf.concat([x, tf.ones([s[0], s[1], s[2], 1]) * scalar], axis=3)", "def _flatten_and_concat(x, batch_shape, dtype):\n # For convenience.\n if x is None:\n return x\n\n def _reshape_part(part):\n part = tf.cast(part, dtype)\n new_shape = ps.con...
[ "0.64366955", "0.5929242", "0.5920341", "0.5902903", "0.5647534", "0.56134844", "0.55967665", "0.55936444", "0.5581356", "0.5517116", "0.54898185", "0.5487083", "0.5465258", "0.5439951", "0.5411873", "0.5377802", "0.5375191", "0.537296", "0.5340463", "0.53384924", "0.5337654"...
0.6666184
0
Create tensors of zeros based on state_size, batch_size, and dtype.
def _zero_state_tensors(state_size, batch_size, dtype): def get_state_shape(s): """Combine s with batch_size to get a proper tensor shape.""" c = _concat(batch_size, s) c_static = _concat(batch_size, s, static=True) size = array_ops.zeros(c, dtype=dtype) size.set_shape(c_static) return size ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_zero_filled_state(batch_size_tensor, state_size, dtype):\n if batch_size_tensor is None or dtype is None:\n raise ValueError(\n 'batch_size and dtype cannot be None while constructing initial state: '\n 'batch_size={}, dtype={}'.format(batch_size_tensor, dtype))\n\n ...
[ "0.83468544", "0.7888466", "0.7704621", "0.75046104", "0.7488166", "0.73252666", "0.7278234", "0.721902", "0.71923685", "0.7187975", "0.71584725", "0.7157532", "0.7157255", "0.7141294", "0.7067486", "0.70597464", "0.70520324", "0.70520324", "0.70306194", "0.7009583", "0.69709...
0.85013586
0
Return zerofilled state tensor(s).
def zero_state(self, batch_size, dtype): # Try to use the last cached zero_state. This is done to avoid recreating # zeros, especially when eager execution is enabled. state_size = self.state_size with ops.name_scope(type(self).__name__ + "ZeroState", values=[batch_size]): output = _zero_state_ten...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state(self):\n return self.kf.x[:self.dim_z].squeeze()", "def _initalize_state(self):\n\n self.memories.append(tf.tanh(\n tf.random_normal(shape=(self.memory_capacity, self.memory_vector_size), stddev=0.5)))\n self.ww_t.append(tf.nn.softmax(tf.range(self.memory_capacity, 0...
[ "0.6772003", "0.6725102", "0.65918064", "0.6534276", "0.64963883", "0.6460507", "0.64191085", "0.6381293", "0.6362374", "0.63078594", "0.6284267", "0.62739545", "0.62267673", "0.6220306", "0.61999446", "0.6179653", "0.61784595", "0.61524236", "0.6102865", "0.6090269", "0.6083...
0.0
-1
Get the lower and upper point of one interval
def interval_point(self, x, n=20): interval = [] set_x = sorted(set(x)) max_set_x, min_set_x = max(set_x), min(set_x) if len(set_x) <= n: interval.append((0, min_set_x)) for i in range(len(set_x)-2): interval.append((set_x[i], set_x[i+1])) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bounds(self):\n bottom_right = np.asarray([self.coords[k][0] for k in range(self.dim)])\n upper_left = np.asarray([self.coords[k][-1] for k in range(self.dim)])\n return bottom_right, upper_left", "def get_xrange_indices(self, lower, upper) -> Tuple[int, int]:\n lower_index = ...
[ "0.6857031", "0.68293405", "0.67777735", "0.67675036", "0.6756523", "0.67432684", "0.66586715", "0.662422", "0.656934", "0.6546398", "0.65240717", "0.65180546", "0.6496418", "0.6489373", "0.6478481", "0.6437387", "0.642918", "0.6426856", "0.64214617", "0.6412392", "0.64059216...
0.0
-1
Discrete the input 1D numpy array based on interval
def interval_discrete(self, x, n=20): res = np.array([0] * x.shape[-1], dtype=int) # logging.info("before_counter: " + str(Counter(x))) x_temp = x[x != -1.0] interval_list = [(-1.0, -1.0)] + self.interval_point(x_temp, n) for i, point in enumerate(interval_list): poin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_interval_discrete(self, test_X, interval=None):\n if not interval:\n interval = self.interval\n temp = []\n for idx in range(test_X.shape[-1]):\n x = test_X[:, idx]\n res = np.array([0] * x.shape[-1], dtype=int)\n # logging.info(\"test_befor...
[ "0.6605961", "0.62803966", "0.6148817", "0.6047014", "0.60086995", "0.5855372", "0.5747299", "0.569348", "0.5649903", "0.5635956", "0.5615522", "0.55164766", "0.54751575", "0.54184735", "0.535646", "0.53404534", "0.5337976", "0.5326043", "0.5316494", "0.52995384", "0.52988255...
0.6298737
1
Chooses a random quote.
async def pornx(ctx, n: int = 1): msg = ["{}".format(text) for text in [random.choice(data) for _ in range(0,n)]] await bot.say('\n'.join(msg))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_random_quote():\n with open (\"./data/quotes.txt\", \"r\") as quotes:\n\n all_quotes = quotes.read().rstrip(\"\\n\").split(\"\\n\\n\")\n\n quote = choice(all_quotes)\n\n return quote", "def random_quote():\n quotes = [\n \"Growth is never by mere chance; it is the result...
[ "0.83396685", "0.81471586", "0.8002349", "0.78939337", "0.78858525", "0.7486583", "0.7207711", "0.7013185", "0.6770739", "0.67052275", "0.6636042", "0.6587465", "0.65616804", "0.6520213", "0.64839387", "0.63207024", "0.6311606", "0.6307215", "0.62671", "0.6223206", "0.6213465...
0.0
-1
Initializes a TensorForestEstimator instance.
def __init__(self, params, device_assigner=None, model_dir=None, graph_builder_class=tensor_forest.RandomForestGraphs, config=None, weights_name=None, keys_name=None, feature_engineering_fn=None, early_stopping_rounds=100, num_trainers=1, traine...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_estimator(self):\n raise NotImplementedError()", "def __init__(\n self,\n estimator = SGDClassifier(),\n ):\n self.estimator = estimator", "def __init__(self):\n\n constant_extratrees_kwargs = {'bootstrap': True,\n ...
[ "0.675916", "0.67464805", "0.66149366", "0.6601964", "0.6521214", "0.650127", "0.64687866", "0.64410293", "0.6357583", "0.63347465", "0.6329043", "0.6292688", "0.6286293", "0.6278424", "0.6263375", "0.6238475", "0.6229336", "0.6214003", "0.6208579", "0.61994475", "0.6185531",...
0.75012684
0
Function that adds two arrays elementwise
def add_arrays(arr1, arr2): if len(arr1) != len(arr2): return None return [arr1[i] + arr2[i] for i in range(len(arr1))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(a, b):\n return np.array([x + y for x, y in zip(a, b)])", "def add_arrays(arr1, arr2):\n if len(arr1) != len(arr2):\n return None\n return [sum(element_wise) for element_wise in zip(arr1, arr2)]", "def add_arrays(arr1, arr2):\n if len(arr1) != len(arr2):\n return (None)\n n...
[ "0.88645655", "0.8182452", "0.80987316", "0.80652523", "0.78296876", "0.76112485", "0.75700754", "0.7409345", "0.73889065", "0.7357356", "0.7311836", "0.7269752", "0.71509093", "0.7147908", "0.7118949", "0.706602", "0.70386785", "0.7022971", "0.6963213", "0.6958695", "0.69387...
0.81113076
2
Get a list of transforms.
def list(self, **kwargs): url_str = self.base_url + '?%s' % urlutils.urlencode(kwargs, True) newheaders = self.get_headers() resp, body = self.client.json_request('GET', url_str, headers=newheaders) if body: return body['elements'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_transforms(self):\n return self.transforms", "def transforms(self):\n return self._transforms", "def transforms(self):\n return self._transforms", "def _get_transforms(loaded_tfm):\n if isinstance(loaded_tfm, tfm.Compose):\n transform = []\n for _tfm ...
[ "0.7597477", "0.7518155", "0.7518155", "0.6945417", "0.68041897", "0.6649946", "0.64846605", "0.6438212", "0.62740946", "0.62678605", "0.6222426", "0.61253667", "0.6053259", "0.60527617", "0.6006949", "0.59260964", "0.592497", "0.59236264", "0.5901011", "0.5901011", "0.588315...
0.0
-1
Get a list of transforms.
def list(self, **kwargs): url_str = self.base_url + '?%s' % urlutils.urlencode(kwargs, True) newheaders = self.get_headers() resp, body = self.client.json_request('GET', url_str, headers=newheaders) if body: return body['elements'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_transforms(self):\n return self.transforms", "def transforms(self):\n return self._transforms", "def transforms(self):\n return self._transforms", "def _get_transforms(loaded_tfm):\n if isinstance(loaded_tfm, tfm.Compose):\n transform = []\n for _tfm ...
[ "0.7597506", "0.75185364", "0.75185364", "0.69432664", "0.6803255", "0.6650321", "0.6485062", "0.6438561", "0.6271606", "0.6267257", "0.6223429", "0.6123619", "0.6052793", "0.60513955", "0.60070765", "0.59254086", "0.592356", "0.5922244", "0.5900966", "0.5900966", "0.58801657...
0.0
-1