зеркало из https://github.com/py-why/EconML.git
Fix DML notebook
This commit is contained in:
Родитель
f975093cdc
Коммит
01318a1888
|
@ -242,9 +242,9 @@
|
|||
],
|
||||
"source": [
|
||||
"plt.figure(figsize=(10,6))\n",
|
||||
"plt.plot(X_test,te_pred[:,0],label='DML default')\n",
|
||||
"plt.plot(X_test,te_pred1[:,0],label='DML polynomial degree=2')\n",
|
||||
"plt.plot(X_test,te_pred2[:,0],label='DML polynomial degree=10 with Lasso')\n",
|
||||
"plt.plot(X_test,te_pred,label='DML default')\n",
|
||||
"plt.plot(X_test,te_pred1,label='DML polynomial degree=2')\n",
|
||||
"plt.plot(X_test,te_pred2,label='DML polynomial degree=10 with Lasso')\n",
|
||||
"expected_te=np.array([exp_te(x_i) for x_i in X_test])\n",
|
||||
"plt.plot(X_test,expected_te,'b--',label='True effect')\n",
|
||||
"plt.ylabel('Treatment Effect')\n",
|
||||
|
@ -378,8 +378,8 @@
|
|||
],
|
||||
"source": [
|
||||
"plt.figure(figsize=(10,6))\n",
|
||||
"plt.plot(X_test, te_pred[:,0,0], label='DML estimate1')\n",
|
||||
"plt.plot(X_test, te_pred[:,0,1], label='DML estimate2')\n",
|
||||
"plt.plot(X_test, te_pred[:,0], label='DML estimate1')\n",
|
||||
"plt.plot(X_test, te_pred[:,1], label='DML estimate2')\n",
|
||||
"expected_te1 = np.array([exp_te(x_i) for x_i in X_test])\n",
|
||||
"expected_te2=np.array([x_i**2 for x_i in X_test]).flatten()\n",
|
||||
"plt.plot(X_test, expected_te1, '--', label='True effect1')\n",
|
||||
|
@ -697,7 +697,7 @@
|
|||
"source": [
|
||||
"# Plot Oranje Juice elasticity as a function of income\n",
|
||||
"plt.figure(figsize=(10,6))\n",
|
||||
"plt.plot(X_test, te_pred[:, 0], label=\"OJ Elasticity\")\n",
|
||||
"plt.plot(X_test, te_pred, label=\"OJ Elasticity\")\n",
|
||||
"plt.xlabel(r'Scale(Income)')\n",
|
||||
"plt.ylabel('Orange Juice Elasticity')\n",
|
||||
"plt.legend()\n",
|
||||
|
@ -746,8 +746,8 @@
|
|||
"source": [
|
||||
"# Plot Oranje Juice elasticity as a function of income\n",
|
||||
"plt.figure(figsize=(10,6))\n",
|
||||
"plt.plot(X_test.flatten(), te_pred[:, 0], label=\"OJ Elasticity\")\n",
|
||||
"plt.fill_between(X_test.flatten(), te_pred_interval[0][:, 0, 0], te_pred_interval[1][:, 0, 0], alpha=.5, label=\"1-99% CI\")\n",
|
||||
"plt.plot(X_test.flatten(), te_pred, label=\"OJ Elasticity\")\n",
|
||||
"plt.fill_between(X_test.flatten(), te_pred_interval[0], te_pred_interval[1], alpha=.5, label=\"1-99% CI\")\n",
|
||||
"plt.xlabel(r'Scale(Income)')\n",
|
||||
"plt.ylabel('Orange Juice Elasticity')\n",
|
||||
"plt.title(\"Orange Juice Elasticity vs Income\")\n",
|
||||
|
|
Загрузка…
Ссылка в новой задаче