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
Sets the workflow_task_count of this WorkflowWorkflowInfoAllOf.
def workflow_task_count(self, workflow_task_count): self._workflow_task_count = workflow_task_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_count(self, process_count):\n\n self._process_count = process_count", "def set_workflows(self, wf_list):\n self._data_dict[self.KEY_BI_WORKFLOWS] = wf_list", "def processor_count(self, processor_count):\n\n self._processor_count = processor_count", "def workflow_status(self, ...
[ "0.5321464", "0.53206366", "0.52921915", "0.5214196", "0.5126126", "0.5088125", "0.50156325", "0.50148696", "0.49930224", "0.49899358", "0.49779657", "0.4957459", "0.49497092", "0.4938707", "0.48402986", "0.48093107", "0.48084217", "0.4760027", "0.4760027", "0.4752337", "0.47...
0.8547748
0
Sets the account of this WorkflowWorkflowInfoAllOf.
def account(self, account): self._account = account
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_account(self, account: str):\n ret = self._call_txtrader_api('set_account', {'account': account})\n if ret:\n self.account = account\n return ret", "def account(self, account: str):\n self._account = account", "def business_account(self, business_account):\n\n ...
[ "0.6609705", "0.64991796", "0.62680054", "0.6256864", "0.6238076", "0.6210242", "0.6059383", "0.603256", "0.601816", "0.59283566", "0.5807356", "0.5661204", "0.56608367", "0.5648552", "0.5631902", "0.5593608", "0.5593608", "0.5593608", "0.5593608", "0.5593608", "0.5593608", ...
0.6595424
3
Sets the organization of this WorkflowWorkflowInfoAllOf.
def organization(self, organization): self._organization = organization
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def organization(self, value):\n organization = self._tower.get_organization_by_name(value)\n if not organization:\n raise InvalidOrganization(value)\n self._update_values('organization', organization.id)", "def setOrganization(self, *args):\n return _libsbml.ModelCreator_s...
[ "0.64512193", "0.6413507", "0.6273569", "0.6273569", "0.59499544", "0.57473254", "0.5661312", "0.5651027", "0.5575408", "0.55587095", "0.5550213", "0.55254066", "0.55254066", "0.55254066", "0.54535234", "0.5386825", "0.5259958", "0.52533203", "0.5210195", "0.52054965", "0.520...
0.7105023
1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, WorkflowWorkflowInfoAllOf): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, WorkflowWorkflowInfoAllOf): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", ...
0.0
-1
Sets the disk id.
def setDisk(self, disk): self.__disk = disk
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setDiskId(self, diskId):\n self.__diskId = diskId", "def disk_num(self, disk_num):\n\n self._disk_num = disk_num", "def disk(self, disk):\n self._context[\"disk\"] = disk", "def _setDisk(self, disk):\n log_method_call(self, self.name, old=getattr(self.disk, \"name\", None),\n ...
[ "0.855126", "0.7090983", "0.6793492", "0.647074", "0.6312028", "0.6186076", "0.6154758", "0.61147004", "0.6099951", "0.6090852", "0.5955262", "0.59471774", "0.5921482", "0.5911233", "0.5900415", "0.58833015", "0.58779275", "0.58755255", "0.5866125", "0.5866125", "0.5866125", ...
0.7199222
1
Sets the disk id.
def setDiskId(self, diskId): self.__diskId = diskId
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setDisk(self, disk):\n self.__disk = disk", "def disk_num(self, disk_num):\n\n self._disk_num = disk_num", "def disk(self, disk):\n self._context[\"disk\"] = disk", "def _setDisk(self, disk):\n log_method_call(self, self.name, old=getattr(self.disk, \"name\", None),\n ...
[ "0.7199222", "0.7090983", "0.6793492", "0.647074", "0.6312028", "0.6186076", "0.6154758", "0.61147004", "0.6099951", "0.6090852", "0.5955262", "0.59471774", "0.5921482", "0.5911233", "0.5900415", "0.58833015", "0.58779275", "0.58755255", "0.5866125", "0.5866125", "0.5866125",...
0.855126
0
Distribution of the state at the first time step.
def initial_state(self, parameters = None): if parameters is not None: parameters_true = parameters.get('tbranch') parameters_false = parameters.get('fbranch') else: parameters_true = parameters_false = None true_init_state = self._dynamics_tbranch.initial_state(parameters_true) # We ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _starting_prob(self, s):\n return self._starting_state_distribution.pdf(s)", "def update_initial_state_distribution(self, initial_state_distribution=None):\n if initial_state_distribution is None:\n self.initial_state_distribution = self.env.get_initial_state_distribution()\n ...
[ "0.70713156", "0.6865461", "0.6714622", "0.6665688", "0.6662402", "0.6662402", "0.6662402", "0.6662402", "0.6662402", "0.6649384", "0.6642803", "0.66367215", "0.66354716", "0.66349643", "0.66329455", "0.6625328", "0.66201437", "0.6549524", "0.65466243", "0.6545233", "0.651902...
0.0
-1
Constructs a FiniteStateMarkovModel entity. See tf.gather for shape conventions.
def __init__(self, transition_parameters = None, initial_dist_logits = None, batch_dims = 0, name = 'FiniteStateMarkovModel'): super().__init__(name=name) self._maybe_set_static_parameters( transition_parameters=transition_parameters, i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_model(n_dimensions, seed):\n with spa.SPA(seed=seed) as model:\n # Create the state holding element\n model.state = spa.State(dimensions=n_dimensions,\n feedback=1.0, feedback_synapse=0.01)\n\n # Create the state transitions\n actions = spa.Act...
[ "0.61582226", "0.5743764", "0.55372304", "0.54695594", "0.5467602", "0.53655535", "0.5364793", "0.53570086", "0.5355838", "0.5248177", "0.52112013", "0.52104205", "0.5190977", "0.5183897", "0.5157981", "0.5144771", "0.5141594", "0.5128713", "0.5102423", "0.5068482", "0.506217...
0.60769093
1
Samples a state tensor for a batch of actors.
def initial_state(self, parameters = None): if parameters is None: parameters = self._get_static_parameters_or_die() return Value( state=ed.Categorical(logits=parameters.get('initial_dist_logits')))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_action(self, state):\n action = self.tf_sess.run(self.sample, feed_dict={self.X: state.reshape(1, len(state))})\n return action", "def sample_state(self, key, state):\n new_state = tf.random.stateless_categorical(\n self._logits[state][None, :], 1, key, dtype=tf.int32)\n retur...
[ "0.6947551", "0.68260443", "0.6703842", "0.6625459", "0.65073866", "0.64972085", "0.64768577", "0.6474318", "0.6455162", "0.6442241", "0.63914365", "0.6366968", "0.6282856", "0.62288976", "0.62052554", "0.6203083", "0.62018615", "0.61644995", "0.61373484", "0.6117139", "0.607...
0.0
-1
Samples a state tensor for a batch of actors.
def initial_state(self, parameters = None): if parameters is None: parameters = self._get_static_parameters_or_die() scale_linear_op = self._initial_dist_scale_ctor( parameters.get('initial_dist_scale')) return Value( state=ed.MultivariateNormalLinearOperator( loc=0.0, scal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_action(self, state):\n action = self.tf_sess.run(self.sample, feed_dict={self.X: state.reshape(1, len(state))})\n return action", "def sample_state(self, key, state):\n new_state = tf.random.stateless_categorical(\n self._logits[state][None, :], 1, key, dtype=tf.int32)\n retur...
[ "0.6947551", "0.68260443", "0.6703842", "0.6625459", "0.65073866", "0.64972085", "0.64768577", "0.6474318", "0.6455162", "0.6442241", "0.63914365", "0.6366968", "0.6282856", "0.62288976", "0.62052554", "0.6203083", "0.62018615", "0.61644995", "0.61373484", "0.6117139", "0.607...
0.0
-1
Constructs a LinearGaussianStateModel entity.
def __init__(self, transition_op_ctor, initial_dist_scale_ctor, transition_noise_scale_ctor = None, initial_dist_scale = None, transition_parameters = None, transition_noise_scale = None, name = 'LinearGaussianState...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linearize(self, at_this_rv: randvars.Normal):\n\n g = self.non_linear_model.state_trans_fun\n dg = self.non_linear_model.jacob_state_trans_fun\n\n x0 = at_this_rv.mean\n\n def force_vector_function(t):\n return g(t, x0) - dg(t, x0) @ x0\n\n def dynamicsmatfun(t):\n...
[ "0.60173315", "0.586068", "0.57481647", "0.5734987", "0.56783867", "0.560434", "0.5567105", "0.55232114", "0.54899967", "0.54825956", "0.5463306", "0.5445745", "0.54207027", "0.5412358", "0.5387524", "0.53816247", "0.53816247", "0.5369552", "0.5368224", "0.53540725", "0.53440...
0.6650809
0
Samples a state tensor for a batch of actors.
def initial_state(self, parameters = None): if parameters is not None: raise NotImplementedError('Dynamically specifying RNN weights is ' 'currently not supported.') initial_rnn_state = self._rnn_cell.get_initial_state( batch_size=self._batch_size, dtype=tf.float32)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_action(self, state):\n action = self.tf_sess.run(self.sample, feed_dict={self.X: state.reshape(1, len(state))})\n return action", "def sample_state(self, key, state):\n new_state = tf.random.stateless_categorical(\n self._logits[state][None, :], 1, key, dtype=tf.int32)\n retur...
[ "0.6947551", "0.68260443", "0.6703842", "0.6625459", "0.65073866", "0.64972085", "0.64768577", "0.6474318", "0.6455162", "0.6442241", "0.63914365", "0.6366968", "0.6282856", "0.62288976", "0.62052554", "0.6203083", "0.62018615", "0.61644995", "0.61373484", "0.6117139", "0.607...
0.0
-1
Get storage location for this S3 service.
def get_storage_location(self): return self.s3_bucket
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_s3_location(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"default_s3_location\")", "def default_s3_location(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"default_s3_location\")", "def default_s3_location(self) -> pulumi.Input[str]:\n return pulumi...
[ "0.7371423", "0.69910794", "0.6987746", "0.6937144", "0.6866469", "0.67450845", "0.67162067", "0.6645967", "0.66115385", "0.6583917", "0.65399504", "0.65077573", "0.64811045", "0.646269", "0.64598596", "0.6449051", "0.64325005", "0.63170296", "0.6312064", "0.630059", "0.62827...
0.9002589
0
Property to read and modify the lower left coordinate of this box in (x,y) form.
def lower_left(self) -> Tuple[decimal.Decimal, decimal.Decimal]: return self.left, self.bottom
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def left(self):\n return self.points['topLeft'].x", "def left(self):\n return self.points['topLeft'].x", "def top_left(self):\n return Point(self.left, self.top)", "def _rect_left(self):\n\treturn min(self.x, self.x + self.w)", "def topLeftCorner(self):\n self._updateExtents()\n...
[ "0.76286256", "0.76286256", "0.76087475", "0.74515605", "0.73134714", "0.7204906", "0.719683", "0.7192302", "0.7148248", "0.70443517", "0.699885", "0.69492775", "0.69086164", "0.6881616", "0.6857238", "0.6813681", "0.6756147", "0.6722424", "0.67214847", "0.67118055", "0.66944...
0.6828447
15
Property to read and modify the lower right coordinate of this box in (x,y) form.
def lower_right(self) -> Tuple[decimal.Decimal, decimal.Decimal]: return self.right, self.bottom
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getupperleft(self):\n return (self.rect.x, self.rect.y)", "def upright(self):\n return Coord([self.x + 1, self.y - 1])", "def topRightCorner(self):\n self._updateExtents()\n return (self._mMaxX,self._mMinY)", "def _rect_left(self):\n\treturn min(self.x, self.x + self.w)", "d...
[ "0.70079947", "0.69519484", "0.6918452", "0.6880475", "0.6871949", "0.68257385", "0.6806675", "0.68065995", "0.6799814", "0.6799814", "0.67966425", "0.67917544", "0.66918015", "0.66918015", "0.66046894", "0.65871626", "0.6579464", "0.6498612", "0.6497025", "0.63779926", "0.62...
0.6270754
25
Property to read and modify the upper left coordinate of this box in (x,y) form.
def upper_left(self) -> Tuple[decimal.Decimal, decimal.Decimal]: return self.left, self.top
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getupperleft(self):\n return (self.rect.x, self.rect.y)", "def upleft(self):\n return Coord([self.x - 1, self.y - 1])", "def top_left(self):\n return Point(self.left, self.top)", "def get_box_coordinates(self):\n return QRect(self.box_begin,self.box_end)", "def downleft(...
[ "0.7736969", "0.7220757", "0.70989484", "0.7098229", "0.7043", "0.70254904", "0.69526947", "0.69526947", "0.6874103", "0.68080246", "0.6794687", "0.6791028", "0.6763088", "0.6756324", "0.6678922", "0.66400844", "0.663078", "0.66178113", "0.6609622", "0.65451723", "0.6543797",...
0.6424764
28
Property to read and modify the upper right coordinate of this box in (x,y) form.
def upper_right(self) -> Tuple[decimal.Decimal, decimal.Decimal]: return self.right, self.top
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def downright(self):\n return Coord([self.x + 1, self.y + 1])", "def upright(self):\n return Coord([self.x + 1, self.y - 1])", "def _rect_right(self):\n\treturn max(self.x, self.x + self.w)", "def topRightCorner(self):\n self._updateExtents()\n return (self._mMaxX,self._mMinY)", ...
[ "0.7234896", "0.7208419", "0.71646935", "0.7128582", "0.7082338", "0.69099325", "0.69099325", "0.684273", "0.67991143", "0.6773436", "0.6712202", "0.6658549", "0.6614157", "0.6590005", "0.65537214", "0.6466284", "0.64545816", "0.64545816", "0.6452278", "0.6450566", "0.6440077...
0.6340971
26
Readonly property accessing the destination title.
def title(self) -> Optional[str]: return self.get("/Title")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title(self):\n\n return self._title", "def get_title(self):\n return self.title", "def get_title(self):\n return self.title", "def get_title(self):\n return self.title", "def title(self) -> str:\n raise NotImplementedError", "def title(self):\n return self['title...
[ "0.6961038", "0.68728906", "0.68728906", "0.68728906", "0.68283546", "0.6824291", "0.6800047", "0.6790193", "0.6790193", "0.6790193", "0.6790193", "0.6790193", "0.6790193", "0.6788795", "0.6788795", "0.6788795", "0.67842835", "0.67842835", "0.67842835", "0.6750037", "0.674765...
0.0
-1
Readonly property accessing the left horizontal coordinate.
def left(self) -> Optional[FloatObject]: return self.get("/Left", None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLeft(self):\n return self.left", "def left(self):\n return self.points['topLeft'].x", "def left(self):\n return self.points['topLeft'].x", "def left(self):\n x, y = (self.loc[0] - 1, self.loc[1])\n\n if x < 0:\n return None # None\n\n return self.g...
[ "0.74524087", "0.7242441", "0.7242441", "0.7196843", "0.7170824", "0.71659166", "0.7137411", "0.71146894", "0.7085377", "0.7063215", "0.7048031", "0.7027578", "0.7016096", "0.6994973", "0.6989465", "0.6982879", "0.6982879", "0.6973955", "0.6862453", "0.6852263", "0.68517905",...
0.66317093
33
Readonly property accessing the right horizontal coordinate.
def right(self) -> Optional[FloatObject]: return self.get("/Right", None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def right(self):\n return self.left + self.width", "def _rect_right(self):\n\treturn max(self.x, self.x + self.w)", "def right(self):\n return self.r", "def getRight(self):\n return self.right", "def right(self):\n return self.points['topRight'].x", "def right(self):\n ...
[ "0.69031847", "0.67124265", "0.66826564", "0.6573892", "0.6562447", "0.6562447", "0.6537001", "0.6501227", "0.6486398", "0.64790356", "0.64750904", "0.6429038", "0.6419027", "0.6419027", "0.6395297", "0.63746417", "0.63521594", "0.6334135", "0.6255263", "0.61487085", "0.60816...
0.5719672
55
Readonly property accessing the top vertical coordinate.
def top(self) -> Optional[FloatObject]: return self.get("/Top", None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_y(self):\r\n return self.position.y + self.size.y + self.bulk", "def _rect_top(self):\n\treturn max(self.y, self.y + self.h)", "def top(self):\n return self.points['topRight'].y", "def top(self):\n return self.points['topRight'].y", "def top_offset(self):\n raise NotImplem...
[ "0.710111", "0.68731254", "0.68259984", "0.68259984", "0.66603446", "0.65493023", "0.6546417", "0.6418809", "0.6361531", "0.6349726", "0.6321155", "0.6274795", "0.6274493", "0.6264007", "0.6201188", "0.6142193", "0.61386585", "0.610809", "0.61047274", "0.60672003", "0.6012361...
0.0
-1
Readonly property accessing the bottom vertical coordinate.
def bottom(self) -> Optional[FloatObject]: return self.get("/Bottom", None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bottom_offset(self):\n raise NotImplementedError", "def bottom(self):\n return self.top + self.height", "def bottom_y(self):\r\n return self.position.y - self.size.y - self.bulk", "def bottom(self):\n return self.points['bottomRight'].y", "def bottom(self):\n return sel...
[ "0.7551743", "0.7382025", "0.7342788", "0.72213024", "0.72213024", "0.7119624", "0.71027684", "0.7079467", "0.6920968", "0.6904349", "0.6835028", "0.6792669", "0.6704462", "0.6666149", "0.6416772", "0.6378363", "0.63745844", "0.6372734", "0.6334849", "0.6298355", "0.6292787",...
0.62286496
25
Initializes heap instance.Inputs are no of elements in heap and limit of restructuring of heap.
def __init__(self, noOfElements, limitOfRestructuring): self.heap = [ 'NaN' ] * noOfElements self.noOfElements = noOfElements self.i = 1 self.noOfRemovedElements = 0 self.limitOfRestructuring = limitOfRestructuring
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.min_heap = []\n self.max_heap = []\n self.size_max, self.size_min = 0, 0", "def __init__(self, heap=[]):\n\n # logger_cagada.debug(\"pero si el orig heap %s\" % heap)\n heapq.heapify(heap)\n # logger_cagada.debug(\"a cihnga el heap %s\" % heap)...
[ "0.7872689", "0.78718746", "0.77746433", "0.7703879", "0.7700862", "0.7640832", "0.76038057", "0.7587779", "0.7543796", "0.74869823", "0.7466747", "0.74636537", "0.7434665", "0.7433525", "0.741593", "0.741593", "0.741593", "0.74121726", "0.7400985", "0.7385111", "0.7349339", ...
0.8127257
0
Function to restructure heap to store elements in a continuous fashion in the list.
def restructureHeap(self): self.i = 1 # Storing the elements that already exist in a temporary list tempList = [] for heapElement in self.heap: if heapElement != "NaN" : tempList.append( heapElement ) # Initializing new heap self.heap = ["NaN...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_heap(data):\n size = len(data)\n for i in range(size//2, -1,-1):\n shiftDown(data, i)", "def _heapify(self):\n start = self._parent(len(self) - 1)\n for i in range(start, -1, -1):\n self._down_heap(i)", "def buildHeap(self, alist):\n i = len(alist) // 2\n ...
[ "0.75522405", "0.7437871", "0.72836965", "0.7224376", "0.71689165", "0.71542585", "0.7145125", "0.7145125", "0.7111045", "0.6952901", "0.69036293", "0.6897025", "0.689172", "0.68875325", "0.6880433", "0.67749697", "0.6733229", "0.67183167", "0.66768026", "0.65680516", "0.6539...
0.8265854
0
Gets the number of the terminal of active PD element that is on the "from" side. This is set after the meter zone is determined.
def pdelements_from_terminal(self) -> int: return self.dss_obj.PDElementsI(ctypes.c_int32(7), ctypes.c_int32(0))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current(self):\n return self.node.sdo[0x221c].phys # mA", "def read_current_stepsize(self):\n function_string = 'DELTAI' + self.output + '?'\n return self.scpi_comm(function_string)", "def getNumActive(self):\n return self._get_active( )", "def getPlungerPos(self):\n ...
[ "0.60825145", "0.5865261", "0.5603476", "0.55617607", "0.5542426", "0.55111235", "0.5410498", "0.540583", "0.53970623", "0.5295192", "0.5291269", "0.52739096", "0.5265048", "0.52591", "0.5257556", "0.5252305", "0.524203", "0.5230821", "0.5213554", "0.52052367", "0.5203081", ...
0.6026718
1
Gets the integer ID of the feeder section that this PDElement branch is part of.
def pdelements_section_id(self) -> int: return self.dss_obj.PDElementsI(ctypes.c_int32(8), ctypes.c_int32(0))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def section_id(self) -> str:\n\n return self[\"id\"]", "def id(self):\n return self.get_data(\"id\")", "def id(self) -> int:\n return self._id", "def id(self) -> int:\n return self._id", "def id(self) -> int:\n return self._id", "def id(self) -> int:\n return sel...
[ "0.66867673", "0.6119269", "0.61072624", "0.61072624", "0.61072624", "0.61072624", "0.61072624", "0.61072624", "0.61072624", "0.61072624", "0.61072624", "0.61072624", "0.61072624", "0.61072624", "0.61072624", "0.61072624", "0.607847", "0.607847", "0.603825", "0.6025901", "0.6...
0.60855085
16
Generate a random string of a given length.
def random_string(length=8, chars=string.ascii_letters + string.digits): return ''.join([chars[random.randint(0, len(chars) - 1)] for i in range(length)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))", "def generate_random_string(length):\r\n return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(length))", "def generate_random_...
[ "0.900645", "0.8976036", "0.8840446", "0.8827785", "0.8795691", "0.8775185", "0.8773582", "0.8742192", "0.8722319", "0.8718203", "0.86625445", "0.8655195", "0.86344033", "0.8606815", "0.85888666", "0.8571902", "0.85610783", "0.8555113", "0.8552302", "0.85510385", "0.8522412",...
0.8397112
25
Given a sequence and the alternative sequence yield all mfes.
def compute_mfes(seq, mutations): for position, character in enumerate(mutations): alt_seq = _replace(seq, position, character) yield dotbracket(alt_seq)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def difference(seq, *seqs):\n yield from differenceby(None, seq, *seqs)", "def sentinelize(inputSeq, sentinel=None, loopSentinel=False, failFun=None):\n for item in inputSeq:\n yield item\n yield sentinel\n while loopSentinel:\n yield loopSentinel\n if failFun:\n failFun()", "def e_seq():\n yi...
[ "0.60232437", "0.5683796", "0.56831485", "0.5667053", "0.56568414", "0.56452036", "0.56023264", "0.5602069", "0.55491084", "0.5485562", "0.5450549", "0.5342842", "0.53096867", "0.52991277", "0.5290579", "0.5288675", "0.52817655", "0.52763766", "0.5240386", "0.5233169", "0.522...
0.61841524
0
Create the application for the test case.
def setUpClass(cls): cls._app = QtWidgets.QApplication.instance() if cls._app is None: cls._app = QtWidgets.QApplication([]) cls._app.setQuitOnLastWindowClosed(False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_and_run():\n\n app = App()\n app.run()", "def application():\n yield create_test_application()", "def create_app(self):\n raise NotImplementedError", "def create_app(self):\n\n app = create_app()\n app.config.from_object('project.config.TestingConfig')\n return...
[ "0.7805628", "0.7759366", "0.775573", "0.7681946", "0.7660952", "0.76274294", "0.75921124", "0.7564451", "0.75274485", "0.7525346", "0.74477637", "0.7445047", "0.7437549", "0.74240017", "0.74143714", "0.73403394", "0.7319924", "0.72962713", "0.7266085", "0.7263547", "0.726016...
0.0
-1
Cast given locale to string. Supports also callbacks that return locales.
def cast_locale(obj, locale, attr): if callable(locale): args_count = get_args_count(locale) if args_count == 0: locale = locale() elif args_count == 1: locale = locale(obj) elif args_count == 2: locale = locale(obj, attr.key) if isinstance(loc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetString(*args, **kwargs):\n return _gdi_.Locale_GetString(*args, **kwargs)", "def get_locale():\n return babel.Locale.parse(_get_locale())", "def format(self, fmt: str, locale: str | None = None) -> str:\n return self._formatter.format(self, fmt, locale)", "def normalize_currency(curre...
[ "0.6052177", "0.55995685", "0.5441465", "0.5332568", "0.532277", "0.5252318", "0.5250403", "0.52497745", "0.52403075", "0.5237608", "0.5225941", "0.51631624", "0.5054695", "0.5050819", "0.50413287", "0.5040657", "0.50388926", "0.5031137", "0.50128025", "0.49931708", "0.498255...
0.7257748
0
add the given vertex to each cluster.
def add_vertex_to_clusters(clusters,vertex): for key in clusters: clusters[key].append(vertex)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_vertex(self, vertex):\n self.vertices.append(vertex)\n self.vertex_edge[vertex] = []", "def add_vertex(self, vertex):\n raise NotImplementedError", "def __add__(self, vertex):\n\n if isinstance(vertex, Vertex):\n vName = vertex.name\n self._vertices[vNa...
[ "0.738936", "0.7228798", "0.7145615", "0.7021899", "0.69024456", "0.6896663", "0.68675625", "0.68639535", "0.68639535", "0.68464905", "0.68456185", "0.6763881", "0.6730218", "0.67227286", "0.6690994", "0.6688325", "0.66764355", "0.6658186", "0.66529715", "0.6647528", "0.66068...
0.82492626
0
Gets base paths for the data directories If DATA_ROOT is set in the environment, use that as the root otherwise use "./data" individual paths can also be set in the environment
def get_default_paths(): DATA_ROOT = os.environ.get("DATA_ROOT", "data") defaults = { "TOKENIZE_DATA_DIR": DATA_ROOT + "/tokenize", "MWT_DATA_DIR": DATA_ROOT + "/mwt", "LEMMA_DATA_DIR": DATA_ROOT + "/lemma", "POS_DATA_DIR": DATA_ROOT + "/pos", "DEPPARSE_DATA_DIR": DATA_RO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDataPath():\n\treturn \"..\" + os.sep + \"data\" + os.sep", "def get_data_dir():\n return Path(current_app.config[\"USER_DIR\"]) / \"data\"", "def get_data_path():\n return os.getcwd() + \"/data/\"", "def data_dir():\n return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')", ...
[ "0.7406677", "0.7309114", "0.71558106", "0.7086502", "0.7073203", "0.7061377", "0.7024207", "0.70034885", "0.7000793", "0.6972889", "0.6858991", "0.68468535", "0.6798503", "0.6786804", "0.6725322", "0.67091423", "0.6696609", "0.66939914", "0.66862553", "0.6677648", "0.6662981...
0.7681709
0
Returns 'X' if the next play is player X, otherwise 'O'.
def next_player(self): # Counter is a useful class that counts objects. count = Counter(self.board) if count.get('X', 0) > count.get('O', 0): return 'O' return 'X'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_player(current_player: Optional[str]) -> str:\n if current_player == c.X:\n return c.O\n else:\n return c.X", "def opponent(self):\n \n if self.side == 'X':\n return 'O'\n else:\n return 'X'", "def play_game(self, playerX, playerO):\r\...
[ "0.78836375", "0.7374691", "0.72335446", "0.7131909", "0.7131909", "0.71021736", "0.7066528", "0.6987133", "0.6833735", "0.6827109", "0.68047506", "0.67475647", "0.6744674", "0.67023987", "0.66803753", "0.6667681", "0.6654215", "0.66286945", "0.6595179", "0.65725344", "0.6539...
0.8343033
0
Gets list of Clients
def list(self) -> List[ListClientDto]: raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_clients(self):\n\n return self.clients_info", "def get(self):\n return get_clientes()", "def get_client_list(self):\r\n cursor = self.conn.cursor()\r\n cursor.execute(\"\"\"SELECT * FROM CLIENT\"\"\")\r\n return cursor.fetchall()", "def redis_client_list(self):\n ...
[ "0.87844324", "0.8421559", "0.83372366", "0.81655127", "0.7901022", "0.78443885", "0.78232926", "0.78232926", "0.77966213", "0.7763598", "0.761962", "0.7604354", "0.7575518", "0.7533317", "0.75269645", "0.7463681", "0.7431685", "0.73718387", "0.7330837", "0.72890383", "0.7277...
0.7461951
16
Determine the covariance coefficient between two columns.
def Covariance(col1, col2): engine = create_engine('postgresql+psycopg2://student:123456@132.249.238.27:5432/bookstore_dp') conn = engine.connect() sql = """ select covar_samp(%s::int, %s::int) from orderlines o, products p where o.productid = p.productid """ %(col1, col2) stmt = text...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_covariance(column1: pd.Series, column2: pd.Series) -> np.float64:\n\n cov = column1.cov(column2)\n return cov", "def covariance(x, y):\n n = len(x)\n return dot(de_mean(x), de_mean(y)) / (n - 1)", "def covariance (x, y):\n n = len(x)\n return dot(de_mean(x), de_mean(y))/(n-1)", ...
[ "0.8119774", "0.7765279", "0.7708766", "0.76439565", "0.7616887", "0.7605421", "0.7570684", "0.7561088", "0.7338393", "0.73225045", "0.7247511", "0.71681315", "0.70561486", "0.6936636", "0.6894876", "0.68887097", "0.6846041", "0.6824522", "0.6823994", "0.6790698", "0.6781073"...
0.0
-1
Return the distance between two points a and b
def distance(a, b): return math.sqrt((a[0]-b[0])**2 + (a[1]-b[1])**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance(a: Point, b: Point) -> float:\n return math.sqrt(math.pow(b.x - a.x, 2) + math.pow(b.y - a.y, 2))", "def distance_between_points(a: Point, b: Point) -> float:\n return math.sqrt((a.x - b.x)**2 + (a.y - b.y)**2)", "def distance(a, b):\n return math.sqrt((a.x - b.x) ** 2 + (a.y - b.y) ** 2)...
[ "0.89458483", "0.88991046", "0.8818057", "0.8759049", "0.8685559", "0.8668778", "0.8660479", "0.85789996", "0.85548586", "0.85233074", "0.8518668", "0.84739554", "0.8447944", "0.8442889", "0.84407747", "0.84218204", "0.83840084", "0.83079374", "0.8275142", "0.8254148", "0.824...
0.8503932
11
Return the dot product (scalar product) of a and b
def dot(a, b): return sum([a[i]*b[i] for i in range(2)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot(a, b):\n return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]", "def dot_product(a,b):\n return sum(pairwise_mult(a,b))", "def dot(a,b):\n return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]", "def dot(a, b):\n\n if len(a) != len(b):\n raise Exception(\"Input vectors must be of same length, not %d an...
[ "0.8812722", "0.87875795", "0.87565994", "0.8732255", "0.8577188", "0.8527434", "0.8359632", "0.8315232", "0.8193967", "0.8135108", "0.8117393", "0.80646706", "0.8049035", "0.80445755", "0.80405647", "0.80045366", "0.79888374", "0.7919624", "0.7898735", "0.7886502", "0.785136...
0.857611
5
Blit surface2, centered, onto surface1
def blit_centered(surface1, surface2): rect = surface2.get_rect() rect = rect.move((surface1.get_width()-rect.width)//2, (surface1.get_height()-rect.height)//2) surface1.blit(surface2, rect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blit_center(screen, source_surface, pos_x, pos_y):\n screen.blit(source_surface, (pos_x - source_surface.get_width() / 2, pos_y - source_surface.get_height() / 2))", "def draw(self, surface):\n\n\t\tsurface.blit(self.image, self.rect.topleft)", "def blit(self, surface):\n surface.blit(self.surfac...
[ "0.6790366", "0.62865055", "0.6105203", "0.60078996", "0.5974837", "0.58546734", "0.57853323", "0.57526255", "0.5750747", "0.57219654", "0.56992954", "0.5673495", "0.5673495", "0.5670575", "0.56416076", "0.5536424", "0.55351275", "0.5514574", "0.55103725", "0.5504038", "0.547...
0.8461208
0
Gets the color of the edge.
def get_color(edge, nR): R_color, E_color = 'C0', 'C1' edge = sorted(edge) if edge[0] < nR: if edge[1] > nR: comp_color = 'gray' zorder = 10 else: comp_color = R_color zorder = 5 else: comp_color = E_color zorder = 5 ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_color(self):\n return self._color", "def get_color(self):\n return self._color", "def get_color(self):\r\n return self._color", "def get_color(self):\n\n return self._color", "def get_edge_color( row ):\n\n rgb = 0.5 * (\n node_color_dict[ row[ 'source' ] ] + \\\n ...
[ "0.7583754", "0.7583754", "0.75743234", "0.7542442", "0.7529707", "0.7523015", "0.7515754", "0.75036937", "0.7497267", "0.7253985", "0.7253985", "0.7253985", "0.72099334", "0.7183728", "0.71804214", "0.71746135", "0.71435606", "0.71435606", "0.7123838", "0.71092427", "0.70886...
0.71043044
20
Test if the Stc3xRelativeHumidityConditionPercent() type works as expected for different values.
def test_relative_humidity_condition_percent(value): result = Stc3xRelativeHumidityConditionPercent(value.get('percent_rh')) assert type(result) is Stc3xRelativeHumidityConditionPercent assert type(result.ticks) is int assert result.ticks == value.get('ticks') assert type(result.percent_rh) is float...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_rh_specific_humidity():\n p = 1013.25 * units.mbar\n temperature = 20. * units.degC\n q = 0.012 * units.dimensionless\n rh = relative_humidity_from_specific_humidity(p, temperature, q)\n assert_almost_equal(rh, 82.71759 * units.percent, 3)", "def test_str_percent(self):\n xknx = XK...
[ "0.6108147", "0.60558736", "0.5909511", "0.5753489", "0.57529473", "0.5706647", "0.5646214", "0.5584023", "0.5577272", "0.5554479", "0.54770046", "0.5465542", "0.5416829", "0.5343803", "0.5296619", "0.5161798", "0.5155328", "0.515257", "0.51523316", "0.51366204", "0.51230216"...
0.8242922
0
Create `dataset` object for training
def create_tfdata(self, file_names, labels, img_size, batch_size=4, shuffle=True): self.anchors = np.array(self.anchors).astype(np.float32)[:, [1, 0]] self.output_shape = tf.TensorShape( [img_size / self.shrink_factor, img_size / self.shrink_factor, len(self.anchors), 5 + self.num_cla...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dataset():\n ds_train_raw, ds_test_raw = load_raw_datasets()\n vectorize_layer = create_vectorizer(ds_train_raw)\n ds_train = ds_train_raw.map(\n lambda text, label: (vectorize_layer(text), label)\n ).prefetch(tf.data.experimental.AUTOTUNE)\n ds_test = ds_test_raw.map(\n lam...
[ "0.7625288", "0.7596115", "0.75756335", "0.7554228", "0.75159276", "0.7451764", "0.73979217", "0.7391445", "0.7356141", "0.7314714", "0.7312134", "0.7295263", "0.7294468", "0.72930044", "0.72680014", "0.725782", "0.7243638", "0.7213914", "0.7192052", "0.7164235", "0.7156028",...
0.0
-1
if load_weights is specified load the trained weights
def init_weights(self, load_weights=None): if load_weights: # TODO pass else: # x: lower layer nodes n # y: current layer nodes n x = self.weights_shape[1] y = self.weights_shape[0] self.weights = np.random.randn(y, x) / np.sqrt(x) # pylint: disable=no-member self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_weights(self):\n self.npz_weights = np.load(self._weight_file)\n self._load_byte_embedding()\n self._load_cnn_weights()\n self._load_highway()\n self._load_projection()", "def load_weights(self, weight_file):\r\n self.model.load_weights(weight_file)", "def _l...
[ "0.7976475", "0.7927563", "0.7897525", "0.7821175", "0.7753297", "0.7680208", "0.76619196", "0.7595748", "0.7590294", "0.75884205", "0.75847566", "0.7419845", "0.73893887", "0.73893887", "0.7374679", "0.7319079", "0.7311311", "0.7308689", "0.72947955", "0.72444606", "0.723284...
0.7777777
4
Invoked by lower layer Once inputs updated, start computing the weighted sum then activation outputs, then forward outputs to next layer
def UpdateInput(self, request, context): self.check_weights() # get values from message batch_id, outputs_of_lower, labels, is_train = self.parse_forward_msg(request) print("Get inputs id: {0}, matrix shape: {1}, labels shape: {2}".format( batch_id, outputs_of_lower.shape, labels.shape)) wei...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feedforward(self, inputs):\n processsum = 0\n for i in range(len(inputs)):\n processsum = processsum + inputs[i] * self.weights[i]\n return self.activate(processsum)", "def forward(W,X):\n return activation_func(np.dot(add_bias(X),W))", "def engage(self):\n # no si...
[ "0.75379217", "0.7400119", "0.7375257", "0.7350896", "0.7341678", "0.7301916", "0.7251322", "0.7242767", "0.71842414", "0.7090362", "0.7083083", "0.7040894", "0.7027726", "0.7002781", "0.6990172", "0.69694924", "0.69687366", "0.6957858", "0.693263", "0.6910701", "0.69032997",...
0.6574824
59
Translate unsafe characters to underscores.
def normalize_pipeline_name(name=''): normalized_name = name for bad in '\\/?%#': normalized_name = normalized_name.replace(bad, '_') return normalized_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize(s):\n s = s.replace(\"_\", \"\\\\_\")\n return s", "def to_safe(self, word):\n return re.sub(\"[^A-Za-z0-9\\-]\", \"_\", word)", "def clean_keeping_underscores(cls, value):\r\n return INVALID_CHARS.sub('_', value)", "def to_safe(word):\n return re.sub(r\"[^A-Za-z0-9\\-...
[ "0.7627837", "0.7590289", "0.74770486", "0.7377017", "0.7189159", "0.7107609", "0.7014927", "0.6968675", "0.6950781", "0.6945946", "0.6887855", "0.68615603", "0.6829315", "0.6815827", "0.6780851", "0.67530257", "0.67220837", "0.6720404", "0.67153865", "0.6707374", "0.6687556"...
0.0
-1
Convert pydantic object to pandas dataframe with 1 row.
def to_df(self): return pd.DataFrame([dict(self)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_df(self):\r\n return pd.DataFrame([dict(self)])", "def to_df(self):\n from ..df import DataFrame\n\n return DataFrame(self)", "def pandas_convert(self):\n data = {}\n\n for names in self.data[0]:\n col_values = []\n\n if names in objects:\n ...
[ "0.75817996", "0.7210344", "0.7195528", "0.7187567", "0.71487796", "0.7104129", "0.71013093", "0.7047505", "0.69818395", "0.6981776", "0.6981776", "0.69500226", "0.6906501", "0.68661636", "0.68262136", "0.681778", "0.67798555", "0.67733806", "0.6754019", "0.673979", "0.672651...
0.75378114
3
Parses input yaml file and substitutes {tokens} from context. Loads yaml into memory to do parsing, so be aware of big files.
def run_step(context): logger.debug("started") context.assert_keys_have_values(__name__, 'fileFormatYamlIn', 'fileFormatYamlOut') in_path = context.get_formatted('fileFormatYamlIn') out_path = context.get_formatted('fileFormatYamlO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_yaml(yfile):\n try:\n f0 = get_fileobj(yfile)\n context_items = [ConTextItem(literal=d[\"Lex\"],\n category=d[\"Type\"],\n re=r\"%s\"%d[\"Regex\"],\n rule=d[\"Direction\"],\n comments=d[\"Comments\"]) for d in ...
[ "0.58173066", "0.564686", "0.5559516", "0.5474356", "0.54730994", "0.5451101", "0.5435742", "0.54168653", "0.54006207", "0.53755003", "0.53265005", "0.5319712", "0.52482605", "0.52397454", "0.52121884", "0.5190898", "0.5177625", "0.5175006", "0.5173243", "0.5164659", "0.51057...
0.65476483
0
Return specified app's main window instance. We need this in order for our Qt dialogs to be correctly parented as a subwindow. For apps that don't use Qt for their UI, various hacks may need to be deployed...
def _main_window(app=HOST): if app in ['standalone', 'generic']: return None # Blender (not Qt) # Requires bqt - see https://github.com/techartorg/bqt elif app == 'blender': obj = QtWidgets.QApplication.instance().blender_widget if obj: return obj # Clarisse (not Qt) # elif app == 'clarisse': # for o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_window():\n # case: Maya\n if pkgutil.find_loader(\"maya\"):\n for obj in QtWidgets.QApplication.topLevelWidgets():\n if obj.objectName() == \"MayaWindow\":\n return obj\n\n # case: Houdini\n if pkgutil.find_loader(\"hou\"):\n module = importlib.import_m...
[ "0.81392723", "0.8023601", "0.8005372", "0.7900502", "0.770894", "0.7697409", "0.7697409", "0.7697409", "0.7661753", "0.7656008", "0.76174015", "0.761251", "0.7562426", "0.7562426", "0.7538503", "0.74310714", "0.73967475", "0.73899364", "0.7374749", "0.72272354", "0.7142622",...
0.8647699
0
Fully connected layer with Mout features.
def fc(regularizers, x, Mout, relu=True): N, Min = x.get_shape() W = _weight_variable(regularizers,[int(Min), Mout], regularization=True) b = _bias_variable(regularizers,[Mout], regularization=True) x = tf.matmul(x, W) + b return tf.nn.relu(x) if relu else x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fully_connected(self, input_layer, num_outputs, activation=None):\n num_inputs = input_layer.get_shape().as_list()[1]\n kernel_size = [num_inputs, num_outputs]\n with tf.variable_scope(self._count_layer('fully_connected')):\n kernel = self._get_variable('weights', kernel_size,\n...
[ "0.63221115", "0.6159888", "0.6134218", "0.60969806", "0.60744804", "0.60744804", "0.605512", "0.6054018", "0.59806514", "0.59806514", "0.59576476", "0.5929704", "0.59036636", "0.59036636", "0.58249193", "0.5731739", "0.571907", "0.57047457", "0.5685404", "0.56569755", "0.562...
0.0
-1
repr, just use __str__
def __repr__(self) -> str: return self.__str__()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\r\n return repr(self)", "def __str__(self):\n return repr(self)", "def __repr__(self):\r\n return self.__str__()", "def __repr__(self):\n str(self)", "def __repr__(self):\r\n return self.to_str()", "def __repr__(self):\r\n return self.to_str()"...
[ "0.87488496", "0.8683042", "0.8472215", "0.84714115", "0.8412814", "0.8412814", "0.8405477", "0.83845913", "0.83845913", "0.83845913", "0.83845913", "0.83845913", "0.8377652", "0.83684355", "0.83684355", "0.83684355", "0.8332875", "0.8332875", "0.8332875", "0.8332875", "0.833...
0.83737326
16
true if the data is 'old'. data returned by the daily limit endpoint is cached on their end for 5 minutes.
def need_update(self): five_minutes_ago = datetime.now() - timedelta(minutes=5) if ( self.fetch_status != self.FetchStatus.NONE and self.collected_at > five_minutes_ago ): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cached_data_fresh(name, max_age):\n age = get_cached_data_age(name)\n if not age:\n return False\n return age < max_age", "def data_is_fresh():\n \n # get timestamp for local data\n current_file_timestamp = datetime.datetime.fromtimestamp(\n os.path.getmtime('s0000661_e.xm...
[ "0.6977411", "0.6945097", "0.6651861", "0.64727867", "0.6381727", "0.63555676", "0.63300383", "0.62320715", "0.6161348", "0.6098978", "0.5937407", "0.5935756", "0.591632", "0.5900302", "0.58821815", "0.5867047", "0.58640426", "0.585731", "0.5820837", "0.58045506", "0.5794672"...
0.611311
9
returns a hubspot3 crm_association_labels client
def crm_association_labels(self): from hubspot3.crm_association_labels import CRMAssociationLabelsClient return CRMAssociationLabelsClient(**self.auth, **self.options)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crm_associations(self):\n from hubspot3.crm_associations import CRMAssociationsClient\n\n return CRMAssociationsClient(**self.auth, **self.options)", "def build_resource_labels(self):\n response = [ \n {\n \"key\": \"instance_id\", \n \"value\": \...
[ "0.6071502", "0.5322365", "0.5304862", "0.5284204", "0.5188073", "0.51244867", "0.50488967", "0.50180405", "0.49787408", "0.49610063", "0.49515802", "0.48883596", "0.48674572", "0.48561567", "0.48498568", "0.48187628", "0.4791505", "0.4775393", "0.47647417", "0.4753614", "0.4...
0.8701838
0
returns a hubspot3 owners client
def owners(self): from hubspot3.owners import OwnersClient return OwnersClient(**self.auth, **self.options)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_client():\n return Client(__address, authkey='strumamor')", "def get_client(self):\n return self.client", "def get_contribs_client():\n from mpcontribs.client import Client\n\n headers = get_consumer()\n\n if is_localhost():\n return Client(apikey=get_user_api_key())\n else...
[ "0.642027", "0.6321152", "0.6277686", "0.6234495", "0.6125955", "0.6105564", "0.59868777", "0.5915874", "0.58269143", "0.5819595", "0.58133", "0.58131087", "0.58131087", "0.5799837", "0.5796643", "0.5795796", "0.5751736", "0.574989", "0.573055", "0.57257473", "0.57205164", ...
0.750011
0
returns a hubspot3 products client
def products(self): from hubspot3.products import ProductsClient return ProductsClient(**self.auth, **self.options)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ecommerce_bridge(self):\n from hubspot3.ecommerce_bridge import EcommerceBridgeClient\n\n return EcommerceBridgeClient(**self.auth, **self.options)", "def getProducts():\n return \"http://api.tcgplayer.com/catalog/products\"", "def _base(self):\n from hubspot3.base import BaseClient...
[ "0.6638602", "0.6370649", "0.6266043", "0.6079702", "0.5941544", "0.59005827", "0.5822369", "0.58213204", "0.5801335", "0.579243", "0.57651037", "0.57154477", "0.57102543", "0.57102543", "0.5709735", "0.5686267", "0.5634477", "0.5612543", "0.5566559", "0.5561518", "0.5549502"...
0.7860981
0
returns a hubspot3 workflows client
def workflows(self): from hubspot3.workflows import WorkflowsClient return WorkflowsClient(**self.auth, **self.options)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rest_client(self):\n return workflow_ctx.internal.handler.rest_client", "def get_workflow_object(\n workflow_name, settings, logger, client, token, decision, maximum_page_size\n):\n module_name = \"workflow.\" + workflow_name\n module_object = importlib.import_module(module_name)\n workflo...
[ "0.64411646", "0.6372315", "0.61268055", "0.57950073", "0.5623727", "0.5577613", "0.5577192", "0.55506825", "0.5480159", "0.5480159", "0.54425", "0.5391359", "0.53900045", "0.5352455", "0.5352455", "0.53495854", "0.53254145", "0.53099036", "0.52997226", "0.5293179", "0.529108...
0.7031461
0
fetches and returns a nice usage limitation object
def usage_limits(self): if self._usage_limits.need_update: limits = self._base._call("integrations/v1/limit/daily")[0] self._usage_limits = Hubspot3UsageLimits( collected_at=datetime.fromtimestamp(int(limits["collectedAt"]) / 1000), current_usage=int(limit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_quota(self):\n raise NotImplementedError", "def _get_next_limit(self):\n return self.__quota", "def get_resource_limit(resource):\n\n return _resources_allowed_dict[resource]", "def get_usage(self):\r\n return self.box_usage", "def get_limit(self):\n return self.limit",...
[ "0.59923756", "0.5986678", "0.59698606", "0.59264624", "0.59192324", "0.58701664", "0.5824707", "0.58099645", "0.57230705", "0.57044595", "0.5687149", "0.567746", "0.5650054", "0.5650054", "0.56480384", "0.5646718", "0.5634448", "0.56341136", "0.5596024", "0.55950665", "0.559...
0.5976128
2
Return a bytestring version of 's', encoded as UTF8. Similar to smart_bytes, except that lazy instances are resolved to strings, rather than kept as lazy objects.
def smart_bytes(s): # Handle the common case first for performance reasons. if isinstance(s, bytes) or isinstance(s, _PROTECTED_TYPES): return s if isinstance(s, memoryview): return bytes(s) return s.encode()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def asbytes(s):\n if isinstance(s, bytes):\n return s\n else:\n return s.encode('utf-8')", "def _as_bytes(s):\n if isinstance(s, bytes):\n return s\n return bytes(s, encoding='latin_1')", "def str_to_bytes(s, encoding='ascii'):\n return s.encode(encoding)", "def bytes_to_s...
[ "0.77897245", "0.767456", "0.71833885", "0.71764076", "0.71764076", "0.7164458", "0.7074817", "0.70611644", "0.7031507", "0.7017202", "0.6989668", "0.6954049", "0.6935905", "0.69111323", "0.69088435", "0.6870624", "0.6802584", "0.6802584", "0.67773366", "0.6661313", "0.660484...
0.74430394
2
Test that when hitting the homepage you get a 200
def test_view_response_via_url(self): request = self.factory.get(reverse('homepage')) response = HomePageView.as_view()(request) # Check that 200 is returned as status code self.assertEquals(response.status_code, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_home_status_code(self):\n result = self.app.get('/')\n self.assertEqual(result.status_code, 200)", "def test_status_home(self):\n self.assertEqual(200, self.response.status_code)", "def test_home(client):\n rv = client.get('/')\n assert 200 == rv.status_code", "def test_ho...
[ "0.8288261", "0.8273573", "0.8228847", "0.8136266", "0.8134166", "0.802451", "0.80047846", "0.7991961", "0.7979805", "0.79744756", "0.7952105", "0.7952105", "0.79487306", "0.79348266", "0.79197043", "0.78920543", "0.78839463", "0.7839149", "0.7757307", "0.7740891", "0.7729057...
0.7475377
73
Make a grayscale color table with the specified bit depth.
def grayscaleColorTable(bits=8): conversion = 255./(2**bits-1) return ''.join([3*chr(int(conversion*i)) for i in range(2**bits)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeReducedColorTable(levels):\n assert len(levels)==3\n assert levels[0]*levels[1]*levels[2]<256\n conversions = [255./(l-1) for l in levels]\n colorTable = [(int(conversions[0]*r),int(conversions[1]*g),int(conversions[2]*b))\n for r in range(levels[0]) for g in range(levels[1]) for b in ra...
[ "0.6044128", "0.5823107", "0.5635321", "0.5456832", "0.5453675", "0.5450638", "0.54488796", "0.54407305", "0.54268736", "0.54213303", "0.5420697", "0.5403138", "0.53998595", "0.53905946", "0.5381059", "0.5355727", "0.53536797", "0.5327542", "0.53266877", "0.5317582", "0.53129...
0.7322485
0
Posterize RGB channels and convert to color table indices.
def reduceColorRGB(channels,levels): data = (levels[2]*levels[1]*reduceColor(channels[0],levels[0])+ levels[2]*reduceColor(channels[1],levels[1])+ reduceColor(channels[2],levels[2])).astype(numpy.uint8) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def colorPaletteToRGB(image_data,color_table): \n color_table_array = numpy.array([ord(c) for c in color_table])\n n_colors = color_table_array.size / 3\n color_table_array = color_table_array.reshape((n_colors,3))\n channels = [color_table_array[image_data,i] for i in range(3)]\n return channels", "def rgb...
[ "0.6731661", "0.6070348", "0.59697247", "0.5910127", "0.58041584", "0.57614917", "0.5750122", "0.56823623", "0.56800586", "0.5613734", "0.559402", "0.55814487", "0.55715173", "0.5552835", "0.55455357", "0.5478539", "0.5478539", "0.5478539", "0.5478539", "0.54701114", "0.54552...
0.60380995
2
Assigns _annotate attribute correctly based on the x_y coordinates of the square. The annotate property is helpful when printing the board, since we only want to print the square_id on select squares to minimize clutter.
def __post_init__(self) -> None: self.annotate = self.x_y[0] == 0 or self.x_y[1] == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def annotate_squares(self, squares, edge=None, player=None):\r\n self.get_cmd(\"annotate_squares\")\r\n self.add_prev_parts(edge)\r\n if player is None:\r\n player = self.get_player()\r\n if not isinstance(squares, list):\r\n squares = [squares]\r\n for squa...
[ "0.6471406", "0.60313916", "0.5988379", "0.5936191", "0.58545285", "0.5851613", "0.58337355", "0.5827301", "0.5827301", "0.58048487", "0.572318", "0.5679954", "0.5632764", "0.5618096", "0.556691", "0.5541786", "0.55382276", "0.54709345", "0.5462119", "0.54503626", "0.54422015...
0.5911904
4
Equality check, makes sure other object is of the right type.
def __eq__(self, other) -> bool: if not isinstance(other, Square): raise TypeError("Cannot compare Square object to object of different type") return self.x_y == other.x_y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_equal_same_type(self, other):\n return True", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n return (isinstance(other, self.__class__) and\n self.type == ot...
[ "0.8274309", "0.8169762", "0.7915901", "0.7888663", "0.7808983", "0.7685614", "0.7679093", "0.7584715", "0.7574893", "0.7559064", "0.7534429", "0.751503", "0.7510035", "0.74932134", "0.7479746", "0.743907", "0.74374664", "0.74303126", "0.74165505", "0.73913157", "0.73913157",...
0.0
-1
Returns true if a nonempty chess piece is on this square, false otherwise.
def is_unoccupied(self) -> bool: return self.piece == Piece() # Piece() creates an "empty-piece"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_piece(self) -> bool:\r\n if self.piece is not None:\r\n return True\r\n \r\n return False", "def in_check(self, colour):\n from pieces import King, Queen, Bishop, Knight, Rook, Pawn\n king_coord = self.white_king_coord if colour is WHITE else self.black_king_...
[ "0.788473", "0.7444026", "0.7438741", "0.7402445", "0.72975266", "0.72751504", "0.7239823", "0.7196185", "0.70857406", "0.7020203", "0.6990272", "0.6967573", "0.69359", "0.6875976", "0.6848787", "0.6824076", "0.6779372", "0.6763597", "0.6727214", "0.6726461", "0.67221916", ...
0.7194114
8
Initialize a new ConsoleController self.
def __init__(self, number_of_cheeses, number_of_stools): self.model = TOAHModel(number_of_stools) self.model.fill_first_stool(number_of_cheeses)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, game):\n self.game = game\n ConsoleController.__init__(self, None)", "def setUp(self):\n self.console = ConsoleWidget()\n self.text_edit = self.console._control", "def start_console(self):\n return", "def __init__(self, args):\n super().__init__()\...
[ "0.6877711", "0.6424866", "0.64218956", "0.6346592", "0.63323087", "0.622217", "0.6177624", "0.6140839", "0.6123322", "0.6034491", "0.6029231", "0.5926883", "0.58533317", "0.58454233", "0.58082134", "0.57866454", "0.5783643", "0.57251877", "0.5723522", "0.5698522", "0.5649235...
0.0
-1
Evaluate the model for specified metric on validation dataset.
def evaluate(self, input_graph, dataloader, postprocess=None, metric=None, measurer=None, iteration=-1, tensorboard=False): logger.info("start to evaluate model....") import tensorflow as tf from .tf_utils.graph_rewriter.generic.pre_optimize import PreOptimization graph...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_evaluate(model,x_train,n_y_array,x_val, vald_array):\n\n scores = model.evaluate(x_train, n_y_array, verbose=1)\n\n scores2 = model.evaluate(x_val, vald_array, verbose=1)\n\n\n print(\"for traininf set\")\n\n print(\"%s: %.2f%%\" % (model.metrics_names[1], scores[1]*100))\n\n print(\"%s: %...
[ "0.7344029", "0.72330433", "0.7220746", "0.716061", "0.7113558", "0.70528936", "0.70115954", "0.6997464", "0.6985259", "0.6977626", "0.6945585", "0.69218165", "0.6917834", "0.690018", "0.68787867", "0.687311", "0.6857455", "0.6845746", "0.6825499", "0.68243575", "0.67950034",...
0.0
-1
Returns the list of neighbour.
def edges_list(self): return self._edges_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_neighbours(self):\n return []", "def get_neighbours(self):\n return self.neighbours", "def get_neighbors(self):\n return self.neighbours_names", "def get_neighbours(self):\n return self._neighbours", "def neighbours(self):\n return [x.node for x in self.edges]...
[ "0.86329573", "0.8253436", "0.8170284", "0.8107017", "0.8021447", "0.7877863", "0.78689766", "0.78689766", "0.78689766", "0.78689766", "0.78027034", "0.77699685", "0.7642167", "0.75673354", "0.75286055", "0.7523496", "0.7513268", "0.749388", "0.7468462", "0.74628246", "0.7433...
0.0
-1
2 edges are equal iff same cordinates and same id
def __eq__(self,other): boul0 = self.linked[0].coordinates[0]==other.linked[0].coordinates[0] and self.linked[0].coordinates[1]==other.linked[0].coordinates[1] boul1 = self.linked[1].coordinates[0]==other.linked[1].coordinates[0] and self.linked[1].coordinates[1]==other.linked[1].coordinates[1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other: Vertex) -> bool:\n if isinstance(other, self.__class__):\n return self.id == other.id and self.edges == other.edges\n return False", "def test_graphid_operator_eq_and_neq():\n\n for xstr, ystr in itertools.product([\"g1\", \"g2\", \"y7\", \"z123\"], repeat=2):\...
[ "0.7005593", "0.6888093", "0.68814456", "0.67372805", "0.669054", "0.6679017", "0.6603304", "0.6564395", "0.6532165", "0.6501918", "0.6495436", "0.64894855", "0.6471989", "0.63639295", "0.63564414", "0.629231", "0.6289114", "0.6284407", "0.62523353", "0.62386227", "0.62386227...
0.69819385
1
Returns the pairs of connected vertices. Beware ! There might be nonconnected vertices in the graph.
def pairs_of_vertices(self): pairs_of_vertices = [] for vertice in self.list_of_vertices: for edge in vertice.edges_list: if non_oriented: if (vertice, edge.linked[1]) and (edge.linked[1], vertice) not in pairs_of_vertices: pairs_of...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vertices(self):\r\n return self.adjacent.keys()", "def vertices(self):\n s = set([x for x in self.edges.keys()])\n t = set([y for v in self.edges.values() for (y,d) in v.items()])\n v = s.union(t)\n return list(v)", "def vertices(self):\r\n return list(self.__graph...
[ "0.75566196", "0.6929476", "0.69189465", "0.68819237", "0.6878861", "0.6878861", "0.6878861", "0.6876629", "0.6873968", "0.6850235", "0.68404484", "0.6838328", "0.68335825", "0.6795832", "0.6788172", "0.6706184", "0.6690003", "0.66820353", "0.66657573", "0.6658202", "0.658479...
0.8280839
0
Get the URL address of the current page.
def get_url(self): return self.driver.current_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_url(self) -> str:\n\n return self.__page_url", "def current_url(self):\n return self.browser.current_url", "def get_current_url():\n return current_url", "def get_url(self):\n url = self.driver.current_url\n return url", "def getUrl(self):\n result = self.CORE....
[ "0.78724766", "0.7816947", "0.75905514", "0.75497556", "0.75209177", "0.73895264", "0.71664745", "0.7093864", "0.7093456", "0.70141834", "0.6956512", "0.6902963", "0.68774617", "0.6868716", "0.6845411", "0.6841052", "0.68401", "0.68181163", "0.6793231", "0.6751907", "0.670328...
0.7510771
5
Yield sublist of A of length N.
def chunks(A, N): for i in range(0, len(A)): r = A[i:i+N] if len(r) == N: yield r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunks(alist, n):\n for i in range(0, len(alist), n):\n yield alist[i:i + n]", "def iter_n(sequence: Sequence[T], n: int) -> List[T]:\n\t\n\tfor i in range(len(sequence) - (n-1)):\n\t\tyield sequence[i:i+n]", "def take(iterable, n):\n return list(itertools.islice(iterable, n))", "def split_b...
[ "0.6799771", "0.6774828", "0.6718393", "0.6640993", "0.6631424", "0.6631424", "0.6621859", "0.6621859", "0.65864396", "0.6580277", "0.6580277", "0.6549579", "0.65188205", "0.64952624", "0.6450778", "0.64263916", "0.64197636", "0.641796", "0.6413278", "0.6404067", "0.63961005"...
0.73276186
0
Evaluate this model with given metric.
def evaluate(self, x: ndarray, label: ndarray) -> Dict[str, float]: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self, dataset, metric='auto', missing_value_action='auto'):\n\n _raise_error_evaluation_metric_is_valid(metric,\n ['auto', 'accuracy', 'confusion_matrix', 'roc_curve', 'auc',\n 'log_loss', 'precision', 'recall', 'f1_score'])\n return super(_Classifier, self...
[ "0.68113047", "0.6704501", "0.66534674", "0.6555745", "0.65372837", "0.65051186", "0.64653605", "0.64548635", "0.64461714", "0.6385725", "0.630229", "0.6243725", "0.62251294", "0.61765313", "0.61485004", "0.61438173", "0.61382234", "0.6135658", "0.61134636", "0.61057013", "0....
0.0
-1
Clear and reset model parameters.
def clear(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self.params.resetParams()", "def reset_parameters(self):\n self.lin.reset_parameters()\n self.att.reset_parameters()\n self.gnn_score.reset_parameters()\n if self.gnn_intra_cluster is not None:\n self.gnn_intra_cluster.reset_parameters()\n s...
[ "0.78882766", "0.75861067", "0.755878", "0.75307584", "0.7482565", "0.744242", "0.74128294", "0.74048585", "0.7376325", "0.73287445", "0.72374463", "0.71701854", "0.71701854", "0.71701854", "0.7142993", "0.7125873", "0.71208763", "0.71208763", "0.71208763", "0.7093835", "0.70...
0.0
-1
Computes the precision for the specified values of k
def accuracy(output, target, topk=(1,)): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.reshape(1, -1).expand_as(pred)) res = [] for k in topk: correct_k = correct[:k].reshape(-1).float().sum(0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den", "def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\...
[ "0.76427615", "0.74189496", "0.7418079", "0.72710466", "0.72456723", "0.72446615", "0.7237539", "0.72213703", "0.7210107", "0.7058935", "0.6852219", "0.6786084", "0.67836976", "0.6768417", "0.67273885", "0.67181736", "0.67181736", "0.67181736", "0.67181736", "0.67181736", "0....
0.0
-1
Returns molecular weight of molecule. Where molecule is in standard chemical notation, e.g. 'CO2', 'HCO3' or B(OH)4 Returns
def calc_M(molecule): # load periodic table els = elements() # define regexs parens = re.compile('\(([A-z0-9]+)\)([0-9]+)?') stoich = re.compile('([A-Z][a-z]?)([0-9]+)?') ps = parens.findall(molecule) # find subgroups in parentheses rem = parens.sub('', molecule) # get remainder m ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight(self) -> float:\n self.sanitize(raise_exception=False)\n return Descriptors.ExactMolWt(self.rd_mol)", "def molecular_weight(elements):\n return (np.array([atomic_mass[i.upper()] for i in elements]).sum())", "def get_mol_wt(self):\n return self.get_empirical_formula().get_mole...
[ "0.6943404", "0.6663832", "0.6620149", "0.6620149", "0.6609809", "0.64106184", "0.63421416", "0.6240017", "0.61388874", "0.61150897", "0.58703834", "0.5817821", "0.5682294", "0.55956477", "0.54666877", "0.5465568", "0.5441643", "0.5404796", "0.53925836", "0.53835183", "0.5364...
0.62040937
8
Converts permass concentrations to molar elemental ratios. Be careful with units.
def to_molar_ratio(massfrac_numerator, massfrac_denominator, numerator_mass, denominator_mass): return (massfrac_numerator / numerator_mass) / (massfrac_denominator / denominator_mass)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_mass_fraction(molar_ratio, massfrac_denominator, numerator_mass, denominator_mass):\n return molar_ratio * massfrac_denominator * numerator_mass / denominator_mass", "def calculate_molar_mass(collector):\n avg_temp = collector.get_average_temperature()\n avg_acceleration = collector.get_a...
[ "0.6570512", "0.6387427", "0.6225264", "0.6197347", "0.61699295", "0.61401415", "0.59813184", "0.5977784", "0.5962342", "0.5911865", "0.5904414", "0.5866847", "0.5850029", "0.5839683", "0.5834741", "0.57970756", "0.5790854", "0.57902527", "0.57459486", "0.5739973", "0.5671409...
0.7075
0
Converts permass concentrations to molar elemental ratios. Be careful with units.
def to_mass_fraction(molar_ratio, massfrac_denominator, numerator_mass, denominator_mass): return molar_ratio * massfrac_denominator * numerator_mass / denominator_mass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_molar_ratio(massfrac_numerator, massfrac_denominator, numerator_mass, denominator_mass):\n return (massfrac_numerator / numerator_mass) / (massfrac_denominator / denominator_mass)", "def calculate_molar_mass(collector):\n avg_temp = collector.get_average_temperature()\n avg_acceleration =...
[ "0.70750344", "0.63879806", "0.6224704", "0.6200152", "0.6170182", "0.61407906", "0.5981897", "0.5978215", "0.5962941", "0.59128755", "0.5904845", "0.5865875", "0.5851286", "0.5841126", "0.58343244", "0.5798284", "0.5793204", "0.579121", "0.5745705", "0.5740774", "0.56701314"...
0.65707004
1
Sets an image's anchor point to its center
def center_image(image): image.anchor_x = image.width/2 image.anchor_y = image.height/2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_anchor_center(img):\n img.anchor_x = int(img.width / 2)\n img.anchor_y = int(img.height / 2)", "def center_image_anchor(image):\n image.anchor_x = image.height/2\n image.anchor_y = image.height/2", "def center_image(image):\r\n image.anchor_x = image.width / 2\r\n image.anchor_y = im...
[ "0.9029463", "0.889027", "0.84556025", "0.84556025", "0.7735181", "0.6867212", "0.6867212", "0.6867212", "0.6599067", "0.6544991", "0.6494122", "0.6492903", "0.6490786", "0.6450402", "0.6446988", "0.63265955", "0.628803", "0.6261697", "0.62337834", "0.61823696", "0.6159086", ...
0.8374943
4
Converts a 2D list of sentences (list of list of words) to onehot encoded tokens of shape [n_sentences, n_words, len(token_mapping), 1].
def prepare_inputs(token_mapping, w2v_W, w2v_U, sentences): tokens = [tokenize(token_mapping, sentence) for sentence in sentences] depth = len(token_mapping) one_hot_tokens = [] for sentence in tokens: one_hot_sentence = [] for i, token in enumerate(sentence): if token ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot(self, x, vocab, n_grams) -> np.ndarray:\n _x = np.zeros((x.__len__(), self.max_length, vocab.__len__()))\n for i, item in enumerate(tqdm(x, desc='One Hot Text Encoder')):\n items = TextProcessor.n_gram_split(item, n_grams)\n for j, token in enumerate(items):\n ...
[ "0.7612472", "0.7453885", "0.73896337", "0.7338679", "0.7274861", "0.723236", "0.71225893", "0.7064828", "0.7060053", "0.7013442", "0.70107055", "0.69854766", "0.6969808", "0.6944609", "0.6912902", "0.6887957", "0.6887957", "0.6864752", "0.68587154", "0.6849206", "0.6849206",...
0.6864606
18
Convert each state from str to its corresponding int value. Convert the int to a onehot vector.
def prepare_labels(state_mapping, sequences): encoded_labels = [[state_mapping[state] for state in label] for label in sequences] depth = len(state_mapping) one_hot_labels = [[one_hot_encode(label, depth) for label in sequence] for sequence in encoded_labels] one_hot_labels = [np.asarray(ls) for ls...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_to_onehot(self, string_seq):\n char_list = list(string_seq)\n int_list = self.char_to_int(char_list)\n one_hot = np.zeros((len(self.unique_chars), len(int_list)))\n for i,int_elem in enumerate(int_list):\n one_hot[int_elem,i] = 1\n return one_hot", "def encode_one_hot(s...
[ "0.7652874", "0.7154067", "0.7031119", "0.70227796", "0.7006052", "0.6976143", "0.6918961", "0.6917776", "0.6915389", "0.68740904", "0.6830135", "0.68282956", "0.6800283", "0.67805237", "0.67596763", "0.67363805", "0.6711154", "0.67109644", "0.67079055", "0.6679125", "0.66779...
0.0
-1
If there's an error, the video's state should change to error.
def test_error(self): with build_video(self.user) as video: video = self._send(video, None) eq_(video.state, 'error')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def videostart_failed(self):\n # type: () -> bool\n return self._videostart_failed", "def test_api_video_update_live_state_invalid_state(self):\n video = factories.VideoFactory(\n id=\"a1a21411-bf2f-4926-b97f-3c48a124d528\",\n upload_state=PENDING,\n live_sta...
[ "0.6850327", "0.6648256", "0.6501016", "0.6486651", "0.64745677", "0.6245674", "0.6153345", "0.6150683", "0.6136198", "0.6088421", "0.6035782", "0.60141194", "0.59987426", "0.59581625", "0.59347904", "0.5892585", "0.5874808", "0.586871", "0.5861455", "0.5848578", "0.58309966"...
0.8121518
0
Calling add_vote increases the vote count.
def test_basic(self): with build_video(self.user, votes=0) as video: votes = video.votes add_vote(video) video = Video.objects.get(pk=video.pk) eq_(video.votes, votes + 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_vote(self, source, target):\n\n if self.votes.get(source, None)==target:\n return # Don't need to change a thing.\n self.votes[source] = target\n\n qty = self.voted.get(target, 0)\n self.voted[target] = qty + 1\n pass", "def add_vote():\n \n\n comment_i...
[ "0.6996275", "0.6280074", "0.62158394", "0.6165154", "0.60829306", "0.6061945", "0.60602486", "0.6038132", "0.59813607", "0.5896909", "0.58887076", "0.5873401", "0.5832762", "0.58298826", "0.57890314", "0.5752846", "0.5719724", "0.5706418", "0.5696254", "0.5661899", "0.564551...
0.53567404
40
SMPTE time format used in the following SMPTE Offset field.
def smpte_format(self) -> int: return self.__smpte_format
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time(self):\n return \"%02u:%02u:%02u (%d)\" % self.rtc.datetime()[4:8]", "def datetime_timeplotxml(self):\n if self.time:\n return self.date.strftime(\"%b %d %Y\") + \" \" + self.time.strftime(\"%H:%M:%S\") + \" GMT\"\n else:\n return self.date.strftime(\"%b %d...
[ "0.6964342", "0.65610915", "0.6521764", "0.6515311", "0.6491577", "0.64914745", "0.64728427", "0.6441333", "0.64370936", "0.63413614", "0.6336355", "0.6286966", "0.62477726", "0.62118185", "0.6189835", "0.618919", "0.6186287", "0.6150095", "0.61360997", "0.6108936", "0.608921...
0.6182555
17
SMPTE time offset to be used.
def smpte_offset(self) -> int: return self.__smpte_offset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def utctime(stamp):\n return stamp + utc_offset", "def time(self, offset=None):\n if offset is None:\n offset = self.offset\n if offset % self.recordsize != 0:\n warnings.warn(\"Offset for which time is requested is not \"\n \"integer multiple of re...
[ "0.6602128", "0.6592711", "0.6570662", "0.6536683", "0.6529877", "0.6436975", "0.6301645", "0.6265782", "0.62313527", "0.62207353", "0.6192506", "0.615404", "0.61043936", "0.59606695", "0.59359276", "0.59303015", "0.59033734", "0.58847", "0.58832085", "0.5850743", "0.5845143"...
0.6522687
5
If price is 4% below the Slow MA, return True
def maStrategy(df, i:int): if not df.__contains__('slow_sma'): Indicators.AddIndicator(df, indicator_name="sma", col_name="slow_sma", args=30) buy_price = 0.96 * df['slow_sma'][i] if buy_price >= df['close'][i]: return min(buy_price, df['high'][i]) return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_price():\n global NUMBER_OF_TOTAL_COINS, BEVERAGE_PRICE\n\n if NUMBER_OF_TOTAL_COINS == BEVERAGE_PRICE:\n return True\n elif NUMBER_OF_TOTAL_COINS < BEVERAGE_PRICE:\n return False\n else:\n return \"FATAL\"", "def check_price(self, price_diff):\n chance = exp(pri...
[ "0.7092251", "0.70886075", "0.68338186", "0.6721053", "0.669013", "0.6486905", "0.64506775", "0.640032", "0.6352781", "0.6351585", "0.63333744", "0.6312263", "0.62225676", "0.6177426", "0.61377215", "0.61357594", "0.61335623", "0.61264473", "0.61101085", "0.6108655", "0.60844...
0.59250563
31
If price is 2.5% below the Lower Bollinger Band, return True
def bollStrategy(df, i:int): if not df.__contains__('low_boll'): Indicators.AddIndicator(df, indicator_name="lbb", col_name="low_boll", args=14) buy_price = 0.975 * df['low_boll'][i] if buy_price >= df['close'][i]: return min(buy_price, df['high'][i]) return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_price():\n global NUMBER_OF_TOTAL_COINS, BEVERAGE_PRICE\n\n if NUMBER_OF_TOTAL_COINS == BEVERAGE_PRICE:\n return True\n elif NUMBER_OF_TOTAL_COINS < BEVERAGE_PRICE:\n return False\n else:\n return \"FATAL\"", "def is_bull_market(self):\n return self.port_return(s...
[ "0.69209397", "0.6902486", "0.67776644", "0.67218643", "0.6555132", "0.65380377", "0.6447067", "0.64414006", "0.6280859", "0.61472887", "0.6134311", "0.6123086", "0.60963", "0.60828555", "0.60571605", "0.60542977", "0.6030594", "0.60294574", "0.60290325", "0.5990258", "0.5984...
0.6071898
14
If price is above the Cloud formed by the Senkou Span A and B, and it moves above Tenkansen (from below), that is a buy signal.
def ichimokuBullish(df, i:int): if not df.__contains__('tenkansen') or not df.__contains__('kijunsen') or \ not df.__contains__('senkou_a') or not df.__contains__('senkou_b'): Indicators.AddIndicator(df, indicator_name="ichimoku", col_name=None, args=None) if i - 1 > 0 and i < len(df): if df['senkou_a'][i] is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_tick(self, low, high):\n buy_orders = [x for x in self.orders if x['side'] == 'buy']\n sell_orders = [x for x in self.orders if x['side'] == 'sell']\n for buy_order in buy_orders:\n if (buy_order['type'] == 'stop' and float(high) >= float(buy_order['price'])) or float(low) <=...
[ "0.6647733", "0.64933574", "0.64789736", "0.635645", "0.63562864", "0.63130605", "0.62567663", "0.61974204", "0.6164737", "0.6123446", "0.6110002", "0.604022", "0.598293", "0.5980419", "0.59796095", "0.596539", "0.59547496", "0.59387416", "0.59142363", "0.5911559", "0.5910275...
0.0
-1
Return the column addressed by column_name throws IndexError if the column doesn't exist.
def getCol(self, column_name): idx = self.colnames.index(column_name) return self.getColByIdx(idx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_column(self, column_name):\n self.check_for_column(column_name)\n return self.data[column_name].dropna()", "def _get_column(self, name):\r\n return self.column(name)", "def _get_column(cls, name):\r\n return cls._columns[name]", "def get_column_index(self, colName):\n\t\tr...
[ "0.7714685", "0.7650503", "0.76223123", "0.76065403", "0.7599028", "0.75833434", "0.75328934", "0.7448818", "0.7424424", "0.738257", "0.7336229", "0.73362017", "0.72618985", "0.7194864", "0.71373194", "0.70307726", "0.6987194", "0.69389665", "0.6921798", "0.6916647", "0.67962...
0.79146
0
Function to generate random string.
def get_random_string(self, length): letters = string.ascii_lowercase return ''.join(random.choice(letters) for i in range(length))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateRandomString():\n return ''.join(b64encode(urandom(32)).decode('utf-8'))", "def generate_random_string():\n return \"\".join(random.choice(string.ascii_lowercase + string.digits) for _ in range(16)) # nosec", "def __generate_random_string():\n return uuid4().hex[:6].upper()", "def g...
[ "0.8847078", "0.8671955", "0.8310088", "0.8151735", "0.8077759", "0.8053863", "0.7999233", "0.7975691", "0.79698485", "0.7943272", "0.7906384", "0.7844923", "0.78303105", "0.78171843", "0.77939504", "0.7769523", "0.7764892", "0.77631474", "0.7732048", "0.77122647", "0.7707292...
0.75691295
44
Return a signature for the given message. To ensure that key rotation works automatically, always fetch the secret token from the secret store immediately before use and do not cache / save the token anywhere. The ``current`` version of the secret will be used to sign the token.
def make_signature(secret: VersionedSecret, message: str, max_age: datetime.timedelta) -> bytes: version = 1 expiration = int(time.time() + max_age.total_seconds()) header = _HEADER_FORMAT.pack(version, expiration) digest = _compute_digest(secret.current, header, message) return base64.urlsafe_b64en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign(self, message):\n return Signature(self._sk.sign(message))", "def get_signature(self, message):\n signature = calc_signature(message, self.negotiate_flags,\n self.outgoing_signing_key,\n self.outgoing_seq_num, self.outgoin...
[ "0.6959091", "0.6849116", "0.65762854", "0.6491322", "0.6461738", "0.6426274", "0.6386524", "0.6348236", "0.630369", "0.6234957", "0.612379", "0.61205864", "0.60925806", "0.6039358", "0.60156816", "0.60063016", "0.5997408", "0.5981859", "0.59768385", "0.5956349", "0.59515107"...
0.68028414
2
Return a copy of the array collapsed into one dimension.
def flatten(self, order='C'): result = super(self.__class__, self).flatten(order) result.nsamples = None return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten_numpy(ndarray):\n return np.reshape(ndarray, (-1,), 'F')", "def flatten(self, arr):\n shape = arr.shape\n return arr.reshape(shape[0] * shape[1], *shape[2:])", "def expand_dims(array):\n return array[np.newaxis, np.newaxis, ...]", "def flatten(self) -> np.ndarray:\n\n ...
[ "0.6731754", "0.67048925", "0.6468377", "0.6466933", "0.63290554", "0.630381", "0.62498814", "0.6234112", "0.6223042", "0.62106687", "0.61890495", "0.61877614", "0.61055", "0.60689557", "0.60284156", "0.6006088", "0.59936386", "0.5950406", "0.5930238", "0.59251297", "0.589467...
0.0
-1
Returns True is string is a number.
def is_number_parse_float(s): try: float(s) return True except ValueError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_number(string):\r\n try:\r\n float(string)\r\n return True\r\n except ValueError: return False", "def is_number(string):\n try:\n float(string)\n return True\n except ValueError:\n return False", "def is_number(s):\r\n try:\r\n int(s)\r\n r...
[ "0.88506556", "0.8807221", "0.87626666", "0.8714686", "0.86490434", "0.8636379", "0.8611055", "0.86024445", "0.85966146", "0.85966146", "0.85966146", "0.85862595", "0.8556225", "0.853933", "0.8464423", "0.8389442", "0.83497494", "0.8290531", "0.8215785", "0.8160896", "0.81168...
0.73616105
78
Returns True is string is a number.
def is_number_regex(s): if re_match('^\d+?\.\d+?$', s) is None: return s.isdigit() return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_number(string):\r\n try:\r\n float(string)\r\n return True\r\n except ValueError: return False", "def is_number(string):\n try:\n float(string)\n return True\n except ValueError:\n return False", "def is_number(s):\r\n try:\r\n int(s)\r\n r...
[ "0.8850884", "0.8807396", "0.87623763", "0.87143797", "0.86495125", "0.86369324", "0.8611852", "0.8602863", "0.8597067", "0.8597067", "0.8597067", "0.85868895", "0.8556723", "0.8540039", "0.846474", "0.83899784", "0.83504224", "0.82912153", "0.8217023", "0.81620115", "0.81181...
0.76521534
44
Returns True is string is a number.
def compiled_regex(s): if comp.match(s) is None: return s.isdigit() return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_number(string):\r\n try:\r\n float(string)\r\n return True\r\n except ValueError: return False", "def is_number(string):\n try:\n float(string)\n return True\n except ValueError:\n return False", "def is_number(s):\r\n try:\r\n int(s)\r\n r...
[ "0.8850884", "0.8807396", "0.87623763", "0.87143797", "0.86495125", "0.86369324", "0.8611852", "0.8602863", "0.8597067", "0.8597067", "0.8597067", "0.85868895", "0.8556723", "0.8540039", "0.846474", "0.83899784", "0.83504224", "0.82912153", "0.8217023", "0.81620115", "0.81181...
0.0
-1
Returns True is string is a number.
def is_number_repl_isdigit(s): return s.replace('.', '', 1).isdigit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_number(string):\r\n try:\r\n float(string)\r\n return True\r\n except ValueError: return False", "def is_number(string):\n try:\n float(string)\n return True\n except ValueError:\n return False", "def is_number(s):\r\n try:\r\n int(s)\r\n r...
[ "0.8850884", "0.8807396", "0.87623763", "0.87143797", "0.86495125", "0.86369324", "0.8611852", "0.8602863", "0.8597067", "0.8597067", "0.8597067", "0.85868895", "0.8556723", "0.8540039", "0.846474", "0.83899784", "0.83504224", "0.82912153", "0.8217023", "0.81620115", "0.81181...
0.7544545
60
Returns True is string is a number.
def is_number_repl_isnumeric(s): return s.replace('.', '', 1).isnumeric()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_number(string):\r\n try:\r\n float(string)\r\n return True\r\n except ValueError: return False", "def is_number(string):\n try:\n float(string)\n return True\n except ValueError:\n return False", "def is_number(s):\r\n try:\r\n int(s)\r\n r...
[ "0.88506556", "0.8807221", "0.87626666", "0.8714686", "0.86490434", "0.8636379", "0.8611055", "0.86024445", "0.85966146", "0.85966146", "0.85966146", "0.85862595", "0.8556225", "0.853933", "0.8464423", "0.8389442", "0.83497494", "0.8290531", "0.8215785", "0.8160896", "0.81168...
0.8040065
21
Get the message data.
def get_message(self): return self.message
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_message(self):\n data = self.socket.recv(1024)\n if not data:\n logging.error('Failed to read data from socket')\n return\n\n return self.decode_message(data)", "def toData(self):\n\n lines = []\n # 1. Request and protocol version\n lines.ap...
[ "0.74726737", "0.7117985", "0.71089983", "0.7055785", "0.7055785", "0.7055785", "0.7049448", "0.70235014", "0.70235014", "0.70216936", "0.70216936", "0.70216936", "0.70216936", "0.7021647", "0.7021647", "0.7021571", "0.7015116", "0.6988721", "0.69623476", "0.6956262", "0.6956...
0.6846719
34
Get the XY position on the map of the node.
def getCoords(nodeName, nodeDatabase): theNode = nodeDatabase[nodeName] if theNode == None: return None xTen = int(nodeName[0]) xOne = int(nodeName[1]) yTen = int(nodeName[2]) yOne = int(nodeName[3]) x = xTen * 10 + xOne y = yTen * 10 + yOne x = float(x) + theNode[0] y = float(y) + theNode[1] return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xy(self):\n return self.coords.xy", "def get_position(self):\n return self._find_gnx_node(self.gnx)", "def coords(self):\n return nx.get_node_attributes(self.network, 'coords')", "def get_xy(self):\r\n return self.board.get_xy()", "def get_coord(self):\n return self.c...
[ "0.7250584", "0.7159918", "0.7108726", "0.6967099", "0.69583595", "0.6904986", "0.6873157", "0.68647164", "0.6741242", "0.66012746", "0.6586785", "0.6573644", "0.6560857", "0.6553393", "0.655308", "0.65177476", "0.6515806", "0.6515806", "0.6504982", "0.64987385", "0.6495844",...
0.6433661
34
This function finds the 2 norm for a given vector. It does this by squaring each value in the list, summing them, and then finally finding the square root of the sum
def norm(vector): result = 0 # initial value for the result of this function for z in range(len(vector)): # this loop will continue as long as there are more values in the list result += vector[z]**2 result = result**.5 # The two equations above find the sum of the squares and then the square...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def l2_norm(v):\n res = 0\n for e in v:\n res += e * e\n return math.sqrt(res)", "def norm(vec):\n n = 0.0\n for i in vec:\n n += math.pow(i, 2)\n return math.sqrt(n)", "def norm_l2(v):\n return np.sqrt((v**2).sum())", "def norm(vec):\n return sqrt(sum([i**2 for i in...
[ "0.81989217", "0.8151633", "0.81496537", "0.81379104", "0.7771093", "0.7727026", "0.7720259", "0.7697699", "0.7678383", "0.7595459", "0.7586427", "0.7577254", "0.7534515", "0.74822927", "0.7480247", "0.738931", "0.73876673", "0.7382133", "0.7350607", "0.7265401", "0.7262132",...
0.8468561
0
This function finds the unit vector, also known as the normalization, of a given vector. It does this by using the the function above to find the 2norm and then dividing each unit in the list by the 2norm
def unit(vector): result = [[0] for row in range(len(vector))] # creates the initial value for result of this function, which is a vector full of 0s with the same lenght of a given vector for z in range(len(vector)): # for loop which continues as long as there are more elements in the vector resul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cal_unit_vec(vector):\n return vector / np.linalg.norm(vector)", "def unit_vector(vector):\n vector = np.array(vector)\n if np.linalg.norm(vector) <= 0.00010:\n normv = 1.0\n else:\n normv = np.linalg.norm(vector)\n return vector / normv", "def unit_vector(vector):\n return ...
[ "0.7996573", "0.7922191", "0.787928", "0.787928", "0.787928", "0.787928", "0.787928", "0.787928", "0.787928", "0.787928", "0.787928", "0.787928", "0.787928", "0.7876743", "0.7876743", "0.7876743", "0.7778686", "0.7772224", "0.7682105", "0.7635428", "0.75481325", "0.75334245...
0.7745174
18
This function finds the product between a scalar and a vector. It does this by taking the vector and multiplying each element by the scalar
def scalarmul(scalar,vector): result = [[0] for row in range(len(vector))] # creates a list full of 0s with the same lenght of the vector for z in range(len(vector)): # for loop which continues as long as there are more elements left in the given vector result[z] = scalar*vector[z] # the list fu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scalar_vector_mult(alpha, v):\n return [alpha*x for x in v]", "def scalar_multiply(c: float, v: Vector) -> Vector:\n return [c * v_i for v_i in v]", "def scalar_multiply(c: float, v: Vector) -> Vector:\n return [c * v_i for v_i in v]", "def scalar_multiply(s: float, v: Vector) -> Vector:\n re...
[ "0.782281", "0.7785813", "0.7785813", "0.77515614", "0.7632434", "0.744548", "0.7437649", "0.7379587", "0.73759156", "0.73759156", "0.7313975", "0.7125886", "0.7030887", "0.7008096", "0.6960221", "0.6944935", "0.690916", "0.6890367", "0.6885481", "0.68412447", "0.6821492", ...
0.6948726
15