|
337 | 337 | "m0 = LGBMRegressor(max_depth=2, min_child_samples=60)\n", |
338 | 338 | "m1 = LGBMRegressor(max_depth=2, min_child_samples=60)\n", |
339 | 339 | "\n", |
340 | | -<<<<<<< e022085c519423acf68e0d4c26b60d477788305d |
341 | | - "# fit the propensity score model\n", |
342 | | - "ps_m = LogisticRegression(solver=\"lbfgs\", penalty='none')\n", |
343 | | - "ps_m.fit(train[X], train[T])\n", |
344 | | - "ps_score = ps_m.predict_proba(train[X])\n", |
345 | | - "\n", |
346 | | - "m0.fit(train.query(f\"{T}==0\")[X], train.query(f\"{T}==0\")[y],\n", |
347 | | - " sample_weight=1/ps_m.predict_proba(train.query(f\"{T}==0\")[X])[:, 0])\n", |
348 | | - "\n", |
349 | | - "m1.fit(train.query(f\"{T}==1\")[X], train.query(f\"{T}==1\")[y],\n", |
350 | | - " sample_weight=1/ps_m.predict_proba(train.query(f\"{T}==1\")[X])[:, 1])\n", |
351 | | -======= |
352 | 340 | "m0.fit(train.query(f\"{T}==0\")[X], train.query(f\"{T}==0\")[y])\n", |
353 | 341 | "m1.fit(train.query(f\"{T}==1\")[X], train.query(f\"{T}==1\")[y])\n", |
354 | | ->>>>>>> update chapter 21 with the newest version from original author |
355 | 342 | "\n", |
356 | 343 | "# estimate the CATE\n", |
357 | 344 | "t_learner_cate_train = m1.predict(train[X]) - m0.predict(train[X])\n", |
|
596 | 583 | "metadata": { |
597 | 584 | "celltoolbar": "Tags", |
598 | 585 | "kernelspec": { |
599 | | - "display_name": "Python 3", |
| 586 | + "display_name": "Python [conda env:base] *", |
600 | 587 | "language": "python", |
601 | | - "name": "python3" |
| 588 | + "name": "conda-base-py" |
602 | 589 | }, |
603 | 590 | "language_info": { |
604 | 591 | "codemirror_mode": { |
|
610 | 597 | "name": "python", |
611 | 598 | "nbconvert_exporter": "python", |
612 | 599 | "pygments_lexer": "ipython3", |
613 | | -<<<<<<< e022085c519423acf68e0d4c26b60d477788305d |
614 | | - "version": "3.8.5" |
615 | | -======= |
616 | | - "version": "3.7.15" |
617 | | ->>>>>>> update chapter 21 with the newest version from original author |
| 600 | + "version": "3.12.3" |
618 | 601 | } |
619 | 602 | }, |
620 | 603 | "nbformat": 4, |
|
0 commit comments