text stringlengths 81 112k |
|---|
Bias-corrected distance correlation estimator between two matrices.
def _u_distance_correlation_sqr_naive(x, y, exponent=1):
"""Bias-corrected distance correlation estimator between two matrices."""
return _distance_sqr_stats_naive_generic(
x, y,
matrix_centered=_u_distance_matrix,
prod... |
Check if the fast algorithm for distance stats can be used.
The fast algorithm has complexity :math:`O(NlogN)`, better than the
complexity of the naive algorithm (:math:`O(N^2)`).
The algorithm can only be used for random variables (not vectors) where
the number of instances is greater than 3. Also, t... |
Inner function of the fast distance covariance.
This function is compiled because otherwise it would become
a bottleneck.
def _dyad_update(y, c): # pylint:disable=too-many-locals
# This function has many locals so it can be compared
# with the original algorithm.
"""
Inner function of the fas... |
Fast algorithm for the squared distance covariance.
def _distance_covariance_sqr_fast_generic(
x, y, unbiased=False): # pylint:disable=too-many-locals
# This function has many locals so it can be compared
# with the original algorithm.
"""Fast algorithm for the squared distance covariance."""
... |
Compute the distance stats using the fast algorithm.
def _distance_stats_sqr_fast_generic(x, y, dcov_function):
"""Compute the distance stats using the fast algorithm."""
covariance_xy_sqr = dcov_function(x, y)
variance_x_sqr = dcov_function(x, x)
variance_y_sqr = dcov_function(y, y)
denominator_sq... |
distance_covariance_sqr(x, y, *, exponent=1)
Computes the usual (biased) estimator for the squared distance covariance
between two random vectors.
Parameters
----------
x: array_like
First random vector. The columns correspond with the individual random
variables while the rows are... |
u_distance_covariance_sqr(x, y, *, exponent=1)
Computes the unbiased estimator for the squared distance covariance
between two random vectors.
Parameters
----------
x: array_like
First random vector. The columns correspond with the individual random
variables while the rows are ind... |
distance_stats_sqr(x, y, *, exponent=1)
Computes the usual (biased) estimators for the squared distance covariance
and squared distance correlation between two random vectors, and the
individual squared distance variances.
Parameters
----------
x: array_like
First random vector. The co... |
u_distance_stats_sqr(x, y, *, exponent=1)
Computes the unbiased estimators for the squared distance covariance
and squared distance correlation between two random vectors, and the
individual squared distance variances.
Parameters
----------
x: array_like
First random vector. The column... |
distance_stats(x, y, *, exponent=1)
Computes the usual (biased) estimators for the distance covariance
and distance correlation between two random vectors, and the
individual distance variances.
Parameters
----------
x: array_like
First random vector. The columns correspond with the in... |
distance_correlation_sqr(x, y, *, exponent=1)
Computes the usual (biased) estimator for the squared distance correlation
between two random vectors.
Parameters
----------
x: array_like
First random vector. The columns correspond with the individual random
variables while the rows a... |
u_distance_correlation_sqr(x, y, *, exponent=1)
Computes the bias-corrected estimator for the squared distance correlation
between two random vectors.
Parameters
----------
x: array_like
First random vector. The columns correspond with the individual random
variables while the rows... |
Square of the affinely invariant distance correlation.
Computes the estimator for the square of the affinely invariant distance
correlation between two random vectors.
.. warning:: The return value of this function is undefined when the
covariance matrix of :math:`x` or :math:`y` is singu... |
pairwise(function, x, y=None, *, pool=None, is_symmetric=None, **kwargs)
Computes a dependency measure between each pair of elements.
Parameters
----------
function: Dependency measure function.
x: iterable of array_like
First list of random vectors. The columns of each vector correspond
... |
Real implementation of :func:`pairwise`.
This function is used to make several parameters keyword-only in
Python 2.
def _pairwise_imp(function, x, y=None, pool=None, is_symmetric=None, **kwargs):
"""
Real implementation of :func:`pairwise`.
This function is used to make several parameters keyword... |
Compile a function using a jit compiler.
The function is always compiled to check errors, but is only used outside
tests, so that code coverage analysis can be performed in jitted functions.
The tests set sys._called_from_test in conftest.py.
def _jit(function):
"""
Compile a function using a jit... |
Return square root of an ndarray.
This sqrt function for ndarrays tries to use the exponentiation operator
if the objects stored do not supply a sqrt method.
def _sqrt(x):
"""
Return square root of an ndarray.
This sqrt function for ndarrays tries to use the exponentiation operator
if the obj... |
Convert vectors to column matrices, to always have a 2d shape.
def _transform_to_2d(t):
"""Convert vectors to column matrices, to always have a 2d shape."""
t = np.asarray(t)
dim = len(t.shape)
assert dim <= 2
if dim < 2:
t = np.atleast_2d(t).T
return t |
Return if the array can be safely converted to double.
That happens when the dtype is a float with the same size of
a double or narrower, or when is an integer that can be safely
converted to double (if the roundtrip conversion works).
def _can_be_double(x):
"""
Return if the array can be safely c... |
Pairwise distance, custom implementation.
def _cdist_naive(x, y, exponent=1):
"""Pairwise distance, custom implementation."""
squared_norms = ((x[_np.newaxis, :, :] - y[:, _np.newaxis, :]) ** 2).sum(2)
exponent = exponent / 2
try:
exponent = squared_norms.take(0).from_float(exponent)
excep... |
Pairwise distance between points in a set.
def _pdist_scipy(x, exponent=1):
"""Pairwise distance between points in a set."""
metric = 'euclidean'
if exponent != 1:
metric = 'sqeuclidean'
distances = _spatial.distance.pdist(x, metric=metric)
distances = _spatial.distance.squareform(distanc... |
Pairwise distance between the points in two sets.
def _cdist_scipy(x, y, exponent=1):
"""Pairwise distance between the points in two sets."""
metric = 'euclidean'
if exponent != 1:
metric = 'sqeuclidean'
distances = _spatial.distance.cdist(x, y, metric=metric)
if exponent != 1:
d... |
Pairwise distance between points in a set.
As Scipy converts every value to double, this wrapper uses
a less efficient implementation if the original dtype
can not be converted to double.
def _pdist(x, exponent=1):
"""
Pairwise distance between points in a set.
As Scipy converts every value t... |
Pairwise distance between points in two sets.
As Scipy converts every value to double, this wrapper uses
a less efficient implementation if the original dtype
can not be converted to double.
def _cdist(x, y, exponent=1):
"""
Pairwise distance between points in two sets.
As Scipy converts ever... |
r"""
pairwise_distances(x, y=None, *, exponent=1)
Pairwise distance between points.
Return the pairwise distance between points in two sets, or
in the same set if only one set is passed.
Parameters
----------
x: array_like
An :math:`n \times m` array of :math:`n` observations in
... |
Respond to the request.
This generates the :attr:`mohawk.Receiver.response_header`
attribute.
:param content=EmptyValue: Byte string of response body that will be sent.
:type content=EmptyValue: str
:param content_type=EmptyValue: content-type header value for response.
... |
Calculates a hash for a given payload.
def calculate_payload_hash(payload, algorithm, content_type):
"""Calculates a hash for a given payload."""
p_hash = hashlib.new(algorithm)
parts = []
parts.append('hawk.' + str(HAWK_VER) + '.payload\n')
parts.append(parse_content_type(content_type) + '\n')
... |
Calculates a message authorization code (MAC).
def calculate_mac(mac_type, resource, content_hash):
"""Calculates a message authorization code (MAC)."""
normalized = normalize_string(mac_type, resource, content_hash)
log.debug(u'normalized resource for mac calc: {norm}'
.format(norm=normalize... |
Calculates a message authorization code (MAC) for a timestamp.
def calculate_ts_mac(ts, credentials):
"""Calculates a message authorization code (MAC) for a timestamp."""
normalized = ('hawk.{hawk_ver}.ts\n{ts}\n'
.format(hawk_ver=HAWK_VER, ts=ts))
log.debug(u'normalized resource for ts m... |
Serializes mac_type and resource into a HAWK string.
def normalize_string(mac_type, resource, content_hash):
"""Serializes mac_type and resource into a HAWK string."""
normalized = [
'hawk.' + str(HAWK_VER) + '.' + mac_type,
normalize_header_attr(resource.timestamp),
normalize_header_a... |
Example Authorization header:
'Hawk id="dh37fgj492je", ts="1367076201", nonce="NPHgnG", ext="and
welcome!", mac="CeWHy4d9kbLGhDlkyw2Nh3PJ7SDOdZDa267KH4ZaNMY="'
def parse_authorization_header(auth_header):
"""
Example Authorization header:
'Hawk id="dh37fgj492je", ts="1367076201", nonc... |
Returns a bewit identifier for the resource as a string.
:param resource:
Resource to generate a bewit for
:type resource: `mohawk.base.Resource`
def get_bewit(resource):
"""
Returns a bewit identifier for the resource as a string.
:param resource:
Resource to generate a bewit for... |
Returns a `bewittuple` representing the parts of an encoded bewit string.
This has the following named attributes:
(id, expiration, mac, ext)
:param bewit:
A base64 encoded bewit string
:type bewit: str
def parse_bewit(bewit):
"""
Returns a `bewittuple` representing the parts of an... |
Strips the bewit parameter out of a url.
Returns (encoded_bewit, stripped_url)
Raises InvalidBewit if no bewit found.
:param url:
The url containing a bewit parameter
:type url: str
def strip_bewit(url):
"""
Strips the bewit parameter out of a url.
Returns (encoded_bewit, stripp... |
Validates the given bewit.
Returns True if the resource has a valid bewit parameter attached,
or raises a subclass of HawkFail otherwise.
:param credential_lookup:
Callable to look up the credentials dict by sender ID.
The credentials dict must have the keys:
``id``, ``key``, and `... |
Accept a response to this request.
:param response_header:
A `Hawk`_ ``Server-Authorization`` header
such as one created by :class:`mohawk.Receiver`.
:type response_header: str
:param content=EmptyValue: Byte string of the response body received.
:type content=E... |
Returns a ``field -> value`` dict of the current state of the instance.
def current_state(self):
"""
Returns a ``field -> value`` dict of the current state of the instance.
"""
field_names = set()
[field_names.add(f.name) for f in self._meta.local_fields]
[field_names.ad... |
Returns true if the instance was persisted (saved) in its old
state.
Examples::
>>> user = User()
>>> user.save()
>>> user.was_persisted()
False
>>> user = User.objects.get(pk=1)
>>> user.delete()
>>> user.was_persist... |
Remove trailing colons from the URI back to the first non-colon.
:param string s: input URI string
:returns: URI string with trailing colons removed
:rtype: string
TEST: trailing colons necessary
>>> s = '1:2::::'
>>> CPE._trim(s)
'1:2'
TEST: trailing ... |
Create the structure to store the input type of system associated
with components of CPE Name (hardware, operating system and software).
:param string system: type of system associated with CPE Name
:param dict components: CPE Name components to store
:returns: None
:exception: ... |
Returns the component list of input attribute.
:param string att: Attribute name to get
:returns: List of Component objects of the attribute in CPE Name
:rtype: list
:exception: ValueError - invalid attribute name
def _get_attribute_components(self, att):
"""
Returns th... |
Pack the values of the five arguments into the simple edition
component. If all the values are blank, just return a blank.
:returns: "edition", "sw_edition", "target_sw", "target_hw" and "other"
attributes packed in a only value
:rtype: string
:exception: TypeError - incompa... |
Returns the CPE Name as URI string of version 2.3.
:returns: CPE Name as URI string of version 2.3
:rtype: string
:exception: TypeError - incompatible version
def as_uri_2_3(self):
"""
Returns the CPE Name as URI string of version 2.3.
:returns: CPE Name as URI string ... |
Returns the CPE Name as Well-Formed Name string of version 2.3.
:return: CPE Name as WFN string
:rtype: string
:exception: TypeError - incompatible version
def as_wfn(self):
"""
Returns the CPE Name as Well-Formed Name string of version 2.3.
:return: CPE Name as WFN st... |
Returns the CPE Name as formatted string of version 2.3.
:returns: CPE Name as formatted string
:rtype: string
:exception: TypeError - incompatible version
def as_fs(self):
"""
Returns the CPE Name as formatted string of version 2.3.
:returns: CPE Name as formatted str... |
Returns True if c is an uppercase letter, a lowercase letter,
a digit or an underscore, otherwise False.
:param string c: Character to check
:returns: True if char is alphanumeric or an underscore,
False otherwise
:rtype: boolean
TEST: a wrong character
>>> ... |
Return the appropriate percent-encoding of character c (URI string).
Certain characters are returned without encoding.
:param string c: Character to check
:returns: Encoded character as URI
:rtype: string
TEST:
>>> c = '.'
>>> CPEComponentSimple._pct_encode_uri... |
Return True if the value of component in attribute "language" is valid,
and otherwise False.
:returns: True if value is valid, False otherwise
:rtype: boolean
def _is_valid_language(self):
"""
Return True if the value of component in attribute "language" is valid,
and o... |
Return True if the value of component in attribute "part" is valid,
and otherwise False.
:returns: True if value of component is valid, False otherwise
:rtype: boolean
def _is_valid_part(self):
"""
Return True if the value of component in attribute "part" is valid,
and ... |
Check if the value of component is correct in the attribute "comp_att".
:param string comp_att: attribute associated with value of component
:returns: None
:exception: ValueError - incorrect value of component
def _parse(self, comp_att):
"""
Check if the value of component is c... |
Returns the value of component encoded as formatted string.
Inspect each character in value of component.
Certain nonalpha characters pass thru without escaping
into the result, but most retain escaping.
:returns: Formatted string associated with component
:rtype: string
def a... |
Returns the value of component encoded as URI string.
Scans an input string s and applies the following transformations:
- Pass alphanumeric characters thru untouched
- Percent-encode quoted non-alphanumerics as needed
- Unquoted special characters are mapped to their special forms.
... |
Set the value of component. By default, the component has a simple
value.
:param string comp_str: new value of component
:param string comp_att: attribute associated with value of component
:returns: None
:exception: ValueError - incorrect value of component
def set_value(self,... |
Convert the characters of string s to standard value (WFN value).
Inspect each character in value of component. Copy quoted characters,
with their escaping, into the result. Look for unquoted non
alphanumerics and if not "*" or "?", add escaping.
:exception: ValueError - invalid charact... |
Checks if the CPE Name is valid.
:returns: None
:exception: ValueError - bad-formed CPE Name
def _parse(self):
"""
Checks if the CPE Name is valid.
:returns: None
:exception: ValueError - bad-formed CPE Name
"""
# CPE Name must not have whitespaces
... |
Returns the values of attribute "att_name" of CPE Name.
By default a only element in each part.
:param string att_name: Attribute name to get
:returns: List of attribute values
:rtype: list
:exception: ValueError - invalid attribute name
def get_attribute_values(self, att_name)... |
Set the value of component.
:param string comp_str: value of component
:returns: None
:exception: ValueError - incorrect value of component
def set_value(self, comp_str):
"""
Set the value of component.
:param string comp_str: value of component
:returns: None
... |
Convert the encoded value of component to standard value (WFN value).
def _decode(self):
"""
Convert the encoded value of component to standard value (WFN value).
"""
s = self._encoded_value
elements = s.replace('~', '').split('!')
dec_elements = []
for elem in... |
Return True if the value of component in generic attribute is valid,
and otherwise False.
:returns: True if value is valid, False otherwise
:rtype: boolean
def _is_valid_value(self):
"""
Return True if the value of component in generic attribute is valid,
and otherwise ... |
r"""
Returns the value of compoment encoded as Well-Formed Name (WFN)
string.
:returns: WFN string
:rtype: string
TEST:
>>> val = 'xp!vista'
>>> comp1 = CPEComponent1_1(val, CPEComponentSimple.ATT_VERSION)
>>> comp1.as_wfn()
'xp\\!vista'
def as... |
Set the value of component. By default, the component has a simple
value.
:param string comp_att: attribute associated with value of component
:returns: None
:exception: ValueError - incorrect value of component
TEST:
>>> val = 'xp!vista'
>>> val2 = 'sp2'
... |
Returns a component with value "value".
:param string att: Attribute name
:param string value: Attribute value
:returns: Component object created
:rtype: CPEComponent
:exception: ValueError - invalid value of attribute
def _create_component(cls, att, value):
"""
... |
Unpack its elements and set the attributes in wfn accordingly.
Parse out the five elements:
~ edition ~ software edition ~ target sw ~ target hw ~ other
:param string value: Value of edition attribute
:returns: Dictionary with parts of edition attribute
:exception: ValueError -... |
Checks if the CPE Name is valid.
:returns: None
:exception: ValueError - bad-formed CPE Name
def _parse(self):
"""
Checks if the CPE Name is valid.
:returns: None
:exception: ValueError - bad-formed CPE Name
"""
# CPE Name must not have whitespaces
... |
Returns the CPE Name as Well-Formed Name string of version 2.3.
If edition component is not packed, only shows the first seven
components, otherwise shows all.
:return: CPE Name as WFN string
:rtype: string
:exception: TypeError - incompatible version
def as_wfn(self):
... |
Convert the characters of character in value of component to standard
value (WFN value).
This function scans the value of component and returns a copy
with all percent-encoded characters decoded.
:exception: ValueError - invalid character in value of component
def _decode(self):
... |
Return True if the input value of attribute "edition" is valid,
and otherwise False.
:returns: True if value is valid, False otherwise
:rtype: boolean
def _is_valid_edition(self):
"""
Return True if the input value of attribute "edition" is valid,
and otherwise False.
... |
Return True if the value of component in attribute "language" is valid,
and otherwise False.
:returns: True if value is valid, False otherwise
:rtype: boolean
CASE 1: Language part with/without region part
CASE 2: Language part without region part
CASE 3: Region part wi... |
Return True if the value of component in attribute "part" is valid,
and otherwise False.
:returns: True if value of component is valid, False otherwise
:rtype: boolean
def _is_valid_part(self):
"""
Return True if the value of component in attribute "part" is valid,
and ... |
Compares two values associated with a attribute of two WFNs,
which may be logical values (ANY or NA) or string values.
:param string source: First attribute value
:param string target: Second attribute value
:returns: The attribute comparison relation.
:rtype: int
This ... |
Compares a source string to a target string,
and addresses the condition in which the source string
includes unquoted special characters.
It performs a simple regular expression match,
with the assumption that (as required) unquoted special characters
appear only at the beginnin... |
Return True if the string contains any unquoted special characters
(question-mark or asterisk), otherwise False.
Ex: _contains_wildcards("foo") => FALSE
Ex: _contains_wildcards("foo\?") => FALSE
Ex: _contains_wildcards("foo?") => TRUE
Ex: _contains_wildcards("\*bar") => FALSE
... |
Returns True if an even number of escape (backslash) characters
precede the character at index idx in string str.
:param string str: string to check
:returns: True if an even number of escape characters precede
the character at index idx in string str, False otherwise.
:rtyp... |
Return True if arg is a string value,
and False if arg is a logical value (ANY or NA).
:param string arg: string to check
:returns: True if value is a string, False if it is a logical value.
:rtype: boolean
This function is a support function for _compare().
def _is_string(cls... |
Compares two WFNs and returns a generator of pairwise attribute-value
comparison results. It provides full access to the individual
comparison results to enable use-case specific implementations
of novel name-comparison algorithms.
Compare each attribute of the Source WFN to the Target ... |
Compares two WFNs and returns True if the set-theoretic relation
between the names is DISJOINT.
:param CPE2_3_WFN source: first WFN CPE Name
:param CPE2_3_WFN target: seconds WFN CPE Name
:returns: True if the set relation between source and target
is DISJOINT, otherwise Fal... |
Compares two WFNs and returns True if the set-theoretic relation
between the names is EQUAL.
:param CPE2_3_WFN source: first WFN CPE Name
:param CPE2_3_WFN target: seconds WFN CPE Name
:returns: True if the set relation between source and target
is EQUAL, otherwise False.
... |
Compares two WFNs and returns True if the set-theoretic relation
between the names is (non-proper) SUBSET.
:param CPE2_3_WFN source: first WFN CPE Name
:param CPE2_3_WFN target: seconds WFN CPE Name
:returns: True if the set relation between source and target
is SUBSET, othe... |
Compares two WFNs and returns True if the set-theoretic relation
between the names is (non-proper) SUPERSET.
:param CPE2_3_WFN source: first WFN CPE Name
:param CPE2_3_WFN target: seconds WFN CPE Name
:returns: True if the set relation between source and target
is SUPERSET, ... |
Adds a CPE element to the set if not already.
Only WFN CPE Names are valid, so this function converts the input CPE
object of version 2.3 to WFN style.
:param CPE cpe: CPE Name to store in set
:returns: None
:exception: ValueError - invalid version of CPE Name
def append(self, ... |
Accepts a set of CPE Names K and a candidate CPE Name X. It returns
'True' if X matches any member of K, and 'False' otherwise.
:param CPESet self: A set of m known CPE Names K = {K1, K2, …, Km}.
:param CPE cpe: A candidate CPE Name X.
:returns: True if X matches K, otherwise False.
... |
Checks if the CPE Name is valid.
:returns: None
:exception: ValueError - bad-formed CPE Name
def _parse(self):
"""
Checks if the CPE Name is valid.
:returns: None
:exception: ValueError - bad-formed CPE Name
"""
# Check prefix and initial bracket of WF... |
Accepts a set of known CPE Names and an expression in the CPE language,
and delivers the answer True if the expression matches with the set.
Otherwise, it returns False.
:param CPELanguage self: An expression in the CPE Applicability
Language, represented as the XML infoset for the ... |
Adds a CPE Name to the set if not already.
:param CPE cpe: CPE Name to store in set
:returns: None
:exception: ValueError - invalid version of CPE Name
TEST:
>>> from .cpeset2_2 import CPESet2_2
>>> from .cpe2_2 import CPE2_2
>>> uri1 = 'cpe:/h:hp'
>>>... |
Set the value of component.
:param string comp_str: value of component
:param string comp_att: attribute associated with comp_str
:returns: None
:exception: ValueError - incorrect value of component
def set_value(self, comp_str, comp_att):
"""
Set the value of component... |
Adds a CPE Name to the set if not already.
:param CPE cpe: CPE Name to store in set
:returns: None
:exception: ValueError - invalid version of CPE Name
TEST:
>>> from .cpeset1_1 import CPESet1_1
>>> from .cpe1_1 import CPE1_1
>>> uri1 = 'cpe://microsoft:windows... |
Accepts a set of known instances of CPE Names and a candidate CPE Name,
and returns 'True' if the candidate can be shown to be
an instance based on the content of the known instances.
Otherwise, it returns 'False'.
:param CPESet self: A set of m known CPE Names K = {K1, K2, …, Km}.
... |
Checks if the CPE Name is valid.
:returns: None
:exception: ValueError - bad-formed CPE Name
def _parse(self):
"""
Checks if the CPE Name is valid.
:returns: None
:exception: ValueError - bad-formed CPE Name
"""
# CPE Name must not have whitespaces
... |
Returns the values of attribute "att_name" of CPE Name.
By default a only element in each part.
:param string att_name: Attribute name to get
:returns: List of attribute values
:rtype: list
:exception: ValueError - invalid attribute name
def get_attribute_values(self, att_name)... |
Checks if CPE Name is valid.
:returns: None
:exception: ValueError - bad-formed CPE Name
def _parse(self):
"""
Checks if CPE Name is valid.
:returns: None
:exception: ValueError - bad-formed CPE Name
"""
# CPE Name must not have whitespaces
if ... |
Returns the CPE Name as WFN string of version 2.3.
Only shows the first seven components.
:return: CPE Name as WFN string
:rtype: string
:exception: TypeError - incompatible version
def as_wfn(self):
"""
Returns the CPE Name as WFN string of version 2.3.
Only sh... |
Returns True if wfn is a non-proper superset (True superset
or equal to) any of the names in cpeset, otherwise False.
:param CPESet cpeset: list of CPE bound Names.
:param CPE2_3_WFN wfn: WFN CPE Name.
:returns: True if wfn is a non-proper superset any of the names in cpeset, otherwise ... |
Returns the result (True, False, Error) of performing the specified
check, unless the check isnt supported, in which case it returns
False. Error is a catch-all for all results other than True and
False.
:param string cpel_dom: XML infoset for the check_fact_ref element.
:retur... |
Unbinds a bound form to a WFN.
:param string boundname: CPE name
:returns: WFN object associated with boundname.
:rtype: CPE2_3_WFN
def _unbind(cls, boundname):
"""
Unbinds a bound form to a WFN.
:param string boundname: CPE name
:returns: WFN object associated... |
Accepts a set of known CPE Names and an expression in the CPE language,
and delivers the answer True if the expression matches with the set.
Otherwise, it returns False.
:param CPELanguage self: An expression in the CPE Applicability
Language, represented as the XML infoset for the ... |
Accepts a set of known instances of CPE Names and a candidate CPE Name,
and returns 'True' if the candidate can be shown to be
an instance based on the content of the known instances.
Otherwise, it returns 'False'.
:param CPESet self: A set of m known CPE Names K = {K1, K2, …, Km}.
... |
Convert the encoded value of component to standard value (WFN value).
def _decode(self):
"""
Convert the encoded value of component to standard value (WFN value).
"""
result = []
idx = 0
s = self._encoded_value
while (idx < len(s)):
# Get the idx'th... |
Check if the set of ids form a single connected component
Parameters
----------
w : spatial weights boject
ids : list
identifiers of units that are tested to be a single connected
component
Returns
-------
True : if the list of ids represents a single connected... |
Check if contiguity is maintained if leaver is removed from neighbors
Parameters
----------
w : spatial weights object
simple contiguity based weights
neighbors : list
nodes that are to be checked if they form a single \
connec... |
Ask user a yes/no question and return their response as a boolean.
``question`` should be a simple, grammatically complete question such as
"Do you wish to continue?", and will have a string similar to ``" [Y/n] "``
appended automatically. This function will *not* append a question mark for
you.
B... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.