funclp.Poisson module

class funclp.Poisson(**kwargs)[source]

Bases: Distribution

property cpu_d2loglikelihood
property cpu_dloglikelihood
property cpu_fisher
property cpu_loglikelihood
property cpu_loglikelihood_reduced
property cpu_pdf
property cpukernel_d2loglikelihood
property cpukernel_dloglikelihood
property cpukernel_fisher
property cpukernel_loglikelihood
property cpukernel_loglikelihood_reduced
property cpukernel_pdf
d2loglikelihood

Decorator class defining universal function factory object from python kernel function, will create kernels, vectorized functions, jitted functions, stack functions, all on CPU / Parallel CPU / GPU.

Examples

>>> from funclp import Parameter, ufunc
>>> import numpy as np
...
>>> class MyClass() :
...     @ufunc(variables=['x', 'y'], data=['constant'], parameters=[Parameter('a', 1), Parameter('b', 0)])
...     def myfunc(x, y, constant, /, a, b) :
...         return a * x + b * y + constant
...     cuda = False
...
>>> instance = MyClass()
...
>>> x = np.arange(20).reshape((1, 20)) # Example of variables that can be broadcasted together
>>> y = np.arange(20).reshape((20, 1)) # Example of variables that can be broadcasted together
>>> constant = np.ones((5, 20, 20)) # Example of data with full shape
>>> a = np.arange(5) # Example of parameter vector
>>> b = 0.5 # Example of scalar use
>>> cpu_out = instance.myfunc(x, y, constant, a=a, b=b)
>>> instance.cuda = True
>>> gpu_out = instance.myfunc(x, y, constant, a=a, b=b)

property default_attributes
dloglikelihood

Decorator class defining universal function factory object from python kernel function, will create kernels, vectorized functions, jitted functions, stack functions, all on CPU / Parallel CPU / GPU.

Examples

>>> from funclp import Parameter, ufunc
>>> import numpy as np
...
>>> class MyClass() :
...     @ufunc(variables=['x', 'y'], data=['constant'], parameters=[Parameter('a', 1), Parameter('b', 0)])
...     def myfunc(x, y, constant, /, a, b) :
...         return a * x + b * y + constant
...     cuda = False
...
>>> instance = MyClass()
...
>>> x = np.arange(20).reshape((1, 20)) # Example of variables that can be broadcasted together
>>> y = np.arange(20).reshape((20, 1)) # Example of variables that can be broadcasted together
>>> constant = np.ones((5, 20, 20)) # Example of data with full shape
>>> a = np.arange(5) # Example of parameter vector
>>> b = 0.5 # Example of scalar use
>>> cpu_out = instance.myfunc(x, y, constant, a=a, b=b)
>>> instance.cuda = True
>>> gpu_out = instance.myfunc(x, y, constant, a=a, b=b)

fisher

Decorator class defining universal function factory object from python kernel function, will create kernels, vectorized functions, jitted functions, stack functions, all on CPU / Parallel CPU / GPU.

Examples

>>> from funclp import Parameter, ufunc
>>> import numpy as np
...
>>> class MyClass() :
...     @ufunc(variables=['x', 'y'], data=['constant'], parameters=[Parameter('a', 1), Parameter('b', 0)])
...     def myfunc(x, y, constant, /, a, b) :
...         return a * x + b * y + constant
...     cuda = False
...
>>> instance = MyClass()
...
>>> x = np.arange(20).reshape((1, 20)) # Example of variables that can be broadcasted together
>>> y = np.arange(20).reshape((20, 1)) # Example of variables that can be broadcasted together
>>> constant = np.ones((5, 20, 20)) # Example of data with full shape
>>> a = np.arange(5) # Example of parameter vector
>>> b = 0.5 # Example of scalar use
>>> cpu_out = instance.myfunc(x, y, constant, a=a, b=b)
>>> instance.cuda = True
>>> gpu_out = instance.myfunc(x, y, constant, a=a, b=b)

property gpu_d2loglikelihood
property gpu_dloglikelihood
property gpu_fisher
property gpu_loglikelihood
property gpu_loglikelihood_reduced
property gpu_pdf
property gpukernel_d2loglikelihood
property gpukernel_dloglikelihood
property gpukernel_fisher
property gpukernel_loglikelihood
property gpukernel_loglikelihood_reduced
property gpukernel_pdf
loglikelihood

Decorator class defining universal function factory object from python kernel function, will create kernels, vectorized functions, jitted functions, stack functions, all on CPU / Parallel CPU / GPU.

Examples

>>> from funclp import Parameter, ufunc
>>> import numpy as np
...
>>> class MyClass() :
...     @ufunc(variables=['x', 'y'], data=['constant'], parameters=[Parameter('a', 1), Parameter('b', 0)])
...     def myfunc(x, y, constant, /, a, b) :
...         return a * x + b * y + constant
...     cuda = False
...
>>> instance = MyClass()
...
>>> x = np.arange(20).reshape((1, 20)) # Example of variables that can be broadcasted together
>>> y = np.arange(20).reshape((20, 1)) # Example of variables that can be broadcasted together
>>> constant = np.ones((5, 20, 20)) # Example of data with full shape
>>> a = np.arange(5) # Example of parameter vector
>>> b = 0.5 # Example of scalar use
>>> cpu_out = instance.myfunc(x, y, constant, a=a, b=b)
>>> instance.cuda = True
>>> gpu_out = instance.myfunc(x, y, constant, a=a, b=b)

loglikelihood_reduced

Decorator class defining universal function factory object from python kernel function, will create kernels, vectorized functions, jitted functions, stack functions, all on CPU / Parallel CPU / GPU.

Examples

>>> from funclp import Parameter, ufunc
>>> import numpy as np
...
>>> class MyClass() :
...     @ufunc(variables=['x', 'y'], data=['constant'], parameters=[Parameter('a', 1), Parameter('b', 0)])
...     def myfunc(x, y, constant, /, a, b) :
...         return a * x + b * y + constant
...     cuda = False
...
>>> instance = MyClass()
...
>>> x = np.arange(20).reshape((1, 20)) # Example of variables that can be broadcasted together
>>> y = np.arange(20).reshape((20, 1)) # Example of variables that can be broadcasted together
>>> constant = np.ones((5, 20, 20)) # Example of data with full shape
>>> a = np.arange(5) # Example of parameter vector
>>> b = 0.5 # Example of scalar use
>>> cpu_out = instance.myfunc(x, y, constant, a=a, b=b)
>>> instance.cuda = True
>>> gpu_out = instance.myfunc(x, y, constant, a=a, b=b)

pdf

Decorator class defining universal function factory object from python kernel function, will create kernels, vectorized functions, jitted functions, stack functions, all on CPU / Parallel CPU / GPU.

Examples

>>> from funclp import Parameter, ufunc
>>> import numpy as np
...
>>> class MyClass() :
...     @ufunc(variables=['x', 'y'], data=['constant'], parameters=[Parameter('a', 1), Parameter('b', 0)])
...     def myfunc(x, y, constant, /, a, b) :
...         return a * x + b * y + constant
...     cuda = False
...
>>> instance = MyClass()
...
>>> x = np.arange(20).reshape((1, 20)) # Example of variables that can be broadcasted together
>>> y = np.arange(20).reshape((20, 1)) # Example of variables that can be broadcasted together
>>> constant = np.ones((5, 20, 20)) # Example of data with full shape
>>> a = np.arange(5) # Example of parameter vector
>>> b = 0.5 # Example of scalar use
>>> cpu_out = instance.myfunc(x, y, constant, a=a, b=b)
>>> instance.cuda = True
>>> gpu_out = instance.myfunc(x, y, constant, a=a, b=b)

python_d2loglikelihood(model_data, weights=np.float32(1.0), /, eps=np.float32(1e-06))

Second derivative of log-likelihood (observed curvature).

python_dloglikelihood(model_data, weights=np.float32(1.0), /, eps=np.float32(1e-06))

Derivative of log-likelihood w.r.t model parameter.

python_fisher(model_data, weights=np.float32(1.0), /, eps=np.float32(1e-06))

Expected curvature (Fisher information).

python_loglikelihood(model_data, weights=np.float32(1.0), /, eps=np.float32(1e-06))

Exact log-likelihood (with constants).

python_loglikelihood_reduced(model_data, weights=np.float32(1.0), /, eps=np.float32(1e-06))

Log-likelihood up to additive constants.

python_pdf(model_data, weights=np.float32(1.0), /, eps=np.float32(1e-06))

Probability Density Function.