<jupyter_start><jupyter_text>Machine Learning with H2O - Tutorial 1: Data in H2O with R**Objective**:- This tutorial demonstrates three different ways to import data into H2O.**Wine Quality Dataset:**- Source: https://archive.ics.uci.edu/ml/datasets/Wine+Quality- CSV (https://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-white.csv)    **Methods**:1. Import data from a local CSV file.2. Import data from the web.3. Convert a Pandas data frame into H2O data frame.**Full Technical Reference:**- http://docs.h2o.ai/h2o/latest-stable/h2o-py/docs/data.html<jupyter_code># Start and connect to a local H2O cluster
suppressPackageStartupMessages(library(h2o))
h2o.init(nthreads = -1)<jupyter_output>H2O is not running yet, starting it now...

Note:  In case of errors look at the following log files:
    /tmp/RtmpBf35BI/h2o_joe_started_from_r.out
    /tmp/RtmpBf35BI/h2o_joe_started_from_r.err


Starting H2O JVM and connecting: .. Connection successful!

R is connected to the H2O cluster: 
    H2O cluster uptime:         2 seconds 553 milliseconds 
    H2O cluster version:        3.10.4.4 
    H2O cluster version age:    5 days  
    H2O cluster name:           H2O_started_from_R_joe_esh642 
    H2O cluster total nodes:    1 
    H2O cluster total memory:   5.21 GB 
    H2O cluster total cores:    8 
    H2O cluster allowed cores:  8 
    H2O cluster healthy:        TRUE 
    H2O Connection ip:          localhost 
    H2O Connection port:        54321 
    H2O Connection proxy:       NA 
    H2O Internal Security:      FALSE 
    R Version:                  R version 3.3.2 (2016-10-31)<jupyter_text><jupyter_code># Method 1 - Import data from a local CSV file
data_from_csv = h2o.importFile("winequality-white.csv")
head(data_from_csv, 5)<jupyter_output>|                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%<jupyter_text><jupyter_code># Method 2 - Import data from the web
data_from_web = h2o.importFile("https://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-white.csv")
head(data_from_web, 5)<jupyter_output>|                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%<jupyter_text><jupyter_code># Method 3 - Convert R data frame into H2O data frame

## Import Wine Quality data using R
wine_df = read.csv('winequality-white.csv', sep = ';')
head(wine_df, 5)
## Convert R data frame into H2O data frame
data_from_df = as.h2o(wine_df)
head(data_from_df, 5)<jupyter_output>|                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
{'fraction_non_alphanumeric': 0.1387618176273254, 'fraction_numerical': 0.02958218969197926, 'mean_word_length': 1.7062706270627064, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 33, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '318368', 'license': 'MIT', 'n_tokens_mistral': 946, 'n_tokens_neox': 854, 'n_words': 229, 'path': 'introduction_to_machine_learning/r_01_data_in_h2o.ipynb', 'repo_name': 'woobe/h2o_tutorials', 'size': '3279'}