sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
def getSpaceUse(self): """Get disk space usage. @return: Dictionary of filesystem space utilization stats for filesystems. """ stats = {} try: out = subprocess.Popen([dfCmd, "-Pk"], stdout=subprocess.PIPE).communic...
Get disk space usage. @return: Dictionary of filesystem space utilization stats for filesystems.
entailment
def retrieveVals(self): """Retrieve values for graphs.""" stats = self._dbconn.getDatabaseStats() databases = stats.get('databases') totals = stats.get('totals') if self.hasGraph('pg_connections'): limit = self._dbconn.getParam('max_connections') ...
Retrieve values for graphs.
entailment
def connect(self, host, port): """Connects via a RS-485 to Ethernet adapter.""" sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((host, port)) self._reader = sock.makefile(mode='rb') self._writer = sock.makefile(mode='wb')
Connects via a RS-485 to Ethernet adapter.
entailment
def process(self, data_changed_callback): """Process data; returns when the reader signals EOF. Callback is notified when any data changes.""" # pylint: disable=too-many-locals,too-many-branches,too-many-statements while True: byte = self._reader.read(1) while Tr...
Process data; returns when the reader signals EOF. Callback is notified when any data changes.
entailment
def send_key(self, key): """Sends a key.""" _LOGGER.info('Queueing key %s', key) frame = self._get_key_event_frame(key) # Queue it to send immediately following the reception # of a keep-alive packet in an attempt to avoid bus collisions. self._send_queue.put({'frame': f...
Sends a key.
entailment
def states(self): """Returns a set containing the enabled states.""" state_list = [] for state in States: if state.value & self._states != 0: state_list.append(state) if (self._flashing_states & States.FILTER) != 0: state_list.append(States.FILTER...
Returns a set containing the enabled states.
entailment
def get_state(self, state): """Returns True if the specified state is enabled.""" # Check to see if we have a change request pending; if we do # return the value we expect it to change to. for data in list(self._send_queue.queue): desired_states = data['desired_states'] ...
Returns True if the specified state is enabled.
entailment
def set_state(self, state, enable): """Set the state.""" is_enabled = self.get_state(state) if is_enabled == enable: return True key = None desired_states = [{'state': state, 'enabled': not is_enabled}] if state == States.FILTER_LOW_SPEED: if no...
Set the state.
entailment
def trace(function, *args, **k) : """Decorates a function by tracing the begining and end of the function execution, if doTrace global is True""" if doTrace : print ("> "+function.__name__, args, k) result = function(*args, **k) if doTrace : print ("< "+function.__name__, args, k, "->", result) return result
Decorates a function by tracing the begining and end of the function execution, if doTrace global is True
entailment
def geocode(self, location) : url = QtCore.QUrl("http://maps.googleapis.com/maps/api/geocode/xml") url.addQueryItem("address", location) url.addQueryItem("sensor", "false") """ url = QtCore.QUrl("http://maps.google.com/maps/geo/") url.addQueryItem("q", location) url.addQueryItem("output", "csv") url.add...
url = QtCore.QUrl("http://maps.google.com/maps/geo/") url.addQueryItem("q", location) url.addQueryItem("output", "csv") url.addQueryItem("sensor", "false")
entailment
def correlate(params, corrmat): """ Force a correlation matrix on a set of statistically distributed objects. This function works on objects in-place. Parameters ---------- params : array An array of of uv objects. corrmat : 2d-array The correlation matrix to b...
Force a correlation matrix on a set of statistically distributed objects. This function works on objects in-place. Parameters ---------- params : array An array of of uv objects. corrmat : 2d-array The correlation matrix to be imposed
entailment
def induce_correlations(data, corrmat): """ Induce a set of correlations on a column-wise dataset Parameters ---------- data : 2d-array An m-by-n array where m is the number of samples and n is the number of independent variables, each column of the array corresponding ...
Induce a set of correlations on a column-wise dataset Parameters ---------- data : 2d-array An m-by-n array where m is the number of samples and n is the number of independent variables, each column of the array corresponding to each variable corrmat : 2d-array ...
entailment
def plotcorr(X, plotargs=None, full=True, labels=None): """ Plots a scatterplot matrix of subplots. Usage: plotcorr(X) plotcorr(..., plotargs=...) # e.g., 'r*', 'bo', etc. plotcorr(..., full=...) # e.g., True or False plotc...
Plots a scatterplot matrix of subplots. Usage: plotcorr(X) plotcorr(..., plotargs=...) # e.g., 'r*', 'bo', etc. plotcorr(..., full=...) # e.g., True or False plotcorr(..., labels=...) # e.g., ['label1', 'label2', ...] Each co...
entailment
def chol(A): """ Calculate the lower triangular matrix of the Cholesky decomposition of a symmetric, positive-definite matrix. """ A = np.array(A) assert A.shape[0] == A.shape[1], "Input matrix must be square" L = [[0.0] * len(A) for _ in range(len(A))] for i in range(len(A)): ...
Calculate the lower triangular matrix of the Cholesky decomposition of a symmetric, positive-definite matrix.
entailment
def get(self, uri, params={}): '''A generic method to make GET requests to the OpenDNS Investigate API on the given URI. ''' return self._session.get(urljoin(Investigate.BASE_URL, uri), params=params, headers=self._auth_header, proxies=self.proxies )
A generic method to make GET requests to the OpenDNS Investigate API on the given URI.
entailment
def post(self, uri, params={}, data={}): '''A generic method to make POST requests to the OpenDNS Investigate API on the given URI. ''' return self._session.post( urljoin(Investigate.BASE_URL, uri), params=params, data=data, headers=self._auth_header, ...
A generic method to make POST requests to the OpenDNS Investigate API on the given URI.
entailment
def get_parse(self, uri, params={}): '''Convenience method to call get() on an arbitrary URI and parse the response into a JSON object. Raises an error on non-200 response status. ''' return self._request_parse(self.get, uri, params)
Convenience method to call get() on an arbitrary URI and parse the response into a JSON object. Raises an error on non-200 response status.
entailment
def post_parse(self, uri, params={}, data={}): '''Convenience method to call post() on an arbitrary URI and parse the response into a JSON object. Raises an error on non-200 response status. ''' return self._request_parse(self.post, uri, params, data)
Convenience method to call post() on an arbitrary URI and parse the response into a JSON object. Raises an error on non-200 response status.
entailment
def categorization(self, domains, labels=False): '''Get the domain status and categorization of a domain or list of domains. 'domains' can be either a single domain, or a list of domains. Setting 'labels' to True will give back categorizations in human-readable form. For more de...
Get the domain status and categorization of a domain or list of domains. 'domains' can be either a single domain, or a list of domains. Setting 'labels' to True will give back categorizations in human-readable form. For more detail, see https://investigate.umbrella.com/docs/api#categori...
entailment
def cooccurrences(self, domain): '''Get the cooccurrences of the given domain. For details, see https://investigate.umbrella.com/docs/api#co-occurrences ''' uri = self._uris["cooccurrences"].format(domain) return self.get_parse(uri)
Get the cooccurrences of the given domain. For details, see https://investigate.umbrella.com/docs/api#co-occurrences
entailment
def related(self, domain): '''Get the related domains of the given domain. For details, see https://investigate.umbrella.com/docs/api#relatedDomains ''' uri = self._uris["related"].format(domain) return self.get_parse(uri)
Get the related domains of the given domain. For details, see https://investigate.umbrella.com/docs/api#relatedDomains
entailment
def security(self, domain): '''Get the Security Information for the given domain. For details, see https://investigate.umbrella.com/docs/api#securityInfo ''' uri = self._uris["security"].format(domain) return self.get_parse(uri)
Get the Security Information for the given domain. For details, see https://investigate.umbrella.com/docs/api#securityInfo
entailment
def rr_history(self, query, query_type="A"): '''Get the RR (Resource Record) History of the given domain or IP. The default query type is for 'A' records, but the following query types are supported: A, NS, MX, TXT, CNAME For details, see https://investigate.umbrella.com/docs/a...
Get the RR (Resource Record) History of the given domain or IP. The default query type is for 'A' records, but the following query types are supported: A, NS, MX, TXT, CNAME For details, see https://investigate.umbrella.com/docs/api#dnsrr_domain
entailment
def domain_whois(self, domain): '''Gets whois information for a domain''' uri = self._uris["whois_domain"].format(domain) resp_json = self.get_parse(uri) return resp_json
Gets whois information for a domain
entailment
def domain_whois_history(self, domain, limit=None): '''Gets whois history for a domain''' params = dict() if limit is not None: params['limit'] = limit uri = self._uris["whois_domain_history"].format(domain) resp_json = self.get_parse(uri, params) return res...
Gets whois history for a domain
entailment
def ns_whois(self, nameservers, limit=DEFAULT_LIMIT, offset=DEFAULT_OFFSET, sort_field=DEFAULT_SORT): '''Gets the domains that have been registered with a nameserver or nameservers''' if not isinstance(nameservers, list): uri = self._uris["whois_ns"].format(nameservers) p...
Gets the domains that have been registered with a nameserver or nameservers
entailment
def search(self, pattern, start=None, limit=None, include_category=None): '''Searches for domains that match a given pattern''' params = dict() if start is None: start = datetime.timedelta(days=30) if isinstance(start, datetime.timedelta): params['start'] = int...
Searches for domains that match a given pattern
entailment
def samples(self, anystring, limit=None, offset=None, sortby=None): '''Return an object representing the samples identified by the input domain, IP, or URL''' uri = self._uris['samples'].format(anystring) params = {'limit': limit, 'offset': offset, 'sortby': sortby} return self.get_par...
Return an object representing the samples identified by the input domain, IP, or URL
entailment
def sample(self, hash, limit=None, offset=None): '''Return an object representing the sample identified by the input hash, or an empty object if that sample is not found''' uri = self._uris['sample'].format(hash) params = {'limit': limit, 'offset': offset} return self.get_parse(uri, pa...
Return an object representing the sample identified by the input hash, or an empty object if that sample is not found
entailment
def as_for_ip(self, ip): '''Gets the AS information for a given IP address.''' if not Investigate.IP_PATTERN.match(ip): raise Investigate.IP_ERR uri = self._uris["as_for_ip"].format(ip) resp_json = self.get_parse(uri) return resp_json
Gets the AS information for a given IP address.
entailment
def prefixes_for_asn(self, asn): '''Gets the AS information for a given ASN. Return the CIDR and geolocation associated with the AS.''' uri = self._uris["prefixes_for_asn"].format(asn) resp_json = self.get_parse(uri) return resp_json
Gets the AS information for a given ASN. Return the CIDR and geolocation associated with the AS.
entailment
def timeline(self, uri): '''Get the domain tagging timeline for a given uri. Could be a domain, ip, or url. For details, see https://docs.umbrella.com/investigate-api/docs/timeline ''' uri = self._uris["timeline"].format(uri) resp_json = self.get_parse(uri) retu...
Get the domain tagging timeline for a given uri. Could be a domain, ip, or url. For details, see https://docs.umbrella.com/investigate-api/docs/timeline
entailment
def abs(x): """ Absolute value """ if isinstance(x, UncertainFunction): mcpts = np.abs(x._mcpts) return UncertainFunction(mcpts) else: return np.abs(x)
Absolute value
entailment
def acos(x): """ Inverse cosine """ if isinstance(x, UncertainFunction): mcpts = np.arccos(x._mcpts) return UncertainFunction(mcpts) else: return np.arccos(x)
Inverse cosine
entailment
def acosh(x): """ Inverse hyperbolic cosine """ if isinstance(x, UncertainFunction): mcpts = np.arccosh(x._mcpts) return UncertainFunction(mcpts) else: return np.arccosh(x)
Inverse hyperbolic cosine
entailment
def asin(x): """ Inverse sine """ if isinstance(x, UncertainFunction): mcpts = np.arcsin(x._mcpts) return UncertainFunction(mcpts) else: return np.arcsin(x)
Inverse sine
entailment
def asinh(x): """ Inverse hyperbolic sine """ if isinstance(x, UncertainFunction): mcpts = np.arcsinh(x._mcpts) return UncertainFunction(mcpts) else: return np.arcsinh(x)
Inverse hyperbolic sine
entailment
def atan(x): """ Inverse tangent """ if isinstance(x, UncertainFunction): mcpts = np.arctan(x._mcpts) return UncertainFunction(mcpts) else: return np.arctan(x)
Inverse tangent
entailment
def atanh(x): """ Inverse hyperbolic tangent """ if isinstance(x, UncertainFunction): mcpts = np.arctanh(x._mcpts) return UncertainFunction(mcpts) else: return np.arctanh(x)
Inverse hyperbolic tangent
entailment
def ceil(x): """ Ceiling function (round towards positive infinity) """ if isinstance(x, UncertainFunction): mcpts = np.ceil(x._mcpts) return UncertainFunction(mcpts) else: return np.ceil(x)
Ceiling function (round towards positive infinity)
entailment
def cos(x): """ Cosine """ if isinstance(x, UncertainFunction): mcpts = np.cos(x._mcpts) return UncertainFunction(mcpts) else: return np.cos(x)
Cosine
entailment
def cosh(x): """ Hyperbolic cosine """ if isinstance(x, UncertainFunction): mcpts = np.cosh(x._mcpts) return UncertainFunction(mcpts) else: return np.cosh(x)
Hyperbolic cosine
entailment
def degrees(x): """ Convert radians to degrees """ if isinstance(x, UncertainFunction): mcpts = np.degrees(x._mcpts) return UncertainFunction(mcpts) else: return np.degrees(x)
Convert radians to degrees
entailment
def exp(x): """ Exponential function """ if isinstance(x, UncertainFunction): mcpts = np.exp(x._mcpts) return UncertainFunction(mcpts) else: return np.exp(x)
Exponential function
entailment
def expm1(x): """ Calculate exp(x) - 1 """ if isinstance(x, UncertainFunction): mcpts = np.expm1(x._mcpts) return UncertainFunction(mcpts) else: return np.expm1(x)
Calculate exp(x) - 1
entailment
def fabs(x): """ Absolute value function """ if isinstance(x, UncertainFunction): mcpts = np.fabs(x._mcpts) return UncertainFunction(mcpts) else: return np.fabs(x)
Absolute value function
entailment
def floor(x): """ Floor function (round towards negative infinity) """ if isinstance(x, UncertainFunction): mcpts = np.floor(x._mcpts) return UncertainFunction(mcpts) else: return np.floor(x)
Floor function (round towards negative infinity)
entailment
def hypot(x, y): """ Calculate the hypotenuse given two "legs" of a right triangle """ if isinstance(x, UncertainFunction) or isinstance(x, UncertainFunction): ufx = to_uncertain_func(x) ufy = to_uncertain_func(y) mcpts = np.hypot(ufx._mcpts, ufy._mcpts) return UncertainF...
Calculate the hypotenuse given two "legs" of a right triangle
entailment
def log(x): """ Natural logarithm """ if isinstance(x, UncertainFunction): mcpts = np.log(x._mcpts) return UncertainFunction(mcpts) else: return np.log(x)
Natural logarithm
entailment
def log10(x): """ Base-10 logarithm """ if isinstance(x, UncertainFunction): mcpts = np.log10(x._mcpts) return UncertainFunction(mcpts) else: return np.log10(x)
Base-10 logarithm
entailment
def log1p(x): """ Natural logarithm of (1 + x) """ if isinstance(x, UncertainFunction): mcpts = np.log1p(x._mcpts) return UncertainFunction(mcpts) else: return np.log1p(x)
Natural logarithm of (1 + x)
entailment
def radians(x): """ Convert degrees to radians """ if isinstance(x, UncertainFunction): mcpts = np.radians(x._mcpts) return UncertainFunction(mcpts) else: return np.radians(x)
Convert degrees to radians
entailment
def sin(x): """ Sine """ if isinstance(x, UncertainFunction): mcpts = np.sin(x._mcpts) return UncertainFunction(mcpts) else: return np.sin(x)
Sine
entailment
def sinh(x): """ Hyperbolic sine """ if isinstance(x, UncertainFunction): mcpts = np.sinh(x._mcpts) return UncertainFunction(mcpts) else: return np.sinh(x)
Hyperbolic sine
entailment
def sqrt(x): """ Square-root function """ if isinstance(x, UncertainFunction): mcpts = np.sqrt(x._mcpts) return UncertainFunction(mcpts) else: return np.sqrt(x)
Square-root function
entailment
def tan(x): """ Tangent """ if isinstance(x, UncertainFunction): mcpts = np.tan(x._mcpts) return UncertainFunction(mcpts) else: return np.tan(x)
Tangent
entailment
def tanh(x): """ Hyperbolic tangent """ if isinstance(x, UncertainFunction): mcpts = np.tanh(x._mcpts) return UncertainFunction(mcpts) else: return np.tanh(x)
Hyperbolic tangent
entailment
def trunc(x): """ Truncate the values to the integer value without rounding """ if isinstance(x, UncertainFunction): mcpts = np.trunc(x._mcpts) return UncertainFunction(mcpts) else: return np.trunc(x)
Truncate the values to the integer value without rounding
entailment
def lhd( dist=None, size=None, dims=1, form="randomized", iterations=100, showcorrelations=False, ): """ Create a Latin-Hypercube sample design based on distributions defined in the `scipy.stats` module Parameters ---------- dist: array_like frozen scipy.stat...
Create a Latin-Hypercube sample design based on distributions defined in the `scipy.stats` module Parameters ---------- dist: array_like frozen scipy.stats.rv_continuous or rv_discrete distribution objects that are defined previous to calling LHD size: int integer valu...
entailment
def to_uncertain_func(x): """ Transforms x into an UncertainFunction-compatible object, unless it is already an UncertainFunction (in which case x is returned unchanged). Raises an exception unless 'x' belongs to some specific classes of objects that are known not to depend on UncertainFunctio...
Transforms x into an UncertainFunction-compatible object, unless it is already an UncertainFunction (in which case x is returned unchanged). Raises an exception unless 'x' belongs to some specific classes of objects that are known not to depend on UncertainFunction objects (which then cannot be co...
entailment
def Beta(alpha, beta, low=0, high=1, tag=None): """ A Beta random variate Parameters ---------- alpha : scalar The first shape parameter beta : scalar The second shape parameter Optional -------- low : scalar Lower bound of the distribution support (...
A Beta random variate Parameters ---------- alpha : scalar The first shape parameter beta : scalar The second shape parameter Optional -------- low : scalar Lower bound of the distribution support (default=0) high : scalar Upper bound of the dist...
entailment
def BetaPrime(alpha, beta, tag=None): """ A BetaPrime random variate Parameters ---------- alpha : scalar The first shape parameter beta : scalar The second shape parameter """ assert ( alpha > 0 and beta > 0 ), 'BetaPrime "alpha" and "beta" paramete...
A BetaPrime random variate Parameters ---------- alpha : scalar The first shape parameter beta : scalar The second shape parameter
entailment
def Bradford(q, low=0, high=1, tag=None): """ A Bradford random variate Parameters ---------- q : scalar The shape parameter low : scalar The lower bound of the distribution (default=0) high : scalar The upper bound of the distribution (default=1) """ ass...
A Bradford random variate Parameters ---------- q : scalar The shape parameter low : scalar The lower bound of the distribution (default=0) high : scalar The upper bound of the distribution (default=1)
entailment
def Burr(c, k, tag=None): """ A Burr random variate Parameters ---------- c : scalar The first shape parameter k : scalar The second shape parameter """ assert c > 0 and k > 0, 'Burr "c" and "k" parameters must be greater than zero' return uv(ss.burr(c, k), ...
A Burr random variate Parameters ---------- c : scalar The first shape parameter k : scalar The second shape parameter
entailment
def ChiSquared(k, tag=None): """ A Chi-Squared random variate Parameters ---------- k : int The degrees of freedom of the distribution (must be greater than one) """ assert int(k) == k and k >= 1, 'Chi-Squared "k" must be an integer greater than 0' return uv(ss.chi2(k), tag=...
A Chi-Squared random variate Parameters ---------- k : int The degrees of freedom of the distribution (must be greater than one)
entailment
def Erlang(k, lamda, tag=None): """ An Erlang random variate. This distribution is the same as a Gamma(k, theta) distribution, but with the restriction that k must be a positive integer. This is provided for greater compatibility with other simulation tools, but provides no advantage over ...
An Erlang random variate. This distribution is the same as a Gamma(k, theta) distribution, but with the restriction that k must be a positive integer. This is provided for greater compatibility with other simulation tools, but provides no advantage over the Gamma distribution in its applications. ...
entailment
def Exponential(lamda, tag=None): """ An Exponential random variate Parameters ---------- lamda : scalar The inverse scale (as shown on Wikipedia). (FYI: mu = 1/lamda.) """ assert lamda > 0, 'Exponential "lamda" must be greater than zero' return uv(ss.expon(scale=1.0 / lamda...
An Exponential random variate Parameters ---------- lamda : scalar The inverse scale (as shown on Wikipedia). (FYI: mu = 1/lamda.)
entailment
def ExtValueMax(mu, sigma, tag=None): """ An Extreme Value Maximum random variate. Parameters ---------- mu : scalar The location parameter sigma : scalar The scale parameter (must be greater than zero) """ assert sigma > 0, 'ExtremeValueMax "sigma" must be greater t...
An Extreme Value Maximum random variate. Parameters ---------- mu : scalar The location parameter sigma : scalar The scale parameter (must be greater than zero)
entailment
def Fisher(d1, d2, tag=None): """ An F (fisher) random variate Parameters ---------- d1 : int Numerator degrees of freedom d2 : int Denominator degrees of freedom """ assert ( int(d1) == d1 and d1 >= 1 ), 'Fisher (F) "d1" must be an integer greater than 0...
An F (fisher) random variate Parameters ---------- d1 : int Numerator degrees of freedom d2 : int Denominator degrees of freedom
entailment
def Gamma(k, theta, tag=None): """ A Gamma random variate Parameters ---------- k : scalar The shape parameter (must be positive and non-zero) theta : scalar The scale parameter (must be positive and non-zero) """ assert ( k > 0 and theta > 0 ), 'Gamma "k...
A Gamma random variate Parameters ---------- k : scalar The shape parameter (must be positive and non-zero) theta : scalar The scale parameter (must be positive and non-zero)
entailment
def LogNormal(mu, sigma, tag=None): """ A Log-Normal random variate Parameters ---------- mu : scalar The location parameter sigma : scalar The scale parameter (must be positive and non-zero) """ assert sigma > 0, 'Log-Normal "sigma" must be positive' return uv(s...
A Log-Normal random variate Parameters ---------- mu : scalar The location parameter sigma : scalar The scale parameter (must be positive and non-zero)
entailment
def Normal(mu, sigma, tag=None): """ A Normal (or Gaussian) random variate Parameters ---------- mu : scalar The mean value of the distribution sigma : scalar The standard deviation (must be positive and non-zero) """ assert sigma > 0, 'Normal "sigma" must be greater...
A Normal (or Gaussian) random variate Parameters ---------- mu : scalar The mean value of the distribution sigma : scalar The standard deviation (must be positive and non-zero)
entailment
def Pareto(q, a, tag=None): """ A Pareto random variate (first kind) Parameters ---------- q : scalar The scale parameter a : scalar The shape parameter (the minimum possible value) """ assert q > 0 and a > 0, 'Pareto "q" and "a" must be positive scalars' p = Uni...
A Pareto random variate (first kind) Parameters ---------- q : scalar The scale parameter a : scalar The shape parameter (the minimum possible value)
entailment
def Pareto2(q, b, tag=None): """ A Pareto random variate (second kind). This form always starts at the origin. Parameters ---------- q : scalar The scale parameter b : scalar The shape parameter """ assert q > 0 and b > 0, 'Pareto2 "q" and "b" must be positive sc...
A Pareto random variate (second kind). This form always starts at the origin. Parameters ---------- q : scalar The scale parameter b : scalar The shape parameter
entailment
def PERT(low, peak, high, g=4.0, tag=None): """ A PERT random variate Parameters ---------- low : scalar Lower bound of the distribution support peak : scalar The location of the distribution's peak (low <= peak <= high) high : scalar Upper bound of the distribut...
A PERT random variate Parameters ---------- low : scalar Lower bound of the distribution support peak : scalar The location of the distribution's peak (low <= peak <= high) high : scalar Upper bound of the distribution support Optional -------- g : scala...
entailment
def StudentT(v, tag=None): """ A Student-T random variate Parameters ---------- v : int The degrees of freedom of the distribution (must be greater than one) """ assert int(v) == v and v >= 1, 'Student-T "v" must be an integer greater than 0' return uv(ss.t(v), tag=tag)
A Student-T random variate Parameters ---------- v : int The degrees of freedom of the distribution (must be greater than one)
entailment
def Triangular(low, peak, high, tag=None): """ A triangular random variate Parameters ---------- low : scalar Lower bound of the distribution support peak : scalar The location of the triangle's peak (low <= peak <= high) high : scalar Upper bound of the distribu...
A triangular random variate Parameters ---------- low : scalar Lower bound of the distribution support peak : scalar The location of the triangle's peak (low <= peak <= high) high : scalar Upper bound of the distribution support
entailment
def Uniform(low, high, tag=None): """ A Uniform random variate Parameters ---------- low : scalar Lower bound of the distribution support. high : scalar Upper bound of the distribution support. """ assert low < high, 'Uniform "low" must be less than "high"' retur...
A Uniform random variate Parameters ---------- low : scalar Lower bound of the distribution support. high : scalar Upper bound of the distribution support.
entailment
def Weibull(lamda, k, tag=None): """ A Weibull random variate Parameters ---------- lamda : scalar The scale parameter k : scalar The shape parameter """ assert ( lamda > 0 and k > 0 ), 'Weibull "lamda" and "k" parameters must be greater than zero' re...
A Weibull random variate Parameters ---------- lamda : scalar The scale parameter k : scalar The shape parameter
entailment
def Bernoulli(p, tag=None): """ A Bernoulli random variate Parameters ---------- p : scalar The probability of success """ assert ( 0 < p < 1 ), 'Bernoulli probability "p" must be between zero and one, non-inclusive' return uv(ss.bernoulli(p), tag=tag)
A Bernoulli random variate Parameters ---------- p : scalar The probability of success
entailment
def Binomial(n, p, tag=None): """ A Binomial random variate Parameters ---------- n : int The number of trials p : scalar The probability of success """ assert ( int(n) == n and n > 0 ), 'Binomial number of trials "n" must be an integer greater than zero'...
A Binomial random variate Parameters ---------- n : int The number of trials p : scalar The probability of success
entailment
def Geometric(p, tag=None): """ A Geometric random variate Parameters ---------- p : scalar The probability of success """ assert ( 0 < p < 1 ), 'Geometric probability "p" must be between zero and one, non-inclusive' return uv(ss.geom(p), tag=tag)
A Geometric random variate Parameters ---------- p : scalar The probability of success
entailment
def Hypergeometric(N, n, K, tag=None): """ A Hypergeometric random variate Parameters ---------- N : int The total population size n : int The number of individuals of interest in the population K : int The number of individuals that will be chosen from the popul...
A Hypergeometric random variate Parameters ---------- N : int The total population size n : int The number of individuals of interest in the population K : int The number of individuals that will be chosen from the population Example ------- (Taken f...
entailment
def Poisson(lamda, tag=None): """ A Poisson random variate Parameters ---------- lamda : scalar The rate of an occurance within a specified interval of time or space. """ assert lamda > 0, 'Poisson "lamda" must be greater than zero.' return uv(ss.poisson(lamda), tag=tag)
A Poisson random variate Parameters ---------- lamda : scalar The rate of an occurance within a specified interval of time or space.
entailment
def covariance_matrix(nums_with_uncert): """ Calculate the covariance matrix of uncertain variables, oriented by the order of the inputs Parameters ---------- nums_with_uncert : array-like A list of variables that have an associated uncertainty Returns ------- cov_m...
Calculate the covariance matrix of uncertain variables, oriented by the order of the inputs Parameters ---------- nums_with_uncert : array-like A list of variables that have an associated uncertainty Returns ------- cov_matrix : 2d-array-like A nested list containin...
entailment
def correlation_matrix(nums_with_uncert): """ Calculate the correlation matrix of uncertain variables, oriented by the order of the inputs Parameters ---------- nums_with_uncert : array-like A list of variables that have an associated uncertainty Returns ------- cor...
Calculate the correlation matrix of uncertain variables, oriented by the order of the inputs Parameters ---------- nums_with_uncert : array-like A list of variables that have an associated uncertainty Returns ------- corr_matrix : 2d-array-like A nested list contain...
entailment
def var(self): """ Variance value as a result of an uncertainty calculation """ mn = self.mean vr = np.mean((self._mcpts - mn) ** 2) return vr
Variance value as a result of an uncertainty calculation
entailment
def skew(self): r""" Skewness coefficient value as a result of an uncertainty calculation, defined as:: _____ m3 \/beta1 = ------ std**3 where m3 is the third central moment and std is the standard deviation ...
r""" Skewness coefficient value as a result of an uncertainty calculation, defined as:: _____ m3 \/beta1 = ------ std**3 where m3 is the third central moment and std is the standard deviation
entailment
def kurt(self): """ Kurtosis coefficient value as a result of an uncertainty calculation, defined as:: m4 beta2 = ------ std**4 where m4 is the fourth central moment and std is the standard deviation """ ...
Kurtosis coefficient value as a result of an uncertainty calculation, defined as:: m4 beta2 = ------ std**4 where m4 is the fourth central moment and std is the standard deviation
entailment
def stats(self): """ The first four standard moments of a distribution: mean, variance, and standardized skewness and kurtosis coefficients. """ mn = self.mean vr = self.var sk = self.skew kt = self.kurt return [mn, vr, sk, kt]
The first four standard moments of a distribution: mean, variance, and standardized skewness and kurtosis coefficients.
entailment
def percentile(self, val): """ Get the distribution value at a given percentile or set of percentiles. This follows the NIST method for calculating percentiles. Parameters ---------- val : scalar or array Either a single value or an array of values be...
Get the distribution value at a given percentile or set of percentiles. This follows the NIST method for calculating percentiles. Parameters ---------- val : scalar or array Either a single value or an array of values between 0 and 1. Returns ...
entailment
def describe(self, name=None): """ Cleanly show what the four displayed distribution moments are: - Mean - Variance - Standardized Skewness Coefficient - Standardized Kurtosis Coefficient For a standard Normal distribution, these are [0, 1...
Cleanly show what the four displayed distribution moments are: - Mean - Variance - Standardized Skewness Coefficient - Standardized Kurtosis Coefficient For a standard Normal distribution, these are [0, 1, 0, 3]. If the object has an asso...
entailment
def plot(self, hist=False, show=False, **kwargs): """ Plot the distribution of the UncertainFunction. By default, the distribution is shown with a kernel density estimate (kde). Optional -------- hist : bool If true, a density histogram is displayed (...
Plot the distribution of the UncertainFunction. By default, the distribution is shown with a kernel density estimate (kde). Optional -------- hist : bool If true, a density histogram is displayed (histtype='stepfilled') show : bool If ``True``, th...
entailment
def plot(self, hist=False, show=False, **kwargs): """ Plot the distribution of the UncertainVariable. Continuous distributions are plotted with a line plot and discrete distributions are plotted with discrete circles. Optional -------- hist : bool ...
Plot the distribution of the UncertainVariable. Continuous distributions are plotted with a line plot and discrete distributions are plotted with discrete circles. Optional -------- hist : bool If true, a histogram is displayed show : bool ...
entailment
def load_hat(self, path): # pylint: disable=no-self-use """Loads the hat from a picture at path. Args: path: The path to load from Returns: The hat data. """ hat = cv2.imread(path, cv2.IMREAD_UNCHANGED) if hat is None: raise ValueErr...
Loads the hat from a picture at path. Args: path: The path to load from Returns: The hat data.
entailment
def find_faces(self, image, draw_box=False): """Uses a haarcascade to detect faces inside an image. Args: image: The image. draw_box: If True, the image will be marked with a rectangle. Return: The faces as returned by OpenCV's detectMultiScale method for ...
Uses a haarcascade to detect faces inside an image. Args: image: The image. draw_box: If True, the image will be marked with a rectangle. Return: The faces as returned by OpenCV's detectMultiScale method for cascades.
entailment
def find_resources(self, rsrc_type, sort=None, yield_pages=False, **kwargs): """Find instances of `rsrc_type` that match the filter in `**kwargs`""" return rsrc_type.find(self, sort=sort, yield_pages=yield_pages, **kwargs)
Find instances of `rsrc_type` that match the filter in `**kwargs`
entailment
def changed(self, message=None, *args): """Marks the object as changed. If a `parent` attribute is set, the `changed()` method on the parent will be called, propagating the change notification up the chain. The message (if provided) will be debug logged. """ if message ...
Marks the object as changed. If a `parent` attribute is set, the `changed()` method on the parent will be called, propagating the change notification up the chain. The message (if provided) will be debug logged.
entailment
def register(cls, origin_type): """Decorator for mutation tracker registration. The provided `origin_type` is mapped to the decorated class such that future calls to `convert()` will convert the object of `origin_type` to an instance of the decorated class. """ def decor...
Decorator for mutation tracker registration. The provided `origin_type` is mapped to the decorated class such that future calls to `convert()` will convert the object of `origin_type` to an instance of the decorated class.
entailment
def convert(cls, obj, parent): """Converts objects to registered tracked types This checks the type of the given object against the registered tracked types. When a match is found, the given object will be converted to the tracked type, its parent set to the provided parent, and returne...
Converts objects to registered tracked types This checks the type of the given object against the registered tracked types. When a match is found, the given object will be converted to the tracked type, its parent set to the provided parent, and returned. If its type does not occur in ...
entailment