SlideShare a Scribd company logo
1 of 22
Download to read offline
CudaTree
Training Random Forests on the GPU
Alex Rubinsteyn (NYU, Mount Sinai)
@ GTC on March 25th, 2014
What’s a Random Forest?
trees = []
for i in 1 .. T:
Xi, Yi = random_sample(X, Y)
t = RandomizedDecisionTree()
t.fit(Xi,Yi)
trees.append(t)
A bagged ensemble of randomized decision
trees. Learning by uncorrelated memorization.
Few free parameters, popular for “data science”
Random Forest trees are trained like normal
decision trees (CART), but use random subset
of features at each split.
bestScore = bestThresh = None
for i in RandomSubset(nFeatures):
Xi, Yi = sort(X[:, i], Y)
for nLess, thresh in enumerate(Xi):
score = Impurity(nLess, Yi)
if score < bestScore:
bestScore = score
bestThresh = thresh
Decision Tree Training
1;
Random Forests:
Easy to Parallelize?
• Each tree gets trained independently!
• Simple parallelization strategy:“each
processor trains a tree”
• Works great for multi-core
implementations (wiseRF, scikit-learn, &c)
• Terrible for GPU
Random Forest GPU
Training Strategies
• Tree per Thread: naive/slow
• Depth-First: data parallel threshold
selection for one tree node
• Breadth-First: learn whole level of a tree
simultaneously (threshold per block)
• Hybrid: Use Depth-First training until too
few samples, switch to Breadth-First
Depth-First Training
Thread block = subset of samples
Depth-First Training
Thread block = subset of samples
Depth-First Training
Thread block = subset of samples
Depth-First Training
Thread block = subset of samples
Depth-First Training
Thread block = subset of samples
Depth-First Training
Thread block = subset of samples
Depth-First Training:
Algorithm Sketch
(1)Parallel Prefix Scan: compute label count
histograms
(2)Map: Evaluate impurity score for all feature
thresholds
(3)Reduce: Which feature/threshold pair has the
lowest impurity score?
(4)Map: Marking whether each sample goes left or
right at the split
(5)Shuffle: keep samples/labels on both sides of the
split contiguous.
Breadth-First Training
Thread block = tree node
Breadth-First Training
Thread block = tree node
Breadth-First Training
Thread block = tree node
Breadth-First Training
Thread block = tree node
Breadth-First Training:
Algorithm Sketch
Uses the same sequence of data parallel operations
(Scan label counts, Map impurity evaluation, &c) as
Depth-First training but within each thread block
Fast at the bottom of the tree (lots of small tree
nodes), insufficient parallelism at the top.
Hybrid Training
★ c = number of classes
★ n = total number of samples
★ f = number of features considered at split
3702 + 1.58c + 0.0577n + 21.84f
Add a tree node to the Breadth-First queue
when it contains fewer samples than:
(coefficients from machine-specific regression, needs to be generalized)
GPU Algorithms vs.
Number of Features
• Randomly generated
synthetic data
• Performance relative
to sklearn 0.14
Benchmark Data
Dataset Samples Features Classes
ImageNet 10k 4k 10
CIFAR100 50k 3k 100
covertype 581k 57 7
poker 1M 11 10
PAMAP2 2.87M 52 10
intrustion 5M 41 24
Benchmark Results
Dataset wiseRF
sklearn
0.15
CudaTree
(Titan)
CudaTree
+
wiseRF
ImageNet 23s 13s 27s 25s
CIFAR100 160s 180s 197s 94s
covertype 107s 73s 67s 52s
poker 117s 98s 59s 58s
PAMAP2 1,066s 241s 934s 757s
intrustion 667s 1,682s 199s 153s
6- core Xeon E5-2630, 24GB, GTX Titan, n_trees = 100, features_per_split = sqrt(n)
Thanks!
• Installing: pip install cudatree
• Source:https://github.com/EasonLiao/CudaTree
• Credit:Yisheng Liao did most of the
hard work, Russell Power & Jinyang
Li were the sanity check brigade.

More Related Content

What's hot

Machine Learning 3 - Decision Tree Learning
Machine Learning 3 - Decision Tree LearningMachine Learning 3 - Decision Tree Learning
Machine Learning 3 - Decision Tree Learning
butest
 
Svm Presentation
Svm PresentationSvm Presentation
Svm Presentation
shahparin
 

What's hot (20)

Support Vector Machines
Support Vector MachinesSupport Vector Machines
Support Vector Machines
 
Support Vector machine
Support Vector machineSupport Vector machine
Support Vector machine
 
Machine Learning 3 - Decision Tree Learning
Machine Learning 3 - Decision Tree LearningMachine Learning 3 - Decision Tree Learning
Machine Learning 3 - Decision Tree Learning
 
Svm Presentation
Svm PresentationSvm Presentation
Svm Presentation
 
002.decision trees
002.decision trees002.decision trees
002.decision trees
 
A Random Forest Approach To Skin Detection With R
A Random Forest Approach To Skin Detection With RA Random Forest Approach To Skin Detection With R
A Random Forest Approach To Skin Detection With R
 
LR1. Summary Day 1
LR1. Summary Day 1LR1. Summary Day 1
LR1. Summary Day 1
 
Id3 algorithm
Id3 algorithmId3 algorithm
Id3 algorithm
 
In-class slides with activities
In-class slides with activitiesIn-class slides with activities
In-class slides with activities
 
1. C Basics for Data Structures Bridge Course
1. C Basics for Data Structures   Bridge Course1. C Basics for Data Structures   Bridge Course
1. C Basics for Data Structures Bridge Course
 
Tree models with Scikit-Learn: Great models with little assumptions
Tree models with Scikit-Learn: Great models with little assumptionsTree models with Scikit-Learn: Great models with little assumptions
Tree models with Scikit-Learn: Great models with little assumptions
 
2.6 support vector machines and associative classifiers revised
2.6 support vector machines and associative classifiers revised2.6 support vector machines and associative classifiers revised
2.6 support vector machines and associative classifiers revised
 
Machine Learning using Support Vector Machine
Machine Learning using Support Vector MachineMachine Learning using Support Vector Machine
Machine Learning using Support Vector Machine
 
MATLAB
MATLABMATLAB
MATLAB
 
Lecture 5 Relationship between pixel-2
Lecture 5 Relationship between pixel-2Lecture 5 Relationship between pixel-2
Lecture 5 Relationship between pixel-2
 
L1 intro2 supervised_learning
L1 intro2 supervised_learningL1 intro2 supervised_learning
L1 intro2 supervised_learning
 
Could a Data Science Program use Data Science Insights?
Could a Data Science Program use Data Science Insights?Could a Data Science Program use Data Science Insights?
Could a Data Science Program use Data Science Insights?
 
Support vector machine
Support vector machineSupport vector machine
Support vector machine
 
SVM
SVMSVM
SVM
 
Ppt shuai
Ppt shuaiPpt shuai
Ppt shuai
 

Similar to CudaTree (GTC 2014)

Decision Tree - C4.5&CART
Decision Tree - C4.5&CARTDecision Tree - C4.5&CART
Decision Tree - C4.5&CART
Xueping Peng
 
iccv2009 tutorial: boosting and random forest - part I
iccv2009 tutorial: boosting and random forest - part Iiccv2009 tutorial: boosting and random forest - part I
iccv2009 tutorial: boosting and random forest - part I
zukun
 
Machine learning interviews day2
Machine learning interviews   day2Machine learning interviews   day2
Machine learning interviews day2
rajmohanc
 
모듈형 패키지를 활용한 나만의 기계학습 모형 만들기 - 회귀나무모형을 중심으로
모듈형 패키지를 활용한 나만의 기계학습 모형 만들기 - 회귀나무모형을 중심으로 모듈형 패키지를 활용한 나만의 기계학습 모형 만들기 - 회귀나무모형을 중심으로
모듈형 패키지를 활용한 나만의 기계학습 모형 만들기 - 회귀나무모형을 중심으로
r-kor
 

Similar to CudaTree (GTC 2014) (20)

MS CS - Selecting Machine Learning Algorithm
MS CS - Selecting Machine Learning AlgorithmMS CS - Selecting Machine Learning Algorithm
MS CS - Selecting Machine Learning Algorithm
 
Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)
Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)
Optimization (DLAI D4L1 2017 UPC Deep Learning for Artificial Intelligence)
 
Decision Tree - C4.5&CART
Decision Tree - C4.5&CARTDecision Tree - C4.5&CART
Decision Tree - C4.5&CART
 
Decision tree learning
Decision tree learningDecision tree learning
Decision tree learning
 
Isolation Forest
Isolation ForestIsolation Forest
Isolation Forest
 
iccv2009 tutorial: boosting and random forest - part I
iccv2009 tutorial: boosting and random forest - part Iiccv2009 tutorial: boosting and random forest - part I
iccv2009 tutorial: boosting and random forest - part I
 
Comparison Study of Decision Tree Ensembles for Regression
Comparison Study of Decision Tree Ensembles for RegressionComparison Study of Decision Tree Ensembles for Regression
Comparison Study of Decision Tree Ensembles for Regression
 
Introduction to Big Data Science
Introduction to Big Data ScienceIntroduction to Big Data Science
Introduction to Big Data Science
 
机器学习Adaboost
机器学习Adaboost机器学习Adaboost
机器学习Adaboost
 
Machine learning in science and industry — day 2
Machine learning in science and industry — day 2Machine learning in science and industry — day 2
Machine learning in science and industry — day 2
 
NEED THE ANSWER IN 30 mins thank you Write a recursive .pdf
NEED THE ANSWER IN 30 mins thank you  Write a recursive .pdfNEED THE ANSWER IN 30 mins thank you  Write a recursive .pdf
NEED THE ANSWER IN 30 mins thank you Write a recursive .pdf
 
Introduction to conventional machine learning techniques
Introduction to conventional machine learning techniquesIntroduction to conventional machine learning techniques
Introduction to conventional machine learning techniques
 
Machine learning interviews day2
Machine learning interviews   day2Machine learning interviews   day2
Machine learning interviews day2
 
모듈형 패키지를 활용한 나만의 기계학습 모형 만들기 - 회귀나무모형을 중심으로
모듈형 패키지를 활용한 나만의 기계학습 모형 만들기 - 회귀나무모형을 중심으로 모듈형 패키지를 활용한 나만의 기계학습 모형 만들기 - 회귀나무모형을 중심으로
모듈형 패키지를 활용한 나만의 기계학습 모형 만들기 - 회귀나무모형을 중심으로
 
deepnet-lourentzou.ppt
deepnet-lourentzou.pptdeepnet-lourentzou.ppt
deepnet-lourentzou.ppt
 
Multiclass Recognition with Multiple Feature Trees
Multiclass Recognition with Multiple Feature TreesMulticlass Recognition with Multiple Feature Trees
Multiclass Recognition with Multiple Feature Trees
 
Multiclass recognition with
Multiclass recognition withMulticlass recognition with
Multiclass recognition with
 
ppt
pptppt
ppt
 
Machine Learning Comparative Analysis - Part 1
Machine Learning Comparative Analysis - Part 1Machine Learning Comparative Analysis - Part 1
Machine Learning Comparative Analysis - Part 1
 
Machine Learning Algorithms (Part 1)
Machine Learning Algorithms (Part 1)Machine Learning Algorithms (Part 1)
Machine Learning Algorithms (Part 1)
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

CudaTree (GTC 2014)