|
92 | 92 | }, |
93 | 93 | { |
94 | 94 | "cell_type": "code", |
95 | | - "execution_count": 213, |
| 95 | + "execution_count": 3, |
96 | 96 | "metadata": {}, |
97 | 97 | "outputs": [], |
98 | 98 | "source": [ |
|
103 | 103 | }, |
104 | 104 | { |
105 | 105 | "cell_type": "code", |
106 | | - "execution_count": 214, |
| 106 | + "execution_count": 4, |
107 | 107 | "metadata": {}, |
108 | 108 | "outputs": [ |
109 | 109 | { |
|
206 | 206 | "4 CS-NRCan-014_A6 1.5 6.0 1.0 66 0.655983 0.344017 EXP" |
207 | 207 | ] |
208 | 208 | }, |
209 | | - "execution_count": 214, |
| 209 | + "execution_count": 4, |
210 | 210 | "metadata": {}, |
211 | 211 | "output_type": "execute_result" |
212 | 212 | } |
|
218 | 218 | }, |
219 | 219 | { |
220 | 220 | "cell_type": "code", |
221 | | - "execution_count": 90, |
| 221 | + "execution_count": 5, |
222 | 222 | "metadata": {}, |
223 | 223 | "outputs": [ |
224 | 224 | { |
|
328 | 328 | "4 HY " |
329 | 329 | ] |
330 | 330 | }, |
331 | | - "execution_count": 90, |
| 331 | + "execution_count": 5, |
332 | 332 | "metadata": {}, |
333 | 333 | "output_type": "execute_result" |
334 | 334 | } |
|
339 | 339 | }, |
340 | 340 | { |
341 | 341 | "cell_type": "code", |
342 | | - "execution_count": 109, |
| 342 | + "execution_count": 6, |
343 | 343 | "metadata": {}, |
344 | 344 | "outputs": [ |
345 | 345 | { |
|
683 | 683 | "22 1.666667e-01 0.000000 RND " |
684 | 684 | ] |
685 | 685 | }, |
686 | | - "execution_count": 109, |
| 686 | + "execution_count": 6, |
687 | 687 | "metadata": {}, |
688 | 688 | "output_type": "execute_result" |
689 | 689 | } |
|
701 | 701 | }, |
702 | 702 | { |
703 | 703 | "cell_type": "code", |
704 | | - "execution_count": 215, |
| 704 | + "execution_count": 7, |
705 | 705 | "metadata": {}, |
706 | 706 | "outputs": [], |
707 | 707 | "source": [ |
|
711 | 711 | }, |
712 | 712 | { |
713 | 713 | "cell_type": "code", |
714 | | - "execution_count": 216, |
| 714 | + "execution_count": 8, |
715 | 715 | "metadata": {}, |
716 | 716 | "outputs": [ |
717 | 717 | { |
|
1289 | 1289 | "23 RND " |
1290 | 1290 | ] |
1291 | 1291 | }, |
1292 | | - "execution_count": 216, |
| 1292 | + "execution_count": 8, |
1293 | 1293 | "metadata": {}, |
1294 | 1294 | "output_type": "execute_result" |
1295 | 1295 | } |
|
1300 | 1300 | }, |
1301 | 1301 | { |
1302 | 1302 | "cell_type": "code", |
1303 | | - "execution_count": 217, |
| 1303 | + "execution_count": 9, |
1304 | 1304 | "metadata": {}, |
1305 | 1305 | "outputs": [ |
1306 | 1306 | { |
|
1491 | 1491 | "[64 rows x 8 columns]" |
1492 | 1492 | ] |
1493 | 1493 | }, |
1494 | | - "execution_count": 217, |
| 1494 | + "execution_count": 9, |
1495 | 1495 | "metadata": {}, |
1496 | 1496 | "output_type": "execute_result" |
1497 | 1497 | } |
|
1502 | 1502 | }, |
1503 | 1503 | { |
1504 | 1504 | "cell_type": "code", |
1505 | | - "execution_count": 95, |
| 1505 | + "execution_count": 10, |
1506 | 1506 | "metadata": {}, |
1507 | 1507 | "outputs": [ |
1508 | 1508 | { |
|
1583 | 1583 | }, |
1584 | 1584 | { |
1585 | 1585 | "cell_type": "code", |
1586 | | - "execution_count": 218, |
| 1586 | + "execution_count": 11, |
1587 | 1587 | "metadata": {}, |
1588 | 1588 | "outputs": [], |
1589 | 1589 | "source": [ |
|
1651 | 1651 | }, |
1652 | 1652 | { |
1653 | 1653 | "cell_type": "code", |
1654 | | - "execution_count": 219, |
| 1654 | + "execution_count": 12, |
1655 | 1655 | "metadata": {}, |
1656 | 1656 | "outputs": [], |
1657 | 1657 | "source": [ |
|
1672 | 1672 | }, |
1673 | 1673 | { |
1674 | 1674 | "cell_type": "code", |
1675 | | - "execution_count": 220, |
| 1675 | + "execution_count": 30, |
1676 | 1676 | "metadata": {}, |
1677 | 1677 | "outputs": [], |
1678 | 1678 | "source": [ |
1679 | 1679 | "# define 3 models with with kernels with 3 different lengthscales\n", |
1680 | | - "gpr_model_0 = GaussianProcessRegressor(kernel=Matern(length_scale= [1,1,1], nu=1.5), alpha = 1e-5, n_restarts_optimizer=5)\n", |
1681 | | - "gpr_model_1 = GaussianProcessRegressor(kernel=Matern(length_scale= [1,1,1], nu=1.5), alpha = 1e-5, n_restarts_optimizer=5)\n", |
1682 | | - "gpr_model_2 = GaussianProcessRegressor(kernel=Matern(length_scale= [1, 1,1], nu=1.5), alpha = 1e-10, n_restarts_optimizer=5)\n", |
| 1680 | + "gpr_model_0 = GaussianProcessRegressor(kernel=Matern(length_scale= [1,1,1], nu=1.5), alpha = 1e-5, n_restarts_optimizer=10)\n", |
| 1681 | + "gpr_model_1 = GaussianProcessRegressor(kernel=Matern(length_scale= [1,1,1], nu=1.5), alpha = 1e-5, n_restarts_optimizer=10)\n", |
| 1682 | + "gpr_model_2 = GaussianProcessRegressor(kernel=Matern(length_scale= [1,1,1], nu=1.5), alpha = 1e-10, n_restarts_optimizer=10)\n", |
1683 | 1683 | "\n", |
1684 | | - "gpr_model_0_1 = GaussianProcessRegressor(kernel=Matern(length_scale= [1,1,1], nu=1.5), alpha = 1e-5, n_restarts_optimizer=5)\n", |
1685 | | - "gpr_model_0_2 = GaussianProcessRegressor(kernel=Matern(length_scale= [1,1,1], nu=1.5), alpha = 1e-5, n_restarts_optimizer=5)" |
| 1684 | + "gpr_model_0_1 = GaussianProcessRegressor(kernel=Matern(length_scale= [1,1,1], nu=1.5), alpha = 1e-5, n_restarts_optimizer=10)\n", |
| 1685 | + "gpr_model_0_2 = GaussianProcessRegressor(kernel=Matern(length_scale= [1,1,1], nu=1.5), alpha = 1e-5, n_restarts_optimizer=10)" |
1686 | 1686 | ] |
1687 | 1687 | }, |
1688 | 1688 | { |
1689 | 1689 | "cell_type": "code", |
1690 | | - "execution_count": 221, |
| 1690 | + "execution_count": 31, |
1691 | 1691 | "metadata": {}, |
1692 | 1692 | "outputs": [ |
1693 | 1693 | { |
|
1716 | 1716 | "print(gpr_model_0_2.kernel_) " |
1717 | 1717 | ] |
1718 | 1718 | }, |
| 1719 | + { |
| 1720 | + "cell_type": "markdown", |
| 1721 | + "metadata": {}, |
| 1722 | + "source": [ |
| 1723 | + "### Saving GPR models for each iteration of the active learning" |
| 1724 | + ] |
| 1725 | + }, |
1719 | 1726 | { |
1720 | 1727 | "cell_type": "code", |
1721 | | - "execution_count": null, |
| 1728 | + "execution_count": 37, |
1722 | 1729 | "metadata": {}, |
1723 | 1730 | "outputs": [], |
1724 | | - "source": [] |
| 1731 | + "source": [ |
| 1732 | + "import pickle\n", |
| 1733 | + "\n", |
| 1734 | + "# Pickle scalers\n", |
| 1735 | + "with open('models/feature_standard_scaler_AL_iteration_0.pkl', 'wb') as f:\n", |
| 1736 | + " pickle.dump(scale_0, f)\n", |
| 1737 | + "with open('models/feature_standard_scaler_AL_iteration_1.pkl', 'wb') as f:\n", |
| 1738 | + " pickle.dump(scale_0_1, f)\n", |
| 1739 | + "with open('models/feature_standard_scaler_AL_iteration_2.pkl', 'wb') as f:\n", |
| 1740 | + " pickle.dump(scale_0_2, f)\n", |
| 1741 | + "\n", |
| 1742 | + "# Pickle models\n", |
| 1743 | + "with open('models/GPR_model_AL_iteration_0.pkl', 'wb') as f:\n", |
| 1744 | + " pickle.dump(gpr_model_0, f)\n", |
| 1745 | + "with open('models/GPR_model_AL_iteration_1.pkl', 'wb') as f:\n", |
| 1746 | + " pickle.dump(gpr_model_0_1, f)\n", |
| 1747 | + "with open('models/GPR_model_AL_iteration_2.pkl', 'wb') as f:\n", |
| 1748 | + " pickle.dump(gpr_model_0_2, f)" |
| 1749 | + ] |
1725 | 1750 | }, |
1726 | 1751 | { |
1727 | 1752 | "cell_type": "markdown", |
|
0 commit comments