NGBoost (Natural Gradient Boosting) for Regression, Classification, Time Series forecasting and Reserving
Want to share your content on python-bloggers? click here.
This post demonstrates the use of the cybooster
library for regression and classification tasks using NGBoost (Natural Gradient Boosting). NGBoost is a probabilistic boosting algorithm that provides uncertainty estimates along with predictions. It works by fitting a base learner (like decision trees or linear models) to the negative gradient of a specified loss function, and was first introduced by Stanford Machine Learning Group in the paper “NGBoost: Natural Gradient Boosting for Probabilistic Prediction” by Duan et al. (2019).
Their implementation is 100% Python.
This is my Cython implementation of NGBoost, designed to be fast and efficient. It supports various base learners and loss functions, making it a versatile tool for regression, time series and classification tasks.
Examples in this post include:
Regression with different base learners (e.g., Linear Regression, Ridge, ExtraTreeRegressor)
Classification with different base learners (e.g., Logistic Regression, RidgeClassifier, ExtraTreeClassifier)
Time series forecasting with different base learners (e.g., Linear Regression, Ridge, ExtraTreeRegressor)
Machine Learning reserving with different base learners (e.g., Linear Regression, Ridge, ExtraTreeRegressor)
0 – Installations
!pip install git+https://github.com/Techtonique/cybooster.git # boosting
!pip install git+https://github.com/Techtonique/mlreserving.git --verbose # reserving
1 – Regression
https://docs.techtonique.net/cybooster/index.html
import numpy as np from cybooster import NGBRegressor, NGBClassifier, SkNGBRegressor from sklearn.datasets import load_diabetes, fetch_openml from sklearn.model_selection import train_test_split from sklearn.datasets import load_breast_cancer, load_iris, load_wine, load_digits from sklearn.metrics import accuracy_score, mean_squared_error, root_mean_squared_error from sklearn.linear_model import LinearRegression, Ridge from sklearn.tree import ExtraTreeRegressor from time import time X, y = fetch_openml("boston", version=1, as_frame=True, return_X_y=True) cols = list(X.columns) print("columns", cols) X_train, X_test, y_train, y_test = train_test_split(X.values, y.values, test_size=0.2, random_state=42) X_train = np.asarray(X_train, dtype=np.float64) y_train = np.asarray(y_train, dtype=np.float64) X_test = np.asarray(X_test, dtype=np.float64) y_test = np.asarray(y_test, dtype=np.float64) regressor = NGBRegressor() start = time() regressor.fit(X_train, y_train) y_pred = regressor.predict(X_test) print(f"Elapsed: {time() - start} s") rmse = root_mean_squared_error(y_test, y_pred) print(f"RMSE for regression: {rmse:.4f}") print("return_std:", regressor.predict(X_test, return_std=True)) regressor = NGBRegressor(LinearRegression()) start = time() regressor.fit(X_train, y_train) y_pred = regressor.predict(X_test) print(f"Elapsed: {time() - start} s") rmse = root_mean_squared_error(y_test, y_pred) print(f"RMSE for regression: {rmse:.4f}") print("return_std:", regressor.predict(X_test, return_std=True)) regressor = NGBRegressor(Ridge()) start = time() regressor.fit(X_train, y_train) y_pred = regressor.predict(X_test) print(f"Elapsed: {time() - start} s") rmse = root_mean_squared_error(y_test, y_pred) print(f"RMSE for regression: {rmse:.4f}") print("return_std:", regressor.predict(X_test, return_std=True)) regressor = NGBRegressor(ExtraTreeRegressor()) start = time() regressor.fit(X_train, y_train) y_pred = regressor.predict(X_test) print(f"Elapsed: {time() - start} s") rmse = root_mean_squared_error(y_test, y_pred) print(f"RMSE for regression: {rmse:.4f}") print("return_std:", regressor.predict(X_test, return_std=True)) regressor = NGBRegressor(feature_engineering=True) start = time() regressor.fit(X_train, y_train) y_pred = regressor.predict(X_test) print(f"Elapsed: {time() - start} s") rmse = root_mean_squared_error(y_test, y_pred) print(f"RMSE for regression: {rmse:.4f}") print("return_std:", regressor.predict(X_test, return_std=True)) regressor = NGBRegressor(feature_engineering=True) start = time() regressor.fit(X_train, y_train) y_pred = regressor.predict(X_test) print(f"Elapsed: {time() - start} s") rmse = root_mean_squared_error(y_test, y_pred) print(f"RMSE for regression: {rmse:.4f}") print("return_std:", regressor.predict(X_test, return_std=True)) regressor = NGBRegressor(obj=Ridge(), feature_engineering=1) start = time() regressor.fit(X_train, y_train) y_pred = regressor.predict(X_test) print(f"Elapsed: {time() - start} s") rmse = root_mean_squared_error(y_test, y_pred) print(f"RMSE for regression: {rmse:.4f}") print("return_std:", regressor.predict(X_test, return_std=True)) regressor = NGBRegressor(ExtraTreeRegressor(), feature_engineering=True) start = time() regressor.fit(X_train, y_train) y_pred = regressor.predict(X_test) print(f"Elapsed: {time() - start} s") rmse = root_mean_squared_error(y_test, y_pred) print(f"RMSE for regression: {rmse:.4f}") print("return_std:", regressor.predict(X_test, return_std=True)) regressor = SkNGBRegressor() start = time() regressor.fit(X_train, y_train) y_pred = regressor.predict(X_test) print(f"Elapsed: {time() - start} s") rmse = root_mean_squared_error(y_test, y_pred) print(f"RMSE for regression: {rmse:.4f}") print("return_std:", regressor.predict(X_test, return_std=True)) regressor = SkNGBRegressor(LinearRegression()) start = time() regressor.fit(X_train, y_train) y_pred = regressor.predict(X_test) print(f"Elapsed: {time() - start} s") rmse = root_mean_squared_error(y_test, y_pred) print(f"RMSE for regression: {rmse:.4f}") print("return_std:", regressor.predict(X_test, return_std=True)) regressor = SkNGBRegressor(Ridge()) start = time() regressor.fit(X_train, y_train) y_pred = regressor.predict(X_test) print(f"Elapsed: {time() - start} s") rmse = root_mean_squared_error(y_test, y_pred) print(f"RMSE for regression: {rmse:.4f}") print("return_std:", regressor.predict(X_test, return_std=True)) regressor = SkNGBRegressor(ExtraTreeRegressor()) start = time() regressor.fit(X_train, y_train) y_pred = regressor.predict(X_test) print(f"Elapsed: {time() - start} s") rmse = root_mean_squared_error(y_test, y_pred) print(f"RMSE for regression: {rmse:.4f}") print("return_std:", regressor.predict(X_test, return_std=True)) regressor = SkNGBRegressor(feature_engineering=True) start = time() regressor.fit(X_train, y_train) y_pred = regressor.predict(X_test) print(f"Elapsed: {time() - start} s") rmse = root_mean_squared_error(y_test, y_pred) print(f"RMSE for regression: {rmse:.4f}") print("return_std:", regressor.predict(X_test, return_std=True)) regressor = SkNGBRegressor(LinearRegression(), feature_engineering=True) start = time() regressor.fit(X_train, y_train) y_pred = regressor.predict(X_test) print(f"Elapsed: {time() - start} s") rmse = root_mean_squared_error(y_test, y_pred) print(f"RMSE for regression: {rmse:.4f}") print("return_std:", regressor.predict(X_test, return_std=True))
columns ['CRIM', 'ZN', 'INDUS', 'CHAS', 'NOX', 'RM', 'AGE', 'DIS', 'RAD', 'TAX', 'PTRATIO', 'B', 'LSTAT'] 100%|██████████| 500/500 [00:02<00:00, 168.64it/s] 100%|██████████| 500/500 [00:00<00:00, 1474.80it/s] Elapsed: 3.3141837120056152 s RMSE for regression: 2.7538 100%|██████████| 500/500 [00:00<00:00, 1883.78it/s] return_std: (array([23.38436609, 30.58162903, 17.01082572, 23.42319969, 17.11013672, 21.63002805, 18.78586961, 14.16734299, 20.1777855 , 20.90566904, 19.78956441, 19.37612816, 7.10426684, 21.45547244, 20.2147791 , 23.82145678, 19.88422254, 9.73326254, 45.73197368, 16.17815899, 24.01994003, 24.6924821 , 13.3467705 , 21.66127135, 15.24208822, 16.30809134, 22.09115231, 13.2719851 , 19.38173126, 21.35139373, 19.70936488, 23.57518806, 21.15338956, 19.34356576, 14.46395528, 17.05941846, 34.72182244, 19.91542233, 20.55266978, 23.64917896, 18.17798021, 30.11079351, 45.73197368, 20.70027259, 22.86656157, 14.71263172, 16.54109909, 23.64917896, 17.86879815, 27.68160472, 21.10834113, 35.33147751, 17.08360841, 25.16644461, 48.05307558, 20.63059483, 16.36893214, 32.16348568, 22.820302 , 18.78819129, 24.55340768, 33.73650617, 28.3963564 , 19.33608366, 25.59953684, 18.16800217, 14.56907957, 23.44529615, 28.35586715, 15.12580327, 21.14445943, 25.27870868, 10.89031819, 21.59891134, 22.14437926, 7.82473017, 20.22146148, 45.64517314, 11.4756152 , 13.463848 , 21.84535476, 12.93329231, 21.39987408, 10.92629513, 20.65790375, 26.77305703, 14.09780644, 23.54508559, 24.31692674, 17.60003041, 21.41024988, 9.35984712, 19.41409108, 20.18605757, 22.59150151, 19.49407858, 37.64151204, 10.33004856, 12.37430999, 15.4511758 , 20.52394697, 22.96895798]), array([2.21217747, 1.79317773, 2.17299443, 1.72160601, 1.86241889, 1.94494808, 2.01598508, 2.0457321 , 1.86130234, 2.00677223, 1.98254139, 2.03008712, 2.74103564, 1.93403934, 1.91095137, 2.30166288, 1.67865655, 2.37849755, 2.9810275 , 1.95636635, 1.59164165, 1.59165463, 1.95575956, 3.16806635, 2.38128471, 2.09468801, 1.94301683, 2.17158815, 2.02620323, 1.99452501, 1.93021234, 1.85352199, 2.18122751, 1.82781761, 1.90510408, 2.14320277, 1.6373213 , 1.69860017, 2.10101793, 1.72688422, 2.27167448, 2.53214026, 3.0178396 , 1.95593248, 2.26322312, 2.29482033, 1.93937773, 1.72688422, 2.20878723, 2.47244714, 2.03008712, 2.27225569, 1.85787471, 2.1492312 , 2.80002349, 1.894994 , 1.88518653, 1.80892404, 1.66966339, 2.04483526, 1.9102816 , 1.76937604, 2.12307872, 2.06315636, 1.99411875, 2.28170609, 2.37285431, 1.69877629, 1.55042239, 2.35588427, 1.67488196, 2.6978741 , 2.34198765, 2.04386697, 1.94008423, 2.54161967, 2.01364821, 2.95193967, 2.1954336 , 2.48872074, 1.86218844, 2.41863477, 1.98485126, 2.41026675, 1.9065504 , 2.02927664, 1.79430316, 1.85352199, 2.02152136, 1.97015712, 2.0264921 , 2.51838215, 1.71928571, 1.9748513 , 2.68449362, 1.75538881, 2.64507232, 2.91292012, 2.10037665, 2.48565442, 1.67488196, 1.96636599])) 100%|██████████| 500/500 [00:01<00:00, 255.81it/s] 100%|██████████| 500/500 [00:00<00:00, 3284.17it/s] Elapsed: 2.1166369915008545 s RMSE for regression: 4.9170 100%|██████████| 500/500 [00:00<00:00, 3691.95it/s] return_std: (array([ 2.89559854e+01, 3.59386442e+01, 1.48693738e+01, 2.50172912e+01, 1.87963370e+01, 2.32514207e+01, 1.76962710e+01, 1.43967457e+01, 2.30117834e+01, 2.06466750e+01, 2.48946285e+01, 1.86661545e+01, -5.89863373e+00, 2.17651681e+01, 1.92625990e+01, 2.61708796e+01, 2.06618518e+01, 5.90643727e+00, 4.03840171e+01, 1.76469498e+01, 2.72198393e+01, 3.00184888e+01, 1.14170560e+01, 2.41518124e+01, 1.78930166e+01, 1.58818311e+01, 2.27815800e+01, 1.46310505e+01, 2.24386277e+01, 1.92199735e+01, 2.24362177e+01, 2.52038688e+01, 2.59184475e+01, 1.77351004e+01, 1.68087202e+01, 1.69896604e+01, 3.11779672e+01, 2.01499715e+01, 2.37594216e+01, 2.46202307e+01, 1.40002278e+01, 3.21936113e+01, 4.25419168e+01, 1.73633850e+01, 2.72467527e+01, 1.70312412e+01, 1.41274280e+01, 2.58830049e+01, 2.03112970e+01, 2.99063723e+01, 2.12985096e+01, 3.42686427e+01, 1.60917362e+01, 2.62030933e+01, 3.94293893e+01, 2.25809329e+01, 1.88712751e+01, 3.26600797e+01, 2.50523836e+01, 1.29514047e+01, 2.26829702e+01, 3.04323746e+01, 3.14689095e+01, 1.59467899e+01, 2.02378711e+01, 1.67508837e+01, 2.05387816e+01, 2.59427537e+01, 3.05647016e+01, 1.16714111e+01, 2.05273346e+01, 2.74503388e+01, 1.10970033e+01, 1.57277162e+01, 2.37866142e+01, 6.30834548e+00, 2.16117434e+01, 4.12914480e+01, 1.87919729e+01, 8.97076184e+00, 2.08436852e+01, 1.33188908e+01, 2.07531518e+01, 9.45307506e+00, 2.32216312e+01, 3.18555843e+01, 1.91265557e+01, 2.54979262e+01, 2.90015282e+01, 2.01610168e+01, 2.55676507e+01, 5.81391648e+00, 2.01124996e+01, 1.50022425e+01, 1.25715837e+01, 2.07399550e+01, 2.47268049e+01, -1.33736349e-02, 1.37447349e+01, 1.62270472e+01, 2.22796387e+01, 2.44679689e+01]), array([4.88465085, 6.14010536, 3.77051703, 3.38313256, 5.87593379, 4.16628595, 3.53909179, 3.43673933, 7.13225439, 3.97103088, 6.17397992, 3.67343389, 3.37494312, 3.79741233, 3.44772708, 6.63080918, 3.48301766, 5.43632304, 5.26831916, 5.91050803, 3.52560359, 4.25532749, 2.98109801, 3.1909353 , 5.53638904, 6.24483216, 3.82809242, 3.84432738, 5.40553942, 3.74945233, 4.63831617, 3.59245432, 6.94365512, 5.37740336, 6.30953916, 3.00095373, 3.75671496, 3.05441553, 4.99921582, 3.34565899, 3.64355497, 5.03346863, 5.54559693, 3.24497069, 4.03865623, 6.02304939, 3.10600201, 3.41547031, 6.60855017, 4.02107129, 3.83349874, 4.66076484, 3.26422714, 3.93656189, 5.4573872 , 5.91960942, 5.94327814, 4.13544147, 3.63078454, 3.20705014, 3.30071072, 3.58440484, 4.49239123, 2.62946448, 2.72246592, 5.22102396, 6.41927019, 3.63808451, 3.87602531, 3.69753143, 3.39275846, 7.07622325, 4.69177358, 2.20579455, 4.01895919, 5.33976197, 3.97647502, 5.49774086, 6.53124834, 3.44193443, 3.31369225, 6.34491286, 2.98463561, 5.65500864, 4.01010849, 6.42992147, 5.12016371, 3.48261173, 4.03026264, 3.54935864, 4.19317565, 4.10191882, 3.42312066, 2.68682782, 5.12924502, 3.39288029, 7.03072039, 4.05528035, 3.80618439, 4.85459194, 3.60023026, 3.92072719])) 100%|██████████| 500/500 [00:01<00:00, 364.79it/s] 100%|██████████| 500/500 [00:00<00:00, 3362.78it/s] Elapsed: 1.5285439491271973 s RMSE for regression: 4.9210 100%|██████████| 500/500 [00:00<00:00, 2120.28it/s] return_std: (array([28.93382564, 35.93463962, 14.78593201, 24.99407843, 18.8255972 , 23.15784878, 17.6787323 , 14.37072688, 22.9176379 , 20.65682089, 24.82656631, 18.64203409, -5.97412585, 21.69305085, 19.24844809, 26.16283404, 20.61351551, 5.86408168, 40.41127522, 17.6687024 , 27.24641606, 30.01626489, 11.40125575, 24.20150409, 17.91582967, 15.79404289, 22.71914105, 14.64314556, 22.3637164 , 19.23688248, 22.38594027, 25.22349139, 25.92872906, 17.80568179, 16.72142142, 17.11804584, 31.18975516, 20.20125214, 23.71634273, 24.59527083, 13.99296738, 32.19989907, 42.56419516, 17.3180222 , 27.24183952, 17.03612099, 14.11657181, 25.86241795, 20.24958978, 29.94788994, 21.28251708, 34.26926853, 16.09220654, 26.21614061, 39.48977879, 22.56580066, 18.91393603, 32.68450562, 25.04440194, 12.90436546, 22.71954274, 30.49448644, 31.4977909 , 15.98259105, 20.2781608 , 16.6489619 , 20.54619681, 25.94312632, 30.6016424 , 11.67621935, 20.50091954, 27.3880417 , 11.11243557, 15.8111653 , 23.71502091, 6.2743131 , 21.58907651, 41.30830632, 18.77412395, 8.86263437, 20.81478651, 13.21244668, 20.75663091, 9.42852114, 23.20597401, 31.83797407, 19.15958655, 25.52957686, 28.97930341, 20.16012702, 25.56979011, 5.76731891, 20.11966444, 14.99100311, 12.58345812, 20.75001239, 24.69300874, -0.16557681, 13.77380563, 16.13266867, 22.25771126, 24.40546012]), array([4.86255756, 6.09494865, 3.75363586, 3.34132076, 5.92411382, 4.09815346, 3.53864437, 3.44807238, 7.02178978, 3.99688208, 6.13748968, 3.64372846, 3.40194179, 3.74075381, 3.44636597, 6.59889823, 3.44369254, 5.47281703, 5.16684781, 5.9604817 , 3.50717833, 4.20441828, 3.00219465, 3.22082121, 5.58571461, 6.19216591, 3.77467221, 3.86990913, 5.38506201, 3.77727411, 4.61828702, 3.59179799, 6.95937864, 5.4718872 , 6.24741631, 3.07225562, 3.73154407, 3.0765441 , 4.98747078, 3.30287322, 3.66890724, 5.00163788, 5.4169417 , 3.21477629, 4.03404886, 6.06437418, 3.12836457, 3.37140573, 6.54851205, 4.02666569, 3.80353545, 4.58824095, 3.28715247, 3.95222019, 5.42846608, 5.88072471, 6.01269398, 4.08314507, 3.61274517, 3.17938945, 3.28749769, 3.54101012, 4.47259739, 2.65530724, 2.70866599, 5.20057441, 6.45103324, 3.61084102, 3.84127395, 3.72438878, 3.36456233, 6.97228955, 4.74598235, 2.21424462, 3.95853693, 5.3812147 , 3.98939977, 5.37063036, 6.54444635, 3.42578068, 3.28370649, 6.28870532, 2.94131809, 5.69518407, 4.00762303, 6.42136243, 5.15875661, 3.48434243, 3.96509485, 3.5639696 , 4.18344325, 4.12058769, 3.44021271, 2.68220721, 5.19466538, 3.40983604, 7.01022288, 4.021494 , 3.84830832, 4.80705248, 3.58197028, 3.86297113])) 100%|██████████| 500/500 [00:06<00:00, 82.34it/s] 100%|██████████| 500/500 [00:00<00:00, 900.82it/s] Elapsed: 6.649160385131836 s RMSE for regression: 3.1118 100%|██████████| 500/500 [00:00<00:00, 634.06it/s] return_std: (array([23.92432767, 32.23199811, 15.9065472 , 23.55152709, 16.44560668, 21.50528718, 19.62972274, 15.60214783, 21.13791043, 20.08245572, 20.75871655, 20.79022535, 9.49207987, 21.84455666, 18.81690688, 23.29149966, 19.9691444 , 8.83078049, 45.02898474, 15.0810664 , 24.32141142, 24.47647831, 14.50220443, 23.37350252, 14.91026783, 15.69875137, 21.48034557, 14.01998471, 19.98351209, 20.6779532 , 21.13933273, 23.28424065, 22.51506377, 22.2659548 , 15.08311346, 16.44693594, 33.82209981, 19.16766996, 21.81065312, 24.07912675, 18.74925607, 29.69576375, 45.15653552, 19.43770008, 22.80150637, 14.12505962, 14.65074153, 25.00144153, 18.33503924, 28.56690305, 21.64338823, 34.22965127, 15.81663379, 26.33284852, 42.33366623, 21.83761604, 14.9389135 , 32.6539377 , 23.1336874 , 19.82451899, 25.06988518, 33.98564794, 28.24008101, 18.99413791, 25.83982819, 17.91428155, 13.81907152, 23.35123041, 28.20741926, 15.99721837, 20.30157124, 26.07142616, 11.53466953, 21.49607078, 22.60273732, 7.49505206, 19.8661215 , 45.65836484, 10.70298502, 10.76485929, 21.68779098, 13.44726735, 20.30286393, 10.38964868, 20.05620467, 27.44983559, 15.75287496, 23.4750758 , 23.47310449, 18.67058642, 22.37995135, 8.6738297 , 18.91913841, 18.75554542, 28.48174444, 19.67986414, 28.34345565, 13.21242691, 13.41168749, 17.85745913, 20.96314437, 24.08725095]), array([0.81279056, 1.07080282, 0.94452261, 0.77681013, 0.91428261, 0.79934448, 0.83860186, 0.99076386, 0.80466753, 0.81781727, 0.81062235, 0.86083171, 1.32596009, 0.79490113, 0.85285183, 0.89760557, 0.8152991 , 1.40823657, 2.02935579, 1.01665395, 0.78122904, 0.79686423, 1.01511471, 0.84066944, 0.99431205, 0.98012602, 0.77889927, 1.05666881, 0.82544889, 0.80703106, 0.8433922 , 0.77232229, 1.00370208, 0.93579518, 0.98516016, 0.90748647, 1.16924366, 0.81983188, 0.78968521, 0.7879158 , 0.86312968, 1.00775757, 1.90946679, 0.822826 , 0.78464479, 1.05879925, 1.01133432, 0.79895587, 0.82638619, 0.91370102, 0.81785212, 1.2014637 , 0.95095277, 0.85183272, 1.74142903, 0.78156776, 0.99365025, 1.13566755, 0.79371541, 0.84170699, 0.81544491, 1.22623516, 0.93893944, 0.8797483 , 0.84026299, 0.89529673, 1.10043774, 0.77245837, 0.87899518, 0.98906687, 0.80520341, 0.85691177, 1.21786562, 0.83625584, 0.79374763, 1.49722816, 0.80764391, 1.98897182, 1.22732704, 1.16796469, 0.77613623, 1.17077873, 0.80619049, 1.24274282, 0.80455364, 0.85673648, 0.98424816, 0.77462749, 0.78761552, 0.84825699, 0.78750174, 1.33084183, 0.85187144, 0.85321226, 1.12958899, 0.82693457, 1.12727242, 1.11340768, 1.10722965, 0.99031367, 0.79964353, 0.79845764])) 100%|██████████| 500/500 [00:25<00:00, 19.51it/s] 100%|██████████| 500/500 [00:01<00:00, 332.37it/s] Elapsed: 27.13788151741028 s RMSE for regression: 2.8106 100%|██████████| 500/500 [00:01<00:00, 291.30it/s] return_std: (array([23.17744862, 30.17066161, 17.02265366, 23.59291786, 16.24336147, 21.74483104, 18.84564119, 14.09300531, 20.10855556, 20.9623932 , 19.69047512, 19.26678495, 7.53451303, 21.6260398 , 20.1489124 , 23.90990735, 19.80213646, 10.03382823, 45.24947247, 15.7005355 , 24.21640908, 24.34884912, 13.25800208, 21.53527528, 15.1898934 , 16.71094627, 22.23986403, 12.79976121, 19.59365104, 21.2825348 , 19.48055541, 23.59352879, 21.35132447, 19.61673861, 14.65246707, 17.35348242, 34.70926311, 19.84296666, 20.54528648, 23.7155794 , 18.19397792, 30.06826972, 45.24947247, 20.30194969, 22.91701671, 14.30161273, 16.67576712, 23.74907287, 17.75581261, 27.66264087, 21.13229281, 35.60124319, 17.18774385, 24.91177563, 46.97009364, 20.57653792, 15.57701284, 32.18185954, 22.85103655, 18.51122079, 24.45595692, 33.67332974, 28.25378425, 19.34175678, 25.85644649, 18.15084276, 14.21052975, 23.53882235, 28.52747901, 15.19081125, 21.30326782, 25.19340405, 10.89938172, 21.39037154, 22.19689567, 7.15791165, 20.14303198, 45.000678 , 12.23143984, 13.69618255, 21.89002964, 13.44594823, 21.49591997, 10.92048049, 20.75016071, 26.71248048, 14.26013303, 23.60867103, 24.01601834, 17.63802446, 21.51037139, 10.25833475, 19.47544323, 20.30182326, 23.95283291, 19.59146969, 36.65588144, 9.61071201, 12.12393297, 15.61254744, 20.93480136, 23.0406723 ]), array([2.0739769 , 1.67640665, 2.17764771, 1.84930219, 1.85107779, 1.92388738, 2.20484521, 2.18248146, 1.89063145, 2.03332157, 1.8366742 , 2.06367643, 2.49434834, 1.8830508 , 2.02913155, 2.14753675, 1.65774962, 2.23351368, 2.79300231, 1.97444722, 1.57315185, 1.62458606, 1.73832862, 3.03891129, 2.27134818, 2.42415484, 1.94058047, 1.97917142, 1.88414955, 2.02913155, 2.0310917 , 1.92163886, 2.39078947, 1.81468257, 1.8767521 , 2.14827747, 1.72472648, 1.68488709, 1.90188311, 1.74699869, 2.78397056, 2.28586818, 3.00078834, 2.10854299, 2.24239995, 2.18559195, 1.90963233, 1.74699869, 2.12130408, 2.41176556, 2.06367643, 2.23526697, 1.83413683, 2.1744423 , 2.94420841, 1.88268558, 1.84584692, 1.77012892, 1.61543576, 1.91059635, 1.80446203, 1.76175851, 2.15115463, 2.14253575, 1.71099815, 2.17560652, 2.08612383, 1.74699869, 1.52794024, 2.21561741, 1.75688762, 2.65495158, 2.14051417, 2.05062931, 1.99332146, 2.7479335 , 2.24258242, 2.76201406, 2.16979543, 2.77627241, 2.00778439, 2.38841813, 2.18151734, 2.22250336, 2.03485713, 1.78531995, 1.72823227, 1.92163886, 1.92729547, 1.81762078, 2.02864274, 2.28142331, 1.73768138, 2.07475637, 2.6100058 , 1.73768138, 2.54063156, 3.07516095, 1.95528874, 2.37594549, 1.59505934, 1.8830508 ])) 100%|██████████| 500/500 [00:21<00:00, 22.90it/s] 100%|██████████| 500/500 [00:01<00:00, 350.06it/s] Elapsed: 23.266273498535156 s RMSE for regression: 2.8106 100%|██████████| 500/500 [00:01<00:00, 291.97it/s] return_std: (array([23.17744862, 30.17066161, 17.02265366, 23.59291786, 16.24336147, 21.74483104, 18.84564119, 14.09300531, 20.10855556, 20.9623932 , 19.69047512, 19.26678495, 7.53451303, 21.6260398 , 20.1489124 , 23.90990735, 19.80213646, 10.03382823, 45.24947247, 15.7005355 , 24.21640908, 24.34884912, 13.25800208, 21.53527528, 15.1898934 , 16.71094627, 22.23986403, 12.79976121, 19.59365104, 21.2825348 , 19.48055541, 23.59352879, 21.35132447, 19.61673861, 14.65246707, 17.35348242, 34.70926311, 19.84296666, 20.54528648, 23.7155794 , 18.19397792, 30.06826972, 45.24947247, 20.30194969, 22.91701671, 14.30161273, 16.67576712, 23.74907287, 17.75581261, 27.66264087, 21.13229281, 35.60124319, 17.18774385, 24.91177563, 46.97009364, 20.57653792, 15.57701284, 32.18185954, 22.85103655, 18.51122079, 24.45595692, 33.67332974, 28.25378425, 19.34175678, 25.85644649, 18.15084276, 14.21052975, 23.53882235, 28.52747901, 15.19081125, 21.30326782, 25.19340405, 10.89938172, 21.39037154, 22.19689567, 7.15791165, 20.14303198, 45.000678 , 12.23143984, 13.69618255, 21.89002964, 13.44594823, 21.49591997, 10.92048049, 20.75016071, 26.71248048, 14.26013303, 23.60867103, 24.01601834, 17.63802446, 21.51037139, 10.25833475, 19.47544323, 20.30182326, 23.95283291, 19.59146969, 36.65588144, 9.61071201, 12.12393297, 15.61254744, 20.93480136, 23.0406723 ]), array([2.0739769 , 1.67640665, 2.17764771, 1.84930219, 1.85107779, 1.92388738, 2.20484521, 2.18248146, 1.89063145, 2.03332157, 1.8366742 , 2.06367643, 2.49434834, 1.8830508 , 2.02913155, 2.14753675, 1.65774962, 2.23351368, 2.79300231, 1.97444722, 1.57315185, 1.62458606, 1.73832862, 3.03891129, 2.27134818, 2.42415484, 1.94058047, 1.97917142, 1.88414955, 2.02913155, 2.0310917 , 1.92163886, 2.39078947, 1.81468257, 1.8767521 , 2.14827747, 1.72472648, 1.68488709, 1.90188311, 1.74699869, 2.78397056, 2.28586818, 3.00078834, 2.10854299, 2.24239995, 2.18559195, 1.90963233, 1.74699869, 2.12130408, 2.41176556, 2.06367643, 2.23526697, 1.83413683, 2.1744423 , 2.94420841, 1.88268558, 1.84584692, 1.77012892, 1.61543576, 1.91059635, 1.80446203, 1.76175851, 2.15115463, 2.14253575, 1.71099815, 2.17560652, 2.08612383, 1.74699869, 1.52794024, 2.21561741, 1.75688762, 2.65495158, 2.14051417, 2.05062931, 1.99332146, 2.7479335 , 2.24258242, 2.76201406, 2.16979543, 2.77627241, 2.00778439, 2.38841813, 2.18151734, 2.22250336, 2.03485713, 1.78531995, 1.72823227, 1.92163886, 1.92729547, 1.81762078, 2.02864274, 2.28142331, 1.73768138, 2.07475637, 2.6100058 , 1.73768138, 2.54063156, 3.07516095, 1.95528874, 2.37594549, 1.59505934, 1.8830508 ])) 100%|██████████| 500/500 [00:20<00:00, 24.62it/s] 100%|██████████| 500/500 [00:01<00:00, 473.22it/s] Elapsed: 21.371967554092407 s RMSE for regression: 4.6128 100%|██████████| 500/500 [00:01<00:00, 472.70it/s] return_std: (array([27.35105517, 38.24061761, 13.24807691, 24.46873377, 18.49086662, 24.44431439, 19.20224238, 13.13473403, 22.90894301, 21.98741348, 24.21489647, 20.46205422, -5.75911111, 23.93151528, 17.92527135, 24.11212775, 21.44934164, 6.74518522, 42.44690897, 17.71341983, 26.57077524, 30.0885548 , 12.26619402, 23.69212985, 18.95957509, 17.16984562, 22.07223727, 13.17719781, 21.84262534, 18.88770145, 20.03593914, 25.14533386, 24.54019245, 21.45918162, 16.09174248, 19.57060774, 30.9900165 , 19.3271562 , 22.73248534, 25.35758129, 15.76834515, 33.22552486, 44.97408044, 17.92797226, 26.33028946, 18.4599263 , 14.42663258, 26.93636282, 19.53689139, 26.33479163, 20.86018543, 33.67917963, 16.55073195, 27.40403113, 37.22331114, 20.87649398, 19.44570505, 33.68619941, 25.63967736, 13.37108124, 23.95713532, 31.25869252, 30.49156048, 13.69956557, 19.1529703 , 16.71905758, 20.36099223, 26.35884787, 30.64793582, 11.6320709 , 20.60936052, 26.41221139, 10.95890524, 10.7945105 , 24.20964304, 5.62925644, 22.16146593, 43.46692404, 17.62994935, 7.5151419 , 20.84992426, 13.11734667, 19.79144432, 10.73822392, 21.08651932, 34.53259846, 17.93527576, 25.30144321, 27.24986369, 20.2654109 , 23.87828862, 5.92920754, 20.74621568, 15.38203707, 20.62815992, 21.48931201, 26.81179826, 0.4839618 , 13.24484973, 14.77219462, 22.89509328, 24.93563306]), array([3.4628609 , 5.08793895, 3.57419156, 2.29128183, 4.88112549, 3.66612346, 3.42655558, 3.65039245, 4.64954702, 3.68219965, 6.49614338, 4.16395195, 3.3650612 , 3.59810232, 2.62161761, 4.04633354, 3.30205986, 5.03086619, 6.76349409, 5.12178976, 2.95560118, 4.14123688, 3.5280306 , 2.89250043, 5.06568838, 4.8349177 , 2.51006218, 3.54781908, 6.54255092, 2.974951 , 3.05045613, 2.81754028, 5.34921633, 5.60759066, 4.58542698, 2.75206282, 3.25095022, 2.34169051, 4.09163933, 2.33446863, 3.45094303, 4.77833477, 7.67122479, 2.66519392, 3.31959386, 5.37708282, 2.9457753 , 2.43921321, 4.36600157, 3.40318111, 3.4644732 , 3.49293641, 3.88787184, 3.36035277, 3.7311132 , 3.22001582, 5.45777911, 5.57471258, 2.96565379, 3.44713176, 3.31574621, 4.71912489, 2.5917232 , 1.86842611, 4.04173082, 6.78207877, 5.40095407, 3.45657422, 5.08406158, 3.5031284 , 2.39301583, 4.08725647, 4.45025755, 2.74534274, 2.86213318, 4.55419455, 3.39881796, 7.52642722, 5.20326039, 3.38796248, 2.73724935, 4.99020679, 3.94047492, 5.13385217, 2.98397429, 5.43579293, 4.25905266, 2.64751788, 3.17792172, 3.93466144, 2.6511593 , 3.69266158, 3.81602351, 2.30590245, 5.54948776, 3.80471731, 5.96241679, 3.7290988 , 3.72726027, 3.99954239, 2.82045431, 2.88894944])) 100%|██████████| 500/500 [00:22<00:00, 21.77it/s] 100%|██████████| 500/500 [00:01<00:00, 429.65it/s] Elapsed: 24.141775608062744 s RMSE for regression: 3.1452 100%|██████████| 500/500 [00:01<00:00, 420.60it/s] return_std: (array([24.19494698, 31.26608549, 15.89364406, 23.26883098, 15.74570605, 21.59672605, 19.59480511, 15.31450401, 21.8124098 , 19.78253667, 20.28987499, 21.18919392, 9.33429589, 21.76792871, 19.14141368, 23.20372103, 19.57305417, 9.94279828, 44.89046319, 14.32345031, 24.62402119, 24.39517142, 14.484181 , 22.99297396, 15.79017315, 16.04081783, 21.58180006, 13.41382341, 19.99701986, 20.61561324, 21.57748265, 23.32664143, 20.37332832, 22.7621935 , 14.85577881, 16.83783802, 33.95898757, 19.23489473, 21.63153082, 24.21079574, 18.86848413, 29.87769606, 44.77363523, 19.41865797, 22.59804775, 13.95968751, 14.94679246, 24.81090022, 18.56148996, 28.35758018, 21.21897379, 33.64945958, 15.62269443, 25.93402232, 42.0448828 , 22.07577872, 14.72586721, 32.27741512, 23.27514223, 19.15642022, 24.9730514 , 34.53995527, 28.28256325, 18.33450678, 25.34947894, 18.30861992, 13.11629336, 23.27001799, 28.49261005, 15.52919571, 20.07510076, 25.13755188, 11.45938209, 21.57596782, 22.08666819, 6.41556461, 20.06670916, 45.09809204, 11.15493716, 11.06782393, 21.65307442, 13.18529878, 19.90197731, 11.01394907, 20.30386754, 27.23716034, 15.67395698, 23.38059099, 23.93236478, 18.59361172, 22.72551175, 9.50574151, 19.28823637, 18.88964096, 27.34444839, 20.35932312, 27.24311126, 12.10755032, 12.84368955, 16.43891664, 21.27013852, 24.01292608]), array([0.82248299, 1.04196426, 1.03948683, 0.78078476, 0.9451825 , 0.79966455, 0.82933838, 0.97999396, 0.79396303, 0.82667521, 0.8335771 , 0.8495569 , 1.38294533, 0.79582053, 0.85392553, 0.84999974, 0.80977565, 1.28720695, 1.98736924, 1.04036662, 0.7823068 , 0.80902761, 1.01880491, 0.84852946, 0.98832231, 0.95690382, 0.78107457, 1.08300667, 0.82975546, 0.80794297, 0.83671969, 0.77335838, 1.04282996, 0.87255634, 0.9997431 , 0.89305965, 1.2368323 , 0.82344456, 0.79165502, 0.78665693, 0.8565258 , 0.98352573, 1.95940353, 0.81944511, 0.79351379, 1.03607553, 0.98283008, 0.79840677, 0.82932558, 0.93567244, 0.81888816, 1.16902247, 0.95064928, 0.8509771 , 1.70052366, 0.78084153, 1.00776918, 1.07581682, 0.79344414, 0.84263107, 0.83563395, 1.26821667, 0.92540824, 0.8779215 , 0.83917372, 0.87246657, 1.10453857, 0.77163302, 0.89285568, 1.00074906, 0.80745512, 0.83017683, 1.19725351, 0.85345944, 0.79777526, 1.55649494, 0.80586305, 2.04304416, 1.24836922, 1.2027286 , 0.78033223, 1.10011592, 0.81695601, 1.24253628, 0.81510906, 0.85543122, 0.97487018, 0.7735899 , 0.77939255, 0.85005983, 0.79202888, 1.3228383 , 0.8421287 , 0.85387087, 0.99797076, 0.82266576, 1.0499877 , 1.16028906, 1.15568086, 0.9893855 , 0.79771329, 0.80297785])) Elapsed: 6.02028751373291 s RMSE for regression: 2.7538 return_std: (array([23.38436609, 30.58162903, 17.01082572, 23.42319969, 17.11013672, 21.63002805, 18.78586961, 14.16734299, 20.1777855 , 20.90566904, 19.78956441, 19.37612816, 7.10426684, 21.45547244, 20.2147791 , 23.82145678, 19.88422254, 9.73326254, 45.73197368, 16.17815899, 24.01994003, 24.6924821 , 13.3467705 , 21.66127135, 15.24208822, 16.30809134, 22.09115231, 13.2719851 , 19.38173126, 21.35139373, 19.70936488, 23.57518806, 21.15338956, 19.34356576, 14.46395528, 17.05941846, 34.72182244, 19.91542233, 20.55266978, 23.64917896, 18.17798021, 30.11079351, 45.73197368, 20.70027259, 22.86656157, 14.71263172, 16.54109909, 23.64917896, 17.86879815, 27.68160472, 21.10834113, 35.33147751, 17.08360841, 25.16644461, 48.05307558, 20.63059483, 16.36893214, 32.16348568, 22.820302 , 18.78819129, 24.55340768, 33.73650617, 28.3963564 , 19.33608366, 25.59953684, 18.16800217, 14.56907957, 23.44529615, 28.35586715, 15.12580327, 21.14445943, 25.27870868, 10.89031819, 21.59891134, 22.14437926, 7.82473017, 20.22146148, 45.64517314, 11.4756152 , 13.463848 , 21.84535476, 12.93329231, 21.39987408, 10.92629513, 20.65790375, 26.77305703, 14.09780644, 23.54508559, 24.31692674, 17.60003041, 21.41024988, 9.35984712, 19.41409108, 20.18605757, 22.59150151, 19.49407858, 37.64151204, 10.33004856, 12.37430999, 15.4511758 , 20.52394697, 22.96895798]), array([2.21217747, 1.79317773, 2.17299443, 1.72160601, 1.86241889, 1.94494808, 2.01598508, 2.0457321 , 1.86130234, 2.00677223, 1.98254139, 2.03008712, 2.74103564, 1.93403934, 1.91095137, 2.30166288, 1.67865655, 2.37849755, 2.9810275 , 1.95636635, 1.59164165, 1.59165463, 1.95575956, 3.16806635, 2.38128471, 2.09468801, 1.94301683, 2.17158815, 2.02620323, 1.99452501, 1.93021234, 1.85352199, 2.18122751, 1.82781761, 1.90510408, 2.14320277, 1.6373213 , 1.69860017, 2.10101793, 1.72688422, 2.27167448, 2.53214026, 3.0178396 , 1.95593248, 2.26322312, 2.29482033, 1.93937773, 1.72688422, 2.20878723, 2.47244714, 2.03008712, 2.27225569, 1.85787471, 2.1492312 , 2.80002349, 1.894994 , 1.88518653, 1.80892404, 1.66966339, 2.04483526, 1.9102816 , 1.76937604, 2.12307872, 2.06315636, 1.99411875, 2.28170609, 2.37285431, 1.69877629, 1.55042239, 2.35588427, 1.67488196, 2.6978741 , 2.34198765, 2.04386697, 1.94008423, 2.54161967, 2.01364821, 2.95193967, 2.1954336 , 2.48872074, 1.86218844, 2.41863477, 1.98485126, 2.41026675, 1.9065504 , 2.02927664, 1.79430316, 1.85352199, 2.02152136, 1.97015712, 2.0264921 , 2.51838215, 1.71928571, 1.9748513 , 2.68449362, 1.75538881, 2.64507232, 2.91292012, 2.10037665, 2.48565442, 1.67488196, 1.96636599])) Elapsed: 1.8189406394958496 s RMSE for regression: 4.9170 return_std: (array([ 2.89559854e+01, 3.59386442e+01, 1.48693738e+01, 2.50172912e+01, 1.87963370e+01, 2.32514207e+01, 1.76962710e+01, 1.43967457e+01, 2.30117834e+01, 2.06466750e+01, 2.48946285e+01, 1.86661545e+01, -5.89863373e+00, 2.17651681e+01, 1.92625990e+01, 2.61708796e+01, 2.06618518e+01, 5.90643727e+00, 4.03840171e+01, 1.76469498e+01, 2.72198393e+01, 3.00184888e+01, 1.14170560e+01, 2.41518124e+01, 1.78930166e+01, 1.58818311e+01, 2.27815800e+01, 1.46310505e+01, 2.24386277e+01, 1.92199735e+01, 2.24362177e+01, 2.52038688e+01, 2.59184475e+01, 1.77351004e+01, 1.68087202e+01, 1.69896604e+01, 3.11779672e+01, 2.01499715e+01, 2.37594216e+01, 2.46202307e+01, 1.40002278e+01, 3.21936113e+01, 4.25419168e+01, 1.73633850e+01, 2.72467527e+01, 1.70312412e+01, 1.41274280e+01, 2.58830049e+01, 2.03112970e+01, 2.99063723e+01, 2.12985096e+01, 3.42686427e+01, 1.60917362e+01, 2.62030933e+01, 3.94293893e+01, 2.25809329e+01, 1.88712751e+01, 3.26600797e+01, 2.50523836e+01, 1.29514047e+01, 2.26829702e+01, 3.04323746e+01, 3.14689095e+01, 1.59467899e+01, 2.02378711e+01, 1.67508837e+01, 2.05387816e+01, 2.59427537e+01, 3.05647016e+01, 1.16714111e+01, 2.05273346e+01, 2.74503388e+01, 1.10970033e+01, 1.57277162e+01, 2.37866142e+01, 6.30834548e+00, 2.16117434e+01, 4.12914480e+01, 1.87919729e+01, 8.97076184e+00, 2.08436852e+01, 1.33188908e+01, 2.07531518e+01, 9.45307506e+00, 2.32216312e+01, 3.18555843e+01, 1.91265557e+01, 2.54979262e+01, 2.90015282e+01, 2.01610168e+01, 2.55676507e+01, 5.81391648e+00, 2.01124996e+01, 1.50022425e+01, 1.25715837e+01, 2.07399550e+01, 2.47268049e+01, -1.33736349e-02, 1.37447349e+01, 1.62270472e+01, 2.22796387e+01, 2.44679689e+01]), array([4.88465085, 6.14010536, 3.77051703, 3.38313256, 5.87593379, 4.16628595, 3.53909179, 3.43673933, 7.13225439, 3.97103088, 6.17397992, 3.67343389, 3.37494312, 3.79741233, 3.44772708, 6.63080918, 3.48301766, 5.43632304, 5.26831916, 5.91050803, 3.52560359, 4.25532749, 2.98109801, 3.1909353 , 5.53638904, 6.24483216, 3.82809242, 3.84432738, 5.40553942, 3.74945233, 4.63831617, 3.59245432, 6.94365512, 5.37740336, 6.30953916, 3.00095373, 3.75671496, 3.05441553, 4.99921582, 3.34565899, 3.64355497, 5.03346863, 5.54559693, 3.24497069, 4.03865623, 6.02304939, 3.10600201, 3.41547031, 6.60855017, 4.02107129, 3.83349874, 4.66076484, 3.26422714, 3.93656189, 5.4573872 , 5.91960942, 5.94327814, 4.13544147, 3.63078454, 3.20705014, 3.30071072, 3.58440484, 4.49239123, 2.62946448, 2.72246592, 5.22102396, 6.41927019, 3.63808451, 3.87602531, 3.69753143, 3.39275846, 7.07622325, 4.69177358, 2.20579455, 4.01895919, 5.33976197, 3.97647502, 5.49774086, 6.53124834, 3.44193443, 3.31369225, 6.34491286, 2.98463561, 5.65500864, 4.01010849, 6.42992147, 5.12016371, 3.48261173, 4.03026264, 3.54935864, 4.19317565, 4.10191882, 3.42312066, 2.68682782, 5.12924502, 3.39288029, 7.03072039, 4.05528035, 3.80618439, 4.85459194, 3.60023026, 3.92072719])) Elapsed: 2.0792505741119385 s RMSE for regression: 4.9210 return_std: (array([28.93382564, 35.93463962, 14.78593201, 24.99407843, 18.8255972 , 23.15784878, 17.6787323 , 14.37072688, 22.9176379 , 20.65682089, 24.82656631, 18.64203409, -5.97412585, 21.69305085, 19.24844809, 26.16283404, 20.61351551, 5.86408168, 40.41127522, 17.6687024 , 27.24641606, 30.01626489, 11.40125575, 24.20150409, 17.91582967, 15.79404289, 22.71914105, 14.64314556, 22.3637164 , 19.23688248, 22.38594027, 25.22349139, 25.92872906, 17.80568179, 16.72142142, 17.11804584, 31.18975516, 20.20125214, 23.71634273, 24.59527083, 13.99296738, 32.19989907, 42.56419516, 17.3180222 , 27.24183952, 17.03612099, 14.11657181, 25.86241795, 20.24958978, 29.94788994, 21.28251708, 34.26926853, 16.09220654, 26.21614061, 39.48977879, 22.56580066, 18.91393603, 32.68450562, 25.04440194, 12.90436546, 22.71954274, 30.49448644, 31.4977909 , 15.98259105, 20.2781608 , 16.6489619 , 20.54619681, 25.94312632, 30.6016424 , 11.67621935, 20.50091954, 27.3880417 , 11.11243557, 15.8111653 , 23.71502091, 6.2743131 , 21.58907651, 41.30830632, 18.77412395, 8.86263437, 20.81478651, 13.21244668, 20.75663091, 9.42852114, 23.20597401, 31.83797407, 19.15958655, 25.52957686, 28.97930341, 20.16012702, 25.56979011, 5.76731891, 20.11966444, 14.99100311, 12.58345812, 20.75001239, 24.69300874, -0.16557681, 13.77380563, 16.13266867, 22.25771126, 24.40546012]), array([4.86255756, 6.09494865, 3.75363586, 3.34132076, 5.92411382, 4.09815346, 3.53864437, 3.44807238, 7.02178978, 3.99688208, 6.13748968, 3.64372846, 3.40194179, 3.74075381, 3.44636597, 6.59889823, 3.44369254, 5.47281703, 5.16684781, 5.9604817 , 3.50717833, 4.20441828, 3.00219465, 3.22082121, 5.58571461, 6.19216591, 3.77467221, 3.86990913, 5.38506201, 3.77727411, 4.61828702, 3.59179799, 6.95937864, 5.4718872 , 6.24741631, 3.07225562, 3.73154407, 3.0765441 , 4.98747078, 3.30287322, 3.66890724, 5.00163788, 5.4169417 , 3.21477629, 4.03404886, 6.06437418, 3.12836457, 3.37140573, 6.54851205, 4.02666569, 3.80353545, 4.58824095, 3.28715247, 3.95222019, 5.42846608, 5.88072471, 6.01269398, 4.08314507, 3.61274517, 3.17938945, 3.28749769, 3.54101012, 4.47259739, 2.65530724, 2.70866599, 5.20057441, 6.45103324, 3.61084102, 3.84127395, 3.72438878, 3.36456233, 6.97228955, 4.74598235, 2.21424462, 3.95853693, 5.3812147 , 3.98939977, 5.37063036, 6.54444635, 3.42578068, 3.28370649, 6.28870532, 2.94131809, 5.69518407, 4.00762303, 6.42136243, 5.15875661, 3.48434243, 3.96509485, 3.5639696 , 4.18344325, 4.12058769, 3.44021271, 2.68220721, 5.19466538, 3.40983604, 7.01022288, 4.021494 , 3.84830832, 4.80705248, 3.58197028, 3.86297113])) Elapsed: 5.062403678894043 s RMSE for regression: 3.1118 return_std: (array([23.92432767, 32.23199811, 15.9065472 , 23.55152709, 16.44560668, 21.50528718, 19.62972274, 15.60214783, 21.13791043, 20.08245572, 20.75871655, 20.79022535, 9.49207987, 21.84455666, 18.81690688, 23.29149966, 19.9691444 , 8.83078049, 45.02898474, 15.0810664 , 24.32141142, 24.47647831, 14.50220443, 23.37350252, 14.91026783, 15.69875137, 21.48034557, 14.01998471, 19.98351209, 20.6779532 , 21.13933273, 23.28424065, 22.51506377, 22.2659548 , 15.08311346, 16.44693594, 33.82209981, 19.16766996, 21.81065312, 24.07912675, 18.74925607, 29.69576375, 45.15653552, 19.43770008, 22.80150637, 14.12505962, 14.65074153, 25.00144153, 18.33503924, 28.56690305, 21.64338823, 34.22965127, 15.81663379, 26.33284852, 42.33366623, 21.83761604, 14.9389135 , 32.6539377 , 23.1336874 , 19.82451899, 25.06988518, 33.98564794, 28.24008101, 18.99413791, 25.83982819, 17.91428155, 13.81907152, 23.35123041, 28.20741926, 15.99721837, 20.30157124, 26.07142616, 11.53466953, 21.49607078, 22.60273732, 7.49505206, 19.8661215 , 45.65836484, 10.70298502, 10.76485929, 21.68779098, 13.44726735, 20.30286393, 10.38964868, 20.05620467, 27.44983559, 15.75287496, 23.4750758 , 23.47310449, 18.67058642, 22.37995135, 8.6738297 , 18.91913841, 18.75554542, 28.48174444, 19.67986414, 28.34345565, 13.21242691, 13.41168749, 17.85745913, 20.96314437, 24.08725095]), array([0.81279056, 1.07080282, 0.94452261, 0.77681013, 0.91428261, 0.79934448, 0.83860186, 0.99076386, 0.80466753, 0.81781727, 0.81062235, 0.86083171, 1.32596009, 0.79490113, 0.85285183, 0.89760557, 0.8152991 , 1.40823657, 2.02935579, 1.01665395, 0.78122904, 0.79686423, 1.01511471, 0.84066944, 0.99431205, 0.98012602, 0.77889927, 1.05666881, 0.82544889, 0.80703106, 0.8433922 , 0.77232229, 1.00370208, 0.93579518, 0.98516016, 0.90748647, 1.16924366, 0.81983188, 0.78968521, 0.7879158 , 0.86312968, 1.00775757, 1.90946679, 0.822826 , 0.78464479, 1.05879925, 1.01133432, 0.79895587, 0.82638619, 0.91370102, 0.81785212, 1.2014637 , 0.95095277, 0.85183272, 1.74142903, 0.78156776, 0.99365025, 1.13566755, 0.79371541, 0.84170699, 0.81544491, 1.22623516, 0.93893944, 0.8797483 , 0.84026299, 0.89529673, 1.10043774, 0.77245837, 0.87899518, 0.98906687, 0.80520341, 0.85691177, 1.21786562, 0.83625584, 0.79374763, 1.49722816, 0.80764391, 1.98897182, 1.22732704, 1.16796469, 0.77613623, 1.17077873, 0.80619049, 1.24274282, 0.80455364, 0.85673648, 0.98424816, 0.77462749, 0.78761552, 0.84825699, 0.78750174, 1.33084183, 0.85187144, 0.85321226, 1.12958899, 0.82693457, 1.12727242, 1.11340768, 1.10722965, 0.99031367, 0.79964353, 0.79845764])) Elapsed: 23.061126470565796 s RMSE for regression: 2.8106 return_std: (array([23.17744862, 30.17066161, 17.02265366, 23.59291786, 16.24336147, 21.74483104, 18.84564119, 14.09300531, 20.10855556, 20.9623932 , 19.69047512, 19.26678495, 7.53451303, 21.6260398 , 20.1489124 , 23.90990735, 19.80213646, 10.03382823, 45.24947247, 15.7005355 , 24.21640908, 24.34884912, 13.25800208, 21.53527528, 15.1898934 , 16.71094627, 22.23986403, 12.79976121, 19.59365104, 21.2825348 , 19.48055541, 23.59352879, 21.35132447, 19.61673861, 14.65246707, 17.35348242, 34.70926311, 19.84296666, 20.54528648, 23.7155794 , 18.19397792, 30.06826972, 45.24947247, 20.30194969, 22.91701671, 14.30161273, 16.67576712, 23.74907287, 17.75581261, 27.66264087, 21.13229281, 35.60124319, 17.18774385, 24.91177563, 46.97009364, 20.57653792, 15.57701284, 32.18185954, 22.85103655, 18.51122079, 24.45595692, 33.67332974, 28.25378425, 19.34175678, 25.85644649, 18.15084276, 14.21052975, 23.53882235, 28.52747901, 15.19081125, 21.30326782, 25.19340405, 10.89938172, 21.39037154, 22.19689567, 7.15791165, 20.14303198, 45.000678 , 12.23143984, 13.69618255, 21.89002964, 13.44594823, 21.49591997, 10.92048049, 20.75016071, 26.71248048, 14.26013303, 23.60867103, 24.01601834, 17.63802446, 21.51037139, 10.25833475, 19.47544323, 20.30182326, 23.95283291, 19.59146969, 36.65588144, 9.61071201, 12.12393297, 15.61254744, 20.93480136, 23.0406723 ]), array([2.0739769 , 1.67640665, 2.17764771, 1.84930219, 1.85107779, 1.92388738, 2.20484521, 2.18248146, 1.89063145, 2.03332157, 1.8366742 , 2.06367643, 2.49434834, 1.8830508 , 2.02913155, 2.14753675, 1.65774962, 2.23351368, 2.79300231, 1.97444722, 1.57315185, 1.62458606, 1.73832862, 3.03891129, 2.27134818, 2.42415484, 1.94058047, 1.97917142, 1.88414955, 2.02913155, 2.0310917 , 1.92163886, 2.39078947, 1.81468257, 1.8767521 , 2.14827747, 1.72472648, 1.68488709, 1.90188311, 1.74699869, 2.78397056, 2.28586818, 3.00078834, 2.10854299, 2.24239995, 2.18559195, 1.90963233, 1.74699869, 2.12130408, 2.41176556, 2.06367643, 2.23526697, 1.83413683, 2.1744423 , 2.94420841, 1.88268558, 1.84584692, 1.77012892, 1.61543576, 1.91059635, 1.80446203, 1.76175851, 2.15115463, 2.14253575, 1.71099815, 2.17560652, 2.08612383, 1.74699869, 1.52794024, 2.21561741, 1.75688762, 2.65495158, 2.14051417, 2.05062931, 1.99332146, 2.7479335 , 2.24258242, 2.76201406, 2.16979543, 2.77627241, 2.00778439, 2.38841813, 2.18151734, 2.22250336, 2.03485713, 1.78531995, 1.72823227, 1.92163886, 1.92729547, 1.81762078, 2.02864274, 2.28142331, 1.73768138, 2.07475637, 2.6100058 , 1.73768138, 2.54063156, 3.07516095, 1.95528874, 2.37594549, 1.59505934, 1.8830508 ])) Elapsed: 20.227847814559937 s RMSE for regression: 4.5960 return_std: (array([27.33645676, 37.96785856, 13.20227066, 24.49371659, 18.50030893, 24.61620594, 19.45236276, 13.18442617, 22.89892568, 22.03664508, 24.1643886 , 20.70616512, -5.64722639, 24.27042506, 17.87812873, 24.04695461, 21.42354932, 6.85066532, 42.40044105, 17.74009791, 26.60813593, 30.07614946, 12.36579208, 23.63831568, 19.00116643, 17.22269587, 22.01777016, 13.16029764, 21.84886626, 18.91130894, 20.0473152 , 25.09749283, 24.52943323, 21.53489254, 16.10987922, 19.616797 , 30.94468446, 19.31390177, 22.7688034 , 25.36602592, 15.95695362, 33.23210111, 44.98064108, 17.90468285, 26.37579605, 18.51720447, 14.27316502, 26.93676495, 19.52208206, 26.30720447, 20.95218485, 33.66372147, 16.61128752, 27.38293755, 37.12480618, 20.78755227, 19.48092021, 33.75976345, 25.66541505, 13.65570444, 24.2946438 , 31.27542102, 30.48183288, 13.70840791, 19.4117369 , 16.76591718, 20.38599331, 26.36123806, 30.67015399, 11.64387421, 20.63860894, 26.34893879, 11.00523623, 10.75725324, 24.18628918, 5.70334602, 22.01500137, 43.47179196, 17.65294457, 7.49784283, 20.82982345, 13.18435957, 19.70376107, 10.82977461, 21.00568039, 34.60399262, 17.9151053 , 25.26348281, 27.19588963, 20.30593366, 23.8894217 , 5.99301262, 20.78297317, 15.3684966 , 21.02337284, 21.52312372, 26.86640757, 0.59508824, 13.25312569, 14.78569872, 22.9439665 , 24.93468901]), array([3.48675914, 4.57219793, 3.52323217, 2.2409931 , 4.90776931, 3.62257593, 3.49688883, 3.73126647, 4.60365963, 3.69013154, 6.5320514 , 4.30507672, 3.28849552, 3.63956666, 2.56380994, 4.0836438 , 3.23508005, 4.9563576 , 6.7297265 , 5.14793405, 2.98109579, 4.15551498, 3.60347841, 2.85417889, 5.10704738, 4.77220475, 2.40916587, 3.54775095, 6.66510104, 2.98033382, 3.05718735, 2.78091267, 5.47950917, 5.68354947, 4.51722309, 2.7396583 , 3.21123487, 2.33283811, 3.96624664, 2.27035511, 3.47712999, 4.79848119, 7.47024037, 2.57707491, 3.37308026, 5.39703587, 2.81765513, 2.37154814, 4.32548284, 3.49253487, 3.49721869, 3.49997171, 4.06391573, 3.29930392, 3.82444998, 3.20348047, 5.51325343, 5.4401105 , 2.94875936, 3.57589059, 3.39702486, 4.54630248, 2.61734027, 1.87496905, 4.26004856, 6.82784442, 5.45470765, 3.44321634, 5.12020421, 3.47939815, 2.34864958, 4.08758588, 4.44557449, 2.75535724, 2.75763039, 4.53549649, 3.23497642, 7.34011831, 5.2400428 , 3.30277306, 2.66714611, 4.91457544, 3.83066603, 5.08744961, 2.93350424, 5.27782843, 4.28240956, 2.62291924, 3.10691847, 4.0692529 , 2.67448801, 3.6568004 , 3.9445158 , 2.23462726, 5.63164584, 3.93657972, 6.05511877, 3.60183787, 3.75073231, 3.97663094, 2.80539422, 2.79451831]))
2 – Classification
https://docs.techtonique.net/cybooster/index.html
datasets = [load_breast_cancer(), load_iris(), load_wine(), load_digits()] for i, dataset in enumerate(datasets): print("dataset #", i+1) X, y = dataset.data, dataset.target X = X.astype(np.float64) y = y.astype(np.int64) X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) regressor = NGBClassifier(verbose=True) start = time() regressor.fit(X_train, y_train) print(f"Elapsed: {time() - start} s") y_pred = regressor.predict(X_test) print(np.mean(y_test == y_pred)) regressor = NGBClassifier(LinearRegression(), verbose=True) start = time() regressor.fit(X_train, y_train) print(f"Elapsed: {time() - start} s") y_pred = regressor.predict(X_test) print(np.mean(y_test == y_pred))
dataset # 1 100%|██████████| 500/500 [00:08<00:00, 59.05it/s] Elapsed: 8.471373319625854 s 100%|██████████| 500/500 [00:00<00:00, 2690.35it/s] 0.956140350877193 100%|██████████| 500/500 [00:02<00:00, 186.11it/s] Elapsed: 2.691697359085083 s 100%|██████████| 500/500 [00:00<00:00, 3150.43it/s] 0.956140350877193 dataset # 2 100%|██████████| 500/500 [00:01<00:00, 279.15it/s] Elapsed: 1.7943899631500244 s 100%|██████████| 500/500 [00:00<00:00, 1922.03it/s] 1.0 100%|██████████| 500/500 [00:02<00:00, 187.01it/s] Elapsed: 2.677215337753296 s 100%|██████████| 500/500 [00:00<00:00, 2840.14it/s] 0.9 dataset # 3 100%|██████████| 500/500 [00:02<00:00, 188.67it/s] Elapsed: 2.655820846557617 s 100%|██████████| 500/500 [00:00<00:00, 1928.71it/s] 0.8611111111111112 100%|██████████| 500/500 [00:01<00:00, 254.23it/s] Elapsed: 1.9717035293579102 s 100%|██████████| 500/500 [00:00<00:00, 2815.23it/s] 1.0 dataset # 4 100%|██████████| 500/500 [00:49<00:00, 10.02it/s] Elapsed: 49.91874361038208 s 100%|██████████| 500/500 [00:01<00:00, 420.79it/s] 0.9083333333333333 100%|██████████| 500/500 [00:45<00:00, 10.98it/s] Elapsed: 45.56386756896973 s 100%|██████████| 500/500 [00:01<00:00, 354.27it/s] 0.95
3 – Time series forecasting
https://docs.techtonique.net/nnetsauce/index.html
import nnetsauce as ns import pandas as pd url = "https://raw.githubusercontent.com/Techtonique/" url += "datasets/main/time_series/multivariate/" url += "ice_cream_vs_heater.csv" df_temp = pd.read_csv(url) df_temp.index = pd.DatetimeIndex(df_temp.date) # must have# first other difference df_icecream = df_temp.drop(columns=['date']).diff().dropna() regr = ns.MTS(obj=NGBRegressor(), type_pi="scp2-kde", replications=250, lags=20, show_progress=False) regr.fit(df_icecream) regr.predict(h=30) regr.plot("heater", type_plot="pi")
100%|██████████| 500/500 [00:04<00:00, 107.94it/s] 100%|██████████| 500/500 [00:00<00:00, 1430.00it/s] 100%|██████████| 500/500 [00:03<00:00, 125.71it/s] 100%|██████████| 500/500 [00:02<00:00, 239.72it/s] 100%|██████████| 500/500 [00:00<00:00, 2786.28it/s] 100%|██████████| 500/500 [00:02<00:00, 239.43it/s] 100%|██████████| 500/500 [00:00<00:00, 3110.51it/s] 100%|██████████| 500/500 [00:00<00:00, 2797.01it/s] 100%|██████████| 500/500 [00:00<00:00, 2942.09it/s] 100%|██████████| 500/500 [00:00<00:00, 3195.59it/s] 100%|██████████| 500/500 [00:00<00:00, 3197.01it/s] 100%|██████████| 500/500 [00:00<00:00, 3230.33it/s] 100%|██████████| 500/500 [00:00<00:00, 3031.66it/s] 100%|██████████| 500/500 [00:00<00:00, 2755.45it/s] 100%|██████████| 500/500 [00:00<00:00, 3177.88it/s] 100%|██████████| 500/500 [00:00<00:00, 3228.63it/s] 100%|██████████| 500/500 [00:00<00:00, 3195.32it/s] 100%|██████████| 500/500 [00:00<00:00, 3146.73it/s] 100%|██████████| 500/500 [00:00<00:00, 2829.95it/s] 100%|██████████| 500/500 [00:00<00:00, 2723.26it/s] 100%|██████████| 500/500 [00:00<00:00, 2970.97it/s] 100%|██████████| 500/500 [00:00<00:00, 3230.97it/s] 100%|██████████| 500/500 [00:00<00:00, 3004.29it/s] 100%|██████████| 500/500 [00:00<00:00, 2751.06it/s] 100%|██████████| 500/500 [00:00<00:00, 3165.60it/s] 100%|██████████| 500/500 [00:00<00:00, 3116.68it/s] 100%|██████████| 500/500 [00:00<00:00, 2904.39it/s] 100%|██████████| 500/500 [00:00<00:00, 2935.10it/s] 100%|██████████| 500/500 [00:00<00:00, 3071.97it/s] 100%|██████████| 500/500 [00:00<00:00, 3083.59it/s] 100%|██████████| 500/500 [00:00<00:00, 2502.46it/s] 100%|██████████| 500/500 [00:00<00:00, 1766.41it/s] 100%|██████████| 500/500 [00:00<00:00, 2097.24it/s] 100%|██████████| 500/500 [00:00<00:00, 2105.69it/s] 100%|██████████| 500/500 [00:00<00:00, 2047.47it/s] 100%|██████████| 500/500 [00:00<00:00, 1045.37it/s] 100%|██████████| 500/500 [00:00<00:00, 2120.77it/s] 100%|██████████| 500/500 [00:00<00:00, 1118.63it/s] 100%|██████████| 500/500 [00:00<00:00, 1724.03it/s] 100%|██████████| 500/500 [00:00<00:00, 1662.00it/s] 100%|██████████| 500/500 [00:00<00:00, 2517.25it/s] 100%|██████████| 500/500 [00:00<00:00, 2913.29it/s] 100%|██████████| 500/500 [00:00<00:00, 3084.72it/s] 100%|██████████| 500/500 [00:00<00:00, 2789.54it/s] 100%|██████████| 500/500 [00:00<00:00, 3072.67it/s] 100%|██████████| 500/500 [00:00<00:00, 3131.44it/s] 100%|██████████| 500/500 [00:00<00:00, 2798.36it/s] 100%|██████████| 500/500 [00:00<00:00, 3190.72it/s] 100%|██████████| 500/500 [00:00<00:00, 3004.53it/s] 100%|██████████| 500/500 [00:00<00:00, 2741.42it/s] 100%|██████████| 500/500 [00:00<00:00, 2995.34it/s] 100%|██████████| 500/500 [00:00<00:00, 3142.13it/s] 100%|██████████| 500/500 [00:00<00:00, 3227.70it/s] 100%|██████████| 500/500 [00:00<00:00, 2965.29it/s] 100%|██████████| 500/500 [00:00<00:00, 3085.74it/s] 100%|██████████| 500/500 [00:00<00:00, 2833.22it/s] 100%|██████████| 500/500 [00:00<00:00, 2941.32it/s] 100%|██████████| 500/500 [00:00<00:00, 2908.35it/s] 100%|██████████| 500/500 [00:00<00:00, 2825.95it/s] 100%|██████████| 500/500 [00:00<00:00, 3134.82it/s] 100%|██████████| 500/500 [00:00<00:00, 3154.45it/s] 100%|██████████| 500/500 [00:00<00:00, 2725.69it/s] 100%|██████████| 500/500 [00:00<00:00, 3059.70it/s] 100%|██████████| 500/500 [00:00<00:00, 3121.49it/s] 100%|██████████| 500/500 [00:00<00:00, 3123.17it/s] 100%|██████████| 500/500 [00:00<00:00, 3137.44it/s]
4 – Reserving
https://docs.techtonique.net/mlreserving/mlreserving.html
import pandas as pd import numpy as np import matplotlib.pyplot as plt from mlreserving import MLReserving # Import models from scikit-learn from sklearn.linear_model import RidgeCV, ElasticNetCV from sklearn.ensemble import RandomForestRegressor from sklearn.tree import ExtraTreeRegressor from sklearn.kernel_ridge import KernelRidge models_run = [] # Define a list of models to try models = [ NGBRegressor(), NGBRegressor(Ridge()), NGBRegressor(LinearRegression()), NGBRegressor(RandomForestRegressor()), ] # Function to evaluate model performance def evaluate_model(model_name, result, ibnr): print(f"\n{'='*50}") print(f"Model: {model_name}") print(f"{'='*50}") print("\nMean predictions:") print(result.mean) print("\nIBNR per origin year (mean):") print(ibnr.mean) print("\nSummary:") print(model.get_summary()) # Display results print("\nMean predictions:") result.mean.plot() plt.title(f'Mean Predictions - {mdl.__class__.__name__}') plt.show() print("\nLower bound (95%):") result.lower.plot() plt.title(f'Lower Bound - {mdl.__class__.__name__}') plt.show() print("\nUpper bound (95%):") result.upper.plot() plt.title(f'Upper Bound - {mdl.__class__.__name__}') plt.show() # Plot IBNR plt.figure(figsize=(10, 6)) plt.plot(ibnr.mean.index, ibnr.mean.values, 'b-', label='Mean IBNR') plt.fill_between(ibnr.mean.index, ibnr.lower.values, ibnr.upper.values, alpha=0.2, label='95% Confidence Interval') plt.title(f'IBNR per Origin Year - {mdl.__class__.__name__}') plt.xlabel('Origin Year') plt.ylabel('IBNR') plt.legend() plt.grid(True) plt.show() # Load the dataset url = "https://raw.githubusercontent.com/Techtonique/datasets/refs/heads/main/tabular/triangle/raa.csv" df = pd.read_csv(url) # Try both factor and non-factor approaches for mdl in models: try: # Initialize the model with prediction intervals model = MLReserving( model=mdl, level=95, random_state=42 ) # Fit the model model.fit(df, origin_col="origin", development_col="development", value_col="values") # Make predictions with intervals result = model.predict() ibnr = model.get_ibnr() # Evaluate the model evaluate_model(mdl.__class__.__name__, result, ibnr) models_run.append(mdl.__class__.__name__) except Exception as e: print(f"Error with model {mdl.__class__.__name__}: {str(e)}") continue print(models_run)
100%|██████████| 500/500 [00:01<00:00, 338.84it/s] 100%|██████████| 500/500 [00:00<00:00, 2896.05it/s] 100%|██████████| 500/500 [00:00<00:00, 3028.89it/s] 100%|██████████| 500/500 [00:00<00:00, 2662.56it/s] ================================================== Model: NGBRegressor ================================================== Mean predictions: origin 1981 1982 1983 1984 1985 1986 1987 \ dev 1 3257.00 4179.00 5582.00 5900.00 8473.00 4932.00 3463.00 2 6514.00 8358.00 11164.00 11800.00 16946.00 9864.00 6926.00 3 9152.00 9469.00 16045.00 16011.00 23217.00 15121.00 13852.00 4 10050.00 14739.00 18313.00 21511.00 29550.00 16354.00 15220.00 5 11784.00 17855.00 20907.00 23670.00 33336.00 19271.00 17468.84 6 14426.00 19672.00 24386.00 26328.00 33561.00 21519.84 19717.68 7 16254.00 19569.00 25035.00 27312.00 34188.99 22147.83 20345.67 8 16853.00 20242.00 25638.00 27954.99 34831.99 22790.83 20988.67 9 16907.00 20777.00 26291.54 28608.54 35485.53 23444.37 21642.21 10 17079.00 21353.59 27031.33 29348.32 36225.32 24184.16 22382.00 origin 1988 1989 1990 dev 1 5596.00 2262.00 3492.94 2 11192.00 4524.00 6996.03 3 17357.00 7027.06 9499.10 4 19520.64 9190.70 11662.73 5 21769.48 11439.54 13911.57 6 24018.31 13688.38 16160.41 7 24646.31 14316.37 16788.40 8 25289.30 14959.36 17431.40 9 25942.85 15612.91 18084.94 10 26682.63 16352.70 18824.73 IBNR per origin year (mean): origin 1982 576.59 1983 1393.33 1984 2036.32 1985 2664.32 1986 4913.16 1987 7162.00 1988 9325.63 1989 11828.70 1990 18824.73 Name: values, dtype: float64 Summary: {'ByOrigin': Latest Mean Ultimate Mean IBNR IBNR 95% Ultimate Lo95 \ origin 1981 172.00 17079.00 NaN NaN 17079.00 1982 535.00 21353.59 576.59 1613.76 20982.60 1983 603.00 27031.33 1393.33 3898.88 26135.10 1984 984.00 29348.32 2036.32 5698.28 28038.46 1985 225.00 36225.32 2664.32 7455.74 34511.44 1986 2917.00 24184.16 4913.16 13744.55 21025.20 1987 1368.00 22382.00 7162.00 20033.35 17777.96 1988 6165.00 26682.63 9325.63 26083.97 20688.24 1989 2262.00 16352.70 11828.70 33083.50 8749.93 1990 NaN 18824.73 18824.73 52645.69 6727.10 Ultimate Hi95 origin 1981 17079.00 1982 22390.76 1983 29536.88 1984 33010.28 1985 41016.74 1986 33015.55 1987 35253.35 1988 43440.97 1989 37607.50 1990 52645.69 , 'Totals': Latest 15231.00 Mean Ultimate 239463.78 Mean IBNR 58724.78 Total IBNR 95% 164257.73 dtype: float64} Mean predictions:
Lower bound (95%):
Upper bound (95%):
100%|██████████| 500/500 [00:01<00:00, 420.56it/s] 100%|██████████| 500/500 [00:00<00:00, 4160.10it/s] 100%|██████████| 500/500 [00:00<00:00, 4138.77it/s] 100%|██████████| 500/500 [00:00<00:00, 4265.03it/s] ================================================== Model: NGBRegressor ================================================== Mean predictions: origin 1981 1982 1983 1984 1985 1986 1987 \ dev 1 3257.00 4179.00 5582.00 5900.00 8473.00 4932.00 3463.00 2 6514.00 8358.00 11164.00 11800.00 16946.00 9864.00 6926.00 3 9152.00 9469.00 16045.00 16011.00 23217.00 15121.00 13852.00 4 10050.00 14739.00 18313.00 21511.00 29550.00 16354.00 15220.00 5 11784.00 17855.00 20907.00 23670.00 33336.00 19271.00 17463.04 6 14426.00 19672.00 24386.00 26328.00 33561.00 20462.65 18821.95 7 16254.00 19569.00 25035.00 27312.00 34180.97 21169.98 19628.88 8 16853.00 20242.00 25638.00 27629.46 34543.37 21583.63 20100.99 9 16907.00 20777.00 25798.43 27812.74 34752.72 21822.73 20374.02 10 17079.00 20857.07 25890.01 27917.46 34872.44 21959.56 20530.38 origin 1988 1989 1990 dev 1 5596.00 2262.00 13112.11 2 11192.00 4524.00 24561.14 3 17357.00 11670.23 32700.37 4 21455.18 16339.71 38020.43 5 24011.96 19253.89 41341.73 6 25561.48 21020.64 43355.99 7 26481.95 22070.53 44553.40 8 27020.71 22685.30 45254.84 9 27332.45 23041.19 45661.08 10 27511.10 23245.26 45894.16 IBNR per origin year (mean): origin 1982 80.07 1983 252.01 1984 605.46 1985 1311.44 1986 2688.56 1987 5310.38 1988 10154.10 1989 18721.26 1990 45894.16 Name: values, dtype: float64 Summary: {'ByOrigin': Latest Mean Ultimate Mean IBNR IBNR 95% Ultimate Lo95 \ origin 1981 172.00 17079.00 NaN NaN 17079.00 1982 535.00 20857.07 80.07 374.18 20793.50 1983 603.00 25890.01 252.01 1173.51 25690.87 1984 984.00 27917.46 605.46 2812.84 27440.46 1985 225.00 34872.44 1311.44 6083.61 33841.23 1986 2917.00 21959.56 2688.56 12460.29 19848.02 1987 1368.00 20530.38 5310.38 24597.16 16362.78 1988 6165.00 27511.10 10154.10 47016.53 19545.65 1989 2262.00 23245.26 18721.26 86667.25 8563.11 1990 NaN 45894.16 45894.16 212425.22 9909.21 Ultimate Hi95 origin 1981 17079.00 1982 21151.18 1983 26811.51 1984 30124.84 1985 39644.61 1986 31731.29 1987 39817.16 1988 64373.53 1989 91191.25 1990 212425.22 , 'Totals': Latest 15231.00 Mean Ultimate 265756.44 Mean IBNR 85017.44 Total IBNR 95% 393610.60 dtype: float64} Mean predictions:
Lower bound (95%):
Upper bound (95%):
100%|██████████| 500/500 [00:01<00:00, 379.50it/s] 100%|██████████| 500/500 [00:00<00:00, 4048.90it/s] 100%|██████████| 500/500 [00:00<00:00, 4330.17it/s] 100%|██████████| 500/500 [00:00<00:00, 3693.07it/s] ================================================== Model: NGBRegressor ================================================== Mean predictions: origin 1981 1982 1983 1984 1985 1986 1987 \ dev 1 3257.00 4179.00 5582.00 5900.00 8473.00 4932.00 3463.00 2 6514.00 8358.00 11164.00 11800.00 16946.00 9864.00 6926.00 3 9152.00 9469.00 16045.00 16011.00 23217.00 15121.00 13852.00 4 10050.00 14739.00 18313.00 21511.00 29550.00 16354.00 15220.00 5 11784.00 17855.00 20907.00 23670.00 33336.00 19271.00 17506.97 6 14426.00 19672.00 24386.00 26328.00 33561.00 20482.47 18891.47 7 16254.00 19569.00 25035.00 27312.00 34188.67 21200.14 19711.97 8 16853.00 20242.00 25638.00 27631.77 34554.51 21618.63 20190.63 9 16907.00 20777.00 25798.66 27815.72 34765.08 21859.64 20466.45 10 17079.00 20856.67 25889.99 27920.39 34885.00 21997.01 20623.76 origin 1988 1989 1990 dev 1 5596.00 2262.00 12977.87 2 11192.00 4524.00 24561.13 3 17357.00 11805.01 32871.63 4 21539.96 16581.33 38325.11 5 24152.42 19565.40 41733.38 6 25734.54 21373.19 43798.88 7 26672.50 22445.35 45024.33 8 27219.93 23071.35 45740.13 9 27535.54 23432.45 46153.21 10 27715.66 23638.65 46389.25 IBNR per origin year (mean): origin 1982 79.67 1983 251.99 1984 608.39 1985 1324.00 1986 2726.01 1987 5403.76 1988 10358.66 1989 19114.65 1990 46389.25 Name: values, dtype: float64 Summary: {'ByOrigin': Latest Mean Ultimate Mean IBNR IBNR 95% Ultimate Lo95 \ origin 1981 172.00 17079.00 NaN NaN 17079.00 1982 535.00 20856.67 79.67 377.74 20793.17 1983 603.00 25889.99 251.99 1190.41 25690.08 1984 984.00 27920.39 608.39 2867.23 27439.21 1985 225.00 34885.00 1324.00 6230.42 33839.86 1986 2917.00 21997.01 2726.01 12815.92 19847.72 1987 1368.00 20623.76 5403.76 25390.52 16366.33 1988 6165.00 27715.66 10358.66 48655.36 19558.00 1989 2262.00 23638.65 19114.65 89764.70 8589.34 1990 NaN 46389.25 46389.25 217814.61 9873.58 Ultimate Hi95 origin 1981 17079.00 1982 21154.74 1983 26828.41 1984 30179.23 1985 39791.42 1986 32086.92 1987 40610.52 1988 66012.36 1989 94288.70 1990 217814.61 , 'Totals': Latest 15231.00 Mean Ultimate 266995.38 Mean IBNR 86256.38 Total IBNR 95% 405106.90 dtype: float64} Mean predictions:
Lower bound (95%):
Upper bound (95%):
100%|██████████| 500/500 [02:29<00:00, 3.34it/s] 100%|██████████| 500/500 [00:11<00:00, 44.92it/s] 100%|██████████| 500/500 [00:11<00:00, 44.70it/s] 100%|██████████| 500/500 [00:11<00:00, 44.27it/s] ================================================== Model: NGBRegressor ================================================== Mean predictions: origin 1981 1982 1983 1984 1985 1986 1987 \ dev 1 3257.00 4179.00 5582.00 5900.00 8473.00 4932.00 3463.00 2 6514.00 8358.00 11164.00 11800.00 16946.00 9864.00 6926.00 3 9152.00 9469.00 16045.00 16011.00 23217.00 15121.00 13852.00 4 10050.00 14739.00 18313.00 21511.00 29550.00 16354.00 15220.00 5 11784.00 17855.00 20907.00 23670.00 33336.00 19271.00 20572.22 6 14426.00 19672.00 24386.00 26328.00 33561.00 29763.63 31064.85 7 16254.00 19569.00 25035.00 27312.00 33769.99 29972.63 31273.85 8 16853.00 20242.00 25638.00 27946.85 34404.84 30607.48 31908.70 9 16907.00 20777.00 26137.54 28446.39 34904.38 31107.01 32408.23 10 17079.00 21216.25 26595.96 28904.81 35362.80 31565.44 32866.66 origin 1988 1989 1990 dev 1 5596.00 2262.00 5687.14 2 11192.00 4524.00 11417.18 3 17357.00 9649.43 16542.60 4 22149.37 14441.79 21334.97 5 27501.59 19794.01 26687.19 6 37994.22 30286.64 37179.82 7 38203.21 30495.64 37388.81 8 38838.06 31130.49 38023.67 9 39337.60 31630.03 38523.20 10 39796.02 32088.45 38981.62 IBNR per origin year (mean): origin 1982 439.25 1983 957.96 1984 1592.81 1985 1801.80 1986 12294.44 1987 17646.66 1988 22439.02 1989 27564.45 1990 38981.62 Name: values, dtype: float64 Summary: {'ByOrigin': Latest Mean Ultimate Mean IBNR IBNR 95% Ultimate Lo95 \ origin 1981 172.00 17079.00 NaN NaN 17079.00 1982 535.00 21216.25 439.25 4566.43 20818.43 1983 603.00 26595.96 957.96 9957.31 25728.52 1984 984.00 28904.81 1592.81 16553.10 27462.80 1985 225.00 35362.80 1801.80 18730.72 33731.03 1986 2917.00 31565.44 12294.44 127598.22 20451.49 1987 1368.00 32866.66 17646.66 183135.38 16915.48 1988 6165.00 39796.02 22439.02 232864.20 19513.50 1989 2262.00 32088.45 27564.45 286048.42 7173.63 1990 NaN 38981.62 38981.62 404517.19 3748.30 Ultimate Hi95 origin 1981 17079.00 1982 25343.43 1983 35595.31 1984 43865.10 1985 52291.72 1986 146869.22 1987 198355.38 1988 250221.20 1989 290572.42 1990 404517.19 , 'Totals': Latest 15231.00 Mean Ultimate 304457.00 Mean IBNR 123718.00 Total IBNR 95% 1283970.96 dtype: float64} Mean predictions:
Lower bound (95%):
Upper bound (95%):
['NGBRegressor', 'NGBRegressor', 'NGBRegressor', 'NGBRegressor']
Want to share your content on python-bloggers? click here.