{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [], "toc_visible": true }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "code", "source": [ "!pip install -q h2o" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "vVD1FYhGf4un", "outputId": "ec1d8e56-24ac-4218-a76d-d7ebfc445c61" }, "execution_count": 1, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m265.9/265.9 MB\u001b[0m \u001b[31m5.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25h" ] } ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "id": "RhhfAVj2evwW" }, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "from sklearn.metrics import mean_absolute_error, mean_absolute_percentage_error\n", "import os\n", "import pickle\n", "\n", "import h2o\n", "from h2o.automl import H2OAutoML" ] }, { "cell_type": "code", "source": [ "import warnings\n", "warnings.filterwarnings('ignore')" ], "metadata": { "id": "gdViY9EHjSIa" }, "execution_count": 3, "outputs": [] }, { "cell_type": "code", "source": [ "path = '/content/drive/MyDrive/datasets/Multimodal_EarningCallTranscripts_Analysis_India/'" ], "metadata": { "id": "Ei8yV-pMgi1p" }, "execution_count": 4, "outputs": [] }, { "cell_type": "code", "source": [ "# Start the H2O cluster (locally)\n", "h2o.init()" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 542 }, "id": "GUZ9TU6ygkS0", "outputId": "60b7fc5f-d220-4373-9cd0-bdca505a4c62" }, "execution_count": 5, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Checking whether there is an H2O instance running at http://localhost:54321..... not found.\n", "Attempting to start a local H2O server...\n", " Java Version: openjdk version \"11.0.26\" 2025-01-21; OpenJDK Runtime Environment (build 11.0.26+4-post-Ubuntu-1ubuntu122.04); OpenJDK 64-Bit Server VM (build 11.0.26+4-post-Ubuntu-1ubuntu122.04, mixed mode, sharing)\n", " Starting server from /usr/local/lib/python3.11/dist-packages/h2o/backend/bin/h2o.jar\n", " Ice root: /tmp/tmpr3sbymez\n", " JVM stdout: /tmp/tmpr3sbymez/h2o_unknownUser_started_from_python.out\n", " JVM stderr: /tmp/tmpr3sbymez/h2o_unknownUser_started_from_python.err\n", " Server is running at http://127.0.0.1:54321\n", "Connecting to H2O server at http://127.0.0.1:54321 ... successful.\n" ] }, { "output_type": "display_data", "data": { "text/plain": [ "-------------------------- -----------------------------------------------------------------------------------------\n", "H2O_cluster_uptime: 08 secs\n", "H2O_cluster_timezone: Etc/UTC\n", "H2O_data_parsing_timezone: UTC\n", "H2O_cluster_version: 3.46.0.7\n", "H2O_cluster_version_age: 12 days\n", "H2O_cluster_name: H2O_from_python_unknownUser_wkm3dv\n", "H2O_cluster_total_nodes: 1\n", "H2O_cluster_free_memory: 3.170 Gb\n", "H2O_cluster_total_cores: 2\n", "H2O_cluster_allowed_cores: 2\n", "H2O_cluster_status: locked, healthy\n", "H2O_connection_url: http://127.0.0.1:54321\n", "H2O_connection_proxy: {\"http\": null, \"https\": null, \"colab_language_server\": \"/usr/colab/bin/language_service\"}\n", "H2O_internal_security: False\n", "Python_version: 3.11.11 final\n", "-------------------------- -----------------------------------------------------------------------------------------" ], "text/html": [ "\n", " \n", "
H2O_cluster_uptime: | \n", "08 secs |
H2O_cluster_timezone: | \n", "Etc/UTC |
H2O_data_parsing_timezone: | \n", "UTC |
H2O_cluster_version: | \n", "3.46.0.7 |
H2O_cluster_version_age: | \n", "12 days |
H2O_cluster_name: | \n", "H2O_from_python_unknownUser_wkm3dv |
H2O_cluster_total_nodes: | \n", "1 |
H2O_cluster_free_memory: | \n", "3.170 Gb |
H2O_cluster_total_cores: | \n", "2 |
H2O_cluster_allowed_cores: | \n", "2 |
H2O_cluster_status: | \n", "locked, healthy |
H2O_connection_url: | \n", "http://127.0.0.1:54321 |
H2O_connection_proxy: | \n", "{\"http\": null, \"https\": null, \"colab_language_server\": \"/usr/colab/bin/language_service\"} |
H2O_internal_security: | \n", "False |
Python_version: | \n", "3.11.11 final |
\n", " | company_name | \n", "ticker | \n", "company_website_link | \n", "screener_link | \n", "transcript_link | \n", "transcript_file_name | \n", "ppt_link | \n", "ppt_file_name | \n", "RESULT DATE | \n", "year | \n", "... | \n", "Cash from Financing Activity | \n", "Net Cash Flow | \n", "Revenue | \n", "Financing Profit | \n", "Financing Margin % | \n", "Deposits | \n", "Borrowing | \n", "RESULT DATE+1 open price | \n", "TARGET-2 REGRESSION NORMALIZED | \n", "split | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "L&T Finance Ltd | \n", "NSE:LTF | \n", "http://www.ltfs.com/ | \n", "https://www.screener.in/company/LTF/consolidated/ | \n", "NaN | \n", "NOT AVAILABLE | \n", "https://www.bseindia.com/stockinfo/AnnPdfOpen.... | \n", "LTF_Oct-2024_ppt.pdf | \n", "2024-10-18 15:30:00 | \n", "2024 | \n", "... | \n", "-7037.0 | \n", "-5515.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "168.0 | \n", "0.012048 | \n", "test | \n", "
1 | \n", "L&T Finance Ltd | \n", "NSE:LTF | \n", "http://www.ltfs.com/ | \n", "https://www.screener.in/company/LTF/consolidated/ | \n", "https://www.bseindia.com/stockinfo/AnnPdfOpen.... | \n", "LTF_Jul-2024_transcript.pdf | \n", "https://www.bseindia.com/stockinfo/AnnPdfOpen.... | \n", "NOT AVAILABLE | \n", "2024-07-16 15:30:00 | \n", "2024 | \n", "... | \n", "-7037.0 | \n", "-5515.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "189.9 | \n", "0.018504 | \n", "validation | \n", "
2 | \n", "Max Healthcare Institute Ltd | \n", "NSE:MAXHEALTH | \n", "http://www.maxhealthcare.in/ | \n", "https://www.screener.in/company/MAXHEALTH/cons... | \n", "https://www.bseindia.com/stockinfo/AnnPdfOpen.... | \n", "MAXHEALTH_Nov-2024_transcript.pdf | \n", "https://www.bseindia.com/stockinfo/AnnPdfOpen.... | \n", "MAXHEALTH_Nov-2024_ppt.pdf | \n", "2024-11-05 15:30:00 | \n", "2024 | \n", "... | \n", "-264.0 | \n", "-394.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "1043.0 | \n", "0.012621 | \n", "test | \n", "
3 | \n", "Max Healthcare Institute Ltd | \n", "NSE:MAXHEALTH | \n", "http://www.maxhealthcare.in/ | \n", "https://www.screener.in/company/MAXHEALTH/cons... | \n", "https://www.bseindia.com/stockinfo/AnnPdfOpen.... | \n", "MAXHEALTH_Aug-2024_transcript.pdf | \n", "https://www.bseindia.com/xml-data/corpfiling/A... | \n", "MAXHEALTH_Aug-2024_ppt.pdf | \n", "2024-08-01 15:30:00 | \n", "2024 | \n", "... | \n", "-264.0 | \n", "-394.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "920.0 | \n", "-0.015990 | \n", "validation | \n", "
4 | \n", "Max Healthcare Institute Ltd | \n", "NSE:MAXHEALTH | \n", "http://www.maxhealthcare.in/ | \n", "https://www.screener.in/company/MAXHEALTH/cons... | \n", "NaN | \n", "NOT AVAILABLE | \n", "https://www.bseindia.com/stockinfo/AnnPdfOpen.... | \n", "MAXHEALTH_Jan-2024_ppt.pdf | \n", "2024-01-31 15:30:00 | \n", "2024 | \n", "... | \n", "-264.0 | \n", "-394.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "780.0 | \n", "0.062598 | \n", "train | \n", "
5 rows × 57 columns
\n", "model_id | rmse | mse | mae | rmsle | mean_residual_deviance |
---|---|---|---|---|---|
DeepLearning_grid_1_AutoML_1_20250409_125927_model_1 | 124.274 | 15444 | 92.95 | 0.186283 | 15444 |
DeepLearning_grid_2_AutoML_1_20250409_125927_model_1 | 148.476 | 22045.2 | 102.05 | 0.263675 | 22045.2 |
DeepLearning_grid_3_AutoML_1_20250409_125927_model_1 | 232.249 | 53939.5 | 138.35 | 0.21911 | 53939.5 |
GBM_5_AutoML_1_20250409_125927 | 347.979 | 121089 | 116.301 | 0.055101 | 121089 |
XGBoost_3_AutoML_1_20250409_125927 | 360.731 | 130127 | 142.876 | 0.12462 | 130127 |
XGBoost_grid_1_AutoML_1_20250409_125927_model_2 | 360.877 | 130232 | 132.802 | 0.0704741 | 130232 |
XGBoost_grid_1_AutoML_1_20250409_125927_model_3 | 362.277 | 131245 | 114.346 | 0.0618231 | 131245 |
GBM_grid_1_AutoML_1_20250409_125927_model_2 | 363.447 | 132094 | 115.479 | 0.0740894 | 132094 |
XGBoost_2_AutoML_1_20250409_125927 | 373.977 | 139859 | 133.238 | 0.0886959 | 139859 |
GBM_3_AutoML_1_20250409_125927 | 386.865 | 149664 | 115.389 | 0.0703277 | 149664 |
XGBoost_1_AutoML_1_20250409_125927 | 389.489 | 151702 | 143.901 | 0.0940194 | 151702 |
GBM_2_AutoML_1_20250409_125927 | 390.618 | 152582 | 116.687 | 0.0778867 | 152582 |
GBM_4_AutoML_1_20250409_125927 | 406.879 | 165550 | 118.116 | 0.0858482 | 165550 |
DeepLearning_1_AutoML_1_20250409_125927 | 410.255 | 168309 | 226.432 | 0.447204 | 168309 |
XRT_1_AutoML_1_20250409_125927 | 426.22 | 181663 | 153.543 | 0.0815366 | 181663 |
DRF_1_AutoML_1_20250409_125927 | 426.821 | 182176 | 140.027 | 0.0642774 | 182176 |
XGBoost_grid_1_AutoML_1_20250409_125927_model_1 | 428.699 | 183783 | 179.014 | 0.115927 | 183783 |
GBM_grid_1_AutoML_1_20250409_125927_model_1 | 476.34 | 226900 | 211.895 | 0.227544 | 226900 |
GBM_1_AutoML_1_20250409_125927 | 1160.2 | 1.34606e+06 | 465.625 | 0.278133 | 1.34606e+06 |
GLM_1_AutoML_1_20250409_125927 | 2474.66 | 6.12395e+06 | 1514.8 | 1.18928 | 6.12395e+06 |
[20 rows x 6 columns]" ] }, "metadata": {}, "execution_count": 12 } ] }, { "cell_type": "code", "source": [ "lb = h2o.automl.get_leaderboard(aml, extra_columns = \"ALL\")\n", "lb" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 409 }, "id": "yQRo3ds2ik4N", "outputId": "e8dd5959-fe95-4296-d031-a586b4c2cf19" }, "execution_count": null, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "model_id rmse mse mae rmsle mean_residual_deviance training_time_ms predict_time_per_row_ms algo\n", "---------------------------------------------------- ------- -------- ------- --------- ------------------------ ------------------ ------------------------- ------------\n", "DeepLearning_grid_1_AutoML_1_20250409_125927_model_1 124.274 15444 92.95 0.186283 15444 90000 0.130107 DeepLearning\n", "DeepLearning_grid_2_AutoML_1_20250409_125927_model_1 148.476 22045.2 102.05 0.263675 22045.2 66419 0.209791 DeepLearning\n", "DeepLearning_grid_3_AutoML_1_20250409_125927_model_1 232.249 53939.5 138.35 0.21911 53939.5 51729 0.152972 DeepLearning\n", "GBM_5_AutoML_1_20250409_125927 347.979 121089 116.301 0.055101 121089 3756 0.215801 GBM\n", "XGBoost_3_AutoML_1_20250409_125927 360.731 130127 142.876 0.12462 130127 1275 0.303849 XGBoost\n", "XGBoost_grid_1_AutoML_1_20250409_125927_model_2 360.877 130232 132.802 0.0704741 130232 5185 0.236808 XGBoost\n", "XGBoost_grid_1_AutoML_1_20250409_125927_model_3 362.277 131245 114.346 0.0618231 131245 7255 0.100218 XGBoost\n", "GBM_grid_1_AutoML_1_20250409_125927_model_2 363.447 132094 115.479 0.0740894 132094 1154 0.086248 GBM\n", "XGBoost_2_AutoML_1_20250409_125927 373.977 139859 133.238 0.0886959 139859 4713 0.110586 XGBoost\n", "GBM_3_AutoML_1_20250409_125927 386.865 149664 115.389 0.0703277 149664 4115 0.17295 GBM\n", "[20 rows x 9 columns]\n" ], "text/html": [ "
model_id | rmse | mse | mae | rmsle | mean_residual_deviance | training_time_ms | predict_time_per_row_ms | algo |
---|---|---|---|---|---|---|---|---|
DeepLearning_grid_1_AutoML_1_20250409_125927_model_1 | 124.274 | 15444 | 92.95 | 0.186283 | 15444 | 90000 | 0.130107 | DeepLearning |
DeepLearning_grid_2_AutoML_1_20250409_125927_model_1 | 148.476 | 22045.2 | 102.05 | 0.263675 | 22045.2 | 66419 | 0.209791 | DeepLearning |
DeepLearning_grid_3_AutoML_1_20250409_125927_model_1 | 232.249 | 53939.5 | 138.35 | 0.21911 | 53939.5 | 51729 | 0.152972 | DeepLearning |
GBM_5_AutoML_1_20250409_125927 | 347.979 | 121089 | 116.301 | 0.055101 | 121089 | 3756 | 0.215801 | GBM |
XGBoost_3_AutoML_1_20250409_125927 | 360.731 | 130127 | 142.876 | 0.12462 | 130127 | 1275 | 0.303849 | XGBoost |
XGBoost_grid_1_AutoML_1_20250409_125927_model_2 | 360.877 | 130232 | 132.802 | 0.0704741 | 130232 | 5185 | 0.236808 | XGBoost |
XGBoost_grid_1_AutoML_1_20250409_125927_model_3 | 362.277 | 131245 | 114.346 | 0.0618231 | 131245 | 7255 | 0.100218 | XGBoost |
GBM_grid_1_AutoML_1_20250409_125927_model_2 | 363.447 | 132094 | 115.479 | 0.0740894 | 132094 | 1154 | 0.086248 | GBM |
XGBoost_2_AutoML_1_20250409_125927 | 373.977 | 139859 | 133.238 | 0.0886959 | 139859 | 4713 | 0.110586 | XGBoost |
GBM_3_AutoML_1_20250409_125927 | 386.865 | 149664 | 115.389 | 0.0703277 | 149664 | 4115 | 0.17295 | GBM |
[20 rows x 9 columns]" ] }, "metadata": {}, "execution_count": 13 } ] }, { "cell_type": "code", "source": [ "# Get the best model using the metric\n", "m = aml.leader\n", "print(m)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "L3qQRFo9isOh", "outputId": "fe84fb62-d72a-4303-99ec-4a49d6b94617" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Model Details\n", "=============\n", "H2ODeepLearningEstimator : Deep Learning\n", "Model Key: DeepLearning_grid_1_AutoML_1_20250409_125927_model_1\n", "\n", "\n", "Status of Neuron Layers: predicting RESULT DATE+1 open price, regression, gaussian distribution, Quadratic loss, 28,101 weights/biases, 345.4 KB, 509,954 training samples, mini-batch size 1\n", " layer units type dropout l1 l2 mean_rate rate_rms momentum mean_weight weight_rms mean_bias bias_rms\n", "-- ------- ------- ---------------- --------- ---- ---- --------------------- --------------------- ---------- ---------------------- ------------------- -------------------- -----------------------\n", " 1 279 Input 15.0\n", " 2 100 RectifierDropout 10.0 0.0 0.0 0.0469522964567144 0.1403437852859497 0.0 -0.0034428720702365887 0.0753689706325531 0.11255552116543806 0.12360426783561707\n", " 3 1 Linear 0.0 0.0 0.0022405613915179854 0.0017097294330596924 0.0 0.0212319300416857 0.10420235991477966 -0.25282336328233784 1.0971281125650402e-154\n", "\n", "ModelMetricsRegression: deeplearning\n", "** Reported on train data. **\n", "\n", "MSE: 18621.99884420956\n", "RMSE: 136.46244481251816\n", "MAE: 103.43077946092374\n", "RMSLE: NaN\n", "Mean Residual Deviance: 18621.99884420956\n", "\n", "ModelMetricsRegression: deeplearning\n", "** Reported on validation data. **\n", "\n", "MSE: 15443.961443829116\n", "RMSE: 124.27373593736175\n", "MAE: 92.95004899710531\n", "RMSLE: 0.18628335185822448\n", "Mean Residual Deviance: 15443.961443829116\n", "\n", "Scoring History: \n", " timestamp duration training_speed epochs iterations samples training_rmse training_deviance training_mae training_r2 validation_rmse validation_deviance validation_mae validation_r2\n", "-- ------------------- ---------------- ---------------- -------- ------------ --------- --------------- ------------------- -------------- ------------- ----------------- --------------------- ---------------- ---------------\n", " 2025-04-09 13:00:31 0.000 sec 0 0 0 nan nan nan nan nan nan nan nan\n", " 2025-04-09 13:00:34 4.094 sec 1088 obs/sec 3.96154 1 3296 329.146 108337 238.841 0.958791 326.899 106863 254.702 0.981018\n", " 2025-04-09 13:00:46 15.511 sec 919 obs/sec 15.8281 4 13169 265.303 70385.7 173.106 0.973227 264.344 69877.5 180.399 0.987588\n", " 2025-04-09 13:00:52 20.781 sec 2530 obs/sec 59.3654 15 49392 293.627 86216.6 158.842 0.967205 238.41 56839.2 161.131 0.989904\n", " 2025-04-09 13:00:57 26.630 sec 3128 obs/sec 94.9639 24 79010 261.137 68192.5 154.536 0.974061 241.418 58282.7 171.948 0.989647\n", " 2025-04-09 13:01:02 31.644 sec 4029 obs/sec 146.369 37 121779 251.449 63226.5 152.988 0.97595 261.663 68467.4 181.197 0.987838\n", " 2025-04-09 13:01:08 37.021 sec 4721 obs/sec 201.74 51 167848 253.406 64214.7 133.288 0.975574 226.851 51461.4 167.281 0.990859\n", " 2025-04-09 13:01:13 42.760 sec 4714 obs/sec 233.382 59 194174 260.461 67840 146.583 0.974195 240.477 57829.3 170.298 0.989728\n", " 2025-04-09 13:01:19 47.748 sec 4996 obs/sec 276.888 70 230371 155.77 24264.4 113.878 0.99077 154.865 23983.3 108.084 0.99574\n", " 2025-04-09 13:01:24 52.900 sec 5334 obs/sec 328.294 83 273141 157.541 24819.2 113.043 0.990559 148.56 22070 105.759 0.99608\n", " 2025-04-09 13:01:29 58.604 sec 5271 obs/sec 359.929 91 299461 164.109 26931.9 113.719 0.989756 182.789 33411.8 132.871 0.994065\n", " 2025-04-09 13:01:34 1 min 3.650 sec 5483 obs/sec 407.332 103 338900 118.9 14137.2 87.5482 0.994623 146.528 21470.3 106.611 0.996186\n", " 2025-04-09 13:01:40 1 min 8.899 sec 5847 obs/sec 470.618 119 391554 147.334 21707.3 106.546 0.991743 165.375 27348.9 120.024 0.995142\n", " 2025-04-09 13:01:45 1 min 14.389 sec 5771 obs/sec 502.234 127 417859 136.462 18622 103.431 0.992917 124.274 15444 92.95 0.997257\n", " 2025-04-09 13:01:51 1 min 19.835 sec 5838 obs/sec 545.746 138 454061 154.782 23957.4 108.395 0.990887 238.007 56647.3 171.409 0.989938\n", " 2025-04-09 13:01:56 1 min 24.856 sec 5845 obs/sec 581.304 147 483645 125.729 15807.8 99.7501 0.993987 136.658 18675.4 103.144 0.996683\n", " 2025-04-09 13:02:01 1 min 29.937 sec 5813 obs/sec 612.925 155 509954 138.101 19071.9 107.809 0.992746 155.658 24229.3 122.639 0.995696\n", " 2025-04-09 13:02:01 1 min 30.040 sec 5811 obs/sec 612.925 155 509954 136.462 18622 103.431 0.992917 124.274 15444 92.95 0.997257\n", "\n", "Variable Importances: \n", "variable relative_importance scaled_importance percentage\n", "------------------------------ --------------------- ------------------- ---------------------\n", "RESULT DATE open price 1.0 1.0 0.010828321493908447\n", "SMA20 0.929417073726654 0.929417073726654 0.01006402687623982\n", "SMA50 0.8927490711212158 0.8927490711212158 0.009666973955488663\n", "Tax % 0.6537733674049377 0.6537733674049377 0.007079268206415791\n", "Equity Capital 0.46502426266670227 0.46502426266670227 0.00503543221862278\n", "Financing Profit.3263.0 0.41729432344436646 0.41729432344436646 0.004518597091838617\n", "CWIP 0.41293013095855713 0.41293013095855713 0.004471340212540974\n", "Revenue.45748.0 0.399463027715683 0.399463027715683 0.004325514089035476\n", "Deposits.384793.0 0.3986609876155853 0.3986609876155853 0.004316829340980612\n", "Borrowing.206214.0 0.39752906560897827 0.39752906560897827 0.0043045725255870405\n", "--- --- --- ---\n", "NIFTY50_close 0.127555713057518 0.127555713057518 0.0013812142693715407\n", "NIFTY50_open 0.1233787015080452 0.1233787015080452 0.0013359842454300803\n", "NIFTY50_volume 0.12220636010169983 0.12220636010169983 0.001323289755781552\n", "inflation 0.11123748123645782 0.11123748123645782 0.0012045152090009738\n", "gdp_growth 0.10398408770561218 0.10398408770561218 0.0011259731319271415\n", "Revenue.missing(NA) 0.0 0.0 0.0\n", "Financing Profit.missing(NA) 0.0 0.0 0.0\n", "Borrowing.missing(NA) 0.0 0.0 0.0\n", "Financing Margin %.missing(NA) 0.0 0.0 0.0\n", "Deposits.missing(NA) 0.0 0.0 0.0\n", "[279 rows x 4 columns]\n", "\n" ] } ] }, { "cell_type": "code", "source": [ "# this is equivalent to\n", "m = aml.get_best_model()\n", "print(m)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "Msn85zf7ivA7", "outputId": "f5edfc17-cedf-4f13-9b32-589cfec09f47" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Model Details\n", "=============\n", "H2ODeepLearningEstimator : Deep Learning\n", "Model Key: DeepLearning_grid_1_AutoML_1_20250409_125927_model_1\n", "\n", "\n", "Status of Neuron Layers: predicting RESULT DATE+1 open price, regression, gaussian distribution, Quadratic loss, 28,101 weights/biases, 345.4 KB, 509,954 training samples, mini-batch size 1\n", " layer units type dropout l1 l2 mean_rate rate_rms momentum mean_weight weight_rms mean_bias bias_rms\n", "-- ------- ------- ---------------- --------- ---- ---- --------------------- --------------------- ---------- ---------------------- ------------------- -------------------- -----------------------\n", " 1 279 Input 15.0\n", " 2 100 RectifierDropout 10.0 0.0 0.0 0.0469522964567144 0.1403437852859497 0.0 -0.0034428720702365887 0.0753689706325531 0.11255552116543806 0.12360426783561707\n", " 3 1 Linear 0.0 0.0 0.0022405613915179854 0.0017097294330596924 0.0 0.0212319300416857 0.10420235991477966 -0.25282336328233784 1.0971281125650402e-154\n", "\n", "ModelMetricsRegression: deeplearning\n", "** Reported on train data. **\n", "\n", "MSE: 18621.99884420956\n", "RMSE: 136.46244481251816\n", "MAE: 103.43077946092374\n", "RMSLE: NaN\n", "Mean Residual Deviance: 18621.99884420956\n", "\n", "ModelMetricsRegression: deeplearning\n", "** Reported on validation data. **\n", "\n", "MSE: 15443.961443829116\n", "RMSE: 124.27373593736175\n", "MAE: 92.95004899710531\n", "RMSLE: 0.18628335185822448\n", "Mean Residual Deviance: 15443.961443829116\n", "\n", "Scoring History: \n", " timestamp duration training_speed epochs iterations samples training_rmse training_deviance training_mae training_r2 validation_rmse validation_deviance validation_mae validation_r2\n", "-- ------------------- ---------------- ---------------- -------- ------------ --------- --------------- ------------------- -------------- ------------- ----------------- --------------------- ---------------- ---------------\n", " 2025-04-09 13:00:31 0.000 sec 0 0 0 nan nan nan nan nan nan nan nan\n", " 2025-04-09 13:00:34 4.094 sec 1088 obs/sec 3.96154 1 3296 329.146 108337 238.841 0.958791 326.899 106863 254.702 0.981018\n", " 2025-04-09 13:00:46 15.511 sec 919 obs/sec 15.8281 4 13169 265.303 70385.7 173.106 0.973227 264.344 69877.5 180.399 0.987588\n", " 2025-04-09 13:00:52 20.781 sec 2530 obs/sec 59.3654 15 49392 293.627 86216.6 158.842 0.967205 238.41 56839.2 161.131 0.989904\n", " 2025-04-09 13:00:57 26.630 sec 3128 obs/sec 94.9639 24 79010 261.137 68192.5 154.536 0.974061 241.418 58282.7 171.948 0.989647\n", " 2025-04-09 13:01:02 31.644 sec 4029 obs/sec 146.369 37 121779 251.449 63226.5 152.988 0.97595 261.663 68467.4 181.197 0.987838\n", " 2025-04-09 13:01:08 37.021 sec 4721 obs/sec 201.74 51 167848 253.406 64214.7 133.288 0.975574 226.851 51461.4 167.281 0.990859\n", " 2025-04-09 13:01:13 42.760 sec 4714 obs/sec 233.382 59 194174 260.461 67840 146.583 0.974195 240.477 57829.3 170.298 0.989728\n", " 2025-04-09 13:01:19 47.748 sec 4996 obs/sec 276.888 70 230371 155.77 24264.4 113.878 0.99077 154.865 23983.3 108.084 0.99574\n", " 2025-04-09 13:01:24 52.900 sec 5334 obs/sec 328.294 83 273141 157.541 24819.2 113.043 0.990559 148.56 22070 105.759 0.99608\n", " 2025-04-09 13:01:29 58.604 sec 5271 obs/sec 359.929 91 299461 164.109 26931.9 113.719 0.989756 182.789 33411.8 132.871 0.994065\n", " 2025-04-09 13:01:34 1 min 3.650 sec 5483 obs/sec 407.332 103 338900 118.9 14137.2 87.5482 0.994623 146.528 21470.3 106.611 0.996186\n", " 2025-04-09 13:01:40 1 min 8.899 sec 5847 obs/sec 470.618 119 391554 147.334 21707.3 106.546 0.991743 165.375 27348.9 120.024 0.995142\n", " 2025-04-09 13:01:45 1 min 14.389 sec 5771 obs/sec 502.234 127 417859 136.462 18622 103.431 0.992917 124.274 15444 92.95 0.997257\n", " 2025-04-09 13:01:51 1 min 19.835 sec 5838 obs/sec 545.746 138 454061 154.782 23957.4 108.395 0.990887 238.007 56647.3 171.409 0.989938\n", " 2025-04-09 13:01:56 1 min 24.856 sec 5845 obs/sec 581.304 147 483645 125.729 15807.8 99.7501 0.993987 136.658 18675.4 103.144 0.996683\n", " 2025-04-09 13:02:01 1 min 29.937 sec 5813 obs/sec 612.925 155 509954 138.101 19071.9 107.809 0.992746 155.658 24229.3 122.639 0.995696\n", " 2025-04-09 13:02:01 1 min 30.040 sec 5811 obs/sec 612.925 155 509954 136.462 18622 103.431 0.992917 124.274 15444 92.95 0.997257\n", "\n", "Variable Importances: \n", "variable relative_importance scaled_importance percentage\n", "------------------------------ --------------------- ------------------- ---------------------\n", "RESULT DATE open price 1.0 1.0 0.010828321493908447\n", "SMA20 0.929417073726654 0.929417073726654 0.01006402687623982\n", "SMA50 0.8927490711212158 0.8927490711212158 0.009666973955488663\n", "Tax % 0.6537733674049377 0.6537733674049377 0.007079268206415791\n", "Equity Capital 0.46502426266670227 0.46502426266670227 0.00503543221862278\n", "Financing Profit.3263.0 0.41729432344436646 0.41729432344436646 0.004518597091838617\n", "CWIP 0.41293013095855713 0.41293013095855713 0.004471340212540974\n", "Revenue.45748.0 0.399463027715683 0.399463027715683 0.004325514089035476\n", "Deposits.384793.0 0.3986609876155853 0.3986609876155853 0.004316829340980612\n", "Borrowing.206214.0 0.39752906560897827 0.39752906560897827 0.0043045725255870405\n", "--- --- --- ---\n", "NIFTY50_close 0.127555713057518 0.127555713057518 0.0013812142693715407\n", "NIFTY50_open 0.1233787015080452 0.1233787015080452 0.0013359842454300803\n", "NIFTY50_volume 0.12220636010169983 0.12220636010169983 0.001323289755781552\n", "inflation 0.11123748123645782 0.11123748123645782 0.0012045152090009738\n", "gdp_growth 0.10398408770561218 0.10398408770561218 0.0011259731319271415\n", "Revenue.missing(NA) 0.0 0.0 0.0\n", "Financing Profit.missing(NA) 0.0 0.0 0.0\n", "Borrowing.missing(NA) 0.0 0.0 0.0\n", "Financing Margin %.missing(NA) 0.0 0.0 0.0\n", "Deposits.missing(NA) 0.0 0.0 0.0\n", "[279 rows x 4 columns]\n", "\n" ] } ] }, { "cell_type": "code", "source": [ "# Get the best model using a non-default metric\n", "m = aml.get_best_model(criterion=\"RMSE\")\n", "print(m)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "unuAUt7zi3ur", "outputId": "75c878ff-60df-44cb-f5f8-eae96126e1f0" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Model Details\n", "=============\n", "H2ODeepLearningEstimator : Deep Learning\n", "Model Key: DeepLearning_grid_1_AutoML_1_20250409_125927_model_1\n", "\n", "\n", "Status of Neuron Layers: predicting RESULT DATE+1 open price, regression, gaussian distribution, Quadratic loss, 28,101 weights/biases, 345.4 KB, 509,954 training samples, mini-batch size 1\n", " layer units type dropout l1 l2 mean_rate rate_rms momentum mean_weight weight_rms mean_bias bias_rms\n", "-- ------- ------- ---------------- --------- ---- ---- --------------------- --------------------- ---------- ---------------------- ------------------- -------------------- -----------------------\n", " 1 279 Input 15.0\n", " 2 100 RectifierDropout 10.0 0.0 0.0 0.0469522964567144 0.1403437852859497 0.0 -0.0034428720702365887 0.0753689706325531 0.11255552116543806 0.12360426783561707\n", " 3 1 Linear 0.0 0.0 0.0022405613915179854 0.0017097294330596924 0.0 0.0212319300416857 0.10420235991477966 -0.25282336328233784 1.0971281125650402e-154\n", "\n", "ModelMetricsRegression: deeplearning\n", "** Reported on train data. **\n", "\n", "MSE: 18621.99884420956\n", "RMSE: 136.46244481251816\n", "MAE: 103.43077946092374\n", "RMSLE: NaN\n", "Mean Residual Deviance: 18621.99884420956\n", "\n", "ModelMetricsRegression: deeplearning\n", "** Reported on validation data. **\n", "\n", "MSE: 15443.961443829116\n", "RMSE: 124.27373593736175\n", "MAE: 92.95004899710531\n", "RMSLE: 0.18628335185822448\n", "Mean Residual Deviance: 15443.961443829116\n", "\n", "Scoring History: \n", " timestamp duration training_speed epochs iterations samples training_rmse training_deviance training_mae training_r2 validation_rmse validation_deviance validation_mae validation_r2\n", "-- ------------------- ---------------- ---------------- -------- ------------ --------- --------------- ------------------- -------------- ------------- ----------------- --------------------- ---------------- ---------------\n", " 2025-04-09 13:00:31 0.000 sec 0 0 0 nan nan nan nan nan nan nan nan\n", " 2025-04-09 13:00:34 4.094 sec 1088 obs/sec 3.96154 1 3296 329.146 108337 238.841 0.958791 326.899 106863 254.702 0.981018\n", " 2025-04-09 13:00:46 15.511 sec 919 obs/sec 15.8281 4 13169 265.303 70385.7 173.106 0.973227 264.344 69877.5 180.399 0.987588\n", " 2025-04-09 13:00:52 20.781 sec 2530 obs/sec 59.3654 15 49392 293.627 86216.6 158.842 0.967205 238.41 56839.2 161.131 0.989904\n", " 2025-04-09 13:00:57 26.630 sec 3128 obs/sec 94.9639 24 79010 261.137 68192.5 154.536 0.974061 241.418 58282.7 171.948 0.989647\n", " 2025-04-09 13:01:02 31.644 sec 4029 obs/sec 146.369 37 121779 251.449 63226.5 152.988 0.97595 261.663 68467.4 181.197 0.987838\n", " 2025-04-09 13:01:08 37.021 sec 4721 obs/sec 201.74 51 167848 253.406 64214.7 133.288 0.975574 226.851 51461.4 167.281 0.990859\n", " 2025-04-09 13:01:13 42.760 sec 4714 obs/sec 233.382 59 194174 260.461 67840 146.583 0.974195 240.477 57829.3 170.298 0.989728\n", " 2025-04-09 13:01:19 47.748 sec 4996 obs/sec 276.888 70 230371 155.77 24264.4 113.878 0.99077 154.865 23983.3 108.084 0.99574\n", " 2025-04-09 13:01:24 52.900 sec 5334 obs/sec 328.294 83 273141 157.541 24819.2 113.043 0.990559 148.56 22070 105.759 0.99608\n", " 2025-04-09 13:01:29 58.604 sec 5271 obs/sec 359.929 91 299461 164.109 26931.9 113.719 0.989756 182.789 33411.8 132.871 0.994065\n", " 2025-04-09 13:01:34 1 min 3.650 sec 5483 obs/sec 407.332 103 338900 118.9 14137.2 87.5482 0.994623 146.528 21470.3 106.611 0.996186\n", " 2025-04-09 13:01:40 1 min 8.899 sec 5847 obs/sec 470.618 119 391554 147.334 21707.3 106.546 0.991743 165.375 27348.9 120.024 0.995142\n", " 2025-04-09 13:01:45 1 min 14.389 sec 5771 obs/sec 502.234 127 417859 136.462 18622 103.431 0.992917 124.274 15444 92.95 0.997257\n", " 2025-04-09 13:01:51 1 min 19.835 sec 5838 obs/sec 545.746 138 454061 154.782 23957.4 108.395 0.990887 238.007 56647.3 171.409 0.989938\n", " 2025-04-09 13:01:56 1 min 24.856 sec 5845 obs/sec 581.304 147 483645 125.729 15807.8 99.7501 0.993987 136.658 18675.4 103.144 0.996683\n", " 2025-04-09 13:02:01 1 min 29.937 sec 5813 obs/sec 612.925 155 509954 138.101 19071.9 107.809 0.992746 155.658 24229.3 122.639 0.995696\n", " 2025-04-09 13:02:01 1 min 30.040 sec 5811 obs/sec 612.925 155 509954 136.462 18622 103.431 0.992917 124.274 15444 92.95 0.997257\n", "\n", "Variable Importances: \n", "variable relative_importance scaled_importance percentage\n", "------------------------------ --------------------- ------------------- ---------------------\n", "RESULT DATE open price 1.0 1.0 0.010828321493908447\n", "SMA20 0.929417073726654 0.929417073726654 0.01006402687623982\n", "SMA50 0.8927490711212158 0.8927490711212158 0.009666973955488663\n", "Tax % 0.6537733674049377 0.6537733674049377 0.007079268206415791\n", "Equity Capital 0.46502426266670227 0.46502426266670227 0.00503543221862278\n", "Financing Profit.3263.0 0.41729432344436646 0.41729432344436646 0.004518597091838617\n", "CWIP 0.41293013095855713 0.41293013095855713 0.004471340212540974\n", "Revenue.45748.0 0.399463027715683 0.399463027715683 0.004325514089035476\n", "Deposits.384793.0 0.3986609876155853 0.3986609876155853 0.004316829340980612\n", "Borrowing.206214.0 0.39752906560897827 0.39752906560897827 0.0043045725255870405\n", "--- --- --- ---\n", "NIFTY50_close 0.127555713057518 0.127555713057518 0.0013812142693715407\n", "NIFTY50_open 0.1233787015080452 0.1233787015080452 0.0013359842454300803\n", "NIFTY50_volume 0.12220636010169983 0.12220636010169983 0.001323289755781552\n", "inflation 0.11123748123645782 0.11123748123645782 0.0012045152090009738\n", "gdp_growth 0.10398408770561218 0.10398408770561218 0.0011259731319271415\n", "Revenue.missing(NA) 0.0 0.0 0.0\n", "Financing Profit.missing(NA) 0.0 0.0 0.0\n", "Borrowing.missing(NA) 0.0 0.0 0.0\n", "Financing Margin %.missing(NA) 0.0 0.0 0.0\n", "Deposits.missing(NA) 0.0 0.0 0.0\n", "[279 rows x 4 columns]\n", "\n" ] } ] }, { "cell_type": "code", "source": [ "# Get training timing info\n", "info = aml.training_info\n", "print(info)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "FGleWmKVi7ui", "outputId": "8fc8b9b4-1421-4016-a8d0-940d259dd262" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "{'creation_epoch': '1744203567', 'start_epoch': '1744203567', 'start_XGBoost_def_2': '1744203567', 'start_GLM_def_1': '1744203574', 'start_GBM_def_5': '1744203575', 'start_XGBoost_def_1': '1744203579', 'start_DRF_def_1': '1744203584', 'start_GBM_def_2': '1744203588', 'start_GBM_def_3': '1744203593', 'start_GBM_def_4': '1744203598', 'start_XGBoost_def_3': '1744203600', 'start_DRF_XRT': '1744203602', 'start_GBM_def_1': '1744203606', 'start_DeepLearning_def_1': '1744203610', 'start_XGBoost_grid_1': '1744203612', 'start_GBM_grid_1': '1744203628', 'start_DeepLearning_grid_1': '1744203631', 'start_DeepLearning_grid_2': '1744203721', 'start_DeepLearning_grid_3': '1744203788', 'stop_epoch': '1744203840', 'duration_secs': '273'}\n" ] } ] }, { "cell_type": "code", "source": [ "aml.leader.model_id" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 36 }, "id": "ey78FPkhi-Fy", "outputId": "529615bc-d692-4163-87b0-1e9111587af0" }, "execution_count": null, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "'DeepLearning_grid_1_AutoML_1_20250409_125927_model_1'" ], "application/vnd.google.colaboratory.intrinsic+json": { "type": "string" } }, "metadata": {}, "execution_count": 18 } ] }, { "cell_type": "code", "source": [ "preds_leader = aml.leader.predict(h2o_test)\n", "preds_leader" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 407 }, "id": "4rJxGSmxjNJj", "outputId": "34b95271-9853-417f-ace2-c969aeab251b" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "deeplearning prediction progress: |██████████████████████████████████████████████| (done) 100%\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ " predict\n", "---------\n", " 43.8964\n", " 875.223\n", "1938.47\n", " 139.043\n", " 186.102\n", "3058.43\n", "4610.1\n", " 670.982\n", " 649.744\n", "1009.34\n", "[107 rows x 1 column]\n" ], "text/html": [ "
predict |
---|
43.8964 |
875.223 |
1938.47 |
139.043 |
186.102 |
3058.43 |
4610.1 |
670.982 |
649.744 |
1009.34 |
[107 rows x 1 column]" ] }, "metadata": {}, "execution_count": 19 } ] }, { "cell_type": "code", "source": [ "print(\"\\n TRAIN SET \\n\")\n", "train_predictions = aml.leader.predict(h2o_train).as_data_frame()['predict'].to_list()\n", "print(calculate_regression_metrics(train[y_col], train_predictions))\n", "\n", "\n", "print(\"\\n VALID SET \\n\")\n", "valid_predictions = aml.leader.predict(h2o_valid).as_data_frame()['predict'].to_list()\n", "print(calculate_regression_metrics(valid[y_col], valid_predictions))\n", "\n", "\n", "print(\"\\n TEST SET \\n\")\n", "test_predictions = aml.leader.predict(h2o_test).as_data_frame()['predict'].to_list()\n", "print(calculate_regression_metrics(test[y_col],test_predictions))" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "ANnqbZMmjb4J", "outputId": "bbb35f38-416e-447f-df3a-6e84a9868b53" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\n", " TRAIN SET \n", "\n", "deeplearning prediction progress: |██████████████████████████████████████████████| (done) 100%\n", "{'MAE': 103.43077778665219, 'RMSE': np.float64(136.46244339115717), 'MAPE': 0.4104183904685377}\n", "\n", " VALID SET \n", "\n", "deeplearning prediction progress: |██████████████████████████████████████████████| (done) 100%\n", "{'MAE': 92.95005429027556, 'RMSE': np.float64(124.27373841117173), 'MAPE': 0.11078708574728854}\n", "\n", " TEST SET \n", "\n", "deeplearning prediction progress: |██████████████████████████████████████████████| (done) 100%\n", "{'MAE': 150.76924019481663, 'RMSE': np.float64(269.1930438865622), 'MAPE': 0.28824375358902776}\n" ] } ] }, { "cell_type": "markdown", "source": [ "# Using Numeric and Text Data Classifier Probabilities" ], "metadata": { "id": "nvgoFcmyjmaK" } }, { "cell_type": "code", "source": [ "for col in final_with_funda.columns:\n", " if 'text_embeddings' in col:\n", " print(col)\n", " del final_with_funda[col]\n", "\n", "all_embeddings_128 = pickle.load(open(path + 'getting_all_texts_together_embeddings_dim128_CPU.pkl', 'rb'))\n", "final_with_funda['text_embeddings'] = all_embeddings_128\n", "\n", "for i in range(128):\n", " final_with_funda['text_embeddings_' + str(i)] = final_with_funda['text_embeddings'].apply(lambda x : x[i])\n", "\n", "text_features = ['text_embeddings_' + str(i) for i in range(128)]\n", "\n", "train = final_with_funda[final_with_funda['split'] == 'train']\n", "valid = final_with_funda[final_with_funda['split'] == 'validation']\n", "test = final_with_funda[final_with_funda['split'] == 'test']\n", "\n", "x_cols_to_use = text_features" ], "metadata": { "id": "3Iit31D4kI85", "colab": { "base_uri": "https://localhost:8080/" }, "outputId": "fb380641-a00a-46ad-e18d-b1d701382c92" }, "execution_count": 20, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "text_embeddings\n", "text_embeddings_0\n", "text_embeddings_1\n", "text_embeddings_2\n", "text_embeddings_3\n", "text_embeddings_4\n", "text_embeddings_5\n", "text_embeddings_6\n", "text_embeddings_7\n", "text_embeddings_8\n", "text_embeddings_9\n", "text_embeddings_10\n", "text_embeddings_11\n", "text_embeddings_12\n", "text_embeddings_13\n", "text_embeddings_14\n", "text_embeddings_15\n", "text_embeddings_16\n", "text_embeddings_17\n", "text_embeddings_18\n", "text_embeddings_19\n", "text_embeddings_20\n", "text_embeddings_21\n", "text_embeddings_22\n", "text_embeddings_23\n", "text_embeddings_24\n", "text_embeddings_25\n", "text_embeddings_26\n", "text_embeddings_27\n", "text_embeddings_28\n", "text_embeddings_29\n", "text_embeddings_30\n", "text_embeddings_31\n", "text_embeddings_32\n", "text_embeddings_33\n", "text_embeddings_34\n", "text_embeddings_35\n", "text_embeddings_36\n", "text_embeddings_37\n", "text_embeddings_38\n", "text_embeddings_39\n", "text_embeddings_40\n", "text_embeddings_41\n", "text_embeddings_42\n", "text_embeddings_43\n", "text_embeddings_44\n", "text_embeddings_45\n", "text_embeddings_46\n", "text_embeddings_47\n", "text_embeddings_48\n", "text_embeddings_49\n", "text_embeddings_50\n", "text_embeddings_51\n", "text_embeddings_52\n", "text_embeddings_53\n", "text_embeddings_54\n", "text_embeddings_55\n", "text_embeddings_56\n", "text_embeddings_57\n", "text_embeddings_58\n", "text_embeddings_59\n", "text_embeddings_60\n", "text_embeddings_61\n", "text_embeddings_62\n", "text_embeddings_63\n", "text_embeddings_64\n", "text_embeddings_65\n", "text_embeddings_66\n", "text_embeddings_67\n", "text_embeddings_68\n", "text_embeddings_69\n", "text_embeddings_70\n", "text_embeddings_71\n", "text_embeddings_72\n", "text_embeddings_73\n", "text_embeddings_74\n", "text_embeddings_75\n", "text_embeddings_76\n", "text_embeddings_77\n", "text_embeddings_78\n", "text_embeddings_79\n", "text_embeddings_80\n", "text_embeddings_81\n", "text_embeddings_82\n", "text_embeddings_83\n", "text_embeddings_84\n", "text_embeddings_85\n", "text_embeddings_86\n", "text_embeddings_87\n", "text_embeddings_88\n", "text_embeddings_89\n", "text_embeddings_90\n", "text_embeddings_91\n", "text_embeddings_92\n", "text_embeddings_93\n", "text_embeddings_94\n", "text_embeddings_95\n", "text_embeddings_96\n", "text_embeddings_97\n", "text_embeddings_98\n", "text_embeddings_99\n", "text_embeddings_100\n", "text_embeddings_101\n", "text_embeddings_102\n", "text_embeddings_103\n", "text_embeddings_104\n", "text_embeddings_105\n", "text_embeddings_106\n", "text_embeddings_107\n", "text_embeddings_108\n", "text_embeddings_109\n", "text_embeddings_110\n", "text_embeddings_111\n", "text_embeddings_112\n", "text_embeddings_113\n", "text_embeddings_114\n", "text_embeddings_115\n", "text_embeddings_116\n", "text_embeddings_117\n", "text_embeddings_118\n", "text_embeddings_119\n", "text_embeddings_120\n", "text_embeddings_121\n", "text_embeddings_122\n", "text_embeddings_123\n", "text_embeddings_124\n", "text_embeddings_125\n", "text_embeddings_126\n", "text_embeddings_127\n" ] } ] }, { "cell_type": "code", "source": [ "y_col = 'classification' #'RESULT DATE+1 open price' #'TARGET-2 REGRESSION NORMALIZED'\n", "\n", "h2o_train = h2o.H2OFrame(train[x_cols_to_use]) # Convert train DataFrame to H2OFrame\n", "h2o_valid = h2o.H2OFrame(valid[x_cols_to_use]) # Convert valid DataFrame to H2OFrame\n", "h2o_test = h2o.H2OFrame(test[x_cols_to_use]) # Convert test DataFrame to H2OFrame\n", "\n", "h2o_train[y_col] = h2o.H2OFrame(train[y_col].to_list()).asfactor() # Convert Pandas Series to H2OFrame before assigning\n", "h2o_valid[y_col] = h2o.H2OFrame(valid[y_col].to_list()).asfactor() # Convert Pandas Series to H2OFrame before assigning\n", "h2o_test[y_col] = h2o.H2OFrame(test[y_col].to_list()).asfactor() # Convert Pandas Series to H2OFrame before assigning\n", "\n", "aml = H2OAutoML(max_models=20, seed=1,nfolds = 0)\n", "aml.train(x=x_cols_to_use, y=y_col, training_frame=h2o_train,validation_frame=h2o_valid)\n", "\n", "# View the AutoML Leaderboard\n", "lb = aml.leaderboard\n", "lb.head(rows=lb.nrows)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 844 }, "id": "f38xcRbZkpjI", "outputId": "d537b43e-d6a4-44f7-d742-bd626f4deb7b" }, "execution_count": 21, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "AutoML progress: |███████████████████████████████████████████████████████████████| (done) 100%\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "model_id auc logloss aucpr mean_per_class_error rmse mse\n", "---------------------------------------------------- -------- --------- -------- ---------------------- -------- --------\n", "XGBoost_2_AutoML_2_20250409_152135 0.521682 0.868195 0.519441 0.490196 0.55289 0.305688\n", "DRF_1_AutoML_2_20250409_152135 0.516968 0.726751 0.518918 0.5 0.514539 0.26475\n", "XGBoost_3_AutoML_2_20250409_152135 0.502451 0.893016 0.498844 0.5 0.561485 0.315265\n", "XGBoost_1_AutoML_2_20250409_152135 0.494532 0.847524 0.54791 0.5 0.555468 0.308545\n", "XGBoost_grid_1_AutoML_2_20250409_152135_model_2 0.486991 0.811853 0.492215 0.470023 0.543988 0.295923\n", "DeepLearning_grid_2_AutoML_2_20250409_152135_model_1 0.483974 1.3188 0.466643 0.5 0.603914 0.364712\n", "GBM_1_AutoML_2_20250409_152135 0.48322 0.729637 0.481765 0.5 0.51663 0.266906\n", "GBM_5_AutoML_2_20250409_152135 0.478695 0.782243 0.491722 0.5 0.535926 0.287216\n", "GBM_grid_1_AutoML_2_20250409_152135_model_2 0.467383 0.746436 0.482668 0.490196 0.523668 0.274228\n", "XGBoost_grid_1_AutoML_2_20250409_152135_model_3 0.465875 0.950725 0.467881 0.490196 0.575634 0.331354\n", "XGBoost_grid_1_AutoML_2_20250409_152135_model_1 0.463989 0.917712 0.465734 0.5 0.567556 0.32212\n", "GBM_4_AutoML_2_20250409_152135 0.463612 0.799223 0.464516 0.460407 0.542634 0.294452\n", "GBM_3_AutoML_2_20250409_152135 0.462104 0.803066 0.462236 0.5 0.542984 0.294832\n", "DeepLearning_1_AutoML_2_20250409_152135 0.460219 0.884179 0.475068 0.5 0.56606 0.320424\n", "GBM_2_AutoML_2_20250409_152135 0.453808 0.804537 0.490487 0.5 0.545743 0.297836\n", "XRT_1_AutoML_2_20250409_152135 0.445701 0.753462 0.497824 0.5 0.527128 0.277864\n", "DeepLearning_grid_1_AutoML_2_20250409_152135_model_1 0.437217 1.6811 0.460449 0.5 0.647546 0.419316\n", "GLM_1_AutoML_2_20250409_152135 0.434201 0.697165 0.460213 0.5 0.501997 0.252001\n", "GBM_grid_1_AutoML_2_20250409_152135_model_1 0.432692 0.837016 0.44726 0.5 0.5559 0.309025\n", "DeepLearning_grid_3_AutoML_2_20250409_152135_model_1 0.428544 0.946621 0.449341 0.5 0.57934 0.335635\n", "[20 rows x 7 columns]\n" ], "text/html": [ "
model_id | auc | logloss | aucpr | mean_per_class_error | rmse | mse |
---|---|---|---|---|---|---|
XGBoost_2_AutoML_2_20250409_152135 | 0.521682 | 0.868195 | 0.519441 | 0.490196 | 0.55289 | 0.305688 |
DRF_1_AutoML_2_20250409_152135 | 0.516968 | 0.726751 | 0.518918 | 0.5 | 0.514539 | 0.26475 |
XGBoost_3_AutoML_2_20250409_152135 | 0.502451 | 0.893016 | 0.498844 | 0.5 | 0.561485 | 0.315265 |
XGBoost_1_AutoML_2_20250409_152135 | 0.494532 | 0.847524 | 0.54791 | 0.5 | 0.555468 | 0.308545 |
XGBoost_grid_1_AutoML_2_20250409_152135_model_2 | 0.486991 | 0.811853 | 0.492215 | 0.470023 | 0.543988 | 0.295923 |
DeepLearning_grid_2_AutoML_2_20250409_152135_model_1 | 0.483974 | 1.3188 | 0.466643 | 0.5 | 0.603914 | 0.364712 |
GBM_1_AutoML_2_20250409_152135 | 0.48322 | 0.729637 | 0.481765 | 0.5 | 0.51663 | 0.266906 |
GBM_5_AutoML_2_20250409_152135 | 0.478695 | 0.782243 | 0.491722 | 0.5 | 0.535926 | 0.287216 |
GBM_grid_1_AutoML_2_20250409_152135_model_2 | 0.467383 | 0.746436 | 0.482668 | 0.490196 | 0.523668 | 0.274228 |
XGBoost_grid_1_AutoML_2_20250409_152135_model_3 | 0.465875 | 0.950725 | 0.467881 | 0.490196 | 0.575634 | 0.331354 |
XGBoost_grid_1_AutoML_2_20250409_152135_model_1 | 0.463989 | 0.917712 | 0.465734 | 0.5 | 0.567556 | 0.32212 |
GBM_4_AutoML_2_20250409_152135 | 0.463612 | 0.799223 | 0.464516 | 0.460407 | 0.542634 | 0.294452 |
GBM_3_AutoML_2_20250409_152135 | 0.462104 | 0.803066 | 0.462236 | 0.5 | 0.542984 | 0.294832 |
DeepLearning_1_AutoML_2_20250409_152135 | 0.460219 | 0.884179 | 0.475068 | 0.5 | 0.56606 | 0.320424 |
GBM_2_AutoML_2_20250409_152135 | 0.453808 | 0.804537 | 0.490487 | 0.5 | 0.545743 | 0.297836 |
XRT_1_AutoML_2_20250409_152135 | 0.445701 | 0.753462 | 0.497824 | 0.5 | 0.527128 | 0.277864 |
DeepLearning_grid_1_AutoML_2_20250409_152135_model_1 | 0.437217 | 1.6811 | 0.460449 | 0.5 | 0.647546 | 0.419316 |
GLM_1_AutoML_2_20250409_152135 | 0.434201 | 0.697165 | 0.460213 | 0.5 | 0.501997 | 0.252001 |
GBM_grid_1_AutoML_2_20250409_152135_model_1 | 0.432692 | 0.837016 | 0.44726 | 0.5 | 0.5559 | 0.309025 |
DeepLearning_grid_3_AutoML_2_20250409_152135_model_1 | 0.428544 | 0.946621 | 0.449341 | 0.5 | 0.57934 | 0.335635 |
[20 rows x 7 columns]" ] }, "metadata": {}, "execution_count": 21 } ] }, { "cell_type": "code", "source": [ "lb = h2o.automl.get_leaderboard(aml, extra_columns = \"ALL\")\n", "lb" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 409 }, "id": "157N21YhkzBr", "outputId": "a2bbeb88-9abe-4337-c78a-9335acd55cf1" }, "execution_count": 22, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "model_id auc logloss aucpr mean_per_class_error rmse mse training_time_ms predict_time_per_row_ms algo\n", "---------------------------------------------------- -------- --------- -------- ---------------------- -------- -------- ------------------ ------------------------- ------------\n", "XGBoost_2_AutoML_2_20250409_152135 0.521682 0.868195 0.519441 0.490196 0.55289 0.305688 2467 0.275334 XGBoost\n", "DRF_1_AutoML_2_20250409_152135 0.516968 0.726751 0.518918 0.5 0.514539 0.26475 3142 0.166365 DRF\n", "XGBoost_3_AutoML_2_20250409_152135 0.502451 0.893016 0.498844 0.5 0.561485 0.315265 3038 0.202713 XGBoost\n", "XGBoost_1_AutoML_2_20250409_152135 0.494532 0.847524 0.54791 0.5 0.555468 0.308545 2641 0.203214 XGBoost\n", "XGBoost_grid_1_AutoML_2_20250409_152135_model_2 0.486991 0.811853 0.492215 0.470023 0.543988 0.295923 6373 0.162094 XGBoost\n", "DeepLearning_grid_2_AutoML_2_20250409_152135_model_1 0.483974 1.3188 0.466643 0.5 0.603914 0.364712 33017 0.198407 DeepLearning\n", "GBM_1_AutoML_2_20250409_152135 0.48322 0.729637 0.481765 0.5 0.51663 0.266906 3467 0.126336 GBM\n", "GBM_5_AutoML_2_20250409_152135 0.478695 0.782243 0.491722 0.5 0.535926 0.287216 1649 0.113597 GBM\n", "GBM_grid_1_AutoML_2_20250409_152135_model_2 0.467383 0.746436 0.482668 0.490196 0.523668 0.274228 1230 0.10611 GBM\n", "XGBoost_grid_1_AutoML_2_20250409_152135_model_3 0.465875 0.950725 0.467881 0.490196 0.575634 0.331354 2592 0.142199 XGBoost\n", "[20 rows x 10 columns]\n" ], "text/html": [ "
model_id | auc | logloss | aucpr | mean_per_class_error | rmse | mse | training_time_ms | predict_time_per_row_ms | algo |
---|---|---|---|---|---|---|---|---|---|
XGBoost_2_AutoML_2_20250409_152135 | 0.521682 | 0.868195 | 0.519441 | 0.490196 | 0.55289 | 0.305688 | 2467 | 0.275334 | XGBoost |
DRF_1_AutoML_2_20250409_152135 | 0.516968 | 0.726751 | 0.518918 | 0.5 | 0.514539 | 0.26475 | 3142 | 0.166365 | DRF |
XGBoost_3_AutoML_2_20250409_152135 | 0.502451 | 0.893016 | 0.498844 | 0.5 | 0.561485 | 0.315265 | 3038 | 0.202713 | XGBoost |
XGBoost_1_AutoML_2_20250409_152135 | 0.494532 | 0.847524 | 0.54791 | 0.5 | 0.555468 | 0.308545 | 2641 | 0.203214 | XGBoost |
XGBoost_grid_1_AutoML_2_20250409_152135_model_2 | 0.486991 | 0.811853 | 0.492215 | 0.470023 | 0.543988 | 0.295923 | 6373 | 0.162094 | XGBoost |
DeepLearning_grid_2_AutoML_2_20250409_152135_model_1 | 0.483974 | 1.3188 | 0.466643 | 0.5 | 0.603914 | 0.364712 | 33017 | 0.198407 | DeepLearning |
GBM_1_AutoML_2_20250409_152135 | 0.48322 | 0.729637 | 0.481765 | 0.5 | 0.51663 | 0.266906 | 3467 | 0.126336 | GBM |
GBM_5_AutoML_2_20250409_152135 | 0.478695 | 0.782243 | 0.491722 | 0.5 | 0.535926 | 0.287216 | 1649 | 0.113597 | GBM |
GBM_grid_1_AutoML_2_20250409_152135_model_2 | 0.467383 | 0.746436 | 0.482668 | 0.490196 | 0.523668 | 0.274228 | 1230 | 0.10611 | GBM |
XGBoost_grid_1_AutoML_2_20250409_152135_model_3 | 0.465875 | 0.950725 | 0.467881 | 0.490196 | 0.575634 | 0.331354 | 2592 | 0.142199 | XGBoost |
[20 rows x 10 columns]" ] }, "metadata": {}, "execution_count": 22 } ] }, { "cell_type": "code", "source": [ "# Get the best model using the metric\n", "m = aml.leader\n", "print(m)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "6evHF-tokzjX", "outputId": "fad90f1d-3e6a-45e6-ea1b-7739e2157d2a" }, "execution_count": 23, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Model Details\n", "=============\n", "H2OXGBoostEstimator : XGBoost\n", "Model Key: XGBoost_2_AutoML_2_20250409_152135\n", "\n", "\n", "Model Summary: \n", " number_of_trees\n", "-- -----------------\n", " 30\n", "\n", "ModelMetricsBinomial: xgboost\n", "** Reported on train data. **\n", "\n", "MSE: 0.04856159627892655\n", "RMSE: 0.22036695822860228\n", "LogLoss: 0.21811686278860418\n", "Mean Per-Class Error: 0.0168651023003121\n", "AUC: 0.9983354525488383\n", "AUCPR: 0.9983430345133928\n", "Gini: 0.9966709050976765\n", "\n", "Confusion Matrix (Act/Pred) for max f1 @ threshold = 0.4844781955083211\n", " 0 1 Error Rate\n", "----- --- --- ------- ------------\n", "0 402 8 0.0195 (8.0/410.0)\n", "1 6 416 0.0142 (6.0/422.0)\n", "Total 408 424 0.0168 (14.0/832.0)\n", "\n", "Maximum Metrics: Maximum metrics at their respective thresholds\n", "metric threshold value idx\n", "--------------------------- ----------- -------- -----\n", "max f1 0.484478 0.983452 201\n", "max f2 0.445234 0.989657 212\n", "max f0point5 0.551076 0.986395 192\n", "max accuracy 0.484478 0.983173 201\n", "max precision 0.982302 1 0\n", "max recall 0.336748 1 234\n", "max specificity 0.982302 1 0\n", "max absolute_mcc 0.484478 0.966348 201\n", "max min_per_class_accuracy 0.488712 0.981043 200\n", "max mean_per_class_accuracy 0.484478 0.983135 201\n", "max tns 0.982302 410 0\n", "max fns 0.982302 421 0\n", "max fps 0.00968025 410 399\n", "max tps 0.336748 422 234\n", "max tnr 0.982302 1 0\n", "max fnr 0.982302 0.99763 0\n", "max fpr 0.00968025 1 399\n", "max tpr 0.336748 1 234\n", "\n", "Gains/Lift Table: Avg response rate: 50.72 %, avg score: 51.05 %\n", "group cumulative_data_fraction lower_threshold lift cumulative_lift response_rate score cumulative_response_rate cumulative_score capture_rate cumulative_capture_rate gain cumulative_gain kolmogorov_smirnov\n", "------- -------------------------- ----------------- -------- ----------------- --------------- --------- -------------------------- ------------------ -------------- ------------------------- -------- ----------------- --------------------\n", "1 0.0108173 0.972137 1.97156 1.97156 1 0.976887 1 0.976887 0.021327 0.021327 97.1564 97.1564 0.021327\n", "2 0.0204327 0.963878 1.97156 1.97156 1 0.968609 1 0.972991 0.0189573 0.0402844 97.1564 97.1564 0.0402844\n", "3 0.0300481 0.958543 1.97156 1.97156 1 0.961398 1 0.969281 0.0189573 0.0592417 97.1564 97.1564 0.0592417\n", "4 0.0408654 0.951325 1.97156 1.97156 1 0.954896 1 0.965473 0.021327 0.0805687 97.1564 97.1564 0.0805687\n", "5 0.0504808 0.945304 1.97156 1.97156 1 0.949574 1 0.962445 0.0189573 0.0995261 97.1564 97.1564 0.0995261\n", "6 0.100962 0.919195 1.97156 1.97156 1 0.932157 1 0.947301 0.0995261 0.199052 97.1564 97.1564 0.199052\n", "7 0.15024 0.900065 1.97156 1.97156 1 0.909711 1 0.934972 0.0971564 0.296209 97.1564 97.1564 0.296209\n", "8 0.200721 0.876327 1.97156 1.97156 1 0.889046 1 0.923421 0.0995261 0.395735 97.1564 97.1564 0.395735\n", "9 0.300481 0.820207 1.97156 1.97156 1 0.850731 1 0.899288 0.196682 0.592417 97.1564 97.1564 0.592417\n", "10 0.40024 0.745953 1.97156 1.97156 1 0.782398 1 0.870153 0.196682 0.7891 97.1564 97.1564 0.7891\n", "11 0.501202 0.510782 1.83074 1.9432 0.928571 0.652121 0.985612 0.826233 0.184834 0.973934 83.0738 94.3196 0.9593\n", "12 0.59976 0.284746 0.264478 1.66733 0.134146 0.377337 0.845691 0.752467 0.0260664 1 -73.5522 66.7335 0.812195\n", "13 0.699519 0.202861 0 1.42955 0 0.24154 0.725086 0.679603 0 1 -100 42.9553 0.609756\n", "14 0.799279 0.138646 0 1.25113 0 0.170537 0.634586 0.616065 0 1 -100 25.1128 0.407317\n", "15 0.899038 0.0952722 0 1.1123 0 0.117953 0.564171 0.560793 0 1 -100 11.2299 0.204878\n", "16 1 0.00968025 0 1 0 0.0629315 0.507212 0.510528 0 1 -100 0 0\n", "\n", "ModelMetricsBinomial: xgboost\n", "** Reported on validation data. **\n", "\n", "MSE: 0.30568781210268564\n", "RMSE: 0.5528904159982208\n", "LogLoss: 0.8681948644613136\n", "Mean Per-Class Error: 0.49019607843137253\n", "AUC: 0.5216817496229261\n", "AUCPR: 0.5194412079480231\n", "Gini: 0.043363499245852255\n", "\n", "Confusion Matrix (Act/Pred) for max f1 @ threshold = 0.06307325512170792\n", " 0 1 Error Rate\n", "----- --- --- ------- ------------\n", "0 1 50 0.9804 (50.0/51.0)\n", "1 0 52 0 (0.0/52.0)\n", "Total 1 102 0.4854 (50.0/103.0)\n", "\n", "Maximum Metrics: Maximum metrics at their respective thresholds\n", "metric threshold value idx\n", "--------------------------- ----------- -------- -----\n", "max f1 0.0630733 0.675325 100\n", "max f2 0.0630733 0.83871 100\n", "max f0point5 0.58902 0.57377 46\n", "max accuracy 0.655599 0.572816 38\n", "max precision 0.918544 0.666667 7\n", "max recall 0.0630733 1 100\n", "max specificity 0.960617 0.980392 0\n", "max absolute_mcc 0.655599 0.151635 38\n", "max min_per_class_accuracy 0.572145 0.54902 50\n", "max mean_per_class_accuracy 0.655599 0.573906 38\n", "max tns 0.960617 50 0\n", "max fns 0.960617 52 0\n", "max fps 0.0345234 51 101\n", "max tps 0.0630733 52 100\n", "max tnr 0.960617 0.980392 0\n", "max fnr 0.960617 1 0\n", "max fpr 0.0345234 1 101\n", "max tpr 0.0630733 1 100\n", "\n", "Gains/Lift Table: Avg response rate: 50.49 %, avg score: 54.79 %\n", "group cumulative_data_fraction lower_threshold lift cumulative_lift response_rate score cumulative_response_rate cumulative_score capture_rate cumulative_capture_rate gain cumulative_gain kolmogorov_smirnov\n", "------- -------------------------- ----------------- -------- ----------------- --------------- -------- -------------------------- ------------------ -------------- ------------------------- --------- ----------------- --------------------\n", "1 0.0194175 0.953524 0 0 0 0.957244 0 0.957244 0 0 -100 -100 -0.0392157\n", "2 0.0291262 0.93633 1.98077 0.660256 1 0.936525 0.333333 0.950338 0.0192308 0.0192308 98.0769 -33.9744 -0.0199849\n", "3 0.0485437 0.931649 0.990385 0.792308 0.5 0.931649 0.4 0.942862 0.0192308 0.0384615 -0.961538 -20.7692 -0.020362\n", "4 0.0485437 0.9311 0 0.792308 0 0 0.4 0.942862 0 0.0384615 -100 -20.7692 -0.020362\n", "5 0.0582524 0.924741 1.98077 0.990385 1 0.924782 0.5 0.939849 0.0192308 0.0576923 98.0769 -0.961538 -0.00113122\n", "6 0.106796 0.848649 1.18846 1.08042 0.6 0.89536 0.545455 0.919626 0.0576923 0.115385 18.8462 8.04196 0.0173454\n", "7 0.15534 0.816536 0.792308 0.990385 0.4 0.832529 0.5 0.892409 0.0384615 0.153846 -20.7692 -0.961538 -0.00301659\n", "8 0.203883 0.801701 1.18846 1.03755 0.6 0.808636 0.52381 0.872463 0.0576923 0.211538 18.8462 3.75458 0.01546\n", "9 0.300971 0.720564 0.990385 1.02233 0.5 0.777296 0.516129 0.841764 0.0961538 0.307692 -0.961538 2.23325 0.0135747\n", "10 0.398058 0.641569 1.58462 1.15947 0.8 0.679651 0.585366 0.802224 0.153846 0.461538 58.4615 15.9475 0.128205\n", "11 0.504854 0.572145 0.90035 1.10466 0.454545 0.601161 0.557692 0.759692 0.0961538 0.557692 -9.96503 10.466 0.106712\n", "12 0.601942 0.482146 0.792308 1.05428 0.4 0.51586 0.532258 0.720364 0.0769231 0.634615 -20.7692 5.42804 0.0659879\n", "13 0.699029 0.397178 0.792308 1.0179 0.4 0.438624 0.513889 0.681233 0.0769231 0.711538 -20.7692 1.78953 0.025264\n", "14 0.796117 0.291779 0.396154 0.942073 0.2 0.346037 0.47561 0.640356 0.0384615 0.75 -60.3846 -5.79268 -0.0931373\n", "15 0.893204 0.217459 1.18846 0.968855 0.6 0.252101 0.48913 0.598154 0.115385 0.865385 18.8462 -3.11455 -0.056184\n", "16 1 0.0345234 1.26049 1 0.636364 0.127751 0.504854 0.547917 0.134615 1 26.049 0 0\n", "\n", "Scoring History: \n", " timestamp duration number_of_trees training_rmse training_logloss training_auc training_pr_auc training_lift training_classification_error validation_rmse validation_logloss validation_auc validation_pr_auc validation_lift validation_classification_error\n", "-- ------------------- ---------- ----------------- --------------- ------------------ -------------- ----------------- --------------- ------------------------------- ----------------- -------------------- ---------------- ------------------- ----------------- ---------------------------------\n", " 2025-04-09 15:21:43 0.006 sec 0 0.5 0.693147 0.5 0.507212 1 0.492788 0.5 0.693147 0.5 0.504854 1 0.495146\n", " 2025-04-09 15:21:44 0.696 sec 5 0.416868 0.530792 0.863614 0.862843 1.97156 0.210337 0.56344 0.841232 0.344834 0.419535 0.990385 0.495146\n", " 2025-04-09 15:21:45 1.189 sec 10 0.356775 0.422749 0.946723 0.949857 1.97156 0.135817 0.582213 0.902885 0.364819 0.427561 0.990385 0.485437\n", " 2025-04-09 15:21:45 1.383 sec 15 0.31032 0.34687 0.978676 0.978871 1.97156 0.0721154 0.575048 0.893553 0.421757 0.455104 0.990385 0.466019\n", " 2025-04-09 15:21:45 1.540 sec 20 0.274289 0.291499 0.990984 0.991582 1.97156 0.0432692 0.577017 0.910416 0.454563 0.496729 0.990385 0.485437\n", " 2025-04-09 15:21:45 2.077 sec 25 0.246853 0.252942 0.995284 0.995437 1.97156 0.0264423 0.564181 0.894831 0.486991 0.498042 0 0.485437\n", " 2025-04-09 15:21:46 2.354 sec 30 0.220367 0.218117 0.998335 0.998343 1.97156 0.0168269 0.55289 0.868195 0.521682 0.519441 0 0.485437\n", "\n", "Variable Importances: \n", "variable relative_importance scaled_importance percentage\n", "------------------- --------------------- -------------------- ---------------------\n", "text_embeddings_40 44.77016830444336 1.0 0.02502580203949166\n", "text_embeddings_53 40.09682846069336 0.8956148698845481 0.022413480437355783\n", "text_embeddings_123 38.98078155517578 0.8706865091527254 0.02178962821651215\n", "text_embeddings_50 38.95652770996094 0.8701447679412582 0.021776070708197336\n", "text_embeddings_10 37.253414154052734 0.8321035092100693 0.02082405769785752\n", "text_embeddings_104 34.9406623840332 0.780445187215555 0.019531266757930488\n", "text_embeddings_54 34.83060836791992 0.7779869874749398 0.01946974833784832\n", "text_embeddings_76 31.192859649658203 0.696733133490641 0.017436305473091503\n", "text_embeddings_111 30.680063247680664 0.6852791581897119 0.01714966055464522\n", "text_embeddings_88 30.59779167175293 0.683441515423478 0.017103672070558146\n", "--- --- --- ---\n", "text_embeddings_115 4.673641204833984 0.10439186140763589 0.002612490058121545\n", "text_embeddings_21 4.560031414031982 0.10185423880971668 0.0025489840173350785\n", "text_embeddings_45 4.397317886352539 0.09821982031539768 0.0024580297795675837\n", "text_embeddings_75 4.332575798034668 0.09677372147838603 0.002421839996342991\n", "text_embeddings_79 4.291599273681641 0.09585845745537899 0.0023989347800893483\n", "text_embeddings_66 3.9384031295776367 0.0879693617141653 0.002201503831799138\n", "text_embeddings_103 3.5999584197998047 0.08040975846504725 0.0020123186973896113\n", "text_embeddings_44 3.2862496376037598 0.07340266436473515 0.0018369605475631109\n", "text_embeddings_13 2.807455539703369 0.06270817479649131 0.0015693223687148318\n", "text_embeddings_20 0.9517765045166016 0.021259167444812564 0.000532027715998285\n", "[113 rows x 4 columns]\n", "\n" ] } ] }, { "cell_type": "code", "source": [ "# this is equivalent to\n", "m = aml.get_best_model()\n", "print(m)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "dvqjA5tck7Z1", "outputId": "39f2d29b-72a0-4a55-b5fe-b267e9c448f9" }, "execution_count": 24, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Model Details\n", "=============\n", "H2OXGBoostEstimator : XGBoost\n", "Model Key: XGBoost_2_AutoML_2_20250409_152135\n", "\n", "\n", "Model Summary: \n", " number_of_trees\n", "-- -----------------\n", " 30\n", "\n", "ModelMetricsBinomial: xgboost\n", "** Reported on train data. **\n", "\n", "MSE: 0.04856159627892655\n", "RMSE: 0.22036695822860228\n", "LogLoss: 0.21811686278860418\n", "Mean Per-Class Error: 0.0168651023003121\n", "AUC: 0.9983354525488383\n", "AUCPR: 0.9983430345133928\n", "Gini: 0.9966709050976765\n", "\n", "Confusion Matrix (Act/Pred) for max f1 @ threshold = 0.4844781955083211\n", " 0 1 Error Rate\n", "----- --- --- ------- ------------\n", "0 402 8 0.0195 (8.0/410.0)\n", "1 6 416 0.0142 (6.0/422.0)\n", "Total 408 424 0.0168 (14.0/832.0)\n", "\n", "Maximum Metrics: Maximum metrics at their respective thresholds\n", "metric threshold value idx\n", "--------------------------- ----------- -------- -----\n", "max f1 0.484478 0.983452 201\n", "max f2 0.445234 0.989657 212\n", "max f0point5 0.551076 0.986395 192\n", "max accuracy 0.484478 0.983173 201\n", "max precision 0.982302 1 0\n", "max recall 0.336748 1 234\n", "max specificity 0.982302 1 0\n", "max absolute_mcc 0.484478 0.966348 201\n", "max min_per_class_accuracy 0.488712 0.981043 200\n", "max mean_per_class_accuracy 0.484478 0.983135 201\n", "max tns 0.982302 410 0\n", "max fns 0.982302 421 0\n", "max fps 0.00968025 410 399\n", "max tps 0.336748 422 234\n", "max tnr 0.982302 1 0\n", "max fnr 0.982302 0.99763 0\n", "max fpr 0.00968025 1 399\n", "max tpr 0.336748 1 234\n", "\n", "Gains/Lift Table: Avg response rate: 50.72 %, avg score: 51.05 %\n", "group cumulative_data_fraction lower_threshold lift cumulative_lift response_rate score cumulative_response_rate cumulative_score capture_rate cumulative_capture_rate gain cumulative_gain kolmogorov_smirnov\n", "------- -------------------------- ----------------- -------- ----------------- --------------- --------- -------------------------- ------------------ -------------- ------------------------- -------- ----------------- --------------------\n", "1 0.0108173 0.972137 1.97156 1.97156 1 0.976887 1 0.976887 0.021327 0.021327 97.1564 97.1564 0.021327\n", "2 0.0204327 0.963878 1.97156 1.97156 1 0.968609 1 0.972991 0.0189573 0.0402844 97.1564 97.1564 0.0402844\n", "3 0.0300481 0.958543 1.97156 1.97156 1 0.961398 1 0.969281 0.0189573 0.0592417 97.1564 97.1564 0.0592417\n", "4 0.0408654 0.951325 1.97156 1.97156 1 0.954896 1 0.965473 0.021327 0.0805687 97.1564 97.1564 0.0805687\n", "5 0.0504808 0.945304 1.97156 1.97156 1 0.949574 1 0.962445 0.0189573 0.0995261 97.1564 97.1564 0.0995261\n", "6 0.100962 0.919195 1.97156 1.97156 1 0.932157 1 0.947301 0.0995261 0.199052 97.1564 97.1564 0.199052\n", "7 0.15024 0.900065 1.97156 1.97156 1 0.909711 1 0.934972 0.0971564 0.296209 97.1564 97.1564 0.296209\n", "8 0.200721 0.876327 1.97156 1.97156 1 0.889046 1 0.923421 0.0995261 0.395735 97.1564 97.1564 0.395735\n", "9 0.300481 0.820207 1.97156 1.97156 1 0.850731 1 0.899288 0.196682 0.592417 97.1564 97.1564 0.592417\n", "10 0.40024 0.745953 1.97156 1.97156 1 0.782398 1 0.870153 0.196682 0.7891 97.1564 97.1564 0.7891\n", "11 0.501202 0.510782 1.83074 1.9432 0.928571 0.652121 0.985612 0.826233 0.184834 0.973934 83.0738 94.3196 0.9593\n", "12 0.59976 0.284746 0.264478 1.66733 0.134146 0.377337 0.845691 0.752467 0.0260664 1 -73.5522 66.7335 0.812195\n", "13 0.699519 0.202861 0 1.42955 0 0.24154 0.725086 0.679603 0 1 -100 42.9553 0.609756\n", "14 0.799279 0.138646 0 1.25113 0 0.170537 0.634586 0.616065 0 1 -100 25.1128 0.407317\n", "15 0.899038 0.0952722 0 1.1123 0 0.117953 0.564171 0.560793 0 1 -100 11.2299 0.204878\n", "16 1 0.00968025 0 1 0 0.0629315 0.507212 0.510528 0 1 -100 0 0\n", "\n", "ModelMetricsBinomial: xgboost\n", "** Reported on validation data. **\n", "\n", "MSE: 0.30568781210268564\n", "RMSE: 0.5528904159982208\n", "LogLoss: 0.8681948644613136\n", "Mean Per-Class Error: 0.49019607843137253\n", "AUC: 0.5216817496229261\n", "AUCPR: 0.5194412079480231\n", "Gini: 0.043363499245852255\n", "\n", "Confusion Matrix (Act/Pred) for max f1 @ threshold = 0.06307325512170792\n", " 0 1 Error Rate\n", "----- --- --- ------- ------------\n", "0 1 50 0.9804 (50.0/51.0)\n", "1 0 52 0 (0.0/52.0)\n", "Total 1 102 0.4854 (50.0/103.0)\n", "\n", "Maximum Metrics: Maximum metrics at their respective thresholds\n", "metric threshold value idx\n", "--------------------------- ----------- -------- -----\n", "max f1 0.0630733 0.675325 100\n", "max f2 0.0630733 0.83871 100\n", "max f0point5 0.58902 0.57377 46\n", "max accuracy 0.655599 0.572816 38\n", "max precision 0.918544 0.666667 7\n", "max recall 0.0630733 1 100\n", "max specificity 0.960617 0.980392 0\n", "max absolute_mcc 0.655599 0.151635 38\n", "max min_per_class_accuracy 0.572145 0.54902 50\n", "max mean_per_class_accuracy 0.655599 0.573906 38\n", "max tns 0.960617 50 0\n", "max fns 0.960617 52 0\n", "max fps 0.0345234 51 101\n", "max tps 0.0630733 52 100\n", "max tnr 0.960617 0.980392 0\n", "max fnr 0.960617 1 0\n", "max fpr 0.0345234 1 101\n", "max tpr 0.0630733 1 100\n", "\n", "Gains/Lift Table: Avg response rate: 50.49 %, avg score: 54.79 %\n", "group cumulative_data_fraction lower_threshold lift cumulative_lift response_rate score cumulative_response_rate cumulative_score capture_rate cumulative_capture_rate gain cumulative_gain kolmogorov_smirnov\n", "------- -------------------------- ----------------- -------- ----------------- --------------- -------- -------------------------- ------------------ -------------- ------------------------- --------- ----------------- --------------------\n", "1 0.0194175 0.953524 0 0 0 0.957244 0 0.957244 0 0 -100 -100 -0.0392157\n", "2 0.0291262 0.93633 1.98077 0.660256 1 0.936525 0.333333 0.950338 0.0192308 0.0192308 98.0769 -33.9744 -0.0199849\n", "3 0.0485437 0.931649 0.990385 0.792308 0.5 0.931649 0.4 0.942862 0.0192308 0.0384615 -0.961538 -20.7692 -0.020362\n", "4 0.0485437 0.9311 0 0.792308 0 0 0.4 0.942862 0 0.0384615 -100 -20.7692 -0.020362\n", "5 0.0582524 0.924741 1.98077 0.990385 1 0.924782 0.5 0.939849 0.0192308 0.0576923 98.0769 -0.961538 -0.00113122\n", "6 0.106796 0.848649 1.18846 1.08042 0.6 0.89536 0.545455 0.919626 0.0576923 0.115385 18.8462 8.04196 0.0173454\n", "7 0.15534 0.816536 0.792308 0.990385 0.4 0.832529 0.5 0.892409 0.0384615 0.153846 -20.7692 -0.961538 -0.00301659\n", "8 0.203883 0.801701 1.18846 1.03755 0.6 0.808636 0.52381 0.872463 0.0576923 0.211538 18.8462 3.75458 0.01546\n", "9 0.300971 0.720564 0.990385 1.02233 0.5 0.777296 0.516129 0.841764 0.0961538 0.307692 -0.961538 2.23325 0.0135747\n", "10 0.398058 0.641569 1.58462 1.15947 0.8 0.679651 0.585366 0.802224 0.153846 0.461538 58.4615 15.9475 0.128205\n", "11 0.504854 0.572145 0.90035 1.10466 0.454545 0.601161 0.557692 0.759692 0.0961538 0.557692 -9.96503 10.466 0.106712\n", "12 0.601942 0.482146 0.792308 1.05428 0.4 0.51586 0.532258 0.720364 0.0769231 0.634615 -20.7692 5.42804 0.0659879\n", "13 0.699029 0.397178 0.792308 1.0179 0.4 0.438624 0.513889 0.681233 0.0769231 0.711538 -20.7692 1.78953 0.025264\n", "14 0.796117 0.291779 0.396154 0.942073 0.2 0.346037 0.47561 0.640356 0.0384615 0.75 -60.3846 -5.79268 -0.0931373\n", "15 0.893204 0.217459 1.18846 0.968855 0.6 0.252101 0.48913 0.598154 0.115385 0.865385 18.8462 -3.11455 -0.056184\n", "16 1 0.0345234 1.26049 1 0.636364 0.127751 0.504854 0.547917 0.134615 1 26.049 0 0\n", "\n", "Scoring History: \n", " timestamp duration number_of_trees training_rmse training_logloss training_auc training_pr_auc training_lift training_classification_error validation_rmse validation_logloss validation_auc validation_pr_auc validation_lift validation_classification_error\n", "-- ------------------- ---------- ----------------- --------------- ------------------ -------------- ----------------- --------------- ------------------------------- ----------------- -------------------- ---------------- ------------------- ----------------- ---------------------------------\n", " 2025-04-09 15:21:43 0.006 sec 0 0.5 0.693147 0.5 0.507212 1 0.492788 0.5 0.693147 0.5 0.504854 1 0.495146\n", " 2025-04-09 15:21:44 0.696 sec 5 0.416868 0.530792 0.863614 0.862843 1.97156 0.210337 0.56344 0.841232 0.344834 0.419535 0.990385 0.495146\n", " 2025-04-09 15:21:45 1.189 sec 10 0.356775 0.422749 0.946723 0.949857 1.97156 0.135817 0.582213 0.902885 0.364819 0.427561 0.990385 0.485437\n", " 2025-04-09 15:21:45 1.383 sec 15 0.31032 0.34687 0.978676 0.978871 1.97156 0.0721154 0.575048 0.893553 0.421757 0.455104 0.990385 0.466019\n", " 2025-04-09 15:21:45 1.540 sec 20 0.274289 0.291499 0.990984 0.991582 1.97156 0.0432692 0.577017 0.910416 0.454563 0.496729 0.990385 0.485437\n", " 2025-04-09 15:21:45 2.077 sec 25 0.246853 0.252942 0.995284 0.995437 1.97156 0.0264423 0.564181 0.894831 0.486991 0.498042 0 0.485437\n", " 2025-04-09 15:21:46 2.354 sec 30 0.220367 0.218117 0.998335 0.998343 1.97156 0.0168269 0.55289 0.868195 0.521682 0.519441 0 0.485437\n", "\n", "Variable Importances: \n", "variable relative_importance scaled_importance percentage\n", "------------------- --------------------- -------------------- ---------------------\n", "text_embeddings_40 44.77016830444336 1.0 0.02502580203949166\n", "text_embeddings_53 40.09682846069336 0.8956148698845481 0.022413480437355783\n", "text_embeddings_123 38.98078155517578 0.8706865091527254 0.02178962821651215\n", "text_embeddings_50 38.95652770996094 0.8701447679412582 0.021776070708197336\n", "text_embeddings_10 37.253414154052734 0.8321035092100693 0.02082405769785752\n", "text_embeddings_104 34.9406623840332 0.780445187215555 0.019531266757930488\n", "text_embeddings_54 34.83060836791992 0.7779869874749398 0.01946974833784832\n", "text_embeddings_76 31.192859649658203 0.696733133490641 0.017436305473091503\n", "text_embeddings_111 30.680063247680664 0.6852791581897119 0.01714966055464522\n", "text_embeddings_88 30.59779167175293 0.683441515423478 0.017103672070558146\n", "--- --- --- ---\n", "text_embeddings_115 4.673641204833984 0.10439186140763589 0.002612490058121545\n", "text_embeddings_21 4.560031414031982 0.10185423880971668 0.0025489840173350785\n", "text_embeddings_45 4.397317886352539 0.09821982031539768 0.0024580297795675837\n", "text_embeddings_75 4.332575798034668 0.09677372147838603 0.002421839996342991\n", "text_embeddings_79 4.291599273681641 0.09585845745537899 0.0023989347800893483\n", "text_embeddings_66 3.9384031295776367 0.0879693617141653 0.002201503831799138\n", "text_embeddings_103 3.5999584197998047 0.08040975846504725 0.0020123186973896113\n", "text_embeddings_44 3.2862496376037598 0.07340266436473515 0.0018369605475631109\n", "text_embeddings_13 2.807455539703369 0.06270817479649131 0.0015693223687148318\n", "text_embeddings_20 0.9517765045166016 0.021259167444812564 0.000532027715998285\n", "[113 rows x 4 columns]\n", "\n" ] } ] }, { "cell_type": "code", "source": [ "# Get the best model using a non-default metric\n", "m = aml.get_best_model(criterion=\"logloss\")\n", "print(m)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "4RExMtKHk-k-", "outputId": "c6afd883-7a20-4363-8e3d-88520a2020d4" }, "execution_count": 25, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Model Details\n", "=============\n", "H2OGeneralizedLinearEstimator : Generalized Linear Modeling\n", "Model Key: GLM_1_AutoML_2_20250409_152135\n", "\n", "\n", "GLM Model: summary\n", " family link regularization lambda_search number_of_predictors_total number_of_active_predictors number_of_iterations training_frame\n", "-- -------- ------ ------------------------- ------------------------------------------------------------------------- ---------------------------- ----------------------------- ---------------------- -----------------------------------------------\n", " binomial logit Ridge ( lambda = 8.3944 ) nlambda = 30, lambda.max = 8.3944, lambda.min = 8.3944, lambda.1se = -1.0 128 128 2 AutoML_2_20250409_152135_training_py_3_sid_8ad7\n", "\n", "ModelMetricsBinomialGLM: glm\n", "** Reported on train data. **\n", "\n", "MSE: 0.24717480793730287\n", "RMSE: 0.49716678080630333\n", "LogLoss: 0.6874882191328064\n", "AUC: 0.6474540515547336\n", "AUCPR: 0.644085032591834\n", "Gini: 0.29490810310946713\n", "Null degrees of freedom: 831\n", "Residual degrees of freedom: 703\n", "Null deviance: 1153.223825527466\n", "Residual deviance: 1143.98039663699\n", "AIC: 1401.98039663699\n", "\n", "Confusion Matrix (Act/Pred) for max f1 @ threshold = 0.4969545190426191\n", " 0 1 Error Rate\n", "----- --- --- ------- -------------\n", "0 92 318 0.7756 (318.0/410.0)\n", "1 33 389 0.0782 (33.0/422.0)\n", "Total 125 707 0.4219 (351.0/832.0)\n", "\n", "Maximum Metrics: Maximum metrics at their respective thresholds\n", "metric threshold value idx\n", "--------------------------- ----------- -------- -----\n", "max f1 0.496955 0.689105 321\n", "max f2 0.477531 0.837302 399\n", "max f0point5 0.501609 0.617147 263\n", "max accuracy 0.501609 0.609375 263\n", "max precision 0.581164 1 0\n", "max recall 0.477531 1 399\n", "max specificity 0.581164 1 0\n", "max absolute_mcc 0.501609 0.229957 263\n", "max min_per_class_accuracy 0.506473 0.590047 205\n", "max mean_per_class_accuracy 0.501609 0.60671 263\n", "max tns 0.581164 410 0\n", "max fns 0.581164 421 0\n", "max fps 0.477737 410 398\n", "max tps 0.477531 422 399\n", "max tnr 0.581164 1 0\n", "max fnr 0.581164 0.99763 0\n", "max fpr 0.477737 1 398\n", "max tpr 0.477531 1 399\n", "\n", "Gains/Lift Table: Avg response rate: 50.72 %, avg score: 50.72 %\n", "group cumulative_data_fraction lower_threshold lift cumulative_lift response_rate score cumulative_response_rate cumulative_score capture_rate cumulative_capture_rate gain cumulative_gain kolmogorov_smirnov\n", "------- -------------------------- ----------------- -------- ----------------- --------------- -------- -------------------------- ------------------ -------------- ------------------------- -------- ----------------- --------------------\n", "1 0.0108173 0.55484 1.53344 1.53344 0.777778 0.563771 0.777778 0.563771 0.0165877 0.0165877 53.3439 53.3439 0.0117096\n", "2 0.0204327 0.542193 1.47867 1.50767 0.75 0.549144 0.764706 0.556888 0.014218 0.0308057 47.8673 50.7667 0.0210496\n", "3 0.0300481 0.531147 1.97156 1.65611 1 0.535422 0.84 0.550019 0.0189573 0.049763 97.1564 65.6114 0.0400069\n", "4 0.0408654 0.527754 1.09531 1.50767 0.555556 0.529574 0.764706 0.544607 0.0118483 0.0616114 9.53133 50.7667 0.0420992\n", "5 0.0504808 0.525382 1.23223 1.4552 0.625 0.526306 0.738095 0.541121 0.0118483 0.0734597 23.2227 45.5202 0.0466304\n", "6 0.100962 0.520465 1.36132 1.40826 0.690476 0.521961 0.714286 0.531541 0.0687204 0.14218 36.1318 40.826 0.0836435\n", "7 0.15024 0.516847 1.53878 1.45107 0.780488 0.518698 0.736 0.527328 0.0758294 0.218009 53.8782 45.1071 0.137522\n", "8 0.200721 0.514332 1.36132 1.4285 0.690476 0.515369 0.724551 0.524321 0.0687204 0.28673 36.1318 42.8498 0.174535\n", "9 0.300481 0.510604 0.950151 1.26969 0.481928 0.512496 0.644 0.520395 0.0947867 0.381517 -4.98487 26.9687 0.164443\n", "10 0.40024 0.508288 1.11643 1.23149 0.566265 0.509393 0.624625 0.517653 0.111374 0.492891 11.6428 23.1487 0.188013\n", "11 0.5 0.50637 0.973905 1.18009 0.493976 0.507386 0.598558 0.515604 0.0971564 0.590047 -2.60949 18.0095 0.18273\n", "12 0.59976 0.504004 1.14018 1.17346 0.578313 0.505165 0.59519 0.513868 0.113744 0.703791 14.0182 17.3456 0.211109\n", "13 0.699519 0.501222 0.973905 1.145 0.493976 0.502581 0.580756 0.512258 0.0971564 0.800948 -2.60949 14.4998 0.205826\n", "14 0.799279 0.498592 0.760121 1.09696 0.385542 0.499945 0.556391 0.510722 0.0758294 0.876777 -23.9879 9.69604 0.157265\n", "15 0.899038 0.494264 0.68886 1.05168 0.349398 0.496661 0.533422 0.509161 0.0687204 0.945498 -31.114 5.16765 0.0942781\n", "16 1 0.477531 0.539833 1 0.27381 0.489849 0.507212 0.507212 0.0545024 1 -46.0167 0 0\n", "\n", "ModelMetricsBinomialGLM: glm\n", "** Reported on validation data. **\n", "\n", "MSE: 0.2520009197817637\n", "RMSE: 0.5019969320441746\n", "LogLoss: 0.6971647390484171\n", "AUC: 0.4342006033182504\n", "AUCPR: 0.4602129339086532\n", "Gini: -0.13159879336349922\n", "Null degrees of freedom: 102\n", "Residual degrees of freedom: -26\n", "Null deviance: 142.7808998601915\n", "Residual deviance: 143.61593624397392\n", "AIC: 401.6159362439739\n", "\n", "Confusion Matrix (Act/Pred) for max f1 @ threshold = 0.4835198410872216\n", " 0 1 Error Rate\n", "----- --- --- ------- ------------\n", "0 0 51 1 (51.0/51.0)\n", "1 0 52 0 (0.0/52.0)\n", "Total 0 103 0.4951 (51.0/103.0)\n", "\n", "Maximum Metrics: Maximum metrics at their respective thresholds\n", "metric threshold value idx\n", "--------------------------- ----------- -------- -----\n", "max f1 0.48352 0.670968 101\n", "max f2 0.48352 0.836013 101\n", "max f0point5 0.48352 0.560345 101\n", "max accuracy 0.520241 0.504854 16\n", "max precision 0.520241 0.529412 16\n", "max recall 0.48352 1 101\n", "max specificity 0.570215 0.980392 0\n", "max absolute_mcc 0.505347 0.191478 61\n", "max min_per_class_accuracy 0.508235 0.411765 51\n", "max mean_per_class_accuracy 0.520241 0.508107 16\n", "max tns 0.570215 50 0\n", "max fns 0.570215 52 0\n", "max fps 0.492519 51 99\n", "max tps 0.48352 52 101\n", "max tnr 0.570215 0.980392 0\n", "max fnr 0.570215 1 0\n", "max fpr 0.492519 1 99\n", "max tpr 0.48352 1 101\n", "\n", "Gains/Lift Table: Avg response rate: 50.49 %, avg score: 51.06 %\n", "group cumulative_data_fraction lower_threshold lift cumulative_lift response_rate score cumulative_response_rate cumulative_score capture_rate cumulative_capture_rate gain cumulative_gain kolmogorov_smirnov\n", "------- -------------------------- ----------------- -------- ----------------- --------------- -------- -------------------------- ------------------ -------------- ------------------------- --------- ----------------- --------------------\n", "1 0.0194175 0.564495 0 0 0 0.567362 0 0.567362 0 0 -100 -100 -0.0392157\n", "2 0.0291262 0.563668 1.98077 0.660256 1 0.563813 0.333333 0.566179 0.0192308 0.0192308 98.0769 -33.9744 -0.0199849\n", "3 0.038835 0.559577 0 0.495192 0 0.560191 0.25 0.564682 0 0.0192308 -100 -50.4808 -0.0395928\n", "4 0.0485437 0.548342 1.98077 0.792308 1 0.549947 0.4 0.561735 0.0192308 0.0384615 98.0769 -20.7692 -0.020362\n", "5 0.0582524 0.529667 0 0.660256 0 0.529885 0.333333 0.556427 0 0.0384615 -100 -33.9744 -0.0399698\n", "6 0.106796 0.522543 1.18846 0.90035 0.6 0.526039 0.454545 0.542614 0.0576923 0.0961538 18.8462 -9.96503 -0.0214932\n", "7 0.15534 0.52082 1.18846 0.990385 0.6 0.521744 0.5 0.536092 0.0576923 0.153846 18.8462 -0.961538 -0.00301659\n", "8 0.203883 0.518536 0.792308 0.943223 0.4 0.519411 0.47619 0.532121 0.0384615 0.192308 -20.7692 -5.67766 -0.0233786\n", "9 0.300971 0.514355 0.990385 0.958437 0.5 0.516476 0.483871 0.527074 0.0961538 0.288462 -0.961538 -4.15633 -0.025264\n", "10 0.398058 0.510991 0.594231 0.869606 0.3 0.512703 0.439024 0.523569 0.0576923 0.346154 -40.5769 -13.0394 -0.104827\n", "11 0.504854 0.508235 0.72028 0.838018 0.363636 0.50967 0.423077 0.520629 0.0769231 0.423077 -27.972 -16.1982 -0.165158\n", "12 0.601942 0.505945 0.990385 0.862593 0.5 0.506583 0.435484 0.518363 0.0961538 0.519231 -0.961538 -13.7407 -0.167044\n", "13 0.699029 0.502526 1.58462 0.962874 0.8 0.50416 0.486111 0.516391 0.153846 0.673077 58.4615 -3.71261 -0.0524133\n", "14 0.796117 0.499338 1.18846 0.990385 0.6 0.5011 0.5 0.514526 0.115385 0.788462 18.8462 -0.961538 -0.01546\n", "15 0.893204 0.496516 0.792308 0.968855 0.4 0.498223 0.48913 0.512754 0.0769231 0.865385 -20.7692 -3.11455 -0.056184\n", "16 1 0.48352 1.26049 1 0.636364 0.492397 0.504854 0.51058 0.134615 1 26.049 0 0\n", "\n", "Scoring History: \n", " timestamp duration iteration lambda predictors deviance_train deviance_test alpha iterations training_rmse training_logloss training_r2 training_auc training_pr_auc training_lift training_classification_error validation_rmse validation_logloss validation_r2 validation_auc validation_pr_auc validation_lift validation_classification_error\n", "-- ------------------- ---------- ----------- -------- ------------ ------------------ ------------------ ------- ------------ ------------------- ------------------ -------------------- ------------------ ----------------- ------------------ ------------------------------- ------------------ -------------------- -------------------- ------------------ ------------------- ----------------- ---------------------------------\n", " 2025-04-09 15:21:39 0.000 sec 2 8.4 129 1.3749764382656129 1.3943294780968343 0.0\n", " 2025-04-09 15:21:39 0.091 sec 4 6.1 129 1.3715574858622348 1.3972670743889783 0.0\n", " 2025-04-09 15:21:38 1.244 sec 5 5 0.49716678080630333 0.6874882191328064 0.011095051152516855 0.6474540515547336 0.644085032591834 1.5334386519220644 0.421875 0.5019969320441746 0.6971647390484171 -0.00809870209831498 0.4342006033182504 0.4602129339086532 0.0 0.49514563106796117\n", " 2025-04-09 15:21:39 0.207 sec 6 4.4 129 1.3673117597744593 1.401149508013086 0.0\n", " 2025-04-09 15:21:39 0.310 sec 8 3.2 129 1.362134972955739 1.4061323998052682 0.0\n", " 2025-04-09 15:21:39 0.466 sec 10 2.4 129 1.3559502468240774 1.4124134258298293 0.0\n", "\n", "Variable Importances: \n", "variable relative_importance scaled_importance percentage\n", "------------------- ---------------------- --------------------- ----------------------\n", "text_embeddings_40 0.009123619645833969 1.0 0.041831677065465825\n", "text_embeddings_101 0.005517772864550352 0.6047789231404315 0.0252989166088107\n", "text_embeddings_50 0.005264927167445421 0.5770656134102976 0.02413962238576451\n", "text_embeddings_0 0.005262942053377628 0.5768480337494993 0.024130520663657985\n", "text_embeddings_62 0.005164535716176033 0.5660621460183586 0.023679328891224535\n", "text_embeddings_17 0.00513411732390523 0.5627281192338582 0.023539860959447705\n", "text_embeddings_104 0.004551626276224852 0.49888382603753295 0.020869147103986106\n", "text_embeddings_96 0.004230691585689783 0.463707579877204 0.019397665734231895\n", "text_embeddings_30 0.003789584618061781 0.41535977662025647 0.01737519604156259\n", "text_embeddings_14 0.003713886020705104 0.4070627848236681 0.017028118960112887\n", "--- --- --- ---\n", "text_embeddings_86 0.000215283696888946 0.023596303358311185 0.0009870729420236402\n", "text_embeddings_111 0.00018158181046601385 0.019902387157155088 0.0008325502323899861\n", "text_embeddings_67 0.00017417987692169845 0.019091093632035892 0.0007986124636418964\n", "text_embeddings_117 0.000165262128575705 0.018113658283767566 0.0007577247038007647\n", "text_embeddings_54 0.0001237387623405084 0.013562463928119805 0.0005673406112531368\n", "text_embeddings_37 8.588682976551354e-05 0.009413679339946095 0.00039378999414647247\n", "text_embeddings_31 8.033354970393702e-05 0.008805008628414159 0.00036832827750246124\n", "text_embeddings_59 5.6291384680662304e-05 0.006169852193078446 0.0002580952644825136\n", "text_embeddings_8 4.806226570508443e-05 0.005267894494816061 0.00022036486132209068\n", "text_embeddings_66 1.6554382455069572e-05 0.0018144533746130727 7.590162761715874e-05\n", "[128 rows x 4 columns]\n", "\n" ] } ] }, { "cell_type": "code", "source": [ "# Get training timing info\n", "info = aml.training_info\n", "print(info)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "mNLljtXYlB9O", "outputId": "14c4ccdb-62ab-4d0e-a17b-d5092d1b9426" }, "execution_count": 26, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "{'creation_epoch': '1744212096', 'start_epoch': '1744212096', 'start_XGBoost_def_2': '1744212096', 'start_GLM_def_1': '1744212099', 'start_GBM_def_5': '1744212100', 'start_XGBoost_def_1': '1744212104', 'start_DRF_def_1': '1744212106', 'start_GBM_def_2': '1744212110', 'start_GBM_def_3': '1744212112', 'start_GBM_def_4': '1744212113', 'start_XGBoost_def_3': '1744212118', 'start_DRF_XRT': '1744212121', 'start_GBM_def_1': '1744212123', 'start_DeepLearning_def_1': '1744212125', 'start_XGBoost_grid_1': '1744212126', 'start_GBM_grid_1': '1744212139', 'start_DeepLearning_grid_1': '1744212141', 'start_DeepLearning_grid_2': '1744212171', 'start_DeepLearning_grid_3': '1744212204', 'stop_epoch': '1744212242', 'duration_secs': '146'}\n" ] } ] }, { "cell_type": "code", "source": [ "aml.leader.model_id" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 35 }, "id": "7XJb9DFnlFC_", "outputId": "4b41e87f-ec60-4720-f5ad-5c86bcde4a6e" }, "execution_count": 27, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "'XGBoost_2_AutoML_2_20250409_152135'" ], "application/vnd.google.colaboratory.intrinsic+json": { "type": "string" } }, "metadata": {}, "execution_count": 27 } ] }, { "cell_type": "code", "source": [ "preds_leader = aml.leader.predict(h2o_test)\n", "preds_leader" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 406 }, "id": "wJRQpJpqlHHp", "outputId": "49e8229e-b1d8-4d51-9aab-0473cf628c68" }, "execution_count": 28, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "xgboost prediction progress: |███████████████████████████████████████████████████| (done) 100%\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ " predict p0 p1\n", "--------- -------- ---------\n", " 1 0.470249 0.529751\n", " 1 0.26728 0.73272\n", " 1 0.308075 0.691925\n", " 1 0.820202 0.179798\n", " 1 0.815303 0.184697\n", " 1 0.855976 0.144024\n", " 1 0.777378 0.222622\n", " 1 0.932411 0.0675895\n", " 1 0.383299 0.616701\n", " 1 0.541873 0.458127\n", "[107 rows x 3 columns]\n" ], "text/html": [ "
predict | p0 | p1 |
---|---|---|
1 | 0.470249 | 0.529751 |
1 | 0.26728 | 0.73272 |
1 | 0.308075 | 0.691925 |
1 | 0.820202 | 0.179798 |
1 | 0.815303 | 0.184697 |
1 | 0.855976 | 0.144024 |
1 | 0.777378 | 0.222622 |
1 | 0.932411 | 0.0675895 |
1 | 0.383299 | 0.616701 |
1 | 0.541873 | 0.458127 |
[107 rows x 3 columns]" ] }, "metadata": {}, "execution_count": 28 } ] }, { "cell_type": "code", "source": [ "print(\"\\n TRAIN SET \\n\")\n", "train_predictions = aml.leader.predict(h2o_train).as_data_frame()['p1'].to_list()\n", "\n", "\n", "print(\"\\n VALID SET \\n\")\n", "valid_predictions = aml.leader.predict(h2o_valid).as_data_frame()['p1'].to_list()\n", "\n", "\n", "print(\"\\n TEST SET \\n\")\n", "test_predictions = aml.leader.predict(h2o_test).as_data_frame()['p1'].to_list()\n", "\n", "\n", "\n", "text_only_preds = {}\n", "text_only_preds['train_predictions'] = train_predictions\n", "text_only_preds['valid_predictions'] = valid_predictions\n", "text_only_preds['test_predictions'] = test_predictions" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "8C9FuDVSlLJl", "outputId": "a536cd02-540c-4405-c332-e4bb7a6b30b3" }, "execution_count": 30, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\n", " TRAIN SET \n", "\n", "xgboost prediction progress: |███████████████████████████████████████████████████| (done) 100%\n", "\n", " VALID SET \n", "\n", "xgboost prediction progress: |███████████████████████████████████████████████████| (done) 100%\n", "\n", " TEST SET \n", "\n", "xgboost prediction progress: |███████████████████████████████████████████████████| (done) 100%\n" ] } ] }, { "cell_type": "code", "source": [ "y_col = 'RESULT DATE+1 open price' #'TARGET-2 REGRESSION NORMALIZED'\n", "x_cols_to_use = ['RESULT DATE open price', 'SMA20', 'SMA50', 'RSI14',\n", " 'gdp_growth', 'inflation', 'NIFTY50_open', 'NIFTY50_close', 'NIFTY50_volume',\n", " 'Sales', 'Expenses', 'Operating Profit', 'OPM %', 'Other Income', 'Interest',\n", " 'Depreciation', 'Profit before tax', 'Tax %', 'Net Profit',\n", " 'EPS in Rs', 'Dividend Payout %', 'Equity Capital', 'Reserves',\n", " 'Borrowings', 'Other Liabilities', 'Total Liabilities',\n", " 'Fixed Assets', 'CWIP', 'Investments', 'Other Assets',\n", " 'Total Assets', 'Cash from Operating Activity',\n", " 'Cash from Investing Activity', 'Cash from Financing Activity',\n", " 'Net Cash Flow', 'Revenue', 'Financing Profit', 'Financing Margin %',\n", " 'Deposits', 'Borrowing'] + ['text_probab']\n", "\n", "train['text_probab'] = text_only_preds['train_predictions']\n", "valid['text_probab'] = text_only_preds['valid_predictions']\n", "test['text_probab'] = text_only_preds['test_predictions']\n", "\n", "\n", "\n", "h2o_train = h2o.H2OFrame(train[x_cols_to_use]) # Convert train DataFrame to H2OFrame\n", "h2o_valid = h2o.H2OFrame(valid[x_cols_to_use]) # Convert valid DataFrame to H2OFrame\n", "h2o_test = h2o.H2OFrame(test[x_cols_to_use]) # Convert test DataFrame to H2OFrame\n", "\n", "h2o_train[y_col] = h2o.H2OFrame(train[y_col].to_list()) # Convert Pandas Series to H2OFrame before assigning\n", "h2o_valid[y_col] = h2o.H2OFrame(valid[y_col].to_list()) # Convert Pandas Series to H2OFrame before assigning\n", "h2o_test[y_col] = h2o.H2OFrame(test[y_col].to_list()) # Convert Pandas Series to H2OFrame before assigning\n", "\n", "aml = H2OAutoML(max_models=20, seed=1,nfolds = 0)\n", "aml.train(x=x_cols_to_use, y=y_col, training_frame=h2o_train,validation_frame=h2o_valid)\n", "\n", "# View the AutoML Leaderboard\n", "lb = aml.leaderboard\n", "lb.head(rows=lb.nrows)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 844 }, "id": "sEXXSHnCKY5x", "outputId": "36139365-344a-4b90-dceb-06f70e0bfaea" }, "execution_count": 33, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "AutoML progress: |███████████████████████████████████████████████████████████████| (done) 100%\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "model_id rmse mse mae rmsle mean_residual_deviance\n", "---------------------------------------------------- -------- ---------------- --------- --------- ------------------------\n", "DeepLearning_grid_1_AutoML_3_20250409_153059_model_1 115.115 13251.4 78.0504 0.198571 13251.4\n", "DeepLearning_grid_2_AutoML_3_20250409_153059_model_1 219.796 48310.4 135.763 0.274313 48310.4\n", "DeepLearning_grid_3_AutoML_3_20250409_153059_model_1 283.643 80453.3 150.574 0.268955 80453.3\n", "DeepLearning_1_AutoML_3_20250409_153059 327.661 107362 163.088 0.31191 107362\n", "GBM_5_AutoML_3_20250409_153059 353.027 124628 121.656 0.058028 124628\n", "XGBoost_grid_1_AutoML_3_20250409_153059_model_2 359.132 128976 129.895 0.0806582 128976\n", "GBM_grid_1_AutoML_3_20250409_153059_model_2 364.131 132591 113.84 0.0775484 132591\n", "XGBoost_3_AutoML_3_20250409_153059 365.803 133812 133.642 0.0807689 133812\n", "XGBoost_2_AutoML_3_20250409_153059 369.732 136702 132.975 0.0898605 136702\n", "XGBoost_grid_1_AutoML_3_20250409_153059_model_3 372.733 138930 120.947 0.0713517 138930\n", "GBM_2_AutoML_3_20250409_153059 393.985 155224 123.257 0.0878179 155224\n", "GBM_3_AutoML_3_20250409_153059 397.278 157830 125.504 0.0984018 157830\n", "GBM_4_AutoML_3_20250409_153059 397.613 158096 119.102 0.0840173 158096\n", "XGBoost_grid_1_AutoML_3_20250409_153059_model_1 411.003 168924 165.744 0.106208 168924\n", "XGBoost_1_AutoML_3_20250409_153059 421.675 177810 156.022 0.0850261 177810\n", "GBM_grid_1_AutoML_3_20250409_153059_model_1 431.237 185966 184.649 0.240062 185966\n", "XRT_1_AutoML_3_20250409_153059 451.33 203698 170.92 0.138523 203698\n", "DRF_1_AutoML_3_20250409_153059 454.358 206441 163.565 0.0777229 206441\n", "GBM_1_AutoML_3_20250409_153059 1159.54 1.34453e+06 471.462 0.304123 1.34453e+06\n", "GLM_1_AutoML_3_20250409_153059 2474.66 6.12395e+06 1514.8 1.18928 6.12395e+06\n", "[20 rows x 6 columns]\n" ], "text/html": [ "
model_id | rmse | mse | mae | rmsle | mean_residual_deviance |
---|---|---|---|---|---|
DeepLearning_grid_1_AutoML_3_20250409_153059_model_1 | 115.115 | 13251.4 | 78.0504 | 0.198571 | 13251.4 |
DeepLearning_grid_2_AutoML_3_20250409_153059_model_1 | 219.796 | 48310.4 | 135.763 | 0.274313 | 48310.4 |
DeepLearning_grid_3_AutoML_3_20250409_153059_model_1 | 283.643 | 80453.3 | 150.574 | 0.268955 | 80453.3 |
DeepLearning_1_AutoML_3_20250409_153059 | 327.661 | 107362 | 163.088 | 0.31191 | 107362 |
GBM_5_AutoML_3_20250409_153059 | 353.027 | 124628 | 121.656 | 0.058028 | 124628 |
XGBoost_grid_1_AutoML_3_20250409_153059_model_2 | 359.132 | 128976 | 129.895 | 0.0806582 | 128976 |
GBM_grid_1_AutoML_3_20250409_153059_model_2 | 364.131 | 132591 | 113.84 | 0.0775484 | 132591 |
XGBoost_3_AutoML_3_20250409_153059 | 365.803 | 133812 | 133.642 | 0.0807689 | 133812 |
XGBoost_2_AutoML_3_20250409_153059 | 369.732 | 136702 | 132.975 | 0.0898605 | 136702 |
XGBoost_grid_1_AutoML_3_20250409_153059_model_3 | 372.733 | 138930 | 120.947 | 0.0713517 | 138930 |
GBM_2_AutoML_3_20250409_153059 | 393.985 | 155224 | 123.257 | 0.0878179 | 155224 |
GBM_3_AutoML_3_20250409_153059 | 397.278 | 157830 | 125.504 | 0.0984018 | 157830 |
GBM_4_AutoML_3_20250409_153059 | 397.613 | 158096 | 119.102 | 0.0840173 | 158096 |
XGBoost_grid_1_AutoML_3_20250409_153059_model_1 | 411.003 | 168924 | 165.744 | 0.106208 | 168924 |
XGBoost_1_AutoML_3_20250409_153059 | 421.675 | 177810 | 156.022 | 0.0850261 | 177810 |
GBM_grid_1_AutoML_3_20250409_153059_model_1 | 431.237 | 185966 | 184.649 | 0.240062 | 185966 |
XRT_1_AutoML_3_20250409_153059 | 451.33 | 203698 | 170.92 | 0.138523 | 203698 |
DRF_1_AutoML_3_20250409_153059 | 454.358 | 206441 | 163.565 | 0.0777229 | 206441 |
GBM_1_AutoML_3_20250409_153059 | 1159.54 | 1.34453e+06 | 471.462 | 0.304123 | 1.34453e+06 |
GLM_1_AutoML_3_20250409_153059 | 2474.66 | 6.12395e+06 | 1514.8 | 1.18928 | 6.12395e+06 |
[20 rows x 6 columns]" ] }, "metadata": {}, "execution_count": 33 } ] }, { "cell_type": "code", "source": [ "lb = h2o.automl.get_leaderboard(aml, extra_columns = \"ALL\")\n", "lb" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 409 }, "id": "_DWB7qlfLUne", "outputId": "83d3ea0b-20fd-46ba-906d-ddcfbb57ebcf" }, "execution_count": 34, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "model_id rmse mse mae rmsle mean_residual_deviance training_time_ms predict_time_per_row_ms algo\n", "---------------------------------------------------- ------- -------- -------- --------- ------------------------ ------------------ ------------------------- ------------\n", "DeepLearning_grid_1_AutoML_3_20250409_153059_model_1 115.115 13251.4 78.0504 0.198571 13251.4 81106 0.062635 DeepLearning\n", "DeepLearning_grid_2_AutoML_3_20250409_153059_model_1 219.796 48310.4 135.763 0.274313 48310.4 58250 0.09149 DeepLearning\n", "DeepLearning_grid_3_AutoML_3_20250409_153059_model_1 283.643 80453.3 150.574 0.268955 80453.3 40590 0.173145 DeepLearning\n", "DeepLearning_1_AutoML_3_20250409_153059 327.661 107362 163.088 0.31191 107362 483 0.025744 DeepLearning\n", "GBM_5_AutoML_3_20250409_153059 353.027 124628 121.656 0.058028 124628 1445 0.047336 GBM\n", "XGBoost_grid_1_AutoML_3_20250409_153059_model_2 359.132 128976 129.895 0.0806582 128976 4941 0.084215 XGBoost\n", "GBM_grid_1_AutoML_3_20250409_153059_model_2 364.131 132591 113.84 0.0775484 132591 1040 0.045228 GBM\n", "XGBoost_3_AutoML_3_20250409_153059 365.803 133812 133.642 0.0807689 133812 610 0.032342 XGBoost\n", "XGBoost_2_AutoML_3_20250409_153059 369.732 136702 132.975 0.0898605 136702 2056 0.040969 XGBoost\n", "XGBoost_grid_1_AutoML_3_20250409_153059_model_3 372.733 138930 120.947 0.0713517 138930 1874 0.032302 XGBoost\n", "[20 rows x 9 columns]\n" ], "text/html": [ "
model_id | rmse | mse | mae | rmsle | mean_residual_deviance | training_time_ms | predict_time_per_row_ms | algo |
---|---|---|---|---|---|---|---|---|
DeepLearning_grid_1_AutoML_3_20250409_153059_model_1 | 115.115 | 13251.4 | 78.0504 | 0.198571 | 13251.4 | 81106 | 0.062635 | DeepLearning |
DeepLearning_grid_2_AutoML_3_20250409_153059_model_1 | 219.796 | 48310.4 | 135.763 | 0.274313 | 48310.4 | 58250 | 0.09149 | DeepLearning |
DeepLearning_grid_3_AutoML_3_20250409_153059_model_1 | 283.643 | 80453.3 | 150.574 | 0.268955 | 80453.3 | 40590 | 0.173145 | DeepLearning |
DeepLearning_1_AutoML_3_20250409_153059 | 327.661 | 107362 | 163.088 | 0.31191 | 107362 | 483 | 0.025744 | DeepLearning |
GBM_5_AutoML_3_20250409_153059 | 353.027 | 124628 | 121.656 | 0.058028 | 124628 | 1445 | 0.047336 | GBM |
XGBoost_grid_1_AutoML_3_20250409_153059_model_2 | 359.132 | 128976 | 129.895 | 0.0806582 | 128976 | 4941 | 0.084215 | XGBoost |
GBM_grid_1_AutoML_3_20250409_153059_model_2 | 364.131 | 132591 | 113.84 | 0.0775484 | 132591 | 1040 | 0.045228 | GBM |
XGBoost_3_AutoML_3_20250409_153059 | 365.803 | 133812 | 133.642 | 0.0807689 | 133812 | 610 | 0.032342 | XGBoost |
XGBoost_2_AutoML_3_20250409_153059 | 369.732 | 136702 | 132.975 | 0.0898605 | 136702 | 2056 | 0.040969 | XGBoost |
XGBoost_grid_1_AutoML_3_20250409_153059_model_3 | 372.733 | 138930 | 120.947 | 0.0713517 | 138930 | 1874 | 0.032302 | XGBoost |
[20 rows x 9 columns]" ] }, "metadata": {}, "execution_count": 34 } ] }, { "cell_type": "code", "source": [ "# Get the best model using the metric\n", "m = aml.leader\n", "print(m)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "zJX3XjFHLV1s", "outputId": "fd5f6a1a-77cb-42f5-e1e1-e38593af241d" }, "execution_count": 35, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Model Details\n", "=============\n", "H2ODeepLearningEstimator : Deep Learning\n", "Model Key: DeepLearning_grid_1_AutoML_3_20250409_153059_model_1\n", "\n", "\n", "Status of Neuron Layers: predicting RESULT DATE+1 open price, regression, gaussian distribution, Quadratic loss, 28,201 weights/biases, 346.8 KB, 858,931 training samples, mini-batch size 1\n", " layer units type dropout l1 l2 mean_rate rate_rms momentum mean_weight weight_rms mean_bias bias_rms\n", "-- ------- ------- ---------------- --------- ---- ---- --------------------- --------------------- ---------- ---------------------- ------------------- -------------------- -----------------------\n", " 1 280 Input 15.0\n", " 2 100 RectifierDropout 10.0 0.0 0.0 0.04534329561915365 0.1347193717956543 0.0 -0.0048023015300245305 0.07585853338241577 0.06739497309629429 0.1536393165588379\n", " 3 1 Linear 0.0 0.0 0.0021420995789230802 0.0016298778355121613 0.0 0.018227952951565384 0.10617497563362122 -0.23974569455258748 1.0971281125650402e-154\n", "\n", "ModelMetricsRegression: deeplearning\n", "** Reported on train data. **\n", "\n", "MSE: 9173.741318110073\n", "RMSE: 95.77964981200377\n", "MAE: 72.66573385585798\n", "RMSLE: NaN\n", "Mean Residual Deviance: 9173.741318110073\n", "\n", "ModelMetricsRegression: deeplearning\n", "** Reported on validation data. **\n", "\n", "MSE: 13251.392204832708\n", "RMSE: 115.1146915247255\n", "MAE: 78.05043438612668\n", "RMSLE: 0.19857098335218032\n", "Mean Residual Deviance: 13251.392204832708\n", "\n", "Scoring History: \n", " timestamp duration training_speed epochs iterations samples training_rmse training_deviance training_mae training_r2 validation_rmse validation_deviance validation_mae validation_r2\n", "-- ------------------- ---------------- ---------------- -------- ------------ --------- --------------- ------------------- -------------- ------------- ----------------- --------------------- ---------------- ---------------\n", " 2025-04-09 15:31:45 0.000 sec 0 0 0 nan nan nan nan nan nan nan nan\n", " 2025-04-09 15:31:46 1.225 sec 7777 obs/sec 9.62861 1 8011 268.819 72263.4 208.437 0.972513 362.259 131232 258.831 0.97669\n", " 2025-04-09 15:31:51 6.267 sec 9403 obs/sec 67.5517 7 56203 243.589 59335.6 158.98 0.97743 220.515 48627 146.444 0.991362\n", " 2025-04-09 15:31:56 11.598 sec 7836 obs/sec 106.173 11 88336 217.947 47501.1 141.468 0.981932 214.145 45857.9 141.017 0.991854\n", " 2025-04-09 15:32:02 17.166 sec 9565 obs/sec 193.077 20 160640 236.658 56007 138.355 0.978696 245.581 60310.2 179.234 0.989287\n", " 2025-04-09 15:32:07 22.589 sec 9805 obs/sec 260.573 27 216797 250.98 62990.8 136.343 0.97604 205.631 42284.3 149.644 0.992489\n", " 2025-04-09 15:32:13 28.042 sec 9334 obs/sec 308.879 32 256987 269.767 72774.3 124.139 0.972319 200.255 40102 151.834 0.992877\n", " 2025-04-09 15:32:18 33.512 sec 9996 obs/sec 395.794 41 329301 206.496 42640.7 117.108 0.983781 192.205 36942.6 138.162 0.993438\n", " 2025-04-09 15:32:23 38.556 sec 9740 obs/sec 444.06 46 369458 127.498 16255.7 91.034 0.993817 148.004 21905.1 112.624 0.996109\n", " 2025-04-09 15:32:29 44.001 sec 9637 obs/sec 502.006 52 417669 151.472 22943.7 117.446 0.991273 168.935 28539.1 126.815 0.994931\n", " 2025-04-09 15:32:34 49.136 sec 9615 obs/sec 559.846 58 465792 133.393 17793.8 101.435 0.993232 129.569 16788.1 96.4624 0.997018\n", " 2025-04-09 15:32:39 54.236 sec 9607 obs/sec 617.743 64 513962 119.925 14381.9 92.0844 0.994529 119.316 14236.4 88.808 0.997471\n", " 2025-04-09 15:32:45 59.627 sec 9687 obs/sec 685.221 71 570104 95.7796 9173.74 72.6657 0.996511 115.115 13251.4 78.0504 0.997646\n", " 2025-04-09 15:32:50 1 min 5.233 sec 10098 obs/sec 781.655 81 650337 104.341 10887 74.5243 0.995859 115.824 13415.1 90.5743 0.997617\n", " 2025-04-09 15:32:56 1 min 10.724 sec 10113 obs/sec 849.118 88 706466 89.6967 8045.5 63.0588 0.99694 134.554 18104.8 98.6566 0.996784\n", " 2025-04-09 15:33:01 1 min 15.901 sec 10489 obs/sec 945.573 98 786717 84.7465 7181.96 58.7717 0.997268 156.665 24544 122.798 0.99564\n", " 2025-04-09 15:33:06 1 min 21.118 sec 10715 obs/sec 1032.37 107 858931 104.103 10837.4 63.9932 0.995878 126.884 16099.5 89.5696 0.99714\n", " 2025-04-09 15:33:06 1 min 21.185 sec 10713 obs/sec 1032.37 107 858931 95.7796 9173.74 72.6657 0.996511 115.115 13251.4 78.0504 0.997646\n", "\n", "Variable Importances: \n", "variable relative_importance scaled_importance percentage\n", "------------------------------ --------------------- ------------------- ---------------------\n", "RESULT DATE open price 1.0 1.0 0.015160175860818066\n", "SMA20 0.7217313051223755 0.7217313051223755 0.010941573509912955\n", "SMA50 0.6360406279563904 0.6360406279563904 0.009642487774444033\n", "Tax % 0.4826675355434418 0.4826675355434418 0.007317324721146231\n", "Equity Capital 0.33975687623023987 0.33975687623023987 0.005150773993572634\n", "CWIP 0.31883957982063293 0.31883957982063293 0.004833664101470134\n", "Borrowing.46043.0 0.2975037693977356 0.2975037693977356 0.004510209463325935\n", "Revenue.33741.0 0.2882390022277832 0.2882390022277832 0.004369753963719924\n", "Financing Profit.2579.0 0.28453347086906433 0.28453347086906433 0.0043135774566639695\n", "Borrowing.206214.0 0.2839178442955017 0.2839178442955017 0.004304244449544167\n", "--- --- --- ---\n", "NIFTY50_open 0.08175812661647797 0.08175812661647797 0.0012394675775568363\n", "inflation 0.07582783699035645 0.07582783699035645 0.001149563343919249\n", "NIFTY50_close 0.07514502108097076 0.07514502108097076 0.0011392117346523975\n", "NIFTY50_volume 0.06987543404102325 0.06987543404102325 0.0010593238684129056\n", "gdp_growth 0.06714197248220444 0.06714197248220444 0.0010178841104724265\n", "Revenue.missing(NA) 0.0 0.0 0.0\n", "Financing Profit.missing(NA) 0.0 0.0 0.0\n", "Borrowing.missing(NA) 0.0 0.0 0.0\n", "Financing Margin %.missing(NA) 0.0 0.0 0.0\n", "Deposits.missing(NA) 0.0 0.0 0.0\n", "[280 rows x 4 columns]\n", "\n" ] } ] }, { "cell_type": "code", "source": [ "# this is equivalent to\n", "m = aml.get_best_model()\n", "print(m)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "OMpmg38CLYIa", "outputId": "5bebe6a3-a33f-4951-9718-dbfeed29f4f8" }, "execution_count": 36, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Model Details\n", "=============\n", "H2ODeepLearningEstimator : Deep Learning\n", "Model Key: DeepLearning_grid_1_AutoML_3_20250409_153059_model_1\n", "\n", "\n", "Status of Neuron Layers: predicting RESULT DATE+1 open price, regression, gaussian distribution, Quadratic loss, 28,201 weights/biases, 346.8 KB, 858,931 training samples, mini-batch size 1\n", " layer units type dropout l1 l2 mean_rate rate_rms momentum mean_weight weight_rms mean_bias bias_rms\n", "-- ------- ------- ---------------- --------- ---- ---- --------------------- --------------------- ---------- ---------------------- ------------------- -------------------- -----------------------\n", " 1 280 Input 15.0\n", " 2 100 RectifierDropout 10.0 0.0 0.0 0.04534329561915365 0.1347193717956543 0.0 -0.0048023015300245305 0.07585853338241577 0.06739497309629429 0.1536393165588379\n", " 3 1 Linear 0.0 0.0 0.0021420995789230802 0.0016298778355121613 0.0 0.018227952951565384 0.10617497563362122 -0.23974569455258748 1.0971281125650402e-154\n", "\n", "ModelMetricsRegression: deeplearning\n", "** Reported on train data. **\n", "\n", "MSE: 9173.741318110073\n", "RMSE: 95.77964981200377\n", "MAE: 72.66573385585798\n", "RMSLE: NaN\n", "Mean Residual Deviance: 9173.741318110073\n", "\n", "ModelMetricsRegression: deeplearning\n", "** Reported on validation data. **\n", "\n", "MSE: 13251.392204832708\n", "RMSE: 115.1146915247255\n", "MAE: 78.05043438612668\n", "RMSLE: 0.19857098335218032\n", "Mean Residual Deviance: 13251.392204832708\n", "\n", "Scoring History: \n", " timestamp duration training_speed epochs iterations samples training_rmse training_deviance training_mae training_r2 validation_rmse validation_deviance validation_mae validation_r2\n", "-- ------------------- ---------------- ---------------- -------- ------------ --------- --------------- ------------------- -------------- ------------- ----------------- --------------------- ---------------- ---------------\n", " 2025-04-09 15:31:45 0.000 sec 0 0 0 nan nan nan nan nan nan nan nan\n", " 2025-04-09 15:31:46 1.225 sec 7777 obs/sec 9.62861 1 8011 268.819 72263.4 208.437 0.972513 362.259 131232 258.831 0.97669\n", " 2025-04-09 15:31:51 6.267 sec 9403 obs/sec 67.5517 7 56203 243.589 59335.6 158.98 0.97743 220.515 48627 146.444 0.991362\n", " 2025-04-09 15:31:56 11.598 sec 7836 obs/sec 106.173 11 88336 217.947 47501.1 141.468 0.981932 214.145 45857.9 141.017 0.991854\n", " 2025-04-09 15:32:02 17.166 sec 9565 obs/sec 193.077 20 160640 236.658 56007 138.355 0.978696 245.581 60310.2 179.234 0.989287\n", " 2025-04-09 15:32:07 22.589 sec 9805 obs/sec 260.573 27 216797 250.98 62990.8 136.343 0.97604 205.631 42284.3 149.644 0.992489\n", " 2025-04-09 15:32:13 28.042 sec 9334 obs/sec 308.879 32 256987 269.767 72774.3 124.139 0.972319 200.255 40102 151.834 0.992877\n", " 2025-04-09 15:32:18 33.512 sec 9996 obs/sec 395.794 41 329301 206.496 42640.7 117.108 0.983781 192.205 36942.6 138.162 0.993438\n", " 2025-04-09 15:32:23 38.556 sec 9740 obs/sec 444.06 46 369458 127.498 16255.7 91.034 0.993817 148.004 21905.1 112.624 0.996109\n", " 2025-04-09 15:32:29 44.001 sec 9637 obs/sec 502.006 52 417669 151.472 22943.7 117.446 0.991273 168.935 28539.1 126.815 0.994931\n", " 2025-04-09 15:32:34 49.136 sec 9615 obs/sec 559.846 58 465792 133.393 17793.8 101.435 0.993232 129.569 16788.1 96.4624 0.997018\n", " 2025-04-09 15:32:39 54.236 sec 9607 obs/sec 617.743 64 513962 119.925 14381.9 92.0844 0.994529 119.316 14236.4 88.808 0.997471\n", " 2025-04-09 15:32:45 59.627 sec 9687 obs/sec 685.221 71 570104 95.7796 9173.74 72.6657 0.996511 115.115 13251.4 78.0504 0.997646\n", " 2025-04-09 15:32:50 1 min 5.233 sec 10098 obs/sec 781.655 81 650337 104.341 10887 74.5243 0.995859 115.824 13415.1 90.5743 0.997617\n", " 2025-04-09 15:32:56 1 min 10.724 sec 10113 obs/sec 849.118 88 706466 89.6967 8045.5 63.0588 0.99694 134.554 18104.8 98.6566 0.996784\n", " 2025-04-09 15:33:01 1 min 15.901 sec 10489 obs/sec 945.573 98 786717 84.7465 7181.96 58.7717 0.997268 156.665 24544 122.798 0.99564\n", " 2025-04-09 15:33:06 1 min 21.118 sec 10715 obs/sec 1032.37 107 858931 104.103 10837.4 63.9932 0.995878 126.884 16099.5 89.5696 0.99714\n", " 2025-04-09 15:33:06 1 min 21.185 sec 10713 obs/sec 1032.37 107 858931 95.7796 9173.74 72.6657 0.996511 115.115 13251.4 78.0504 0.997646\n", "\n", "Variable Importances: \n", "variable relative_importance scaled_importance percentage\n", "------------------------------ --------------------- ------------------- ---------------------\n", "RESULT DATE open price 1.0 1.0 0.015160175860818066\n", "SMA20 0.7217313051223755 0.7217313051223755 0.010941573509912955\n", "SMA50 0.6360406279563904 0.6360406279563904 0.009642487774444033\n", "Tax % 0.4826675355434418 0.4826675355434418 0.007317324721146231\n", "Equity Capital 0.33975687623023987 0.33975687623023987 0.005150773993572634\n", "CWIP 0.31883957982063293 0.31883957982063293 0.004833664101470134\n", "Borrowing.46043.0 0.2975037693977356 0.2975037693977356 0.004510209463325935\n", "Revenue.33741.0 0.2882390022277832 0.2882390022277832 0.004369753963719924\n", "Financing Profit.2579.0 0.28453347086906433 0.28453347086906433 0.0043135774566639695\n", "Borrowing.206214.0 0.2839178442955017 0.2839178442955017 0.004304244449544167\n", "--- --- --- ---\n", "NIFTY50_open 0.08175812661647797 0.08175812661647797 0.0012394675775568363\n", "inflation 0.07582783699035645 0.07582783699035645 0.001149563343919249\n", "NIFTY50_close 0.07514502108097076 0.07514502108097076 0.0011392117346523975\n", "NIFTY50_volume 0.06987543404102325 0.06987543404102325 0.0010593238684129056\n", "gdp_growth 0.06714197248220444 0.06714197248220444 0.0010178841104724265\n", "Revenue.missing(NA) 0.0 0.0 0.0\n", "Financing Profit.missing(NA) 0.0 0.0 0.0\n", "Borrowing.missing(NA) 0.0 0.0 0.0\n", "Financing Margin %.missing(NA) 0.0 0.0 0.0\n", "Deposits.missing(NA) 0.0 0.0 0.0\n", "[280 rows x 4 columns]\n", "\n" ] } ] }, { "cell_type": "code", "source": [ "# Get the best model using a non-default metric\n", "m = aml.get_best_model(criterion=\"RMSE\")\n", "print(m)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "FiOVLrGkLa2B", "outputId": "705eee7b-7337-419f-9c36-b20be64e4237" }, "execution_count": 37, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Model Details\n", "=============\n", "H2ODeepLearningEstimator : Deep Learning\n", "Model Key: DeepLearning_grid_1_AutoML_3_20250409_153059_model_1\n", "\n", "\n", "Status of Neuron Layers: predicting RESULT DATE+1 open price, regression, gaussian distribution, Quadratic loss, 28,201 weights/biases, 346.8 KB, 858,931 training samples, mini-batch size 1\n", " layer units type dropout l1 l2 mean_rate rate_rms momentum mean_weight weight_rms mean_bias bias_rms\n", "-- ------- ------- ---------------- --------- ---- ---- --------------------- --------------------- ---------- ---------------------- ------------------- -------------------- -----------------------\n", " 1 280 Input 15.0\n", " 2 100 RectifierDropout 10.0 0.0 0.0 0.04534329561915365 0.1347193717956543 0.0 -0.0048023015300245305 0.07585853338241577 0.06739497309629429 0.1536393165588379\n", " 3 1 Linear 0.0 0.0 0.0021420995789230802 0.0016298778355121613 0.0 0.018227952951565384 0.10617497563362122 -0.23974569455258748 1.0971281125650402e-154\n", "\n", "ModelMetricsRegression: deeplearning\n", "** Reported on train data. **\n", "\n", "MSE: 9173.741318110073\n", "RMSE: 95.77964981200377\n", "MAE: 72.66573385585798\n", "RMSLE: NaN\n", "Mean Residual Deviance: 9173.741318110073\n", "\n", "ModelMetricsRegression: deeplearning\n", "** Reported on validation data. **\n", "\n", "MSE: 13251.392204832708\n", "RMSE: 115.1146915247255\n", "MAE: 78.05043438612668\n", "RMSLE: 0.19857098335218032\n", "Mean Residual Deviance: 13251.392204832708\n", "\n", "Scoring History: \n", " timestamp duration training_speed epochs iterations samples training_rmse training_deviance training_mae training_r2 validation_rmse validation_deviance validation_mae validation_r2\n", "-- ------------------- ---------------- ---------------- -------- ------------ --------- --------------- ------------------- -------------- ------------- ----------------- --------------------- ---------------- ---------------\n", " 2025-04-09 15:31:45 0.000 sec 0 0 0 nan nan nan nan nan nan nan nan\n", " 2025-04-09 15:31:46 1.225 sec 7777 obs/sec 9.62861 1 8011 268.819 72263.4 208.437 0.972513 362.259 131232 258.831 0.97669\n", " 2025-04-09 15:31:51 6.267 sec 9403 obs/sec 67.5517 7 56203 243.589 59335.6 158.98 0.97743 220.515 48627 146.444 0.991362\n", " 2025-04-09 15:31:56 11.598 sec 7836 obs/sec 106.173 11 88336 217.947 47501.1 141.468 0.981932 214.145 45857.9 141.017 0.991854\n", " 2025-04-09 15:32:02 17.166 sec 9565 obs/sec 193.077 20 160640 236.658 56007 138.355 0.978696 245.581 60310.2 179.234 0.989287\n", " 2025-04-09 15:32:07 22.589 sec 9805 obs/sec 260.573 27 216797 250.98 62990.8 136.343 0.97604 205.631 42284.3 149.644 0.992489\n", " 2025-04-09 15:32:13 28.042 sec 9334 obs/sec 308.879 32 256987 269.767 72774.3 124.139 0.972319 200.255 40102 151.834 0.992877\n", " 2025-04-09 15:32:18 33.512 sec 9996 obs/sec 395.794 41 329301 206.496 42640.7 117.108 0.983781 192.205 36942.6 138.162 0.993438\n", " 2025-04-09 15:32:23 38.556 sec 9740 obs/sec 444.06 46 369458 127.498 16255.7 91.034 0.993817 148.004 21905.1 112.624 0.996109\n", " 2025-04-09 15:32:29 44.001 sec 9637 obs/sec 502.006 52 417669 151.472 22943.7 117.446 0.991273 168.935 28539.1 126.815 0.994931\n", " 2025-04-09 15:32:34 49.136 sec 9615 obs/sec 559.846 58 465792 133.393 17793.8 101.435 0.993232 129.569 16788.1 96.4624 0.997018\n", " 2025-04-09 15:32:39 54.236 sec 9607 obs/sec 617.743 64 513962 119.925 14381.9 92.0844 0.994529 119.316 14236.4 88.808 0.997471\n", " 2025-04-09 15:32:45 59.627 sec 9687 obs/sec 685.221 71 570104 95.7796 9173.74 72.6657 0.996511 115.115 13251.4 78.0504 0.997646\n", " 2025-04-09 15:32:50 1 min 5.233 sec 10098 obs/sec 781.655 81 650337 104.341 10887 74.5243 0.995859 115.824 13415.1 90.5743 0.997617\n", " 2025-04-09 15:32:56 1 min 10.724 sec 10113 obs/sec 849.118 88 706466 89.6967 8045.5 63.0588 0.99694 134.554 18104.8 98.6566 0.996784\n", " 2025-04-09 15:33:01 1 min 15.901 sec 10489 obs/sec 945.573 98 786717 84.7465 7181.96 58.7717 0.997268 156.665 24544 122.798 0.99564\n", " 2025-04-09 15:33:06 1 min 21.118 sec 10715 obs/sec 1032.37 107 858931 104.103 10837.4 63.9932 0.995878 126.884 16099.5 89.5696 0.99714\n", " 2025-04-09 15:33:06 1 min 21.185 sec 10713 obs/sec 1032.37 107 858931 95.7796 9173.74 72.6657 0.996511 115.115 13251.4 78.0504 0.997646\n", "\n", "Variable Importances: \n", "variable relative_importance scaled_importance percentage\n", "------------------------------ --------------------- ------------------- ---------------------\n", "RESULT DATE open price 1.0 1.0 0.015160175860818066\n", "SMA20 0.7217313051223755 0.7217313051223755 0.010941573509912955\n", "SMA50 0.6360406279563904 0.6360406279563904 0.009642487774444033\n", "Tax % 0.4826675355434418 0.4826675355434418 0.007317324721146231\n", "Equity Capital 0.33975687623023987 0.33975687623023987 0.005150773993572634\n", "CWIP 0.31883957982063293 0.31883957982063293 0.004833664101470134\n", "Borrowing.46043.0 0.2975037693977356 0.2975037693977356 0.004510209463325935\n", "Revenue.33741.0 0.2882390022277832 0.2882390022277832 0.004369753963719924\n", "Financing Profit.2579.0 0.28453347086906433 0.28453347086906433 0.0043135774566639695\n", "Borrowing.206214.0 0.2839178442955017 0.2839178442955017 0.004304244449544167\n", "--- --- --- ---\n", "NIFTY50_open 0.08175812661647797 0.08175812661647797 0.0012394675775568363\n", "inflation 0.07582783699035645 0.07582783699035645 0.001149563343919249\n", "NIFTY50_close 0.07514502108097076 0.07514502108097076 0.0011392117346523975\n", "NIFTY50_volume 0.06987543404102325 0.06987543404102325 0.0010593238684129056\n", "gdp_growth 0.06714197248220444 0.06714197248220444 0.0010178841104724265\n", "Revenue.missing(NA) 0.0 0.0 0.0\n", "Financing Profit.missing(NA) 0.0 0.0 0.0\n", "Borrowing.missing(NA) 0.0 0.0 0.0\n", "Financing Margin %.missing(NA) 0.0 0.0 0.0\n", "Deposits.missing(NA) 0.0 0.0 0.0\n", "[280 rows x 4 columns]\n", "\n" ] } ] }, { "cell_type": "code", "source": [ "# Get training timing info\n", "info = aml.training_info\n", "print(info)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "QjYm40bYLdNt", "outputId": "62fbb703-2a75-4577-d9ce-d6e3debdc110" }, "execution_count": 38, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "{'creation_epoch': '1744212660', 'start_epoch': '1744212660', 'start_XGBoost_def_2': '1744212660', 'start_GLM_def_1': '1744212669', 'start_GBM_def_5': '1744212670', 'start_XGBoost_def_1': '1744212672', 'start_DRF_def_1': '1744212674', 'start_GBM_def_2': '1744212678', 'start_GBM_def_3': '1744212680', 'start_GBM_def_4': '1744212684', 'start_XGBoost_def_3': '1744212688', 'start_DRF_XRT': '1744212688', 'start_GBM_def_1': '1744212692', 'start_DeepLearning_def_1': '1744212693', 'start_XGBoost_grid_1': '1744212694', 'start_GBM_grid_1': '1744212703', 'start_DeepLearning_grid_1': '1744212705', 'start_DeepLearning_grid_2': '1744212787', 'start_DeepLearning_grid_3': '1744212845', 'stop_epoch': '1744212886', 'duration_secs': '226'}\n" ] } ] }, { "cell_type": "code", "source": [ "aml.leader.model_id" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 35 }, "id": "1lU0X7MULhaw", "outputId": "366925fd-82a5-4731-8fc8-ded57d309ad3" }, "execution_count": 39, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "'DeepLearning_grid_1_AutoML_3_20250409_153059_model_1'" ], "application/vnd.google.colaboratory.intrinsic+json": { "type": "string" } }, "metadata": {}, "execution_count": 39 } ] }, { "cell_type": "code", "source": [ "preds_leader = aml.leader.predict(h2o_test)\n", "preds_leader" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 406 }, "id": "Y87tqIQDLjrq", "outputId": "b6632d43-dbf8-454a-b7eb-15f065be8bf3" }, "execution_count": 40, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "deeplearning prediction progress: |██████████████████████████████████████████████| (done) 100%\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ " predict\n", "---------\n", " 111.347\n", " 949.212\n", "1912.91\n", " 79.4909\n", " 121.781\n", "2905.96\n", "4425.99\n", " 637.457\n", " 684.523\n", " 991.548\n", "[107 rows x 1 column]\n" ], "text/html": [ "
predict |
---|
111.347 |
949.212 |
1912.91 |
79.4909 |
121.781 |
2905.96 |
4425.99 |
637.457 |
684.523 |
991.548 |
[107 rows x 1 column]" ] }, "metadata": {}, "execution_count": 40 } ] }, { "cell_type": "code", "source": [ "print(\"\\n TRAIN SET \\n\")\n", "train_predictions = aml.leader.predict(h2o_train).as_data_frame()['predict'].to_list()\n", "print(calculate_regression_metrics(train[y_col], train_predictions))\n", "\n", "print(\"\\n VALID SET \\n\")\n", "valid_predictions = aml.leader.predict(h2o_valid).as_data_frame()['predict'].to_list()\n", "print(calculate_regression_metrics(valid[y_col], valid_predictions))\n", "\n", "print(\"\\n TEST SET \\n\")\n", "test_predictions = aml.leader.predict(h2o_test).as_data_frame()['predict'].to_list()\n", "print(calculate_regression_metrics(test[y_col],test_predictions))" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "hN7dhhXsLl-Z", "outputId": "6a276831-6e04-4c9e-a9af-b65192b953bb" }, "execution_count": 41, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\n", " TRAIN SET \n", "\n", "deeplearning prediction progress: |██████████████████████████████████████████████| (done) 100%\n", "{'MAE': 72.6657340887975, 'RMSE': np.float64(95.77964918899451), 'MAPE': 0.27260300292523304}\n", "\n", " VALID SET \n", "\n", "deeplearning prediction progress: |██████████████████████████████████████████████| (done) 100%\n", "{'MAE': 78.05043850896263, 'RMSE': np.float64(115.11468693949165), 'MAPE': 0.12153298746353784}\n", "\n", " TEST SET \n", "\n", "deeplearning prediction progress: |██████████████████████████████████████████████| (done) 100%\n", "{'MAE': 125.20351368229714, 'RMSE': np.float64(216.63874679442355), 'MAPE': 0.3489434709529733}\n" ] } ] }, { "cell_type": "markdown", "source": [ "# Using Numeric, Text Data Classifier Probabilities, and Image Data Classifier Probabilities" ], "metadata": { "id": "IbbSroQQmaX5" } }, { "cell_type": "code", "source": [ "for col in final_with_funda.columns:\n", " if 'text_embeddings' in col:\n", " print(col)\n", " del final_with_funda[col]\n", "\n", "# all_embeddings_128 = pickle.load(open(path + 'getting_all_texts_together_embeddings_dim128_CPU.pkl', 'rb'))\n", "# final_with_funda['text_embeddings'] = all_embeddings_128\n", "\n", "# for i in range(128):\n", "# final_with_funda['text_embeddings_' + str(i)] = final_with_funda['text_embeddings'].apply(lambda x : x[i])\n", "\n", "# text_features = ['text_embeddings_' + str(i) for i in range(128)]" ], "metadata": { "id": "YSTz6UtNp45q", "colab": { "base_uri": "https://localhost:8080/" }, "outputId": "b53efc5a-7646-4e0f-e182-8671cb538bad" }, "execution_count": 43, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "text_embeddings\n", "text_embeddings_0\n", "text_embeddings_1\n", "text_embeddings_2\n", "text_embeddings_3\n", "text_embeddings_4\n", "text_embeddings_5\n", "text_embeddings_6\n", "text_embeddings_7\n", "text_embeddings_8\n", "text_embeddings_9\n", "text_embeddings_10\n", "text_embeddings_11\n", "text_embeddings_12\n", "text_embeddings_13\n", "text_embeddings_14\n", "text_embeddings_15\n", "text_embeddings_16\n", "text_embeddings_17\n", "text_embeddings_18\n", "text_embeddings_19\n", "text_embeddings_20\n", "text_embeddings_21\n", "text_embeddings_22\n", "text_embeddings_23\n", "text_embeddings_24\n", "text_embeddings_25\n", "text_embeddings_26\n", "text_embeddings_27\n", "text_embeddings_28\n", "text_embeddings_29\n", "text_embeddings_30\n", "text_embeddings_31\n", "text_embeddings_32\n", "text_embeddings_33\n", "text_embeddings_34\n", "text_embeddings_35\n", "text_embeddings_36\n", "text_embeddings_37\n", "text_embeddings_38\n", "text_embeddings_39\n", "text_embeddings_40\n", "text_embeddings_41\n", "text_embeddings_42\n", "text_embeddings_43\n", "text_embeddings_44\n", "text_embeddings_45\n", "text_embeddings_46\n", "text_embeddings_47\n", "text_embeddings_48\n", "text_embeddings_49\n", "text_embeddings_50\n", "text_embeddings_51\n", "text_embeddings_52\n", "text_embeddings_53\n", "text_embeddings_54\n", "text_embeddings_55\n", "text_embeddings_56\n", "text_embeddings_57\n", "text_embeddings_58\n", "text_embeddings_59\n", "text_embeddings_60\n", "text_embeddings_61\n", "text_embeddings_62\n", "text_embeddings_63\n", "text_embeddings_64\n", "text_embeddings_65\n", "text_embeddings_66\n", "text_embeddings_67\n", "text_embeddings_68\n", "text_embeddings_69\n", "text_embeddings_70\n", "text_embeddings_71\n", "text_embeddings_72\n", "text_embeddings_73\n", "text_embeddings_74\n", "text_embeddings_75\n", "text_embeddings_76\n", "text_embeddings_77\n", "text_embeddings_78\n", "text_embeddings_79\n", "text_embeddings_80\n", "text_embeddings_81\n", "text_embeddings_82\n", "text_embeddings_83\n", "text_embeddings_84\n", "text_embeddings_85\n", "text_embeddings_86\n", "text_embeddings_87\n", "text_embeddings_88\n", "text_embeddings_89\n", "text_embeddings_90\n", "text_embeddings_91\n", "text_embeddings_92\n", "text_embeddings_93\n", "text_embeddings_94\n", "text_embeddings_95\n", "text_embeddings_96\n", "text_embeddings_97\n", "text_embeddings_98\n", "text_embeddings_99\n", "text_embeddings_100\n", "text_embeddings_101\n", "text_embeddings_102\n", "text_embeddings_103\n", "text_embeddings_104\n", "text_embeddings_105\n", "text_embeddings_106\n", "text_embeddings_107\n", "text_embeddings_108\n", "text_embeddings_109\n", "text_embeddings_110\n", "text_embeddings_111\n", "text_embeddings_112\n", "text_embeddings_113\n", "text_embeddings_114\n", "text_embeddings_115\n", "text_embeddings_116\n", "text_embeddings_117\n", "text_embeddings_118\n", "text_embeddings_119\n", "text_embeddings_120\n", "text_embeddings_121\n", "text_embeddings_122\n", "text_embeddings_123\n", "text_embeddings_124\n", "text_embeddings_125\n", "text_embeddings_126\n", "text_embeddings_127\n" ] } ] }, { "cell_type": "code", "source": [ "img_emd_df = pd.read_csv(path + \"image_embedding_mean_pooled_128_dim_CPU_df.csv\")\n", "final_with_funda = pd.concat([final_with_funda, img_emd_df] , axis = 1)" ], "metadata": { "id": "oIDoIMmlmeHm" }, "execution_count": 44, "outputs": [] }, { "cell_type": "code", "source": [ "image_features = [\"image_embedding_\" + str(i) for i in range(128)]\n", "\n", "train = final_with_funda[final_with_funda['split'] == 'train']\n", "valid = final_with_funda[final_with_funda['split'] == 'validation']\n", "test = final_with_funda[final_with_funda['split'] == 'test']\n", "\n", "x_cols_to_use = image_features" ], "metadata": { "id": "LquPqDzGo4ae" }, "execution_count": 48, "outputs": [] }, { "cell_type": "code", "source": [ "y_col = 'classification' #'RESULT DATE+1 open price'#'TARGET-2 REGRESSION NORMALIZED'\n", "\n", "h2o_train = h2o.H2OFrame(train[x_cols_to_use]) # Convert train DataFrame to H2OFrame\n", "h2o_valid = h2o.H2OFrame(valid[x_cols_to_use]) # Convert valid DataFrame to H2OFrame\n", "h2o_test = h2o.H2OFrame(test[x_cols_to_use]) # Convert test DataFrame to H2OFrame\n", "\n", "h2o_train[y_col] = h2o.H2OFrame(train[y_col].to_list()).asfactor() # Convert Pandas Series to H2OFrame before assigning\n", "h2o_valid[y_col] = h2o.H2OFrame(valid[y_col].to_list()).asfactor() # Convert Pandas Series to H2OFrame before assigning\n", "h2o_test[y_col] = h2o.H2OFrame(test[y_col].to_list()).asfactor() # Convert Pandas Series to H2OFrame before assigning\n", "\n", "aml = H2OAutoML(max_models=20, seed=1,nfolds = 0)\n", "aml.train(x=x_cols_to_use, y=y_col, training_frame=h2o_train,validation_frame=h2o_valid)\n", "\n", "# View the AutoML Leaderboard\n", "lb = aml.leaderboard\n", "lb.head(rows=lb.nrows)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 844 }, "id": "0NrGS04FqMfQ", "outputId": "4d498c24-ac2c-4626-e42c-126af926e038" }, "execution_count": 49, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "AutoML progress: |███████████████████████████████████████████████████████████████| (done) 100%\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "model_id auc logloss aucpr mean_per_class_error rmse mse\n", "---------------------------------------------------- -------- --------- -------- ---------------------- -------- --------\n", "XRT_1_AutoML_4_20250409_154354 0.503017 0.733152 0.484082 0.480392 0.516668 0.266945\n", "XGBoost_grid_1_AutoML_4_20250409_154354_model_1 0.488499 0.847333 0.503155 0.5 0.548085 0.300397\n", "GBM_grid_1_AutoML_4_20250409_154354_model_2 0.487745 0.724781 0.476677 0.470588 0.514349 0.264555\n", "GLM_1_AutoML_4_20250409_154354 0.486991 0.692994 0.534541 0.4704 0.499927 0.249927\n", "GBM_2_AutoML_4_20250409_154354 0.481335 0.792884 0.465885 0.490196 0.537859 0.289292\n", "GBM_4_AutoML_4_20250409_154354 0.479072 0.766912 0.484253 0.480392 0.530249 0.281163\n", "XGBoost_3_AutoML_4_20250409_154354 0.477941 0.868045 0.477292 0.5 0.557476 0.310779\n", "DeepLearning_grid_2_AutoML_4_20250409_154354_model_1 0.473039 1.05933 0.456692 0.450603 0.596275 0.355543\n", "DeepLearning_1_AutoML_4_20250409_154354 0.472662 0.857147 0.486409 0.5 0.550378 0.302916\n", "DeepLearning_grid_3_AutoML_4_20250409_154354_model_1 0.468514 0.844478 0.459279 0.5 0.549941 0.302435\n", "DRF_1_AutoML_4_20250409_154354 0.467195 0.760494 0.452942 0.5 0.527926 0.278706\n", "DeepLearning_grid_1_AutoML_4_20250409_154354_model_1 0.462858 1.32825 0.463777 0.5 0.60405 0.364876\n", "XGBoost_grid_1_AutoML_4_20250409_154354_model_3 0.458333 0.917929 0.45348 0.5 0.568323 0.322991\n", "GBM_1_AutoML_4_20250409_154354 0.45494 0.719961 0.459342 0.470211 0.512716 0.262878\n", "GBM_5_AutoML_4_20250409_154354 0.453808 0.776823 0.455488 0.460219 0.53518 0.286418\n", "XGBoost_grid_1_AutoML_4_20250409_154354_model_2 0.4523 0.860165 0.447011 0.5 0.559062 0.31255\n", "GBM_grid_1_AutoML_4_20250409_154354_model_1 0.439103 0.796162 0.464251 0.490008 0.543544 0.29544\n", "XGBoost_2_AutoML_4_20250409_154354 0.435332 1.03246 0.449842 0.5 0.594755 0.353734\n", "XGBoost_1_AutoML_4_20250409_154354 0.429299 0.86822 0.437805 0.5 0.563479 0.317509\n", "GBM_3_AutoML_4_20250409_154354 0.40856 0.819399 0.431929 0.480392 0.552144 0.304863\n", "[20 rows x 7 columns]\n" ], "text/html": [ "
model_id | auc | logloss | aucpr | mean_per_class_error | rmse | mse |
---|---|---|---|---|---|---|
XRT_1_AutoML_4_20250409_154354 | 0.503017 | 0.733152 | 0.484082 | 0.480392 | 0.516668 | 0.266945 |
XGBoost_grid_1_AutoML_4_20250409_154354_model_1 | 0.488499 | 0.847333 | 0.503155 | 0.5 | 0.548085 | 0.300397 |
GBM_grid_1_AutoML_4_20250409_154354_model_2 | 0.487745 | 0.724781 | 0.476677 | 0.470588 | 0.514349 | 0.264555 |
GLM_1_AutoML_4_20250409_154354 | 0.486991 | 0.692994 | 0.534541 | 0.4704 | 0.499927 | 0.249927 |
GBM_2_AutoML_4_20250409_154354 | 0.481335 | 0.792884 | 0.465885 | 0.490196 | 0.537859 | 0.289292 |
GBM_4_AutoML_4_20250409_154354 | 0.479072 | 0.766912 | 0.484253 | 0.480392 | 0.530249 | 0.281163 |
XGBoost_3_AutoML_4_20250409_154354 | 0.477941 | 0.868045 | 0.477292 | 0.5 | 0.557476 | 0.310779 |
DeepLearning_grid_2_AutoML_4_20250409_154354_model_1 | 0.473039 | 1.05933 | 0.456692 | 0.450603 | 0.596275 | 0.355543 |
DeepLearning_1_AutoML_4_20250409_154354 | 0.472662 | 0.857147 | 0.486409 | 0.5 | 0.550378 | 0.302916 |
DeepLearning_grid_3_AutoML_4_20250409_154354_model_1 | 0.468514 | 0.844478 | 0.459279 | 0.5 | 0.549941 | 0.302435 |
DRF_1_AutoML_4_20250409_154354 | 0.467195 | 0.760494 | 0.452942 | 0.5 | 0.527926 | 0.278706 |
DeepLearning_grid_1_AutoML_4_20250409_154354_model_1 | 0.462858 | 1.32825 | 0.463777 | 0.5 | 0.60405 | 0.364876 |
XGBoost_grid_1_AutoML_4_20250409_154354_model_3 | 0.458333 | 0.917929 | 0.45348 | 0.5 | 0.568323 | 0.322991 |
GBM_1_AutoML_4_20250409_154354 | 0.45494 | 0.719961 | 0.459342 | 0.470211 | 0.512716 | 0.262878 |
GBM_5_AutoML_4_20250409_154354 | 0.453808 | 0.776823 | 0.455488 | 0.460219 | 0.53518 | 0.286418 |
XGBoost_grid_1_AutoML_4_20250409_154354_model_2 | 0.4523 | 0.860165 | 0.447011 | 0.5 | 0.559062 | 0.31255 |
GBM_grid_1_AutoML_4_20250409_154354_model_1 | 0.439103 | 0.796162 | 0.464251 | 0.490008 | 0.543544 | 0.29544 |
XGBoost_2_AutoML_4_20250409_154354 | 0.435332 | 1.03246 | 0.449842 | 0.5 | 0.594755 | 0.353734 |
XGBoost_1_AutoML_4_20250409_154354 | 0.429299 | 0.86822 | 0.437805 | 0.5 | 0.563479 | 0.317509 |
GBM_3_AutoML_4_20250409_154354 | 0.40856 | 0.819399 | 0.431929 | 0.480392 | 0.552144 | 0.304863 |
[20 rows x 7 columns]" ] }, "metadata": {}, "execution_count": 49 } ] }, { "cell_type": "code", "source": [ "lb = h2o.automl.get_leaderboard(aml, extra_columns = \"ALL\")\n", "lb" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 409 }, "id": "INdYsJVVq9lX", "outputId": "b67b1b31-8f3e-44f5-efb3-021bcdd4ec3c" }, "execution_count": 50, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "model_id auc logloss aucpr mean_per_class_error rmse mse training_time_ms predict_time_per_row_ms algo\n", "---------------------------------------------------- -------- --------- -------- ---------------------- -------- -------- ------------------ ------------------------- ------------\n", "XRT_1_AutoML_4_20250409_154354 0.503017 0.733152 0.484082 0.480392 0.516668 0.266945 1101 0.129188 DRF\n", "XGBoost_grid_1_AutoML_4_20250409_154354_model_1 0.488499 0.847333 0.503155 0.5 0.548085 0.300397 1456 0.102439 XGBoost\n", "GBM_grid_1_AutoML_4_20250409_154354_model_2 0.487745 0.724781 0.476677 0.470588 0.514349 0.264555 1472 0.096619 GBM\n", "GLM_1_AutoML_4_20250409_154354 0.486991 0.692994 0.534541 0.4704 0.499927 0.249927 573 0.145861 GLM\n", "GBM_2_AutoML_4_20250409_154354 0.481335 0.792884 0.465885 0.490196 0.537859 0.289292 1917 0.13284 GBM\n", "GBM_4_AutoML_4_20250409_154354 0.479072 0.766912 0.484253 0.480392 0.530249 0.281163 1843 0.101481 GBM\n", "XGBoost_3_AutoML_4_20250409_154354 0.477941 0.868045 0.477292 0.5 0.557476 0.310779 999 0.090673 XGBoost\n", "DeepLearning_grid_2_AutoML_4_20250409_154354_model_1 0.473039 1.05933 0.456692 0.450603 0.596275 0.355543 32263 0.134248 DeepLearning\n", "DeepLearning_1_AutoML_4_20250409_154354 0.472662 0.857147 0.486409 0.5 0.550378 0.302916 353 0.0919 DeepLearning\n", "DeepLearning_grid_3_AutoML_4_20250409_154354_model_1 0.468514 0.844478 0.459279 0.5 0.549941 0.302435 33586 0.160156 DeepLearning\n", "[20 rows x 10 columns]\n" ], "text/html": [ "
model_id | auc | logloss | aucpr | mean_per_class_error | rmse | mse | training_time_ms | predict_time_per_row_ms | algo |
---|---|---|---|---|---|---|---|---|---|
XRT_1_AutoML_4_20250409_154354 | 0.503017 | 0.733152 | 0.484082 | 0.480392 | 0.516668 | 0.266945 | 1101 | 0.129188 | DRF |
XGBoost_grid_1_AutoML_4_20250409_154354_model_1 | 0.488499 | 0.847333 | 0.503155 | 0.5 | 0.548085 | 0.300397 | 1456 | 0.102439 | XGBoost |
GBM_grid_1_AutoML_4_20250409_154354_model_2 | 0.487745 | 0.724781 | 0.476677 | 0.470588 | 0.514349 | 0.264555 | 1472 | 0.096619 | GBM |
GLM_1_AutoML_4_20250409_154354 | 0.486991 | 0.692994 | 0.534541 | 0.4704 | 0.499927 | 0.249927 | 573 | 0.145861 | GLM |
GBM_2_AutoML_4_20250409_154354 | 0.481335 | 0.792884 | 0.465885 | 0.490196 | 0.537859 | 0.289292 | 1917 | 0.13284 | GBM |
GBM_4_AutoML_4_20250409_154354 | 0.479072 | 0.766912 | 0.484253 | 0.480392 | 0.530249 | 0.281163 | 1843 | 0.101481 | GBM |
XGBoost_3_AutoML_4_20250409_154354 | 0.477941 | 0.868045 | 0.477292 | 0.5 | 0.557476 | 0.310779 | 999 | 0.090673 | XGBoost |
DeepLearning_grid_2_AutoML_4_20250409_154354_model_1 | 0.473039 | 1.05933 | 0.456692 | 0.450603 | 0.596275 | 0.355543 | 32263 | 0.134248 | DeepLearning |
DeepLearning_1_AutoML_4_20250409_154354 | 0.472662 | 0.857147 | 0.486409 | 0.5 | 0.550378 | 0.302916 | 353 | 0.0919 | DeepLearning |
DeepLearning_grid_3_AutoML_4_20250409_154354_model_1 | 0.468514 | 0.844478 | 0.459279 | 0.5 | 0.549941 | 0.302435 | 33586 | 0.160156 | DeepLearning |
[20 rows x 10 columns]" ] }, "metadata": {}, "execution_count": 50 } ] }, { "cell_type": "code", "source": [ "# Get the best model using the metric\n", "m = aml.leader\n", "print(m)\n", "# this is equivalent to\n", "m = aml.get_best_model()\n", "print(m)\n", "# Get the best model using a non-default metric\n", "m = aml.get_best_model(criterion=\"logloss\")\n", "print(m)\n", "# Get training timing info\n", "info = aml.training_info\n", "print(info)\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "HZ4-ceidq-_w", "outputId": "be9a876e-6d63-42bf-d9fc-345df60648d8" }, "execution_count": 51, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Could not find exact threshold 0.0; using closest threshold found 0.0.\n", "Model Details\n", "=============\n", "H2ORandomForestEstimator : Distributed Random Forest\n", "Model Key: XRT_1_AutoML_4_20250409_154354\n", "\n", "\n", "Model Summary: \n", " number_of_trees number_of_internal_trees model_size_in_bytes min_depth max_depth mean_depth min_leaves max_leaves mean_leaves\n", "-- ----------------- -------------------------- --------------------- ----------- ----------- ------------ ------------ ------------ -------------\n", " 40 40 54873 13 20 16.5 94 115 104.475\n", "\n", "ModelMetricsBinomial: drf\n", "** Reported on train data. **\n", "\n", "MSE: 0.27357332063544987\n", "RMSE: 0.5230423698281526\n", "LogLoss: 0.8737924656542455\n", "Mean Per-Class Error: 0.5\n", "AUC: 0.5218963125650214\n", "AUCPR: 0.5305415130974961\n", "Gini: 0.043792625130042895\n", "\n", "Confusion Matrix (Act/Pred) for max f1 @ threshold = 0.0\n", " 0 1 Error Rate\n", "----- --- --- ------- -------------\n", "0 0 410 1 (410.0/410.0)\n", "1 0 422 0 (0.0/422.0)\n", "Total 0 832 0.4928 (410.0/832.0)\n", "\n", "Maximum Metrics: Maximum metrics at their respective thresholds\n", "metric threshold value idx\n", "--------------------------- ----------- --------- -----\n", "max f1 0 0.673046 383\n", "max f2 0 0.837302 383\n", "max f0point5 0.0909091 0.563475 378\n", "max accuracy 0.505051 0.536058 281\n", "max precision 1 0.75 0\n", "max recall 0 1 383\n", "max specificity 1 0.997561 0\n", "max absolute_mcc 0.505051 0.0706843 281\n", "max min_per_class_accuracy 0.527509 0.492683 211\n", "max mean_per_class_accuracy 0.505051 0.534782 281\n", "max tns 1 409 0\n", "max fns 1 419 0\n", "max fps 0.0625 410 382\n", "max tps 0 422 383\n", "max tnr 1 0.997561 0\n", "max fnr 1 0.992891 0\n", "max fpr 0.0625 1 382\n", "max tpr 0 1 383\n", "\n", "Gains/Lift Table: Avg response rate: 50.72 %, avg score: 51.72 %\n", "group cumulative_data_fraction lower_threshold lift cumulative_lift response_rate score cumulative_response_rate cumulative_score capture_rate cumulative_capture_rate gain cumulative_gain kolmogorov_smirnov\n", "------- -------------------------- ----------------- -------- ----------------- --------------- -------- -------------------------- ------------------ -------------- ------------------------- -------- ----------------- --------------------\n", "1 0.0108173 0.937269 1.31438 1.31438 0.666667 0.976276 0.666667 0.976276 0.014218 0.014218 31.4376 31.4376 0.00690094\n", "2 0.0216346 0.9 0.876251 1.09531 0.444444 0.910603 0.555556 0.943439 0.00947867 0.0236967 -12.3749 9.53133 0.00418449\n", "3 0.0300481 0.86725 0.844956 1.02521 0.428571 0.885818 0.52 0.927305 0.007109 0.0308057 -15.5044 2.52133 0.00153739\n", "4 0.0408654 0.848966 1.31438 1.10176 0.666667 0.859016 0.558824 0.909229 0.014218 0.0450237 31.4376 10.1756 0.00843833\n", "5 0.0504808 0.827941 1.23223 1.12661 0.625 0.841038 0.571429 0.89624 0.0118483 0.056872 23.2227 12.6608 0.0129696\n", "6 0.104567 0.75 1.00769 1.0651 0.511111 0.781686 0.54023 0.836988 0.0545024 0.111374 0.768826 6.50978 0.0138134\n", "7 0.155048 0.6875 1.22049 1.11569 0.619048 0.708304 0.565891 0.795091 0.0616114 0.172986 22.0492 11.5691 0.0364004\n", "8 0.209135 0.647059 0.920063 1.0651 0.466667 0.661059 0.54023 0.760428 0.049763 0.222749 -7.99368 6.50978 0.0276269\n", "9 0.307692 0.571429 1.08196 1.0705 0.54878 0.608311 0.542969 0.711703 0.106635 0.329384 8.19558 7.04976 0.044018\n", "10 0.40024 0.534287 0.793747 1.0065 0.402597 0.545712 0.510511 0.67332 0.0734597 0.402844 -20.6253 0.650413 0.00528263\n", "11 0.5 0.527439 0.902644 0.985782 0.457831 0.530691 0.5 0.644863 0.0900474 0.492891 -9.73562 -1.4218 -0.0144261\n", "12 0.644231 0.5 1.24866 1.04463 0.633333 0.513626 0.529851 0.615482 0.180095 0.672986 24.8657 4.46346 0.0583516\n", "13 0.700721 0.45 0.880912 1.03144 0.446809 0.466114 0.523156 0.60344 0.049763 0.722749 -11.9088 3.14357 0.0447\n", "14 0.800481 0.384615 0.950151 1.02131 0.481928 0.41356 0.518018 0.579776 0.0947867 0.817536 -4.98487 2.13057 0.0346087\n", "15 0.902644 0.285714 0.81182 0.997596 0.411765 0.335175 0.505992 0.552092 0.0829384 0.900474 -18.818 -0.240438 -0.00440412\n", "16 1 0 1.02229 1 0.518519 0.193554 0.507212 0.517186 0.0995261 1 2.22924 0 0\n", "\n", "ModelMetricsBinomial: drf\n", "** Reported on validation data. **\n", "\n", "MSE: 0.26694534134080883\n", "RMSE: 0.5166675346301612\n", "LogLoss: 0.733151810715092\n", "Mean Per-Class Error: 0.4803921568627451\n", "AUC: 0.5030165912518854\n", "AUCPR: 0.48408172623538337\n", "Gini: 0.006033182503770718\n", "\n", "Confusion Matrix (Act/Pred) for max f1 @ threshold = 0.26249999999999996\n", " 0 1 Error Rate\n", "----- --- --- ------- ------------\n", "0 2 49 0.9608 (49.0/51.0)\n", "1 0 52 0 (0.0/52.0)\n", "Total 2 101 0.4757 (49.0/103.0)\n", "\n", "Maximum Metrics: Maximum metrics at their respective thresholds\n", "metric threshold value idx\n", "--------------------------- ----------- -------- -----\n", "max f1 0.2625 0.679739 44\n", "max f2 0.2625 0.841424 44\n", "max f0point5 0.4625 0.596591 30\n", "max accuracy 0.4625 0.582524 30\n", "max precision 0.4625 0.56 30\n", "max recall 0.2625 1 44\n", "max specificity 0.872449 0.980392 0\n", "max absolute_mcc 0.4625 0.180515 30\n", "max min_per_class_accuracy 0.529681 0.490196 20\n", "max mean_per_class_accuracy 0.4625 0.580317 30\n", "max tns 0.872449 50 0\n", "max fns 0.872449 52 0\n", "max fps 0.175 51 46\n", "max tps 0.2625 52 44\n", "max tnr 0.872449 0.980392 0\n", "max fnr 0.872449 1 0\n", "max fpr 0.175 1 46\n", "max tpr 0.2625 1 44\n", "\n", "Gains/Lift Table: Avg response rate: 50.49 %, avg score: 51.42 %\n", "group cumulative_data_fraction lower_threshold lift cumulative_lift response_rate score cumulative_response_rate cumulative_score capture_rate cumulative_capture_rate gain cumulative_gain kolmogorov_smirnov\n", "------- -------------------------- ----------------- -------- ----------------- --------------- -------- -------------------------- ------------------ -------------- ------------------------- -------- ----------------- --------------------\n", "1 0.0194175 0.764477 0 0 0 0.818611 0 0.818611 0 0 -100 -100 -0.0392157\n", "2 0.0291262 0.749898 1.98077 0.660256 1 0.75 0.333333 0.795741 0.0192308 0.0192308 98.0769 -33.9744 -0.0199849\n", "3 0.038835 0.747313 1.98077 0.990385 1 0.747449 0.5 0.783668 0.0192308 0.0384615 98.0769 -0.961538 -0.000754148\n", "4 0.0485437 0.744563 0 0.792308 0 0.745177 0.4 0.775969 0 0.0384615 -100 -20.7692 -0.020362\n", "5 0.0582524 0.73625 1.98077 0.990385 1 0.7375 0.5 0.769558 0.0192308 0.0576923 98.0769 -0.961538 -0.00113122\n", "6 0.106796 0.72 0.792308 0.90035 0.4 0.725 0.454545 0.749304 0.0384615 0.0961538 -20.7692 -9.96503 -0.0214932\n", "7 0.15534 0.6425 0.792308 0.866587 0.4 0.685 0.4375 0.729209 0.0384615 0.134615 -20.7692 -13.3413 -0.0418552\n", "8 0.213592 0.6 0.330128 0.72028 0.166667 0.612075 0.363636 0.697263 0.0192308 0.153846 -66.9872 -27.972 -0.120664\n", "9 0.339806 0.55 1.21893 0.905495 0.615385 0.56729 0.457143 0.648988 0.153846 0.307692 21.8935 -9.45055 -0.0648567\n", "10 0.524272 0.529681 1.25101 1.02707 0.631579 0.530498 0.518519 0.607297 0.230769 0.538462 25.1012 2.70655 0.0286576\n", "11 0.650485 0.5 1.06657 1.03473 0.538462 0.510986 0.522388 0.58861 0.134615 0.673077 6.6568 3.47302 0.0456259\n", "12 0.708738 0.475 1.65064 1.08535 0.833333 0.479398 0.547945 0.579633 0.0961538 0.769231 65.0641 8.5353 0.122172\n", "13 0.796117 0.400909 0.880342 1.06285 0.444444 0.440758 0.536585 0.564391 0.0769231 0.846154 -11.9658 6.28518 0.101056\n", "14 0.902913 0.325 0.36014 0.979735 0.181818 0.366477 0.494624 0.540982 0.0384615 0.884615 -63.986 -2.02647 -0.0369532\n", "15 1 0.175 1.18846 1 0.6 0.265083 0.504854 0.514196 0.115385 1 18.8462 0 0\n", "\n", "Scoring History: \n", " timestamp duration number_of_trees training_rmse training_logloss training_auc training_pr_auc training_lift training_classification_error validation_rmse validation_logloss validation_auc validation_pr_auc validation_lift validation_classification_error\n", "-- ------------------- ---------- ----------------- --------------- ------------------ -------------- ----------------- --------------- ------------------------------- ----------------- -------------------- ---------------- ------------------- ----------------- ---------------------------------\n", " 2025-04-09 15:44:08 0.003 sec 0 nan nan nan nan nan nan nan nan nan nan nan nan\n", " 2025-04-09 15:44:08 0.134 sec 5 0.612095 8.68454 0.4993 0.500615 0.975067 0.496032 0.54931 2.057 0.483786 0.486203 0.990385 0.485437\n", " 2025-04-09 15:44:08 0.269 sec 10 0.567014 4.71586 0.517176 0.519524 0.995739 0.493917 0.533117 1.09021 0.494155 0.471029 0 0.456311\n", " 2025-04-09 15:44:08 0.405 sec 15 0.546601 2.73683 0.518128 0.530648 1.0715 0.493381 0.528227 0.764315 0.486048 0.461115 0 0.446602\n", " 2025-04-09 15:44:08 0.543 sec 20 0.537079 1.78979 0.522478 0.533993 1.24136 0.493381 0.524952 0.755205 0.502074 0.486332 0 0.485437\n", " 2025-04-09 15:44:08 0.673 sec 25 0.529604 1.1952 0.515466 0.532999 1.54909 0.492788 0.518512 0.73966 0.510181 0.490486 0 0.466019\n", " 2025-04-09 15:44:09 0.815 sec 30 0.526731 1.03656 0.517221 0.533481 1.43386 0.492788 0.513769 0.728093 0.518477 0.510371 1.32051 0.475728\n", " 2025-04-09 15:44:09 0.954 sec 35 0.523509 0.913184 0.525754 0.538357 1.43386 0.492788 0.511981 0.722618 0.517345 0.500646 0.990385 0.466019\n", " 2025-04-09 15:44:09 1.085 sec 40 0.523042 0.873792 0.521896 0.530542 1.31438 0.492788 0.516668 0.733152 0.503017 0.484082 0 0.475728\n", "\n", "Variable Importances: \n", "variable relative_importance scaled_importance percentage\n", "------------------- --------------------- ------------------- --------------------\n", "image_embedding_102 57.265804290771484 1.0 0.013768384106252987\n", "image_embedding_2 57.028099060058594 0.9958490894582407 0.013711232775523349\n", "image_embedding_58 55.984230041503906 0.9776206015939235 0.013460255952931259\n", "image_embedding_119 52.04658889770508 0.9088598255502456 0.012513531176917864\n", "image_embedding_121 49.1323356628418 0.8579698874631817 0.011812858962191733\n", "image_embedding_74 48.09544372558594 0.8398632363806096 0.01156355963520898\n", "image_embedding_112 47.8549690246582 0.8356639641638656 0.011505742442362132\n", "image_embedding_26 46.8930549621582 0.8188666088413802 0.01127447000231294\n", "image_embedding_34 46.083770751953125 0.804734541367118 0.011079894269111813\n", "image_embedding_29 44.053897857666016 0.7692880315446019 0.010591853106649344\n", "--- --- --- ---\n", "image_embedding_79 23.79640769958496 0.41554306264095914 0.005721356499129471\n", "image_embedding_72 23.59850311279297 0.412087167988941 0.00567377441412974\n", "image_embedding_118 22.900894165039062 0.3999052217752505 0.005506048699497935\n", "image_embedding_98 22.726417541503906 0.3968584362512188 0.005464099386113695\n", "image_embedding_59 22.507030487060547 0.3930274055486829 0.005411352283878332\n", "image_embedding_77 20.217405319213867 0.3530449902800361 0.004860859032963889\n", "image_embedding_33 19.780132293701172 0.3454091414357169 0.004755725733098014\n", "image_embedding_3 19.47235870361328 0.34003466719407094 0.00468172790736987\n", "image_embedding_71 19.449649810791016 0.3396381147819724 0.004676268021441837\n", "image_embedding_81 19.439210891723633 0.33945582590649664 0.004673758198185989\n", "[128 rows x 4 columns]\n", "\n", "Could not find exact threshold 0.0; using closest threshold found 0.0.\n", "Model Details\n", "=============\n", "H2ORandomForestEstimator : Distributed Random Forest\n", "Model Key: XRT_1_AutoML_4_20250409_154354\n", "\n", "\n", "Model Summary: \n", " number_of_trees number_of_internal_trees model_size_in_bytes min_depth max_depth mean_depth min_leaves max_leaves mean_leaves\n", "-- ----------------- -------------------------- --------------------- ----------- ----------- ------------ ------------ ------------ -------------\n", " 40 40 54873 13 20 16.5 94 115 104.475\n", "\n", "ModelMetricsBinomial: drf\n", "** Reported on train data. **\n", "\n", "MSE: 0.27357332063544987\n", "RMSE: 0.5230423698281526\n", "LogLoss: 0.8737924656542455\n", "Mean Per-Class Error: 0.5\n", "AUC: 0.5218963125650214\n", "AUCPR: 0.5305415130974961\n", "Gini: 0.043792625130042895\n", "\n", "Confusion Matrix (Act/Pred) for max f1 @ threshold = 0.0\n", " 0 1 Error Rate\n", "----- --- --- ------- -------------\n", "0 0 410 1 (410.0/410.0)\n", "1 0 422 0 (0.0/422.0)\n", "Total 0 832 0.4928 (410.0/832.0)\n", "\n", "Maximum Metrics: Maximum metrics at their respective thresholds\n", "metric threshold value idx\n", "--------------------------- ----------- --------- -----\n", "max f1 0 0.673046 383\n", "max f2 0 0.837302 383\n", "max f0point5 0.0909091 0.563475 378\n", "max accuracy 0.505051 0.536058 281\n", "max precision 1 0.75 0\n", "max recall 0 1 383\n", "max specificity 1 0.997561 0\n", "max absolute_mcc 0.505051 0.0706843 281\n", "max min_per_class_accuracy 0.527509 0.492683 211\n", "max mean_per_class_accuracy 0.505051 0.534782 281\n", "max tns 1 409 0\n", "max fns 1 419 0\n", "max fps 0.0625 410 382\n", "max tps 0 422 383\n", "max tnr 1 0.997561 0\n", "max fnr 1 0.992891 0\n", "max fpr 0.0625 1 382\n", "max tpr 0 1 383\n", "\n", "Gains/Lift Table: Avg response rate: 50.72 %, avg score: 51.72 %\n", "group cumulative_data_fraction lower_threshold lift cumulative_lift response_rate score cumulative_response_rate cumulative_score capture_rate cumulative_capture_rate gain cumulative_gain kolmogorov_smirnov\n", "------- -------------------------- ----------------- -------- ----------------- --------------- -------- -------------------------- ------------------ -------------- ------------------------- -------- ----------------- --------------------\n", "1 0.0108173 0.937269 1.31438 1.31438 0.666667 0.976276 0.666667 0.976276 0.014218 0.014218 31.4376 31.4376 0.00690094\n", "2 0.0216346 0.9 0.876251 1.09531 0.444444 0.910603 0.555556 0.943439 0.00947867 0.0236967 -12.3749 9.53133 0.00418449\n", "3 0.0300481 0.86725 0.844956 1.02521 0.428571 0.885818 0.52 0.927305 0.007109 0.0308057 -15.5044 2.52133 0.00153739\n", "4 0.0408654 0.848966 1.31438 1.10176 0.666667 0.859016 0.558824 0.909229 0.014218 0.0450237 31.4376 10.1756 0.00843833\n", "5 0.0504808 0.827941 1.23223 1.12661 0.625 0.841038 0.571429 0.89624 0.0118483 0.056872 23.2227 12.6608 0.0129696\n", "6 0.104567 0.75 1.00769 1.0651 0.511111 0.781686 0.54023 0.836988 0.0545024 0.111374 0.768826 6.50978 0.0138134\n", "7 0.155048 0.6875 1.22049 1.11569 0.619048 0.708304 0.565891 0.795091 0.0616114 0.172986 22.0492 11.5691 0.0364004\n", "8 0.209135 0.647059 0.920063 1.0651 0.466667 0.661059 0.54023 0.760428 0.049763 0.222749 -7.99368 6.50978 0.0276269\n", "9 0.307692 0.571429 1.08196 1.0705 0.54878 0.608311 0.542969 0.711703 0.106635 0.329384 8.19558 7.04976 0.044018\n", "10 0.40024 0.534287 0.793747 1.0065 0.402597 0.545712 0.510511 0.67332 0.0734597 0.402844 -20.6253 0.650413 0.00528263\n", "11 0.5 0.527439 0.902644 0.985782 0.457831 0.530691 0.5 0.644863 0.0900474 0.492891 -9.73562 -1.4218 -0.0144261\n", "12 0.644231 0.5 1.24866 1.04463 0.633333 0.513626 0.529851 0.615482 0.180095 0.672986 24.8657 4.46346 0.0583516\n", "13 0.700721 0.45 0.880912 1.03144 0.446809 0.466114 0.523156 0.60344 0.049763 0.722749 -11.9088 3.14357 0.0447\n", "14 0.800481 0.384615 0.950151 1.02131 0.481928 0.41356 0.518018 0.579776 0.0947867 0.817536 -4.98487 2.13057 0.0346087\n", "15 0.902644 0.285714 0.81182 0.997596 0.411765 0.335175 0.505992 0.552092 0.0829384 0.900474 -18.818 -0.240438 -0.00440412\n", "16 1 0 1.02229 1 0.518519 0.193554 0.507212 0.517186 0.0995261 1 2.22924 0 0\n", "\n", "ModelMetricsBinomial: drf\n", "** Reported on validation data. **\n", "\n", "MSE: 0.26694534134080883\n", "RMSE: 0.5166675346301612\n", "LogLoss: 0.733151810715092\n", "Mean Per-Class Error: 0.4803921568627451\n", "AUC: 0.5030165912518854\n", "AUCPR: 0.48408172623538337\n", "Gini: 0.006033182503770718\n", "\n", "Confusion Matrix (Act/Pred) for max f1 @ threshold = 0.26249999999999996\n", " 0 1 Error Rate\n", "----- --- --- ------- ------------\n", "0 2 49 0.9608 (49.0/51.0)\n", "1 0 52 0 (0.0/52.0)\n", "Total 2 101 0.4757 (49.0/103.0)\n", "\n", "Maximum Metrics: Maximum metrics at their respective thresholds\n", "metric threshold value idx\n", "--------------------------- ----------- -------- -----\n", "max f1 0.2625 0.679739 44\n", "max f2 0.2625 0.841424 44\n", "max f0point5 0.4625 0.596591 30\n", "max accuracy 0.4625 0.582524 30\n", "max precision 0.4625 0.56 30\n", "max recall 0.2625 1 44\n", "max specificity 0.872449 0.980392 0\n", "max absolute_mcc 0.4625 0.180515 30\n", "max min_per_class_accuracy 0.529681 0.490196 20\n", "max mean_per_class_accuracy 0.4625 0.580317 30\n", "max tns 0.872449 50 0\n", "max fns 0.872449 52 0\n", "max fps 0.175 51 46\n", "max tps 0.2625 52 44\n", "max tnr 0.872449 0.980392 0\n", "max fnr 0.872449 1 0\n", "max fpr 0.175 1 46\n", "max tpr 0.2625 1 44\n", "\n", "Gains/Lift Table: Avg response rate: 50.49 %, avg score: 51.42 %\n", "group cumulative_data_fraction lower_threshold lift cumulative_lift response_rate score cumulative_response_rate cumulative_score capture_rate cumulative_capture_rate gain cumulative_gain kolmogorov_smirnov\n", "------- -------------------------- ----------------- -------- ----------------- --------------- -------- -------------------------- ------------------ -------------- ------------------------- -------- ----------------- --------------------\n", "1 0.0194175 0.764477 0 0 0 0.818611 0 0.818611 0 0 -100 -100 -0.0392157\n", "2 0.0291262 0.749898 1.98077 0.660256 1 0.75 0.333333 0.795741 0.0192308 0.0192308 98.0769 -33.9744 -0.0199849\n", "3 0.038835 0.747313 1.98077 0.990385 1 0.747449 0.5 0.783668 0.0192308 0.0384615 98.0769 -0.961538 -0.000754148\n", "4 0.0485437 0.744563 0 0.792308 0 0.745177 0.4 0.775969 0 0.0384615 -100 -20.7692 -0.020362\n", "5 0.0582524 0.73625 1.98077 0.990385 1 0.7375 0.5 0.769558 0.0192308 0.0576923 98.0769 -0.961538 -0.00113122\n", "6 0.106796 0.72 0.792308 0.90035 0.4 0.725 0.454545 0.749304 0.0384615 0.0961538 -20.7692 -9.96503 -0.0214932\n", "7 0.15534 0.6425 0.792308 0.866587 0.4 0.685 0.4375 0.729209 0.0384615 0.134615 -20.7692 -13.3413 -0.0418552\n", "8 0.213592 0.6 0.330128 0.72028 0.166667 0.612075 0.363636 0.697263 0.0192308 0.153846 -66.9872 -27.972 -0.120664\n", "9 0.339806 0.55 1.21893 0.905495 0.615385 0.56729 0.457143 0.648988 0.153846 0.307692 21.8935 -9.45055 -0.0648567\n", "10 0.524272 0.529681 1.25101 1.02707 0.631579 0.530498 0.518519 0.607297 0.230769 0.538462 25.1012 2.70655 0.0286576\n", "11 0.650485 0.5 1.06657 1.03473 0.538462 0.510986 0.522388 0.58861 0.134615 0.673077 6.6568 3.47302 0.0456259\n", "12 0.708738 0.475 1.65064 1.08535 0.833333 0.479398 0.547945 0.579633 0.0961538 0.769231 65.0641 8.5353 0.122172\n", "13 0.796117 0.400909 0.880342 1.06285 0.444444 0.440758 0.536585 0.564391 0.0769231 0.846154 -11.9658 6.28518 0.101056\n", "14 0.902913 0.325 0.36014 0.979735 0.181818 0.366477 0.494624 0.540982 0.0384615 0.884615 -63.986 -2.02647 -0.0369532\n", "15 1 0.175 1.18846 1 0.6 0.265083 0.504854 0.514196 0.115385 1 18.8462 0 0\n", "\n", "Scoring History: \n", " timestamp duration number_of_trees training_rmse training_logloss training_auc training_pr_auc training_lift training_classification_error validation_rmse validation_logloss validation_auc validation_pr_auc validation_lift validation_classification_error\n", "-- ------------------- ---------- ----------------- --------------- ------------------ -------------- ----------------- --------------- ------------------------------- ----------------- -------------------- ---------------- ------------------- ----------------- ---------------------------------\n", " 2025-04-09 15:44:08 0.003 sec 0 nan nan nan nan nan nan nan nan nan nan nan nan\n", " 2025-04-09 15:44:08 0.134 sec 5 0.612095 8.68454 0.4993 0.500615 0.975067 0.496032 0.54931 2.057 0.483786 0.486203 0.990385 0.485437\n", " 2025-04-09 15:44:08 0.269 sec 10 0.567014 4.71586 0.517176 0.519524 0.995739 0.493917 0.533117 1.09021 0.494155 0.471029 0 0.456311\n", " 2025-04-09 15:44:08 0.405 sec 15 0.546601 2.73683 0.518128 0.530648 1.0715 0.493381 0.528227 0.764315 0.486048 0.461115 0 0.446602\n", " 2025-04-09 15:44:08 0.543 sec 20 0.537079 1.78979 0.522478 0.533993 1.24136 0.493381 0.524952 0.755205 0.502074 0.486332 0 0.485437\n", " 2025-04-09 15:44:08 0.673 sec 25 0.529604 1.1952 0.515466 0.532999 1.54909 0.492788 0.518512 0.73966 0.510181 0.490486 0 0.466019\n", " 2025-04-09 15:44:09 0.815 sec 30 0.526731 1.03656 0.517221 0.533481 1.43386 0.492788 0.513769 0.728093 0.518477 0.510371 1.32051 0.475728\n", " 2025-04-09 15:44:09 0.954 sec 35 0.523509 0.913184 0.525754 0.538357 1.43386 0.492788 0.511981 0.722618 0.517345 0.500646 0.990385 0.466019\n", " 2025-04-09 15:44:09 1.085 sec 40 0.523042 0.873792 0.521896 0.530542 1.31438 0.492788 0.516668 0.733152 0.503017 0.484082 0 0.475728\n", "\n", "Variable Importances: \n", "variable relative_importance scaled_importance percentage\n", "------------------- --------------------- ------------------- --------------------\n", "image_embedding_102 57.265804290771484 1.0 0.013768384106252987\n", "image_embedding_2 57.028099060058594 0.9958490894582407 0.013711232775523349\n", "image_embedding_58 55.984230041503906 0.9776206015939235 0.013460255952931259\n", "image_embedding_119 52.04658889770508 0.9088598255502456 0.012513531176917864\n", "image_embedding_121 49.1323356628418 0.8579698874631817 0.011812858962191733\n", "image_embedding_74 48.09544372558594 0.8398632363806096 0.01156355963520898\n", "image_embedding_112 47.8549690246582 0.8356639641638656 0.011505742442362132\n", "image_embedding_26 46.8930549621582 0.8188666088413802 0.01127447000231294\n", "image_embedding_34 46.083770751953125 0.804734541367118 0.011079894269111813\n", "image_embedding_29 44.053897857666016 0.7692880315446019 0.010591853106649344\n", "--- --- --- ---\n", "image_embedding_79 23.79640769958496 0.41554306264095914 0.005721356499129471\n", "image_embedding_72 23.59850311279297 0.412087167988941 0.00567377441412974\n", "image_embedding_118 22.900894165039062 0.3999052217752505 0.005506048699497935\n", "image_embedding_98 22.726417541503906 0.3968584362512188 0.005464099386113695\n", "image_embedding_59 22.507030487060547 0.3930274055486829 0.005411352283878332\n", "image_embedding_77 20.217405319213867 0.3530449902800361 0.004860859032963889\n", "image_embedding_33 19.780132293701172 0.3454091414357169 0.004755725733098014\n", "image_embedding_3 19.47235870361328 0.34003466719407094 0.00468172790736987\n", "image_embedding_71 19.449649810791016 0.3396381147819724 0.004676268021441837\n", "image_embedding_81 19.439210891723633 0.33945582590649664 0.004673758198185989\n", "[128 rows x 4 columns]\n", "\n", "Model Details\n", "=============\n", "H2OGeneralizedLinearEstimator : Generalized Linear Modeling\n", "Model Key: GLM_1_AutoML_4_20250409_154354\n", "\n", "\n", "GLM Model: summary\n", " family link regularization lambda_search number_of_predictors_total number_of_active_predictors number_of_iterations training_frame\n", "-- -------- ------ ------------------------- ------------------------------------------------------------------------- ---------------------------- ----------------------------- ---------------------- ------------------------------------------------\n", " binomial logit Ridge ( lambda = 4.4996 ) nlambda = 30, lambda.max = 4.4996, lambda.min = 4.4996, lambda.1se = -1.0 128 128 2 AutoML_4_20250409_154354_training_py_33_sid_8ad7\n", "\n", "ModelMetricsBinomialGLM: glm\n", "** Reported on train data. **\n", "\n", "MSE: 0.24671077965958113\n", "RMSE: 0.4966998889264836\n", "LogLoss: 0.6865573685617513\n", "AUC: 0.6203357993295573\n", "AUCPR: 0.6311231274689704\n", "Gini: 0.24067159865911458\n", "Null degrees of freedom: 831\n", "Residual degrees of freedom: 703\n", "Null deviance: 1153.223825527466\n", "Residual deviance: 1142.4314612867543\n", "AIC: 1400.4314612867543\n", "\n", "Confusion Matrix (Act/Pred) for max f1 @ threshold = 0.48191718356880825\n", " 0 1 Error Rate\n", "----- --- --- ------- -------------\n", "0 39 371 0.9049 (371.0/410.0)\n", "1 3 419 0.0071 (3.0/422.0)\n", "Total 42 790 0.4495 (374.0/832.0)\n", "\n", "Maximum Metrics: Maximum metrics at their respective thresholds\n", "metric threshold value idx\n", "--------------------------- ----------- -------- -----\n", "max f1 0.481917 0.691419 363\n", "max f2 0.481917 0.84544 363\n", "max f0point5 0.496723 0.599146 286\n", "max accuracy 0.496723 0.581731 286\n", "max precision 0.584894 1 0\n", "max recall 0.472586 1 396\n", "max specificity 0.584894 1 0\n", "max absolute_mcc 0.481917 0.200982 363\n", "max min_per_class_accuracy 0.507302 0.481043 204\n", "max mean_per_class_accuracy 0.514329 0.580511 139\n", "max tns 0.584894 410 0\n", "max fns 0.584894 421 0\n", "max fps 0.465854 410 399\n", "max tps 0.472586 422 396\n", "max tnr 0.584894 1 0\n", "max fnr 0.584894 0.99763 0\n", "max fpr 0.465854 1 399\n", "max tpr 0.472586 1 396\n", "\n", "Gains/Lift Table: Avg response rate: 50.72 %, avg score: 50.72 %\n", "group cumulative_data_fraction lower_threshold lift cumulative_lift response_rate score cumulative_response_rate cumulative_score capture_rate cumulative_capture_rate gain cumulative_gain kolmogorov_smirnov\n", "------- -------------------------- ----------------- -------- ----------------- --------------- -------- -------------------------- ------------------ -------------- ------------------------- --------- ----------------- --------------------\n", "1 0.0108173 0.549577 1.7525 1.7525 0.888889 0.560555 0.888889 0.560555 0.0189573 0.0189573 75.2501 75.2501 0.0165183\n", "2 0.0204327 0.53997 1.47867 1.62364 0.75 0.545459 0.823529 0.553451 0.014218 0.0331754 47.8673 62.3641 0.0258583\n", "3 0.0300481 0.535781 1.23223 1.49839 0.625 0.53713 0.76 0.548228 0.0118483 0.0450237 23.2227 49.8389 0.0303896\n", "4 0.0408654 0.53296 1.97156 1.62364 1 0.534259 0.823529 0.544531 0.021327 0.0663507 97.1564 62.3641 0.0517166\n", "5 0.0504808 0.529941 1.47867 1.59603 0.75 0.531235 0.809524 0.541998 0.014218 0.0805687 47.8673 59.6028 0.0610565\n", "6 0.100962 0.524757 1.31438 1.4552 0.666667 0.526932 0.738095 0.534465 0.0663507 0.146919 31.4376 45.5202 0.0932609\n", "7 0.15024 0.520632 1.25026 1.38798 0.634146 0.52268 0.704 0.530599 0.0616114 0.208531 25.026 38.7981 0.118287\n", "8 0.200721 0.517881 1.22049 1.34586 0.619048 0.519103 0.682635 0.527708 0.0616114 0.270142 22.0492 34.5858 0.140874\n", "9 0.300481 0.511211 0.997659 1.23026 0.506024 0.514552 0.624 0.52334 0.0995261 0.369668 -0.234112 23.0256 0.1404\n", "10 0.40024 0.507914 0.973905 1.16636 0.493976 0.509622 0.591592 0.519921 0.0971564 0.466825 -2.60949 16.6361 0.135117\n", "11 0.606971 0.50722 1.05456 1.12828 0.534884 0.507238 0.572277 0.515601 0.218009 0.684834 5.45575 12.8281 0.158005\n", "12 0.699519 0.502135 0.768142 1.08063 0.38961 0.504305 0.54811 0.514107 0.07109 0.755924 -23.1858 8.06339 0.114461\n", "13 0.799279 0.496199 1.11643 1.0851 0.566265 0.499093 0.550376 0.512233 0.111374 0.867299 11.6428 8.51014 0.13803\n", "14 0.899038 0.488554 0.783875 1.05168 0.39759 0.492979 0.533422 0.510096 0.0781991 0.945498 -21.6125 5.16765 0.0942781\n", "15 1 0.465854 0.539833 1 0.27381 0.481523 0.507212 0.507212 0.0545024 1 -46.0167 0 0\n", "\n", "ModelMetricsBinomialGLM: glm\n", "** Reported on validation data. **\n", "\n", "MSE: 0.24992706207487297\n", "RMSE: 0.4999270567541559\n", "LogLoss: 0.692994412275714\n", "AUC: 0.48699095022624433\n", "AUCPR: 0.5345411623118929\n", "Gini: -0.02601809954751133\n", "Null degrees of freedom: 102\n", "Residual degrees of freedom: -26\n", "Null deviance: 142.7808998601915\n", "Residual deviance: 142.7568489287971\n", "AIC: 400.7568489287971\n", "\n", "Confusion Matrix (Act/Pred) for max f1 @ threshold = 0.48200451395305594\n", " 0 1 Error Rate\n", "----- --- --- ------- ------------\n", "0 4 47 0.9216 (47.0/51.0)\n", "1 1 51 0.0192 (1.0/52.0)\n", "Total 5 98 0.466 (48.0/103.0)\n", "\n", "Maximum Metrics: Maximum metrics at their respective thresholds\n", "metric threshold value idx\n", "--------------------------- ----------- -------- -----\n", "max f1 0.482005 0.68 80\n", "max f2 0.465589 0.836013 85\n", "max f0point5 0.482005 0.574324 80\n", "max accuracy 0.524517 0.533981 6\n", "max precision 0.561684 1 0\n", "max recall 0.465589 1 85\n", "max specificity 0.561684 1 0\n", "max absolute_mcc 0.534663 0.171532 2\n", "max min_per_class_accuracy 0.50722 0.45098 40\n", "max mean_per_class_accuracy 0.524517 0.538084 6\n", "max tns 0.561684 51 0\n", "max fns 0.561684 51 0\n", "max fps 0.477157 51 84\n", "max tps 0.465589 52 85\n", "max tnr 0.561684 1 0\n", "max fnr 0.561684 0.980769 0\n", "max fpr 0.477157 1 84\n", "max tpr 0.465589 1 85\n", "\n", "Gains/Lift Table: Avg response rate: 50.49 %, avg score: 50.58 %\n", "group cumulative_data_fraction lower_threshold lift cumulative_lift response_rate score cumulative_response_rate cumulative_score capture_rate cumulative_capture_rate gain cumulative_gain kolmogorov_smirnov\n", "------- -------------------------- ----------------- -------- ----------------- --------------- -------- -------------------------- ------------------ -------------- ------------------------- --------- ----------------- --------------------\n", "1 0.0194175 0.545653 1.98077 1.98077 1 0.553781 1 0.553781 0.0384615 0.0384615 98.0769 98.0769 0.0384615\n", "2 0.0291262 0.534465 1.98077 1.98077 1 0.534663 1 0.547408 0.0192308 0.0576923 98.0769 98.0769 0.0576923\n", "3 0.038835 0.52956 0 1.48558 0 0.529722 0.75 0.542986 0 0.0576923 -100 48.5577 0.0380845\n", "4 0.0485437 0.527021 1.98077 1.58462 1 0.527029 0.8 0.539795 0.0192308 0.0769231 98.0769 58.4615 0.0573152\n", "5 0.0679612 0.526935 0.990385 1.41484 0.5 0.526935 0.714286 0.536121 0.0192308 0.0961538 -0.961538 41.4835 0.0569382\n", "6 0.106796 0.521065 0.495192 1.08042 0.25 0.523102 0.545455 0.531387 0.0192308 0.115385 -50.4808 8.04196 0.0173454\n", "7 0.15534 0.517754 0.792308 0.990385 0.4 0.518534 0.5 0.52737 0.0384615 0.153846 -20.7692 -0.961538 -0.00301659\n", "8 0.203883 0.516388 1.18846 1.03755 0.6 0.517281 0.52381 0.524968 0.0576923 0.211538 18.8462 3.75458 0.01546\n", "9 0.300971 0.511349 0.594231 0.894541 0.3 0.513575 0.451613 0.521293 0.0576923 0.269231 -40.5769 -10.5459 -0.0641026\n", "10 0.398058 0.507239 0.990385 0.917917 0.5 0.508921 0.463415 0.518275 0.0961538 0.365385 -0.961538 -8.20826 -0.0659879\n", "11 0.563107 0.50722 1.28167 1.02454 0.647059 0.50722 0.517241 0.515035 0.211538 0.576923 28.1674 2.45358 0.0279035\n", "12 0.601942 0.505897 0.495192 0.990385 0.25 0.506673 0.5 0.514495 0.0192308 0.596154 -50.4808 -0.961538 -0.0116893\n", "13 0.699029 0.49958 0.990385 0.990385 0.5 0.502316 0.5 0.512804 0.0961538 0.692308 -0.961538 -0.961538 -0.0135747\n", "14 0.796117 0.495066 0.990385 0.990385 0.5 0.497745 0.5 0.510967 0.0961538 0.788462 -0.961538 -0.961538 -0.01546\n", "15 0.893204 0.48512 0.990385 0.990385 0.5 0.49094 0.5 0.508791 0.0961538 0.884615 -0.961538 -0.961538 -0.0173454\n", "16 1 0.465589 1.08042 1 0.545455 0.48043 0.504854 0.505762 0.115385 1 8.04196 0 0\n", "\n", "Scoring History: \n", " timestamp duration iteration lambda predictors deviance_train deviance_test alpha iterations training_rmse training_logloss training_r2 training_auc training_pr_auc training_lift training_classification_error validation_rmse validation_logloss validation_r2 validation_auc validation_pr_auc validation_lift validation_classification_error\n", "-- ------------------- ---------- ----------- -------- ------------ ------------------ ------------------ ------- ------------ ------------------ ------------------ -------------------- ------------------ ------------------ ----------------- ------------------------------- ------------------ -------------------- ---------------------- ------------------- ------------------- ------------------ ---------------------------------\n", " 2025-04-09 15:43:56 0.000 sec 2 4.5 129 1.3731147371235026 1.385988824551428 0.0\n", " 2025-04-09 15:43:56 0.046 sec 4 3.3 129 1.3693083833193973 1.3866106131408604 0.0\n", " 2025-04-09 15:43:55 0.551 sec 5 5 0.4966998889264836 0.6865573685617513 0.012951550461947292 0.6203357993295573 0.6311231274689704 1.752501316482359 0.4495192307692308 0.4999270567541559 0.692994412275714 0.00019751072687501647 0.48699095022624433 0.5345411623118929 1.9807692307692308 0.46601941747572817\n", " 2025-04-09 15:43:56 0.098 sec 6 2.4 129 1.3646624139113563 1.3877253613735065 0.0\n", " 2025-04-09 15:43:56 0.135 sec 8 1.7 129 1.3591271656385213 1.3896190261375776 0.0\n", " 2025-04-09 15:43:56 0.176 sec 10 1.3 129 1.3526687474791932 1.392562863401605 0.0\n", " 2025-04-09 15:43:56 0.220 sec 12 0.92 129 1.3452838554523603 1.3969132830901438 0.0\n", "\n", "Variable Importances: \n", "variable relative_importance scaled_importance percentage\n", "------------------- ---------------------- -------------------- ---------------------\n", "image_embedding_102 0.008855576626956463 1.0 0.026157338009840447\n", "image_embedding_124 0.007842048071324825 0.8855491179934634 0.023163607603671102\n", "image_embedding_34 0.007366372738033533 0.831834339913024 0.02175857199729748\n", "image_embedding_74 0.007365822792053223 0.8317722382562401 0.021756947583270014\n", "image_embedding_119 0.007316749542951584 0.8262307302134709 0.021611996484311048\n", "image_embedding_64 0.00683643389493227 0.7719919529714302 0.02019325445475055\n", "image_embedding_58 0.006550434045493603 0.7396959364062208 0.01934847663308296\n", "image_embedding_26 0.0063993120566010475 0.7226307586929437 0.018902097011438773\n", "image_embedding_24 0.006248128600418568 0.7055586398969439 0.01845553582954766\n", "image_embedding_105 0.006024055182933807 0.6802555538389814 0.01779367445483745\n", "--- --- --- ---\n", "image_embedding_109 0.00038485092227347195 0.04345859546875603 0.001136761171109172\n", "image_embedding_82 0.0003519737219903618 0.0397459969934595 0.0010396494778960224\n", "image_embedding_118 0.0003119232424069196 0.03522336890603173 0.0009213495663203758\n", "image_embedding_89 0.00030231819255277514 0.03413873599518247 0.0008929784566546945\n", "image_embedding_108 0.0002783353556878865 0.031430517448251864 0.0008221386687181117\n", "image_embedding_62 0.00024555076379328966 0.02772837660800435 0.0007253005193997229\n", "image_embedding_72 0.00024344016856048256 0.027490041452461523 0.0007190663061765613\n", "image_embedding_30 0.0002010560710914433 0.022703893779138746 0.000593873423720446\n", "image_embedding_14 0.00014245958300307393 0.016086991169996265 0.0004207928655949109\n", "image_embedding_65 0.00011829416325781494 0.013358154780991487 0.0003494137697941605\n", "[128 rows x 4 columns]\n", "\n", "{'creation_epoch': '1744213434', 'start_epoch': '1744213434', 'start_XGBoost_def_2': '1744213434', 'start_GLM_def_1': '1744213436', 'start_GBM_def_5': '1744213437', 'start_XGBoost_def_1': '1744213437', 'start_DRF_def_1': '1744213439', 'start_GBM_def_2': '1744213440', 'start_GBM_def_3': '1744213442', 'start_GBM_def_4': '1744213445', 'start_XGBoost_def_3': '1744213447', 'start_DRF_XRT': '1744213448', 'start_GBM_def_1': '1744213449', 'start_DeepLearning_def_1': '1744213450', 'start_XGBoost_grid_1': '1744213451', 'start_GBM_grid_1': '1744213455', 'start_DeepLearning_grid_1': '1744213458', 'start_DeepLearning_grid_2': '1744213488', 'start_DeepLearning_grid_3': '1744213520', 'stop_epoch': '1744213554', 'duration_secs': '119'}\n" ] } ] }, { "cell_type": "code", "source": [ "aml.leader.model_id" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 35 }, "id": "orRokDpZrDpf", "outputId": "62fa2615-b7e4-4286-f657-d13d6cf703d8" }, "execution_count": 52, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "'XRT_1_AutoML_4_20250409_154354'" ], "application/vnd.google.colaboratory.intrinsic+json": { "type": "string" } }, "metadata": {}, "execution_count": 52 } ] }, { "cell_type": "code", "source": [ "preds_leader = aml.leader.predict(h2o_test)\n", "preds_leader\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 406 }, "id": "oV3lUV26rE7O", "outputId": "b7fc894d-0c91-41b4-86eb-ef09d40776f6" }, "execution_count": 53, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "drf prediction progress: |███████████████████████████████████████████████████████| (done) 100%\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ " predict p0 p1\n", "--------- -------- --------\n", " 1 0.575 0.425\n", " 1 0.202551 0.797449\n", " 1 0.470319 0.529681\n", " 1 0.35 0.65\n", " 1 0.470319 0.529681\n", " 1 0.5875 0.4125\n", " 1 0.425 0.575\n", " 1 0.7 0.3\n", " 1 0.470319 0.529681\n", " 1 0.55 0.45\n", "[107 rows x 3 columns]\n" ], "text/html": [ "
predict | p0 | p1 |
---|---|---|
1 | 0.575 | 0.425 |
1 | 0.202551 | 0.797449 |
1 | 0.470319 | 0.529681 |
1 | 0.35 | 0.65 |
1 | 0.470319 | 0.529681 |
1 | 0.5875 | 0.4125 |
1 | 0.425 | 0.575 |
1 | 0.7 | 0.3 |
1 | 0.470319 | 0.529681 |
1 | 0.55 | 0.45 |
[107 rows x 3 columns]" ] }, "metadata": {}, "execution_count": 53 } ] }, { "cell_type": "code", "source": [ "print(\"\\n TRAIN SET \\n\")\n", "train_predictions = aml.leader.predict(h2o_train).as_data_frame()['p1'].to_list()\n", "\n", "\n", "print(\"\\n VALID SET \\n\")\n", "valid_predictions = aml.leader.predict(h2o_valid).as_data_frame()['p1'].to_list()\n", "\n", "print(\"\\n TEST SET \\n\")\n", "test_predictions = aml.leader.predict(h2o_test).as_data_frame()['p1'].to_list()\n", "\n", "image_only_preds = {}\n", "image_only_preds['train_predictions'] = train_predictions\n", "image_only_preds['valid_predictions'] = valid_predictions\n", "image_only_preds['test_predictions'] = test_predictions" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "x-_f6tugrOgC", "outputId": "61c8a979-0080-4bb3-b093-19a5316f3eab" }, "execution_count": 54, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\n", " TRAIN SET \n", "\n", "drf prediction progress: |███████████████████████████████████████████████████████| (done) 100%\n", "\n", " VALID SET \n", "\n", "drf prediction progress: |███████████████████████████████████████████████████████| (done) 100%\n", "\n", " TEST SET \n", "\n", "drf prediction progress: |███████████████████████████████████████████████████████| (done) 100%\n" ] } ] }, { "cell_type": "code", "source": [ "y_col = 'RESULT DATE+1 open price' #'TARGET-2 REGRESSION NORMALIZED'\n", "x_cols_to_use = ['RESULT DATE open price', 'SMA20', 'SMA50', 'RSI14',\n", " 'gdp_growth', 'inflation', 'NIFTY50_open', 'NIFTY50_close', 'NIFTY50_volume',\n", " 'Sales', 'Expenses', 'Operating Profit', 'OPM %', 'Other Income', 'Interest',\n", " 'Depreciation', 'Profit before tax', 'Tax %', 'Net Profit',\n", " 'EPS in Rs', 'Dividend Payout %', 'Equity Capital', 'Reserves',\n", " 'Borrowings', 'Other Liabilities', 'Total Liabilities',\n", " 'Fixed Assets', 'CWIP', 'Investments', 'Other Assets',\n", " 'Total Assets', 'Cash from Operating Activity',\n", " 'Cash from Investing Activity', 'Cash from Financing Activity',\n", " 'Net Cash Flow', 'Revenue', 'Financing Profit', 'Financing Margin %',\n", " 'Deposits', 'Borrowing'] + ['text_probab'] + ['image_probab']\n", "\n", "train['text_probab'] = text_only_preds['train_predictions']\n", "valid['text_probab'] = text_only_preds['valid_predictions']\n", "test['text_probab'] = text_only_preds['test_predictions']\n", "\n", "train['image_probab'] = image_only_preds['train_predictions']\n", "valid['image_probab'] = image_only_preds['valid_predictions']\n", "test['image_probab'] = image_only_preds['test_predictions']\n", "\n", "h2o_train = h2o.H2OFrame(train[x_cols_to_use]) # Convert train DataFrame to H2OFrame\n", "h2o_valid = h2o.H2OFrame(valid[x_cols_to_use]) # Convert valid DataFrame to H2OFrame\n", "h2o_test = h2o.H2OFrame(test[x_cols_to_use]) # Convert test DataFrame to H2OFrame\n", "\n", "h2o_train[y_col] = h2o.H2OFrame(train[y_col].to_list()) # Convert Pandas Series to H2OFrame before assigning\n", "h2o_valid[y_col] = h2o.H2OFrame(valid[y_col].to_list()) # Convert Pandas Series to H2OFrame before assigning\n", "h2o_test[y_col] = h2o.H2OFrame(test[y_col].to_list()) # Convert Pandas Series to H2OFrame before assigning\n", "\n", "aml = H2OAutoML(max_models=100, seed=1,nfolds = 0)\n", "aml.train(x=x_cols_to_use, y=y_col, training_frame=h2o_train,validation_frame=h2o_valid)\n", "\n", "# View the AutoML Leaderboard\n", "lb = aml.leaderboard\n", "lb.head(rows=lb.nrows)" ], "metadata": { "id": "KRR4zK3hziQP", "colab": { "base_uri": "https://localhost:8080/", "height": 1000 }, "outputId": "99c23151-f36b-4443-c1df-deb5459b98c3" }, "execution_count": 71, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "Parse progress: |████████████████████████████████████████████████████████████████| (done) 100%\n", "AutoML progress: |███████████████████████████████████████████████████████████████| (done) 100%\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ "model_id rmse mse mae rmsle mean_residual_deviance\n", "----------------------------------------------------- -------- ---------------- --------- ----------- ------------------------\n", "DeepLearning_grid_1_AutoML_7_20250409_160125_model_9 100.024 10004.8 64.5561 0.266664 10004.8\n", "DeepLearning_grid_1_AutoML_7_20250409_160125_model_1 134.704 18145.1 90.0874 0.188638 18145.1\n", "DeepLearning_grid_1_AutoML_7_20250409_160125_model_4 135.642 18398.7 100.929 0.194114 18398.7\n", "DeepLearning_grid_1_AutoML_7_20250409_160125_model_10 149.507 22352.2 89.8572 nan 22352.2\n", "DeepLearning_grid_1_AutoML_7_20250409_160125_model_5 164.876 27184.1 113.692 0.253921 27184.1\n", "DeepLearning_grid_2_AutoML_7_20250409_160125_model_4 168.761 28480.3 136.099 0.283903 28480.3\n", "DeepLearning_grid_1_AutoML_7_20250409_160125_model_2 188.361 35479.9 138.995 nan 35479.9\n", "DeepLearning_grid_2_AutoML_7_20250409_160125_model_10 193.53 37453.7 139.606 nan 37453.7\n", "DeepLearning_grid_3_AutoML_7_20250409_160125_model_4 203.619 41460.6 118.388 0.214535 41460.6\n", "DeepLearning_grid_3_AutoML_7_20250409_160125_model_7 205.314 42154 121.346 0.22253 42154\n", "DeepLearning_grid_3_AutoML_7_20250409_160125_model_1 207.528 43067.9 116.164 0.314633 43067.9\n", "DeepLearning_grid_3_AutoML_7_20250409_160125_model_10 215.478 46430.7 114.794 0.193609 46430.7\n", "DeepLearning_grid_1_AutoML_7_20250409_160125_model_7 217.389 47258 147.873 nan 47258\n", "DeepLearning_grid_1_AutoML_7_20250409_160125_model_6 221.629 49119.5 144.504 0.25002 49119.5\n", "DeepLearning_grid_2_AutoML_7_20250409_160125_model_1 235.728 55567.5 186.976 0.349211 55567.5\n", "DeepLearning_grid_2_AutoML_7_20250409_160125_model_7 248.525 61764.6 181.495 nan 61764.6\n", "DeepLearning_grid_1_AutoML_7_20250409_160125_model_3 257.242 66173.4 169.275 nan 66173.4\n", "DeepLearning_grid_1_AutoML_7_20250409_160125_model_11 257.672 66395.1 161.105 nan 66395.1\n", "DeepLearning_grid_3_AutoML_7_20250409_160125_model_8 275.723 76023 186.465 nan 76023\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_8 322.575 104055 118.816 0.061503 104055\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_13 323.824 104862 122.203 0.0652133 104862\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_23 334.453 111859 119.161 0.0863272 111859\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_31 343.315 117865 126.802 0.102759 117865\n", "DeepLearning_1_AutoML_7_20250409_160125 345.776 119561 180.892 nan 119561\n", "DeepLearning_grid_2_AutoML_7_20250409_160125_model_6 350.948 123165 253.962 0.571391 123165\n", "DeepLearning_grid_1_AutoML_7_20250409_160125_model_8 352.587 124317 263.534 nan 124317\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_27 352.811 124476 145.251 0.0781429 124476\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_25 354.925 125972 126.807 0.098505 125972\n", "XGBoost_3_AutoML_7_20250409_160125 356.462 127065 133.239 0.0937253 127065\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_24 361.243 130496 149.89 0.0855626 130496\n", "DeepLearning_grid_2_AutoML_7_20250409_160125_model_9 362.184 131177 213.631 0.30945 131177\n", "GBM_5_AutoML_7_20250409_160125 366.99 134682 121.127 0.0585085 134682\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_10 371.605 138090 124.646 0.0737216 138090\n", "GBM_grid_1_AutoML_7_20250409_160125_model_12 372.355 138648 112.975 0.0578716 138648\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_29 373.223 139296 133.716 0.0896737 139296\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_2 373.411 139436 154.186 0.0982836 139436\n", "GBM_grid_1_AutoML_7_20250409_160125_model_21 373.766 139701 136.83 0.0625747 139701\n", "GBM_grid_1_AutoML_7_20250409_160125_model_2 373.793 139721 131.995 0.0843552 139721\n", "XGBoost_2_AutoML_7_20250409_160125 381.087 145227 138.912 0.0829641 145227\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_3 381.373 145445 121.161 0.0683393 145445\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_4 382.775 146517 132.798 0.0945484 146517\n", "GBM_grid_1_AutoML_7_20250409_160125_model_13 384.045 147490 146.04 0.0883831 147490\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_33 386.962 149739 131.287 0.0720799 149739\n", "GBM_grid_1_AutoML_7_20250409_160125_model_8 387.56 150202 144.694 0.107274 150202\n", "DeepLearning_grid_2_AutoML_7_20250409_160125_model_8 389.366 151606 288.426 nan 151606\n", "GBM_grid_1_AutoML_7_20250409_160125_model_17 392.039 153694 143.235 0.114527 153694\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_12 394.288 155463 129.674 0.0695782 155463\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_16 395.37 156318 178.41 0.202227 156318\n", "DeepLearning_grid_2_AutoML_7_20250409_160125_model_3 398.281 158628 223.427 0.281647 158628\n", "GBM_4_AutoML_7_20250409_160125 398.305 158647 123.528 0.0877705 158647\n", "GBM_3_AutoML_7_20250409_160125 403.436 162761 127.608 0.0824873 162761\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_17 403.476 162793 131.504 0.0816832 162793\n", "GBM_2_AutoML_7_20250409_160125 403.593 162887 122.134 0.074959 162887\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_1 409.332 167553 165.164 0.0996374 167553\n", "XGBoost_1_AutoML_7_20250409_160125 410.198 168263 166.545 0.103922 168263\n", "GBM_grid_1_AutoML_7_20250409_160125_model_3 414.628 171916 139.648 0.116314 171916\n", "GBM_grid_1_AutoML_7_20250409_160125_model_1 415.403 172560 150.605 0.156217 172560\n", "DeepLearning_grid_2_AutoML_7_20250409_160125_model_11 417.624 174410 265.895 0.475627 174410\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_7 423.496 179349 156.584 0.1058 179349\n", "GBM_grid_1_AutoML_7_20250409_160125_model_5 425.309 180887 139.146 0.0773054 180887\n", "GBM_grid_1_AutoML_7_20250409_160125_model_7 427.33 182611 181.637 0.159149 182611\n", "XRT_1_AutoML_7_20250409_160125 429.632 184583 148.454 0.0765111 184583\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_20 430.564 185386 131.065 0.0865655 185386\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_11 433.739 188130 147.004 0.0764827 188130\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_14 436.157 190233 157.822 0.128808 190233\n", "GBM_grid_1_AutoML_7_20250409_160125_model_9 437.171 191119 181.273 0.193966 191119\n", "GBM_grid_1_AutoML_7_20250409_160125_model_10 445.206 198209 189.802 0.279025 198209\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_6 445.258 198255 175.764 0.11972 198255\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_22 454.969 206997 166.684 0.0899557 206997\n", "DRF_1_AutoML_7_20250409_160125 463.945 215245 157.149 0.0849622 215245\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_18 472.034 222816 181.679 0.295749 222816\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_5 474.409 225064 204.879 0.142061 225064\n", "GBM_grid_1_AutoML_7_20250409_160125_model_18 476.677 227221 233.897 0.308515 227221\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_28 479.908 230311 167.367 0.0970178 230311\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_19 483.866 234126 171.465 0.0940305 234126\n", "GBM_grid_1_AutoML_7_20250409_160125_model_22 485.57 235778 208.016 0.355136 235778\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_30 487.878 238025 192.236 0.218711 238025\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_26 498.399 248401 189.226 0.264324 248401\n", "DeepLearning_grid_3_AutoML_7_20250409_160125_model_5 502.841 252849 283.578 0.449787 252849\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_9 512.179 262327 191.581 0.142146 262327\n", "DeepLearning_grid_3_AutoML_7_20250409_160125_model_6 520.06 270463 314.781 0.559899 270463\n", "DeepLearning_grid_3_AutoML_7_20250409_160125_model_3 534.976 286200 288.428 0.53734 286200\n", "DeepLearning_grid_2_AutoML_7_20250409_160125_model_5 550.304 302834 359.712 0.646087 302834\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_32 562.155 316019 209.692 0.104479 316019\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_15 564.745 318937 198.665 0.132069 318937\n", "GBM_grid_1_AutoML_7_20250409_160125_model_20 567.379 321919 230.968 nan 321919\n", "XGBoost_grid_1_AutoML_7_20250409_160125_model_21 580.055 336463 217.43 0.129691 336463\n", "DeepLearning_grid_3_AutoML_7_20250409_160125_model_9 582.034 338763 322.652 0.346926 338763\n", "GBM_grid_1_AutoML_7_20250409_160125_model_11 610.317 372487 277.712 0.330178 372487\n", "GBM_grid_1_AutoML_7_20250409_160125_model_15 627.069 393215 361.711 0.377148 393215\n", "GBM_grid_1_AutoML_7_20250409_160125_model_4 654.448 428303 230.922 nan 428303\n", "DeepLearning_grid_3_AutoML_7_20250409_160125_model_11 686.392 471134 390.937 0.619126 471134\n", "DeepLearning_grid_2_AutoML_7_20250409_160125_model_2 729.073 531548 366.812 0.552833 531548\n", "DeepLearning_grid_3_AutoML_7_20250409_160125_model_2 814.185 662896 434.196 0.49391 662896\n", "GBM_grid_1_AutoML_7_20250409_160125_model_14 1139.42 1.29828e+06 510.838 nan 1.29828e+06\n", "GBM_grid_1_AutoML_7_20250409_160125_model_6 1147.89 1.31765e+06 474.836 nan 1.31765e+06\n", "GBM_grid_1_AutoML_7_20250409_160125_model_16 1152.12 1.32738e+06 474.541 nan 1.32738e+06\n", "GBM_1_AutoML_7_20250409_160125 1164.63 1.35636e+06 464.474 nan 1.35636e+06\n", "GBM_grid_1_AutoML_7_20250409_160125_model_19 1170.14 1.36923e+06 486.197 nan 1.36923e+06\n", "GLM_1_AutoML_7_20250409_160125 2474.66 6.12395e+06 1514.8 1.18928 6.12395e+06\n", "[100 rows x 6 columns]\n" ], "text/html": [ "
model_id | rmse | mse | mae | rmsle | mean_residual_deviance |
---|---|---|---|---|---|
DeepLearning_grid_1_AutoML_7_20250409_160125_model_9 | 100.024 | 10004.8 | 64.5561 | 0.266664 | 10004.8 |
DeepLearning_grid_1_AutoML_7_20250409_160125_model_1 | 134.704 | 18145.1 | 90.0874 | 0.188638 | 18145.1 |
DeepLearning_grid_1_AutoML_7_20250409_160125_model_4 | 135.642 | 18398.7 | 100.929 | 0.194114 | 18398.7 |
DeepLearning_grid_1_AutoML_7_20250409_160125_model_10 | 149.507 | 22352.2 | 89.8572 | nan | 22352.2 |
DeepLearning_grid_1_AutoML_7_20250409_160125_model_5 | 164.876 | 27184.1 | 113.692 | 0.253921 | 27184.1 |
DeepLearning_grid_2_AutoML_7_20250409_160125_model_4 | 168.761 | 28480.3 | 136.099 | 0.283903 | 28480.3 |
DeepLearning_grid_1_AutoML_7_20250409_160125_model_2 | 188.361 | 35479.9 | 138.995 | nan | 35479.9 |
DeepLearning_grid_2_AutoML_7_20250409_160125_model_10 | 193.53 | 37453.7 | 139.606 | nan | 37453.7 |
DeepLearning_grid_3_AutoML_7_20250409_160125_model_4 | 203.619 | 41460.6 | 118.388 | 0.214535 | 41460.6 |
DeepLearning_grid_3_AutoML_7_20250409_160125_model_7 | 205.314 | 42154 | 121.346 | 0.22253 | 42154 |
DeepLearning_grid_3_AutoML_7_20250409_160125_model_1 | 207.528 | 43067.9 | 116.164 | 0.314633 | 43067.9 |
DeepLearning_grid_3_AutoML_7_20250409_160125_model_10 | 215.478 | 46430.7 | 114.794 | 0.193609 | 46430.7 |
DeepLearning_grid_1_AutoML_7_20250409_160125_model_7 | 217.389 | 47258 | 147.873 | nan | 47258 |
DeepLearning_grid_1_AutoML_7_20250409_160125_model_6 | 221.629 | 49119.5 | 144.504 | 0.25002 | 49119.5 |
DeepLearning_grid_2_AutoML_7_20250409_160125_model_1 | 235.728 | 55567.5 | 186.976 | 0.349211 | 55567.5 |
DeepLearning_grid_2_AutoML_7_20250409_160125_model_7 | 248.525 | 61764.6 | 181.495 | nan | 61764.6 |
DeepLearning_grid_1_AutoML_7_20250409_160125_model_3 | 257.242 | 66173.4 | 169.275 | nan | 66173.4 |
DeepLearning_grid_1_AutoML_7_20250409_160125_model_11 | 257.672 | 66395.1 | 161.105 | nan | 66395.1 |
DeepLearning_grid_3_AutoML_7_20250409_160125_model_8 | 275.723 | 76023 | 186.465 | nan | 76023 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_8 | 322.575 | 104055 | 118.816 | 0.061503 | 104055 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_13 | 323.824 | 104862 | 122.203 | 0.0652133 | 104862 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_23 | 334.453 | 111859 | 119.161 | 0.0863272 | 111859 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_31 | 343.315 | 117865 | 126.802 | 0.102759 | 117865 |
DeepLearning_1_AutoML_7_20250409_160125 | 345.776 | 119561 | 180.892 | nan | 119561 |
DeepLearning_grid_2_AutoML_7_20250409_160125_model_6 | 350.948 | 123165 | 253.962 | 0.571391 | 123165 |
DeepLearning_grid_1_AutoML_7_20250409_160125_model_8 | 352.587 | 124317 | 263.534 | nan | 124317 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_27 | 352.811 | 124476 | 145.251 | 0.0781429 | 124476 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_25 | 354.925 | 125972 | 126.807 | 0.098505 | 125972 |
XGBoost_3_AutoML_7_20250409_160125 | 356.462 | 127065 | 133.239 | 0.0937253 | 127065 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_24 | 361.243 | 130496 | 149.89 | 0.0855626 | 130496 |
DeepLearning_grid_2_AutoML_7_20250409_160125_model_9 | 362.184 | 131177 | 213.631 | 0.30945 | 131177 |
GBM_5_AutoML_7_20250409_160125 | 366.99 | 134682 | 121.127 | 0.0585085 | 134682 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_10 | 371.605 | 138090 | 124.646 | 0.0737216 | 138090 |
GBM_grid_1_AutoML_7_20250409_160125_model_12 | 372.355 | 138648 | 112.975 | 0.0578716 | 138648 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_29 | 373.223 | 139296 | 133.716 | 0.0896737 | 139296 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_2 | 373.411 | 139436 | 154.186 | 0.0982836 | 139436 |
GBM_grid_1_AutoML_7_20250409_160125_model_21 | 373.766 | 139701 | 136.83 | 0.0625747 | 139701 |
GBM_grid_1_AutoML_7_20250409_160125_model_2 | 373.793 | 139721 | 131.995 | 0.0843552 | 139721 |
XGBoost_2_AutoML_7_20250409_160125 | 381.087 | 145227 | 138.912 | 0.0829641 | 145227 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_3 | 381.373 | 145445 | 121.161 | 0.0683393 | 145445 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_4 | 382.775 | 146517 | 132.798 | 0.0945484 | 146517 |
GBM_grid_1_AutoML_7_20250409_160125_model_13 | 384.045 | 147490 | 146.04 | 0.0883831 | 147490 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_33 | 386.962 | 149739 | 131.287 | 0.0720799 | 149739 |
GBM_grid_1_AutoML_7_20250409_160125_model_8 | 387.56 | 150202 | 144.694 | 0.107274 | 150202 |
DeepLearning_grid_2_AutoML_7_20250409_160125_model_8 | 389.366 | 151606 | 288.426 | nan | 151606 |
GBM_grid_1_AutoML_7_20250409_160125_model_17 | 392.039 | 153694 | 143.235 | 0.114527 | 153694 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_12 | 394.288 | 155463 | 129.674 | 0.0695782 | 155463 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_16 | 395.37 | 156318 | 178.41 | 0.202227 | 156318 |
DeepLearning_grid_2_AutoML_7_20250409_160125_model_3 | 398.281 | 158628 | 223.427 | 0.281647 | 158628 |
GBM_4_AutoML_7_20250409_160125 | 398.305 | 158647 | 123.528 | 0.0877705 | 158647 |
GBM_3_AutoML_7_20250409_160125 | 403.436 | 162761 | 127.608 | 0.0824873 | 162761 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_17 | 403.476 | 162793 | 131.504 | 0.0816832 | 162793 |
GBM_2_AutoML_7_20250409_160125 | 403.593 | 162887 | 122.134 | 0.074959 | 162887 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_1 | 409.332 | 167553 | 165.164 | 0.0996374 | 167553 |
XGBoost_1_AutoML_7_20250409_160125 | 410.198 | 168263 | 166.545 | 0.103922 | 168263 |
GBM_grid_1_AutoML_7_20250409_160125_model_3 | 414.628 | 171916 | 139.648 | 0.116314 | 171916 |
GBM_grid_1_AutoML_7_20250409_160125_model_1 | 415.403 | 172560 | 150.605 | 0.156217 | 172560 |
DeepLearning_grid_2_AutoML_7_20250409_160125_model_11 | 417.624 | 174410 | 265.895 | 0.475627 | 174410 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_7 | 423.496 | 179349 | 156.584 | 0.1058 | 179349 |
GBM_grid_1_AutoML_7_20250409_160125_model_5 | 425.309 | 180887 | 139.146 | 0.0773054 | 180887 |
GBM_grid_1_AutoML_7_20250409_160125_model_7 | 427.33 | 182611 | 181.637 | 0.159149 | 182611 |
XRT_1_AutoML_7_20250409_160125 | 429.632 | 184583 | 148.454 | 0.0765111 | 184583 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_20 | 430.564 | 185386 | 131.065 | 0.0865655 | 185386 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_11 | 433.739 | 188130 | 147.004 | 0.0764827 | 188130 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_14 | 436.157 | 190233 | 157.822 | 0.128808 | 190233 |
GBM_grid_1_AutoML_7_20250409_160125_model_9 | 437.171 | 191119 | 181.273 | 0.193966 | 191119 |
GBM_grid_1_AutoML_7_20250409_160125_model_10 | 445.206 | 198209 | 189.802 | 0.279025 | 198209 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_6 | 445.258 | 198255 | 175.764 | 0.11972 | 198255 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_22 | 454.969 | 206997 | 166.684 | 0.0899557 | 206997 |
DRF_1_AutoML_7_20250409_160125 | 463.945 | 215245 | 157.149 | 0.0849622 | 215245 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_18 | 472.034 | 222816 | 181.679 | 0.295749 | 222816 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_5 | 474.409 | 225064 | 204.879 | 0.142061 | 225064 |
GBM_grid_1_AutoML_7_20250409_160125_model_18 | 476.677 | 227221 | 233.897 | 0.308515 | 227221 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_28 | 479.908 | 230311 | 167.367 | 0.0970178 | 230311 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_19 | 483.866 | 234126 | 171.465 | 0.0940305 | 234126 |
GBM_grid_1_AutoML_7_20250409_160125_model_22 | 485.57 | 235778 | 208.016 | 0.355136 | 235778 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_30 | 487.878 | 238025 | 192.236 | 0.218711 | 238025 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_26 | 498.399 | 248401 | 189.226 | 0.264324 | 248401 |
DeepLearning_grid_3_AutoML_7_20250409_160125_model_5 | 502.841 | 252849 | 283.578 | 0.449787 | 252849 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_9 | 512.179 | 262327 | 191.581 | 0.142146 | 262327 |
DeepLearning_grid_3_AutoML_7_20250409_160125_model_6 | 520.06 | 270463 | 314.781 | 0.559899 | 270463 |
DeepLearning_grid_3_AutoML_7_20250409_160125_model_3 | 534.976 | 286200 | 288.428 | 0.53734 | 286200 |
DeepLearning_grid_2_AutoML_7_20250409_160125_model_5 | 550.304 | 302834 | 359.712 | 0.646087 | 302834 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_32 | 562.155 | 316019 | 209.692 | 0.104479 | 316019 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_15 | 564.745 | 318937 | 198.665 | 0.132069 | 318937 |
GBM_grid_1_AutoML_7_20250409_160125_model_20 | 567.379 | 321919 | 230.968 | nan | 321919 |
XGBoost_grid_1_AutoML_7_20250409_160125_model_21 | 580.055 | 336463 | 217.43 | 0.129691 | 336463 |
DeepLearning_grid_3_AutoML_7_20250409_160125_model_9 | 582.034 | 338763 | 322.652 | 0.346926 | 338763 |
GBM_grid_1_AutoML_7_20250409_160125_model_11 | 610.317 | 372487 | 277.712 | 0.330178 | 372487 |
GBM_grid_1_AutoML_7_20250409_160125_model_15 | 627.069 | 393215 | 361.711 | 0.377148 | 393215 |
GBM_grid_1_AutoML_7_20250409_160125_model_4 | 654.448 | 428303 | 230.922 | nan | 428303 |
DeepLearning_grid_3_AutoML_7_20250409_160125_model_11 | 686.392 | 471134 | 390.937 | 0.619126 | 471134 |
DeepLearning_grid_2_AutoML_7_20250409_160125_model_2 | 729.073 | 531548 | 366.812 | 0.552833 | 531548 |
DeepLearning_grid_3_AutoML_7_20250409_160125_model_2 | 814.185 | 662896 | 434.196 | 0.49391 | 662896 |
GBM_grid_1_AutoML_7_20250409_160125_model_14 | 1139.42 | 1.29828e+06 | 510.838 | nan | 1.29828e+06 |
GBM_grid_1_AutoML_7_20250409_160125_model_6 | 1147.89 | 1.31765e+06 | 474.836 | nan | 1.31765e+06 |
GBM_grid_1_AutoML_7_20250409_160125_model_16 | 1152.12 | 1.32738e+06 | 474.541 | nan | 1.32738e+06 |
GBM_1_AutoML_7_20250409_160125 | 1164.63 | 1.35636e+06 | 464.474 | nan | 1.35636e+06 |
GBM_grid_1_AutoML_7_20250409_160125_model_19 | 1170.14 | 1.36923e+06 | 486.197 | nan | 1.36923e+06 |
GLM_1_AutoML_7_20250409_160125 | 2474.66 | 6.12395e+06 | 1514.8 | 1.18928 | 6.12395e+06 |
[100 rows x 6 columns]" ] }, "metadata": {}, "execution_count": 71 } ] }, { "cell_type": "code", "source": [ "lb = h2o.automl.get_leaderboard(aml, extra_columns = \"ALL\")\n", "lb" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 409 }, "id": "3iX8Rw16O86m", "outputId": "eba966d5-7bd2-44bd-c3d3-1337ce882b7b" }, "execution_count": 72, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "model_id rmse mse mae rmsle mean_residual_deviance training_time_ms predict_time_per_row_ms algo\n", "----------------------------------------------------- ------- ------- -------- ---------- ------------------------ ------------------ ------------------------- ------------\n", "DeepLearning_grid_1_AutoML_7_20250409_160125_model_9 100.024 10004.8 64.5561 0.266664 10004.8 40893 0.051003 DeepLearning\n", "DeepLearning_grid_1_AutoML_7_20250409_160125_model_1 134.704 18145.1 90.0874 0.188638 18145.1 43225 0.067006 DeepLearning\n", "DeepLearning_grid_1_AutoML_7_20250409_160125_model_4 135.642 18398.7 100.929 0.194114 18398.7 102919 0.063598 DeepLearning\n", "DeepLearning_grid_1_AutoML_7_20250409_160125_model_10 149.507 22352.2 89.8572 nan 22352.2 40231 0.054317 DeepLearning\n", "DeepLearning_grid_1_AutoML_7_20250409_160125_model_5 164.876 27184.1 113.692 0.253921 27184.1 31895 0.075369 DeepLearning\n", "DeepLearning_grid_2_AutoML_7_20250409_160125_model_4 168.761 28480.3 136.099 0.283903 28480.3 59139 0.085656 DeepLearning\n", "DeepLearning_grid_1_AutoML_7_20250409_160125_model_2 188.361 35479.9 138.995 nan 35479.9 46488 0.038126 DeepLearning\n", "DeepLearning_grid_2_AutoML_7_20250409_160125_model_10 193.53 37453.7 139.606 nan 37453.7 36671 0.066524 DeepLearning\n", "DeepLearning_grid_3_AutoML_7_20250409_160125_model_4 203.619 41460.6 118.388 0.214535 41460.6 62840 0.079879 DeepLearning\n", "DeepLearning_grid_3_AutoML_7_20250409_160125_model_7 205.314 42154 121.346 0.22253 42154 106315 0.082181 DeepLearning\n", "[100 rows x 9 columns]\n" ], "text/html": [ "
model_id | rmse | mse | mae | rmsle | mean_residual_deviance | training_time_ms | predict_time_per_row_ms | algo |
---|---|---|---|---|---|---|---|---|
DeepLearning_grid_1_AutoML_7_20250409_160125_model_9 | 100.024 | 10004.8 | 64.5561 | 0.266664 | 10004.8 | 40893 | 0.051003 | DeepLearning |
DeepLearning_grid_1_AutoML_7_20250409_160125_model_1 | 134.704 | 18145.1 | 90.0874 | 0.188638 | 18145.1 | 43225 | 0.067006 | DeepLearning |
DeepLearning_grid_1_AutoML_7_20250409_160125_model_4 | 135.642 | 18398.7 | 100.929 | 0.194114 | 18398.7 | 102919 | 0.063598 | DeepLearning |
DeepLearning_grid_1_AutoML_7_20250409_160125_model_10 | 149.507 | 22352.2 | 89.8572 | nan | 22352.2 | 40231 | 0.054317 | DeepLearning |
DeepLearning_grid_1_AutoML_7_20250409_160125_model_5 | 164.876 | 27184.1 | 113.692 | 0.253921 | 27184.1 | 31895 | 0.075369 | DeepLearning |
DeepLearning_grid_2_AutoML_7_20250409_160125_model_4 | 168.761 | 28480.3 | 136.099 | 0.283903 | 28480.3 | 59139 | 0.085656 | DeepLearning |
DeepLearning_grid_1_AutoML_7_20250409_160125_model_2 | 188.361 | 35479.9 | 138.995 | nan | 35479.9 | 46488 | 0.038126 | DeepLearning |
DeepLearning_grid_2_AutoML_7_20250409_160125_model_10 | 193.53 | 37453.7 | 139.606 | nan | 37453.7 | 36671 | 0.066524 | DeepLearning |
DeepLearning_grid_3_AutoML_7_20250409_160125_model_4 | 203.619 | 41460.6 | 118.388 | 0.214535 | 41460.6 | 62840 | 0.079879 | DeepLearning |
DeepLearning_grid_3_AutoML_7_20250409_160125_model_7 | 205.314 | 42154 | 121.346 | 0.22253 | 42154 | 106315 | 0.082181 | DeepLearning |
[100 rows x 9 columns]" ] }, "metadata": {}, "execution_count": 72 } ] }, { "cell_type": "code", "source": [ "# Get the best model using the metric\n", "m = aml.leader\n", "print(m)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "0A80RCfVPsA3", "outputId": "ea11fb9e-ceaf-47f3-bb95-4ce73eb45881" }, "execution_count": 73, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Model Details\n", "=============\n", "H2ODeepLearningEstimator : Deep Learning\n", "Model Key: DeepLearning_grid_1_AutoML_7_20250409_160125_model_9\n", "\n", "\n", "Status of Neuron Layers: predicting RESULT DATE+1 open price, regression, gaussian distribution, Quadratic loss, 5,661 weights/biases, 81.9 KB, 2,254,720 training samples, mini-batch size 1\n", " layer units type dropout l1 l2 mean_rate rate_rms momentum mean_weight weight_rms mean_bias bias_rms\n", "-- ------- ------- ---------------- --------- ---- ---- -------------------- -------------------- ---------- --------------------- ------------------- ------------------- -----------------------\n", " 1 281 Input 0.0\n", " 2 20 RectifierDropout 10.0 0.0 0.0 0.1224201583713347 0.24743318557739258 0.0 -0.003040129768628973 0.10864239931106567 0.31249810220787977 0.49442625045776367\n", " 3 1 Linear 0.0 0.0 0.003484321317228023 0.004025295376777649 0.0 -0.004980345163494349 0.08620524406433105 -0.3716514757246579 1.0971281125650402e-154\n", "\n", "ModelMetricsRegression: deeplearning\n", "** Reported on train data. **\n", "\n", "MSE: 4384.805144886077\n", "RMSE: 66.21786122252875\n", "MAE: 39.35300687872675\n", "RMSLE: NaN\n", "Mean Residual Deviance: 4384.805144886077\n", "\n", "ModelMetricsRegression: deeplearning\n", "** Reported on validation data. **\n", "\n", "MSE: 10004.799000384448\n", "RMSE: 100.02399212381222\n", "MAE: 64.55607092312168\n", "RMSLE: 0.26666437297003515\n", "Mean Residual Deviance: 10004.799000384448\n", "\n", "Scoring History: \n", " timestamp duration training_speed epochs iterations samples training_rmse training_deviance training_mae training_r2 validation_rmse validation_deviance validation_mae validation_r2\n", "-- ------------------- ---------------- ---------------- -------- ------------ ----------- --------------- ------------------- -------------- ------------- ----------------- --------------------- ---------------- ---------------\n", " 2025-04-09 16:09:56 0.000 sec 0 0 0 nan nan nan nan nan nan nan nan\n", " 2025-04-09 16:09:56 6 min 37.012 sec 38165 obs/sec 10 1 8320 240.37 57777.8 137.635 0.978023 294.514 86738.6 221.46 0.984593\n", " 2025-04-09 16:10:01 6 min 42.073 sec 60003 obs/sec 380 38 316160 91.0855 8296.57 49.7045 0.996844 122.101 14908.7 79.0275 0.997352\n", " 2025-04-09 16:10:06 6 min 47.148 sec 53162 obs/sec 660 66 549120 76.6521 5875.54 43.7185 0.997765 113.021 12773.7 70.2205 0.997731\n", " 2025-04-09 16:10:11 6 min 52.260 sec 55013 obs/sec 1020 102 848640 66.2179 4384.81 39.353 0.998332 100.024 10004.8 64.5561 0.998223\n", " 2025-04-09 16:10:17 6 min 57.375 sec 57541 obs/sec 1420 142 1.18144e+06 61.5197 3784.67 35.8641 0.99856 108.075 11680.1 63.681 0.997925\n", " 2025-04-09 16:10:22 7 min 2.404 sec 54715 obs/sec 1680 168 1.39776e+06 60.9563 3715.67 35.8824 0.998587 107.104 11471.3 64.1603 0.997962\n", " 2025-04-09 16:10:27 7 min 7.456 sec 56030 obs/sec 2060 206 1.71392e+06 61.1253 3736.3 34.7526 0.998579 118.973 14154.7 71.2795 0.997486\n", " 2025-04-09 16:10:32 7 min 12.547 sec 57379 obs/sec 2460 246 2.04672e+06 68.0689 4633.37 38.9115 0.998238 132.304 17504.4 78.5939 0.996891\n", " 2025-04-09 16:10:37 7 min 17.654 sec 55306 obs/sec 2710 271 2.25472e+06 58.1131 3377.13 33.0698 0.998715 113.531 12889.2 68.2691 0.997711\n", " 2025-04-09 16:10:37 7 min 17.667 sec 55299 obs/sec 2710 271 2.25472e+06 66.2179 4384.81 39.353 0.998332 100.024 10004.8 64.5561 0.998223\n", "\n", "Variable Importances: \n", "variable relative_importance scaled_importance percentage\n", "------------------------------ --------------------- -------------------- ---------------------\n", "RESULT DATE open price 1.0 1.0 0.033923893359142504\n", "SMA20 0.6353387236595154 0.6353387236595154 0.021553163108359107\n", "Investments 0.3604700565338135 0.3604700565338135 0.012228547757017157\n", "SMA50 0.3130214214324951 0.3130214214324951 0.010618905319803168\n", "Equity Capital 0.23126667737960815 0.23126667737960815 0.00784546610094904\n", "Interest 0.22151115536689758 0.22151115536689758 0.00751452081252708\n", "Total Liabilities 0.19082963466644287 0.19082963466644287 0.006473684176188531\n", "Other Assets 0.18919093906879425 0.18919093906879425 0.006418093241485803\n", "Other Income 0.18473364412784576 0.18473364412784576 0.006266884443238821\n", "Reserves 0.18401896953582764 0.18401896953582764 0.006242639898592709\n", "--- --- --- ---\n", "Dividend Payout % 0.047408148646354675 0.047408148646354675 0.001608268979033312\n", "OPM % 0.034951724112033844 0.034951724112033844 0.0011856985614948057\n", "inflation 0.031954050064086914 0.031954050064086914 0.001084005786766785\n", "NIFTY50_volume 0.03183847293257713 0.03183847293257713 0.0010800849604826917\n", "gdp_growth 0.027104398235678673 0.027104398235678673 0.0009194867153108935\n", "Revenue.missing(NA) 0.0 0.0 0.0\n", "Financing Profit.missing(NA) 0.0 0.0 0.0\n", "Borrowing.missing(NA) 0.0 0.0 0.0\n", "Financing Margin %.missing(NA) 0.0 0.0 0.0\n", "Deposits.missing(NA) 0.0 0.0 0.0\n", "[281 rows x 4 columns]\n", "\n" ] } ] }, { "cell_type": "code", "source": [ "# Get training timing info\n", "info = aml.training_info\n", "print(info)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "cRlHUJ21PyjX", "outputId": "3b81d02a-3cd1-4a92-dcfd-7ddeea147212" }, "execution_count": 74, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "{'creation_epoch': '1744214486', 'start_epoch': '1744214486', 'start_XGBoost_def_2': '1744214486', 'start_GLM_def_1': '1744214488', 'start_GBM_def_5': '1744214488', 'start_XGBoost_def_1': '1744214488', 'start_DRF_def_1': '1744214489', 'start_GBM_def_2': '1744214491', 'start_GBM_def_3': '1744214492', 'start_GBM_def_4': '1744214494', 'start_XGBoost_def_3': '1744214495', 'start_DRF_XRT': '1744214496', 'start_GBM_def_1': '1744214499', 'start_DeepLearning_def_1': '1744214501', 'start_XGBoost_grid_1': '1744214501', 'start_GBM_grid_1': '1744214574', 'start_DeepLearning_grid_1': '1744214600', 'start_DeepLearning_grid_2': '1744215129', 'start_DeepLearning_grid_3': '1744215596', 'stop_epoch': '1744216240', 'duration_secs': '1754'}\n" ] } ] }, { "cell_type": "code", "source": [ "aml.leader.model_id" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 35 }, "id": "iOlRLFu1P-oX", "outputId": "fcdc8f90-ec65-439e-eb3e-8d2f0e42c480" }, "execution_count": 75, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "'DeepLearning_grid_1_AutoML_7_20250409_160125_model_9'" ], "application/vnd.google.colaboratory.intrinsic+json": { "type": "string" } }, "metadata": {}, "execution_count": 75 } ] }, { "cell_type": "code", "source": [ "preds_leader = aml.leader.predict(h2o_test)\n", "preds_leader" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 406 }, "id": "J7mERM2YP_yS", "outputId": "895fe069-cf12-4cd0-f8ce-ff088c68d3ce" }, "execution_count": 76, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "deeplearning prediction progress: |██████████████████████████████████████████████| (done) 100%\n" ] }, { "output_type": "execute_result", "data": { "text/plain": [ " predict\n", "----------\n", " 9.18649\n", "1006.17\n", "1854.82\n", " 81.9125\n", " 97.5076\n", "2888.97\n", "4506.62\n", " 637.33\n", " 617.228\n", "1029.59\n", "[107 rows x 1 column]\n" ], "text/html": [ "
predict |
---|
9.18649 |
1006.17 |
1854.82 |
81.9125 |
97.5076 |
2888.97 |
4506.62 |
637.33 |
617.228 |
1029.59 |
[107 rows x 1 column]" ] }, "metadata": {}, "execution_count": 76 } ] }, { "cell_type": "code", "source": [ "print(\"\\n TRAIN SET \\n\")\n", "train_predictions = aml.leader.predict(h2o_train).as_data_frame()['predict'].to_list()\n", "print(calculate_regression_metrics(train[y_col], train_predictions))\n", "\n", "print(\"\\n VALID SET \\n\")\n", "valid_predictions = aml.leader.predict(h2o_valid).as_data_frame()['predict'].to_list()\n", "print(calculate_regression_metrics(valid[y_col], valid_predictions))\n", "\n", "print(\"\\n TEST SET \\n\")\n", "test_predictions = aml.leader.predict(h2o_test).as_data_frame()['predict'].to_list()\n", "print(calculate_regression_metrics(test[y_col],test_predictions))" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "xUHCNpAWSJeX", "outputId": "814a1a0e-5c50-474f-f144-aae295b6c298" }, "execution_count": 77, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\n", " TRAIN SET \n", "\n", "deeplearning prediction progress: |██████████████████████████████████████████████| (done) 100%\n", "{'MAE': 39.35300733202008, 'RMSE': np.float64(66.21786015854784), 'MAPE': 0.14468676367502867}\n", "\n", " VALID SET \n", "\n", "deeplearning prediction progress: |██████████████████████████████████████████████| (done) 100%\n", "{'MAE': 64.55607585185871, 'RMSE': np.float64(100.02399540743662), 'MAPE': 0.07541354069196421}\n", "\n", " TEST SET \n", "\n", "deeplearning prediction progress: |██████████████████████████████████████████████| (done) 100%\n", "{'MAE': 104.78748524053184, 'RMSE': np.float64(188.53744596018586), 'MAPE': 0.333730313262129}\n" ] } ] }, { "cell_type": "code", "source": [ "best_model = aml.get_best_model()\n", "model_path = h2o.save_model(model=best_model, path=path + \"mimic_best_model\", force=True)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "sHnFQEqxcbX-", "outputId": "1126c37a-6abc-4660-d8d6-1c91a17be2ae" }, "execution_count": 82, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "/content/drive/MyDrive/datasets/Multimodal_EarningCallTranscripts_Analysis_India/mimic_best_model/DeepLearning_grid_1_AutoML_7_20250409_160125_model_9\n" ] } ] }, { "cell_type": "code", "source": [ "# To load the model, use the following commands\n", "# !unzip Best_Performing_Model_on_MiMIC.zip\n", "# loaded_model = h2o.load_model(\"DeepLearning_grid_1_AutoML_7_20250409_160125_model_9\")" ], "metadata": { "id": "ZVNkZoLjdVE7" }, "execution_count": null, "outputs": [] } ] }