using h2o random grid search for hyper-parameters optimization

21
Using H2O Random Grid Search for Hyper-parameters Optimization Jo-fai (Joe) Chow Data Scientist [email protected]

Upload: jo-fai-chow

Post on 06-Jan-2017

148 views

Category:

Data & Analytics


0 download

TRANSCRIPT

Page 1: Using H2O Random Grid Search for Hyper-parameters Optimization

Using H2O Random Gr id Search for Hyper-parameters Optimization

Jo-fai (Joe) ChowData [email protected]

Page 2: Using H2O Random Grid Search for Hyper-parameters Optimization

WHO AM I

• Customer Data Scientist at H2O.ai• Background

o Telecom (Virgin Media)o Data Science Platform (Domino Data Lab)oWater Engineering + Machine Learning Research

(STREAM Industrial Doctorate Centre)

Page 3: Using H2O Random Grid Search for Hyper-parameters Optimization

ABOUT H2O

• Companyo Team: 50 (45 shown)o Founded in 2012, Mountain View,

California.o Venture capital backed

• Productso Open-source machine learning platform.o Flow (Web), R, Python, Spark, Hadoop

interfaces.

Page 4: Using H2O Random Grid Search for Hyper-parameters Optimization

ABOUT THIS TALK

• Story of a baker and a data scientistoWhy you should care

• Hyper-parameters optimizationo Common techniqueso H2O Python API

• Other H2O features for streamlining workflow

Page 5: Using H2O Random Grid Search for Hyper-parameters Optimization

STORY OF A BAKER

• Making a cakeo Source

• Ingredients o Process:

• Mixing• Baking• Decorating

o End product• A nice looking cake

Credit: www.dphotographer.co.uk/image/201305/baking_a_cake

Page 6: Using H2O Random Grid Search for Hyper-parameters Optimization

STORY OF A DATA SCIENTIST

• Making a data producto Source

• Raw datao Process:

• Data munging• Analyzing / Modeling • Reporting

o End product• Apps, graphs or reports

Credit: www.simranjindal.com

Page 7: Using H2O Random Grid Search for Hyper-parameters Optimization

BAKER AND DATA SCIENTIST

• What do they have in common?o Process is important to bakers and data scientists.

Yet, most customers do not appreciate the effort.oMost customers only care about raw materials

quality and end products.

Page 8: Using H2O Random Grid Search for Hyper-parameters Optimization

WHY YOU SHOULD CARE

• We can use machine/software to automate some laborious tasks.

• We can spend more time on quality assurance and presentation.

• This talk is about making one specific task, hyper-parameters tuning, more efficient.

Page 9: Using H2O Random Grid Search for Hyper-parameters Optimization

HYPER-PARAMETERS OPTIMISATION

• Overviewo Optimizing an algorithm’s performance.

• e.g. Random Forest, Gradient Boosting Machine (GBM)o Trying different sets of hyper-parameters within a

defined search space.o No rules of thumb.

Page 10: Using H2O Random Grid Search for Hyper-parameters Optimization

HYPER-PARAMETERS OPTIMISATION

• Example of hyper-parameters in H2Oo Random Forest:

• No. of trees, depth of trees, sample rate …o Gradient Boosting Machine (GBM):

• No. of trees, depth of trees, learning rate, sample rate …o Deep Learning:

• Activation, hidden layer sizes, L1, L2, dropout ratios …

Page 11: Using H2O Random Grid Search for Hyper-parameters Optimization

COMMON TECHNIQUES

• Manual searcho Tuning by hand - inefficiento Expert opinion (not always reliable)

• Grid searcho Automated search within a defined spaceo Computationally expensive

• Random grid searcho More efficient than manual / grid searcho Equal performance in less time

Page 12: Using H2O Random Grid Search for Hyper-parameters Optimization

RANDOM GRID SEARCH – DOES IT WORK?

• Random Search for Hyper-Parameter Optimizationo Journal of Machine Learning Research (2012) o James Bergstra and Yoshua Bengioo “Compared with deep belief networks configured by a

thoughtful combination of manual search and grid search, purely random search found statistically equal performance on four of seven data sets, and superior performance on one of seven.”

Page 13: Using H2O Random Grid Search for Hyper-parameters Optimization

RELATED FEATURE – EARLY STOPPING

• A technique for regularization.• Avoid over-fitting the training set.• Useful when combined with hyper-parameter

search:o Additional controls (e.g. time constraint,

tolerance)

Page 14: Using H2O Random Grid Search for Hyper-parameters Optimization

H2O RANDOM GRID SEARCH

• Objectiveso Optimize model performance based on evaluation

metric.o Explore the defined search space randomly.o Use early-stopping for regularization and

additional controls.

Page 15: Using H2O Random Grid Search for Hyper-parameters Optimization

RANDOM GRID SEARCH (PYTHON API)

Page 16: Using H2O Random Grid Search for Hyper-parameters Optimization

RANDOM GRID SEARCH

• Outputso Best model based on metrico A set of hyper-parameters for the best model

• Other APIso R, REST, Java (see documentation on GitHub)

Page 17: Using H2O Random Grid Search for Hyper-parameters Optimization

OTHER H2O FEATURES

• h2oEnsembleo Better predictive performance

• Sparkling Water = Spark + H2O• Plain Old Java Object (POJO)

o Productionize H2O models

Page 18: Using H2O Random Grid Search for Hyper-parameters Optimization

CONCLUSIONS

• Most people only care about the end product.• Use H2O random grid search to save time on

hyper-parameters tuning.• Spend more time on quality assurance and

presentation.

Page 19: Using H2O Random Grid Search for Hyper-parameters Optimization

CONCLUSIONS

• H2O Random Grid Searcho An efficient way to tune hyper-parameterso APIs for Python, R, Java, RESTo Do check out the code examples on GitHub

• Combine with other H2O featureso Streamline data science workflow

Page 20: Using H2O Random Grid Search for Hyper-parameters Optimization

ACKNOWLEDGEMENTS

• GoDataDriven• Conference sponsors• My colleagues at H2O.ai

Page 21: Using H2O Random Grid Search for Hyper-parameters Optimization

THANK YOU

• Resourceso Slides + code – github.com/h2oai/h2o-meetupso Download H2O – www.h2o.aio Documentation – www.h2o.ai/docs/o [email protected]

• We are hiring – www.h2o.ai/careers/