Miscellaneous

Confidence Interval

mlpy.percentile_ci_median(x, nboot=1000, alpha=0.025, rseed=0)

Percentile confidence interval for the median of a sample x and unknown distribution.

Input

  • x - [1D numpy array] sample
  • nboot - [integer] (>1) number of resamples
  • alpha - [float] confidence level is 100*(1-2*alpha) (0.0<alpha<1.0)
  • rseed - [integer] random seed

Output

  • ci - (cimin, cimax) confidence interval

Example:

>>> from numpy import *
>>> from mlpy import *
>>> x = array([1,2,4,3,2,2,1,1,2,3,4,3,2])
>>> percentile_ci_median(x, nboot = 100)
(1.8461538461538463, 2.8461538461538463)

Peaks Detection

mlpy.span_pd(x, span)

span peaks detection.

Input

  • x - [1D numpy array float] data
  • span - [odd int] span

Output

  • idx - [1D numpy array integer] peaks indexes

New in version 2.0.7.

Functions from GSL

mlpy.gamma(x)

Gamma Function.

Input

  • x - [float] data

Output

  • gx - [float] gamma(x)
mlpy.fact(x)

Factorial x!. The factorial is related to the gamma function by x! = gamma(x+1)

Input

  • x - [int] data

Output

  • fx - [float] factorial x!
mlpy.quantile(x, f)

Quantile value of sorted data. The elements of the array must be in ascending numerical order. The quantile is determined by the f, a fraction between 0 and 1. The quantile is found by interpolation, using the formula: quantile = (1 - delta) x_i + delta x_{i+1} where i is floor((n - 1)f) and delta is (n-1)f - i.

Input

  • x - [1D numpy array float] sorted data
  • f - [float] fraction between 0 and 1

Output

  • q - [float] quantile
mlpy.cdf_gaussian_P(x, sigma)

Cumulative Distribution Functions (CDF) P(x) for the Gaussian distribution.

Input

  • x - [float] data
  • sigma - [float] standard deviation

Output

  • p - [float]

New in version 2.0.2.

Other

mlpy.away(a, b, d)

Given numpy 1D array a and numpy 1D array b compute c = { bi : | bi - aj | > d for each i, j}

Input

  • a - [1D numpy array float]
  • b - [1D numpy array float]
  • d - [double]

Output

  • c - [1D numpy array float]

New in version 2.0.3.

mlpy.is_power(n, b)

Return True if ‘n’ is power of ‘b’, False otherwise.

New in version 2.0.6.

mlpy.next_power(n, b)

Returns the smallest integer, greater than or equal to ‘n’ which can be obtained as power of ‘b’.

New in version 2.0.6.

Table Of Contents

Previous topic

Data Management

Next topic

Tools

This Page