Skip to content

Commit

Permalink
errors fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sidd3888 committed Jun 14, 2024
1 parent c2b0cd3 commit ca7bfec
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions examples/Distributions/EquiprobableLognormal.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@
"1.0000000002309708\n",
"1.0000000000008682\n",
"0.9999999999848911\n",
"CPU times: total: 781 ms\n",
"Wall time: 2.32 s\n"
"CPU times: total: 625 ms\n",
"Wall time: 2.33 s\n"
]
}
],
Expand Down Expand Up @@ -172,24 +172,20 @@
"metadata": {},
"outputs": [
{
"ename": "ValueError",
"evalue": "This method is only implemented for bivariate distributions. For general distributions, use the approx_equiprobable method instead.",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)",
"File \u001b[1;32m<timed exec>:3\u001b[0m\n",
"File \u001b[1;32mc:\\Users\\sidda\\OneDrive\\Ashoka\\RA\\EconARK\\Repo\\HARK\\HARK\\distribution.py:1012\u001b[0m, in \u001b[0;36mMVLogNormal.bv_approx_equiprobable\u001b[1;34m(self, N)\u001b[0m\n\u001b[0;32m 996\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 997\u001b[0m \u001b[38;5;124;03mMakes a discrete approximation using the equiprobable method to this bivariate lognormal distribution.\u001b[39;00m\n\u001b[0;32m 998\u001b[0m \n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 1008\u001b[0m \u001b[38;5;124;03m points for discrete probability mass function.\u001b[39;00m\n\u001b[0;32m 1009\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 1011\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mM \u001b[38;5;241m!=\u001b[39m \u001b[38;5;241m2\u001b[39m:\n\u001b[1;32m-> 1012\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[0;32m 1013\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mThis method is only implemented for bivariate distributions. For general distributions, use the approx_equiprobable method instead.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 1014\u001b[0m )\n\u001b[0;32m 1016\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m np\u001b[38;5;241m.\u001b[39marray_equal(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mSigma, np\u001b[38;5;241m.\u001b[39mdiag(np\u001b[38;5;241m.\u001b[39mdiag(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mSigma))):\n\u001b[0;32m 1017\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mSigma[\u001b[38;5;241m0\u001b[39m, \u001b[38;5;241m0\u001b[39m] \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m0.0\u001b[39m:\n",
"\u001b[1;31mValueError\u001b[0m: This method is only implemented for bivariate distributions. For general distributions, use the approx_equiprobable method instead."
"name": "stdout",
"output_type": "stream",
"text": [
"This method is only implemented for bivariate distributions. For general distributions, use the approx_equiprobable method instead.\n"
]
}
],
"source": [
"N = 10\n",
"\n",
"X_approx = X.bv_approx_equiprobable(N)\n",
"\n",
"X_approx.expected()"
"try:\n",
" X_approx = X.bv_approx_equiprobable(N)\n",
"except Exception as e:\n",
" print(e)"
]
},
{
Expand All @@ -208,8 +204,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: total: 15.6 ms\n",
"Wall time: 78.2 ms\n"
"CPU times: total: 31.2 ms\n",
"Wall time: 91.6 ms\n"
]
},
{
Expand Down

0 comments on commit ca7bfec

Please sign in to comment.