R language ︱h2o Some R language practices for deep learning--H2O Package

Source: Internet
Author: User


Several application cases of R language H2O package


Author's message: Inspired to understand the H2O platform of some R language implementation, online has a H2O demo file. I post some cases here, and put some small examples of their own practice.

About H2O platform long what kind, can see H2O's official website, about deep learning long what kind of, you can see some tutorials, such as PARALLELR blog in the analysis.

The following is mainly to paste a few cases, let us see.


————————————————————————————————————————————————————————————


Matt︱r language calls Deep learning Architecture series citations


R language ︱h2o Some R language practices for deep learning--H2O Package


R User's Gospel ︱tensorflow:tensorflow R interface

Mxnet: Combining R and GPU to accelerate deep learning

fragmentation ︱r language and deep learning


SPARKLYR Package: Implement Spark and R interface, will be able to play spark with Dplyr

—————————————————————————————————————



The H2O package described in this article mainly has the following brief steps in the process of calling :

Connect, build H2O environment (Heo.init ())--Data into H2O format (AS.H2O)-Model Fit (h2o.deeplearning)-Prediction (H2O.PREDICT)-Data rendering (h2o.performance).



One, H2O package demo (GLM)

Online already have, blog author read and do a simple Chinese comment. Details can be found in std1984 blog.




second, the case from PARALLELR blog

The main purpose of the blog is to show that deep learning is more accurate than other common learning methods. Data is H2O Web site data, the author of the Windows system is not able to download the data, so the subsequent analysis has no way to continue.

Library (H2O) # single threadh2o.init () #连接h2o平台train_file <-"https://h2o-public-test-data.s3.amazonaws.com/ bigdata/laptop/mnist/train.csv.gz "Test_file <-" https://h2o-public-test-data.s3.amazonaws.com/bigdata/laptop/ Mnist/test.csv.gz "Train <-h2o.importfile (train_file) test <-h2o.importfile (test_file) # to see a brief summary of T  He data, run the following commandsummary (train) Summary (test) y <-"C785" x <-Setdiff (names (train), y) # We encode the Response column as categorical for Multinomial#classificationtrain[,y] <-as.factor (Train[,y]) test[,y] <-as.fact                               or (Test[,y]) # Train a deep learning model and validsystem.time (MODEL_CV <-h2o.deeplearning (x = x, y = y, training_frame = train, distribution = "Mul                               Tinomial ", activation =" rectifier ", Hidden = C (32),                 L1 = 1e-5,              epochs = 200)) 


Three, the simplest case--deep learning based on IRIS data set

This case is mainly from the H2O official manual, h2o.deeplearning package examples, relatively simple and easy to understand. If you want to see the predicted data you can use As.data.frame to change the data frame format that r can recognize.

# #参考来自: H2O Official Manual, example of h2o.deeplearning function library (H2O) h2o.init () Iris.hex <-AS.H2O (Iris) Iris.dl <- h2o.deeplearning (x = 1:4, y = 6, Training_frame = Iris.hex)  #模型拟合 # now make a predictionpredictions <-h2o.predict ( IRIS.DL, Iris.hex)          #预测as. Data.frame (predictions)                             #预测数据变成数据框performance = h2o.performance (model = IRIS.DL) Print (performance)


the results of the output grow to look like this.

The approximate composition is: model evaluation Indicator + confusion Matrix + some indicator thresholds (what is this??). )

See the confusion matrix, you almost understand ~

> Print (performance) h2obinomialmetrics:deeplearning** reported on training data. **description:metrics reported on full training Framemse:0.01030833r^2:0.9536125logloss:0.05097025auc:1gini:1co    NFusion Matrix for F1-optimal threshold:0 1 Error Rate0 100 0 0.000000 =0/1001 0 50 0.000000                      =0/50totals 0.000000 =0/150maximum Metrics:maximum Metrics at their respective thresholds Metric threshold value Idx1 Max F1 0.983179 1.000000 492 max F2 0.983179 1.              000000 493 Max f0point5 0.983179 1.000000 494 max accuracy 0.983179 1.000000 495  Max Precision 0.999915 1.000000 max recall 0.983179 1.000000 497 max specificity 0.999915 1.000000 Max ABSOLUTE_MCC 0.983179 1.000000 499 max min_per_class_accuracy 0.983179 1.000000 4 9gains/lift table:extract with ' H2o.gainslift (&LT;MODEL&GT;, <data>) ' or ' H2o.gainslift (<model>, Valid=<t/f>, xval=<t/f>) ' 


R language ︱h2o Some R language practices for deep learning--H2O Package

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.