AI - H2O - 安裝與運行


安裝的要求

H2O的安裝對操作系統、編程語言和瀏覽器有具體的要求。
詳情請查看官方信息

下載H2O

示例 - 在CentOS7.5中直接運行

官網信息

查看系統及Java信息

[Anliven@localhost ~]$ uname -a
Linux localhost.localdomain 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[Anliven@localhost ~]$ 
[Anliven@localhost ~]$ cat /etc/system-release
CentOS Linux release 7.5.1804 (Core) 
[Anliven@localhost ~]$ 
[Anliven@localhost ~]$ java -version
openjdk version "1.8.0_161"
OpenJDK Runtime Environment (build 1.8.0_161-b14)
OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)
[Anliven@localhost ~]$ 

運行H2O

通過java -jar h2o.jar -ip <IP_Address> -port <PortNumber>命令運行H2O

[Anliven@localhost h2o-3.24.0.5]$ pwd
/home/Anliven/Downloads/h2o-3.24.0.5
[Anliven@localhost h2o-3.24.0.5]$ 
[Anliven@localhost h2o-3.24.0.5]$ ll
total 127012
drwxr-xr-x 3 Anliven Anliven        18 Jun 19 08:19 bindings
-rw-r--r-- 1 Anliven Anliven 130056596 Jun 19 08:19 h2o.jar
drwxr-xr-x 2 Anliven Anliven        47 Jun 19 08:19 python
drwxr-xr-x 2 Anliven Anliven        33 Jun 19 08:19 R
[Anliven@localhost h2o-3.24.0.5]$ 
[Anliven@localhost h2o-3.24.0.5]$ java -jar h2o.jar -ip 192.168.16.101 -port 54321
06-21 23:44:41.564 192.168.16.101:54321  4039   main      INFO: ----- H2O started  -----
06-21 23:44:41.582 192.168.16.101:54321  4039   main      INFO: Build git branch: rel-yates
06-21 23:44:41.582 192.168.16.101:54321  4039   main      INFO: Build git hash: b9cd4d5bcd44a4949ca8c677c5e54c10ee72c968
06-21 23:44:41.583 192.168.16.101:54321  4039   main      INFO: Build git describe: jenkins-3.24.0.4-66-gb9cd4d5
06-21 23:44:41.583 192.168.16.101:54321  4039   main      INFO: Build project version: 3.24.0.5
06-21 23:44:41.583 192.168.16.101:54321  4039   main      INFO: Build age: 2 days
06-21 23:44:41.583 192.168.16.101:54321  4039   main      INFO: Built by: 'jenkins'
06-21 23:44:41.583 192.168.16.101:54321  4039   main      INFO: Built on: '2019-06-18 23:52:14'
06-21 23:44:41.583 192.168.16.101:54321  4039   main      INFO: Found H2O Core extensions: [Watchdog, XGBoost, KrbStandalone]
06-21 23:44:41.584 192.168.16.101:54321  4039   main      INFO: Processed H2O arguments: [-ip, 192.168.16.101, -port, 54321]
06-21 23:44:41.584 192.168.16.101:54321  4039   main      INFO: Java availableProcessors: 4
06-21 23:44:41.584 192.168.16.101:54321  4039   main      INFO: Java heap totalMemory: 240.0 MB
06-21 23:44:41.584 192.168.16.101:54321  4039   main      INFO: Java heap maxMemory: 3.45 GB
06-21 23:44:41.584 192.168.16.101:54321  4039   main      INFO: Java version: Java 1.8.0_161 (from Oracle Corporation)
06-21 23:44:41.584 192.168.16.101:54321  4039   main      INFO: JVM launch parameters: []
06-21 23:44:41.585 192.168.16.101:54321  4039   main      INFO: OS version: Linux 3.10.0-957.el7.x86_64 (amd64)
06-21 23:44:41.585 192.168.16.101:54321  4039   main      INFO: Machine physical memory: 15.51 GB
06-21 23:44:41.585 192.168.16.101:54321  4039   main      INFO: Machine locale: en_US
06-21 23:44:41.585 192.168.16.101:54321  4039   main      INFO: X-h2o-cluster-id: 1561131880800
06-21 23:44:41.585 192.168.16.101:54321  4039   main      INFO: User name: 'Anliven'
06-21 23:44:41.585 192.168.16.101:54321  4039   main      INFO: IPv6 stack selected: false
06-21 23:44:41.585 192.168.16.101:54321  4039   main      INFO: Network interface is down: name:virbr0 (virbr0)
06-21 23:44:41.585 192.168.16.101:54321  4039   main      INFO: Possible IP Address: enp0s8 (enp0s8), fe80:0:0:0:cfdd:6281:f738:fba%enp0s8
06-21 23:44:41.586 192.168.16.101:54321  4039   main      INFO: Possible IP Address: enp0s8 (enp0s8), 192.168.16.101
06-21 23:44:41.586 192.168.16.101:54321  4039   main      INFO: Possible IP Address: enp0s3 (enp0s3), fe80:0:0:0:c48f:c289:276:2308%enp0s3
06-21 23:44:41.586 192.168.16.101:54321  4039   main      INFO: Possible IP Address: enp0s3 (enp0s3), 10.0.2.15
06-21 23:44:41.586 192.168.16.101:54321  4039   main      INFO: Possible IP Address: lo (lo), 0:0:0:0:0:0:0:1%lo
06-21 23:44:41.586 192.168.16.101:54321  4039   main      INFO: Possible IP Address: lo (lo), 127.0.0.1
06-21 23:44:41.586 192.168.16.101:54321  4039   main      INFO: H2O node running in unencrypted mode.
06-21 23:44:41.588 192.168.16.101:54321  4039   main      INFO: Internal communication uses port: 54322
06-21 23:44:41.588 192.168.16.101:54321  4039   main      INFO: Listening for HTTP and REST traffic on http://192.168.16.101:54321/
06-21 23:44:41.589 192.168.16.101:54321  4039   main      INFO: H2O cloud name: 'Anliven' on /192.168.16.101:54321, static configuration based on -flatfile null
06-21 23:44:41.589 192.168.16.101:54321  4039   main      INFO: If you have trouble connecting, try SSH tunneling from your local machine (e.g., via port 55555):
06-21 23:44:41.589 192.168.16.101:54321  4039   main      INFO:   1. Open a terminal and run 'ssh -L 55555:localhost:54321 Anliven@192.168.16.101'
06-21 23:44:41.589 192.168.16.101:54321  4039   main      INFO:   2. Point your browser to http://localhost:55555
06-21 23:44:42.307 192.168.16.101:54321  4039   main      INFO: Log dir: '/tmp/h2o-Anliven/h2ologs'
06-21 23:44:42.307 192.168.16.101:54321  4039   main      INFO: Cur dir: '/home/Anliven/Downloads/h2o-3.24.0.5'
06-21 23:44:42.321 192.168.16.101:54321  4039   main      INFO: Subsystem for distributed import from HTTP/HTTPS successfully initialized
06-21 23:44:42.322 192.168.16.101:54321  4039   main      INFO: HDFS subsystem successfully initialized
06-21 23:44:42.327 192.168.16.101:54321  4039   main      INFO: S3 subsystem successfully initialized
06-21 23:44:42.352 192.168.16.101:54321  4039   main      INFO: GCS subsystem successfully initialized
06-21 23:44:42.352 192.168.16.101:54321  4039   main      INFO: Flow dir: '/home/Anliven/h2oflows'
06-21 23:44:42.372 192.168.16.101:54321  4039   main      INFO: Cloud of size 1 formed [/192.168.16.101:54321]
06-21 23:44:42.386 192.168.16.101:54321  4039   main      INFO: Registered parsers: [GUESS, ARFF, XLS, SVMLight, AVRO, PARQUET, CSV]
06-21 23:44:42.387 192.168.16.101:54321  4039   main      INFO: Watchdog extension initialized
06-21 23:44:42.387 192.168.16.101:54321  4039   main      INFO: XGBoost extension initialized
06-21 23:44:42.388 192.168.16.101:54321  4039   main      INFO: KrbStandalone extension initialized
06-21 23:44:42.388 192.168.16.101:54321  4039   main      INFO: Registered 3 core extensions in: 327ms
06-21 23:44:42.389 192.168.16.101:54321  4039   main      INFO: Registered H2O core extensions: [Watchdog, XGBoost, KrbStandalone]
06-21 23:44:42.625 192.168.16.101:54321  4039   main      INFO: Found XGBoost backend with library: xgboost4j_gpu
06-21 23:44:42.625 192.168.16.101:54321  4039   main      INFO: XGBoost supported backends: [WITH_GPU, WITH_OMP]
06-21 23:44:42.788 192.168.16.101:54321  4039   main      INFO: Registered: 174 REST APIs in: 399ms
06-21 23:44:42.788 192.168.16.101:54321  4039   main      INFO: Registered REST API extensions: [Amazon S3, XGBoost, Algos, AutoML, Core V3, Core V4]
06-21 23:44:43.005 192.168.16.101:54321  4039   main      INFO: Registered: 249 schemas in 216ms
06-21 23:44:43.005 192.168.16.101:54321  4039   main      INFO: H2O started in 2195ms
06-21 23:44:43.005 192.168.16.101:54321  4039   main      INFO: 
06-21 23:44:43.005 192.168.16.101:54321  4039   main      INFO: Open H2O Flow in your web browser: http://192.168.16.101:54321
06-21 23:44:43.006 192.168.16.101:54321  4039   main      INFO: 

H2O Flow的web頁面:

h2o.jar的幫助信息

執行java -jar h2o.jar --help命令顯示幫助信息。

問題處理

問題1:無法打開H2O的web頁面

處理方法:
查看啟動日志,如果看到類似"http://192.168.16.101:54321"信息說明H2O已經成功啟動,
那么此時問題的原因應該與網絡相關,需要檢查防火牆/代理/路由等相關網絡設置.
建議先檢查防火牆的設置。可以關閉防火牆並設置為開機不啟動,也可以將H2O的web服務加入到防火牆的規則中。

[root@localhost ~]# firewall-cmd --state
running
[root@localhost ~]# systemctl stop firewalld && systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# 

問題2:H2O的啟動日志中顯示“Failed to determine IP, falling back to localhost”信息

執行java -jar h2o.jar后,H2O的啟動日志中顯示有“Failed to determine IP, falling back to localhost”信息

處理方法:通過java -jar h2o.jar -ip <IP_Address> -port <PortNumber>命令指定IP地址和端口來運行H2O。

示例 - 在Anaconda3環境中安裝H2O並運行

官網信息

使用的命令

conda create -n h2o pip python=3.6  # 創建Python3.6的虛擬環境
conda activate h2o  # 激活並進入虛擬環境
pip install -U h2o  # 在虛擬環境中安裝h2o,參數-U表明要升級安裝任何依賴項

安裝完成后的包列表

(h2o) C:\Users\guowli>pip list
Package      Version
------------ --------
certifi      2019.3.9
chardet      3.0.4
colorama     0.4.1
future       0.17.1
h2o          3.24.0.5
idna         2.8
pip          19.1.1
requests     2.22.0
setuptools   41.0.1
tabulate     0.8.3
urllib3      1.25.3
wheel        0.33.4
wincertstore 0.2

(h2o) C:\Users\guowli>

運行初始化

(h2o) C:\Users\guowli>python
Python 3.6.8 |Anaconda, Inc.| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import h2o  # 導入模塊
>>> h2o.init()  # 將顯示啟動的相關信息,表格中包括可用的節點個數/存儲空間/內核個數等信息
Checking whether there is an H2O instance running at http://localhost:54321 ..... not found.
Attempting to start a local H2O server...
; Java HotSpot(TM) Client VM (build 25.152-b16, mixed mode)
C:\Office-Tools\Anaconda3\envs\h2o\lib\site-packages\h2o\backend\server.py:369: UserWarning:   You have a 32-bit version of Java. H2O works best with 64-bit Java.
  Please download the latest 64-bit Java SE JDK from Oracle.

  warn("  You have a 32-bit version of Java. H2O works best with 64-bit Java.\n"
  Starting server from C:\Office-Tools\Anaconda3\envs\h2o\lib\site-packages\h2o\backend\bin\h2o.jar
  Ice root: C:\Users\guowli\AppData\Local\Temp\tmpydo64nu9
  JVM stdout: C:\Users\guowli\AppData\Local\Temp\tmpydo64nu9\h2o_guowli_started_from_python.out
  JVM stderr: C:\Users\guowli\AppData\Local\Temp\tmpydo64nu9\h2o_guowli_started_from_python.err
  Server is running at http://127.0.0.1:54321
Connecting to H2O server at http://127.0.0.1:54321 ... successful.
--------------------------  ------------------------------------------
H2O cluster uptime:         01 secs
H2O cluster timezone:       Asia/Shanghai
H2O data parsing timezone:  UTC
H2O cluster version:        3.24.0.5  # H2O版本
H2O cluster version age:    10 hours and 43 minutes
H2O cluster name:           H2O_from_python_guowli_76mkk5
H2O cluster total nodes:    1  # 集群節點個數
H2O cluster free memory:    247.5 Mb
H2O cluster total cores:    8  # 集群內核個數
H2O cluster allowed cores:  8  # 集群可用內核個數
H2O cluster status:         accepting new members, healthy
H2O connection url:         http://127.0.0.1:54321  # Web地址
H2O connection proxy:
H2O internal security:      False
H2O API Extensions:         Amazon S3, Algos, AutoML, Core V3, Core V4
Python version:             3.6.8 final  # Python版本
--------------------------  ------------------------------------------
>>>

注意:

  • 默認情況下,H2O實例允許使用所有內核, 並且通常需要25%的系統存儲空間.
  • 可以通過類似h2o.init(nthreads=2,max_mem_size=4) 命令指定相關啟動配置.
  • 通過h2o.shutdown()1命令關閉H2O實例.

運行官方Demo

>>> h2o.demo("glm")

-------------------------------------------------------------------------------
Demo of H2O's Generalized Linear Estimator.

This demo uploads a dataset to h2o, parses it, and shows a description.
Then it divides the dataset into training and test sets, builds a GLM
from the training set, and makes predictions for the test set.
Finally, default performance metrics are displayed.
-------------------------------------------------------------------------------

>>> # Connect to H2O
>>> h2o.init()

Checking whether there is an H2O instance running at http://localhost:54321 . connected.
--------------------------  ------------------------------------------
H2O cluster uptime:         44 secs
H2O cluster timezone:       Asia/Shanghai
H2O data parsing timezone:  UTC
H2O cluster version:        3.24.0.5
H2O cluster version age:    10 hours and 44 minutes
H2O cluster name:           H2O_from_python_guowli_76mkk5
H2O cluster total nodes:    1
H2O cluster free memory:    240.7 Mb
H2O cluster total cores:    8
H2O cluster allowed cores:  8
H2O cluster status:         locked, healthy
H2O connection url:         http://localhost:54321
H2O connection proxy:
H2O internal security:      False
H2O API Extensions:         Amazon S3, Algos, AutoML, Core V3, Core V4
Python version:             3.6.8 final
--------------------------  ------------------------------------------

>>> # Upload the prostate dataset that comes included in the h2o python package
>>> prostate = h2o.load_dataset("prostate")

Parse progress: |█████████████████████████████████████████████████████████| 100%

>>> # Print a description of the prostate data
>>> prostate.describe()

Rows:380
Cols:9


         ID                  CAPSULE             AGE                RACE                DPROS               DCAPS               PSA                 VOL                 GLEASON
-------  ------------------  ------------------  -----------------  ------------------  ------------------  ------------------  ------------------  ------------------  ------------------
type     int                 int                 int                int                 int                 int                 real                real                int
mins     1.0                 0.0                 43.0               0.0                 1.0                 1.0                 0.3                 0.0                 0.0
mean     190.5               0.4026315789473684  66.03947368421049  1.0868421052631572  2.2710526315789488  1.1078947368421048  15.408631578947375  15.812921052631573  6.3842105263157904
maxs     380.0               1.0                 79.0               2.0                 4.0                 2.0                 139.7               97.6                9.0
sigma    109.84079387914127  0.4910743389630552  6.527071269173311  0.3087732580252793  1.0001076181502861  0.3106564493514939  19.99757266856046   18.347619967271175  1.0919533744261092
zeros    0                   227                 0                  3                   0                   0                   0                   167                 2
missing  0                   0                   0                  0                   0                   0                   0                   0                   0
0        1.0                 0.0                 65.0               1.0                 2.0                 1.0                 1.4                 0.0                 6.0
1        2.0                 0.0                 72.0               1.0                 3.0                 2.0                 6.7                 0.0                 7.0
2        3.0                 0.0                 70.0               1.0                 1.0                 2.0                 4.9                 0.0                 6.0
3        4.0                 0.0                 76.0               2.0                 2.0                 1.0                 51.2                20.0                7.0
4        5.0                 0.0                 69.0               1.0                 1.0                 1.0                 12.3                55.9                6.0
5        6.0                 1.0                 71.0               1.0                 3.0                 2.0                 3.3                 0.0                 8.0
6        7.0                 0.0                 68.0               2.0                 4.0                 2.0                 31.9                0.0                 7.0
7        8.0                 0.0                 61.0               2.0                 4.0                 2.0                 66.7                27.2                7.0
8        9.0                 0.0                 69.0               1.0                 1.0                 1.0                 3.9                 24.0                7.0
9        10.0                0.0                 68.0               2.0                 1.0                 2.0                 13.0                0.0                 6.0

>>> # Randomly split the dataset into ~70/30, training/test sets
>>> train, test = prostate.split_frame(ratios=[0.70])


>>> # Convert the response columns to factors (for binary classification problems)
>>> train["CAPSULE"] = train["CAPSULE"].asfactor()
>>> test["CAPSULE"] = test["CAPSULE"].asfactor()


>>> # Build a (classification) GLM
>>> from h2o.estimators import H2OGeneralizedLinearEstimator
>>> prostate_glm = H2OGeneralizedLinearEstimator(family="binomial", alpha=[0.5])
>>> prostate_glm.train(x=["AGE", "RACE", "PSA", "VOL", "GLEASON"],
...                    y="CAPSULE", training_frame=train)

glm Model Build progress: |███████████████████████████████████████████████| 100%

>>> # Show the model
>>> prostate_glm.show()

Model Details
=============
H2OGeneralizedLinearEstimator :  Generalized Linear Modeling
Model Key:  GLM_model_python_1560911750112_1


ModelMetricsBinomialGLM: glm
** Reported on train data. **

MSE: 0.16734436667135488
RMSE: 0.40907745803375045
LogLoss: 0.5023661857779066
Null degrees of freedom: 271
Residual degrees of freedom: 266
Null deviance: 368.556956020097
Residual deviance: 273.28720506318115
AIC: 285.28720506318115
AUC: 0.8176339285714287
pr_auc: 0.7776373382337975
Gini: 0.6352678571428574
Confusion Matrix (Act/Pred) for max f1 @ threshold = 0.30277329744729137:
       0    1    Error    Rate
-----  ---  ---  -------  ------------
0      111  49   0.3063   (49.0/160.0)
1      20   92   0.1786   (20.0/112.0)
Total  131  141  0.2537   (69.0/272.0)
Maximum Metrics: Maximum metrics at their respective thresholds

metric                       threshold    value     idx
---------------------------  -----------  --------  -----
max f1                       0.302773     0.727273  140
max f2                       0.167286     0.807175  220
max f0point5                 0.599644     0.742574  72
max accuracy                 0.527291     0.768382  98
max precision                0.980771     1         0
max recall                   0.0656329    1         252
max specificity              0.980771     1         0
max absolute_mcc             0.524337     0.516584  100
max min_per_class_accuracy   0.443324     0.741071  123
max mean_per_class_accuracy  0.302773     0.757589  140
Gains/Lift Table: Avg response rate: 41.18 %, avg score: 41.18 %

    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
--  -------  --------------------------  -----------------  --------  -----------------  ---------------  ---------  --------------------------  ------------------  --------------  -------------------------  --------  -----------------
    1        0.0110294                   0.975592           2.42857   2.42857            1                0.979539   1                           0.979539            0.0267857       0.0267857                  142.857   142.857
    2        0.0220588                   0.966995           2.42857   2.42857            1                0.971859   1                           0.975699            0.0267857       0.0535714                  142.857   142.857
    3        0.0330882                   0.961389           2.42857   2.42857            1                0.964036   1                           0.971811            0.0267857       0.0803571                  142.857   142.857
    4        0.0404412                   0.949559           2.42857   2.42857            1                0.956522   1                           0.969032            0.0178571       0.0982143                  142.857   142.857
    5        0.0514706                   0.922488           2.42857   2.42857            1                0.938832   1                           0.96256             0.0267857       0.125                      142.857   142.857
    6        0.102941                    0.863277           2.2551    2.34184            0.928571         0.889015   0.964286                    0.925788            0.116071        0.241071                   125.51    134.184
    7        0.150735                    0.709532           1.49451   2.07317            0.615385         0.790488   0.853659                    0.882888            0.0714286       0.3125                     49.4505   107.317
    8        0.202206                    0.634824           1.73469   1.98701            0.714286         0.665299   0.818182                    0.827502            0.0892857       0.401786                   73.4694   98.7013
    9        0.301471                    0.584551           1.5291    1.83624            0.62963          0.606812   0.756098                    0.754835            0.151786        0.553571                   52.9101   83.6237
    10       0.400735                    0.495188           1.25926   1.69332            0.518519         0.537514   0.697248                    0.701003            0.125           0.678571                   25.9259   69.3316
    11       0.5                         0.338356           1.07937   1.57143            0.444444         0.433575   0.647059                    0.647911            0.107143        0.785714                   7.93651   57.1429
    12       0.599265                    0.250821           0.719577  1.43032            0.296296         0.2807     0.588957                    0.587085            0.0714286       0.857143                   -28.0423  43.0324
    13       0.698529                    0.214874           0.269841  1.26541            0.111111         0.235682   0.521053                    0.537149            0.0267857       0.883929                   -73.0159  26.5414
    14       0.797794                    0.174605           0.62963   1.18631            0.259259         0.196557   0.488479                    0.494771            0.0625          0.946429                   -37.037   18.6307
    15       0.897059                    0.076389           0.359788  1.09485            0.148148         0.115647   0.45082                     0.452819            0.0357143       0.982143                   -64.0212  9.48478
    16       1                           0.000108149        0.173469  1                  0.0714286        0.0540133  0.411765                    0.411765            0.0178571       1                          -82.6531  0

Scoring History:
    timestamp            duration    iterations    negative_log_likelihood    objective
--  -------------------  ----------  ------------  -------------------------  -----------
    2019-06-19 10:37:22  0.000 sec   0             184.278                    0.677494
    2019-06-19 10:37:22  0.012 sec   1             140.926                    0.518611
    2019-06-19 10:37:22  0.021 sec   2             136.838                    0.503852
    2019-06-19 10:37:22  0.022 sec   3             136.645                    0.503224
    2019-06-19 10:37:22  0.023 sec   4             136.644                    0.503222

>>> # Predict on the test set and show the first ten predictions
>>> predictions = prostate_glm.predict(test)
>>> predictions.show()

glm prediction progress: |████████████████████████████████████████████████| 100%
  predict        p0         p1
---------  --------  ---------
        1  0.457574  0.542426
        1  0.189866  0.810134
        1  0.419438  0.580562
        1  0.521769  0.478231
        1  0.375439  0.624561
        0  0.927869  0.0721311
        0  0.960693  0.0393066
        0  0.700254  0.299746
        0  0.714227  0.285773
        0  0.778058  0.221942

[108 rows x 3 columns]

>>> # Show default performance metrics
>>> performance = prostate_glm.model_performance(test)
>>> performance.show()


ModelMetricsBinomialGLM: glm
** Reported on test data. **

MSE: 0.20621247932950715
RMSE: 0.45410624233708474
LogLoss: 0.5944711796848934
Null degrees of freedom: 107
Residual degrees of freedom: 102
Null deviance: 143.86304763240474
Residual deviance: 128.40577481193696
AIC: 140.40577481193696
AUC: 0.740444120859119
pr_auc: 0.6109686413835654
Gini: 0.4808882417182381
Confusion Matrix (Act/Pred) for max f1 @ threshold = 0.2449261037363724:
       0    1    Error    Rate
-----  ---  ---  -------  ------------
0      38   29   0.4328   (29.0/67.0)
1      6    35   0.1463   (6.0/41.0)
Total  44   64   0.3241   (35.0/108.0)
Maximum Metrics: Maximum metrics at their respective thresholds

metric                       threshold    value     idx
---------------------------  -----------  --------  -----
max f1                       0.244926     0.666667  63
max f2                       0.132351     0.795918  80
max f0point5                 0.285773     0.59387   54
max accuracy                 0.594262     0.694444  23
max precision                0.996946     1         0
max recall                   0.0644647    1         98
max specificity              0.996946     1         0
max absolute_mcc             0.244926     0.415635  63
max min_per_class_accuracy   0.325993     0.682927  48
max mean_per_class_accuracy  0.244926     0.710411  63
Gains/Lift Table: Avg response rate: 37.96 %, avg score: 37.52 %

    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
--  -------  --------------------------  -----------------  --------  -----------------  ---------------  ---------  --------------------------  ------------------  --------------  -------------------------  --------  -----------------
    1        0.0185185                   0.979652           2.63415   2.63415            1                0.98867    1                           0.98867             0.0487805       0.0487805                  163.415   163.415
    2        0.0277778                   0.968501           2.63415   2.63415            1                0.969789   1                           0.982377            0.0243902       0.0731707                  163.415   163.415
    3        0.037037                    0.959393           2.63415   2.63415            1                0.960585   1                           0.976929            0.0243902       0.097561                   163.415   163.415
    4        0.0462963                   0.954581           2.63415   2.63415            1                0.954909   1                           0.972525            0.0243902       0.121951                   163.415   163.415
    5        0.0555556                   0.949862           2.63415   2.63415            1                0.953739   1                           0.969394            0.0243902       0.146341                   163.415   163.415
    6        0.101852                    0.799582           1.05366   1.91574            0.4              0.850374   0.727273                    0.915294            0.0487805       0.195122                   5.36585   91.5743
    7        0.157407                    0.658583           0.878049  1.5495             0.333333         0.710796   0.588235                    0.843118            0.0487805       0.243902                   -12.1951  54.9498
    8        0.203704                    0.598989           2.10732   1.67627            0.8              0.624421   0.636364                    0.793414            0.097561        0.341463                   110.732   67.6275
    9        0.305556                    0.538529           0.957871  1.43681            0.363636         0.562347   0.545455                    0.716392            0.097561        0.439024                   -4.21286  43.6807
    10       0.398148                    0.458199           1.31707   1.40896            0.5              0.510598   0.534884                    0.668533            0.121951        0.560976                   31.7073   40.8962
    11       0.5                         0.286173           1.67627   1.46341            0.636364         0.350458   0.555556                    0.60374             0.170732        0.731707                   67.6275   46.3415
    12       0.601852                    0.235707           1.19734   1.41839            0.454545         0.262231   0.538462                    0.545946            0.121951        0.853659                   19.7339   41.8386
    13       0.694444                    0.183515           0.526829  1.29951            0.2              0.212878   0.493333                    0.501537            0.0487805       0.902439                   -47.3171  29.9512
    14       0.796296                    0.095848           0.478936  1.19455            0.181818         0.143011   0.453488                    0.455679            0.0487805       0.95122                    -52.1064  19.4555
    15       0.898148                    0.0664361          0.239468  1.08625            0.0909091        0.0762976  0.412371                    0.412656            0.0243902       0.97561                    -76.0532  8.62459
    16       1                           0.000121128        0.239468  1                  0.0909091        0.044715   0.37963                     0.375181            0.0243902       1                          -76.0532  0


---- End of Demo ----

>>>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM