In order to create a customized pdf in zfit; Skew normal distribution (asymmetric gaussian), how can be called the error function? Seems that math.erf(x) and scipy.special.erf(x) do not works (they are tensor-like ones).
This is my code:
class AsymmetricGauss(zfit.pdf.ZPDF):
_N_OBS = 1 # dimension, can be omitted
_PARAMS = ['mean', 'std', 'alpha'] # the name of the parameters
def _unnormalized_pdf(self, x):
x = z.unstack_x(x)
mean = self.params['mean']
std = self.params['std']
alpha = self.params['alpha']
t = (x - mean)/std
normal = (1/std*(math.sqrt(2*math.pi)))*z.exp(-(t)**2)
cumulative = (1/2)*(1 + math.erf(alpha*t))
return 2*normal*cumulative
This code raises error in the line:
cumulative = (1/2)(1 + math.erf(alphat))
. The error message is:
"NotImplementedError: Cannot convert a symbolic tf.Tensor (mul_2:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported."
How can I solve this problem? Is there another better way to create a Skew normal distribution?