02: Remove redundant asserts

This commit is contained in:
2022-09-19 15:34:18 +02:00
parent 6c6d1963af
commit a11be7e9b8

View File

@ -600,9 +600,8 @@
" assert b > 0\n", " assert b > 0\n",
" assert n >= 1 and type(n) == int\n", " assert n >= 1 and type(n) == int\n",
" \n", " \n",
" # TODO: Remove ternaries as we already assert.\n", " E_X = alpha*b/(alpha - 1)\n",
" E_X = alpha*b/(alpha - 1) if alpha > 1 else np.inf\n", " Var_X = alpha*b**2/( (alpha - 1)**2*(alpha - 2) )\n",
" Var_X = alpha*b**2/( (alpha - 1)**2*(alpha - 2) ) if alpha > 2 else np.inf\n",
" \n", " \n",
" inv_pareto_samples = [inversion_sample(lambda p: f_inv_pareto(alpha, b, p)) for _ in range(n)]\n", " inv_pareto_samples = [inversion_sample(lambda p: f_inv_pareto(alpha, b, p)) for _ in range(n)]\n",
" return np.sqrt(n/Var_X)*(np.mean(inv_pareto_samples) - E_X)\n", " return np.sqrt(n/Var_X)*(np.mean(inv_pareto_samples) - E_X)\n",