SlideShare a Scribd company logo
Distributed GLM Implementation
on H2O platform
Tomas Nykodym, 0xDATA
Linear Regression
Data:
x, y + noise
Goal:
predict y using x
i.e. find a,b s.t.
y = a*x + b
Linear Regression
Least Squares Fit
Real Relation:
y=3x+10+N(0,20)
Best Fit:
y = 3.08*x + 6
Prostate Cancer Example
Data:
x = PSA
(prostate-specific antigen)
y = CAPSULE
0 = no tumour
1 = tumour
Goal:
predict y using x
Prostate Cancer Example
Linear Regression Fit
Data:
x = PSA
(prostate-specific antigen)
y = CAPSULE
0 = no tumour
1 = tumour
Fit:
Least squares fit
Generalized Linear Model
Generalizes linear regression by:
– adding a link function g to transform the output
z = g(y) – new response variable
– noise (i.e.variance) does not have to be constant
– fit is maximal likelihood instead of least squares
Prostate Cancer
Logistic Regression Fit
Data:
x = PSA
(prostate-specific antigen)
y = CAPSULE
0 = no tumour
1 = tumour
GLM Fit:
– Binomial family
– Logit link
– Predict probability
of CAPSULE=1.
Implementation - Solve GLM by IRLSM
Input:
– X: data matrix N*P
– Y: response vector (N rows)
– family, link function, α,β
INNER LOOP:
Solve elastic net:
ADMM(Boyd 2010, page 43):
OUTER LOOP:
While β changes, compute:
zk +1=β k +( yāˆ’Ī¼ k )
d Ī·
d μ
W k +1
āˆ’1
=(
d Ī·
d μ
)
2
Var(μ k )
γ
l+1
=( X
T
WX +ρ I )
āˆ’1
X
T
Wz+ρ (β
l
āˆ’u
l
)
β l+1
=Sλ /ρ (γ l+1
+ul
)
ul+1
=uk
+γ l+1
āˆ’Ī²l+1
Output:
– β vector of coefficients, solution
to max-likellihood
XX = X
T
W k+1 X
Xz= X
T
Wzk +1
H2O Implementation
Outer Loop:
(Map Reduce Task)
public class SimpleGLM extends MRTask {
@Override public void map(Chunk c) {
res = new double [p][p];
for(double [] x:c.rows()){
double eta,mu,var;
eta = computeEta(x);
mu = _link.linkInv(eta);
var = Math.max(1e-5,_family.variance(mu));
double dp = _link.linkInvDeriv(eta);
double w = dp*dp/var;
for(int i = 0; i < x.length; ++i)
for(int j = 0; j < x.length; ++j)
res[i][j] += x[i]*x[j]*w;
}
}
@Override public void reduce(SimpleGLM g) {
for(int i = 0; i < res.length; ++i)
for(int j = 0; i < res.length; ++i)
res[i][j] += g.res[i][j];
}
}
Inner Loop:
(ADMM solver)
public double [] solve(Matrix xx, Matrix xy) {
// ADMM LSM Solve
CholeskyDecomposition lu; // cache decomp!
lu = new CholeskyDecomposition(xx);
for( int i = 0; i < 1000; ++i ) {
// Solve using cached Cholesky decomposition!
xm = lu.solve(xyPrime);
// compute u and z update
for( int j = 0; j < N-1; ++j ) {
double x_hat = xm.get(j, 0);
x_norm += x_hat * x_hat;
double zold = z[j];
z[j] = shrinkage(x_hat + u[j], kappa);
u[j] += x_hat - z[j];
u_norm += u[j] * u[j];
}
}
}
double shrinkage(double x, double k) {
return Math.max(0,x-k)-Math.max(0,-x-k);
}
Regularization
Elastic Net (Zhou, Hastie, 2005):
ā— Added L1 and L2 penalty to β to:
– avoid overfitting, reduce variance
– obtain sparse solution (L1 penalty)
– avoid problems with correlated covariates
No longer analytical solution.
Options: LARS, ADMM, Generalized Gradient, ...
β =argmin( X β āˆ’ y)
T
( X β āˆ’y)+α ∄β∄1+(1āˆ’Ī± )∄β∄2
2
Linear Regression
Least Squares Method
Find β by minimizing the sum of squared errors:
Analytical solution:
Easily parallelized if XT
X is reasonably small.
β =(X T
X )āˆ’1
X T
y=(
1
n
āˆ‘ xi xi
T
)
āˆ’1
1
n
āˆ‘ xi y
β =argmin( X β āˆ’ y)
T
( X β āˆ’y)
Generalized Linear Model
ā— Generalizes linear regression by:
– adding a link function g to transform the response
z = g(y) – new response variable
Ī· = Xβ – linear predictor
μ = g-1
(Ī·)
– y has a distribution in the exponential family
– variance depends on μ
e.g var(μ) = μ*(1-μ) for Binomial family.
– fit by maximizing the likelihood of the model

More Related Content

What's hot (20)

PPTX
Pytorch and Machine Learning for the Math Impaired
Tyrel Denison
Ā 
PDF
Semi vae memo (1)
Masato Nakai
Ā 
PDF
Irs gan doc
Masato Nakai
Ā 
PDF
Semi vae memo (2)
Masato Nakai
Ā 
PDF
Numerical_Methods_Simpson_Rule
Alex_5991
Ā 
PDF
Deep Learning with Julia1.0 and Flux
Satoshi Terasaki
Ā 
PPT
C++ ammar .s.q
ammarsalem5
Ā 
PDF
Lec 3-mcgregor
Atner Yegorov
Ā 
PDF
Fast parallelizable scenario-based stochastic optimization
Pantelis Sopasakis
Ā 
PDF
Sergey Shelpuk & Olha Romaniuk - ā€œDeep learning, Tensorflow, and Fashion: how...
Lviv Startup Club
Ā 
PDF
Interpolation
Dmytro Mitin
Ā 
PDF
Машинное Š¾Š±ŃƒŃ‡ŠµŠ½ŠøŠµ на JS. Š” чего Š½Š°Ń‡Š°Ń‚ŃŒ Šø куГа иГти | Odessa Frontend Meetup #12
OdessaFrontend
Ā 
PPTX
Cristian tovar 10 03 jt
Isaac Geovaniz Tellez Chacon
Ā 
PPTX
Cristian tovar 10 03 jt
Isaac Geovaniz Tellez Chacon
Ā 
PDF
Statistics for Economics Midterm 2 Cheat Sheet
Laurel Ayuyao
Ā 
PDF
The Uncertain Enterprise
ClarkTony
Ā 
PDF
HMPC for Upper Stage Attitude Control
Pantelis Sopasakis
Ā 
PPTX
CrystalBall - Compute Relative Frequency in Hadoop
Suvash Shah
Ā 
PDF
0004
sts9ratm0624
Ā 
PDF
Maximizing Submodular Function over the Integer Lattice
Tasuku Soma
Ā 
Pytorch and Machine Learning for the Math Impaired
Tyrel Denison
Ā 
Semi vae memo (1)
Masato Nakai
Ā 
Irs gan doc
Masato Nakai
Ā 
Semi vae memo (2)
Masato Nakai
Ā 
Numerical_Methods_Simpson_Rule
Alex_5991
Ā 
Deep Learning with Julia1.0 and Flux
Satoshi Terasaki
Ā 
C++ ammar .s.q
ammarsalem5
Ā 
Lec 3-mcgregor
Atner Yegorov
Ā 
Fast parallelizable scenario-based stochastic optimization
Pantelis Sopasakis
Ā 
Sergey Shelpuk & Olha Romaniuk - ā€œDeep learning, Tensorflow, and Fashion: how...
Lviv Startup Club
Ā 
Interpolation
Dmytro Mitin
Ā 
Машинное Š¾Š±ŃƒŃ‡ŠµŠ½ŠøŠµ на JS. Š” чего Š½Š°Ń‡Š°Ń‚ŃŒ Šø куГа иГти | Odessa Frontend Meetup #12
OdessaFrontend
Ā 
Cristian tovar 10 03 jt
Isaac Geovaniz Tellez Chacon
Ā 
Cristian tovar 10 03 jt
Isaac Geovaniz Tellez Chacon
Ā 
Statistics for Economics Midterm 2 Cheat Sheet
Laurel Ayuyao
Ā 
The Uncertain Enterprise
ClarkTony
Ā 
HMPC for Upper Stage Attitude Control
Pantelis Sopasakis
Ā 
CrystalBall - Compute Relative Frequency in Hadoop
Suvash Shah
Ā 
0004
sts9ratm0624
Ā 
Maximizing Submodular Function over the Integer Lattice
Tasuku Soma
Ā 

Viewers also liked (6)

PDF
H2O World - Building Data Products for Data Natives - Monica Rogati
Sri Ambati
Ā 
PPTX
Running GLM in R
Sri Ambati
Ā 
PDF
H2O.ai's Distributed Deep Learning by Arno Candel 04/03/14
Sri Ambati
Ā 
PPTX
H2O World - Clustering & Feature Extraction on Text - Seth Redmore
Sri Ambati
Ā 
PDF
Arno candel h2o_a_platform_for_big_math_hadoop_summit_june2016
Sri Ambati
Ā 
PDF
H2O World - Advanced Analytics at Macys.com - Daqing Zhao
Sri Ambati
Ā 
H2O World - Building Data Products for Data Natives - Monica Rogati
Sri Ambati
Ā 
Running GLM in R
Sri Ambati
Ā 
H2O.ai's Distributed Deep Learning by Arno Candel 04/03/14
Sri Ambati
Ā 
H2O World - Clustering & Feature Extraction on Text - Seth Redmore
Sri Ambati
Ā 
Arno candel h2o_a_platform_for_big_math_hadoop_summit_june2016
Sri Ambati
Ā 
H2O World - Advanced Analytics at Macys.com - Daqing Zhao
Sri Ambati
Ā 
Ad

Similar to Glm talk Tomas (20)

PDF
Hybrid dynamics in large-scale logistics networks
MKosmykov
Ā 
PDF
Improved Trainings of Wasserstein GANs (WGAN-GP)
Sangwoo Mo
Ā 
PDF
H2O World - Consensus Optimization and Machine Learning - Stephen Boyd
Sri Ambati
Ā 
PDF
LMM, linear models with random effects, lecture 10
CharlesMBlangerNzaki
Ā 
PDF
Time-Series Analysis on Multiperiodic Conditional Correlation by Sparse Covar...
Michael Lie
Ā 
PDF
SIAM - Minisymposium on Guaranteed numerical algorithms
Jagadeeswaran Rathinavel
Ā 
PDF
MUMS: Transition & SPUQ Workshop - Practical Bayesian Optimization for Urban ...
The Statistical and Applied Mathematical Sciences Institute
Ā 
PPT
Logisticregression
sujimaa
Ā 
PPT
Logisticregression
rnunoo
Ā 
PDF
Need for Controllers having Integer Coefficients in Homomorphically Encrypted D...
CDSL_at_SNU
Ā 
PPT
logisticregression.ppt
ShrutiPanda12
Ā 
PPT
logisticregression
SahilShahPhD2020
Ā 
PPT
unconditional binary logisticregression.ppt
mikaelgirum
Ā 
PDF
NTHU AI Reading Group: Improved Training of Wasserstein GANs
Mark Chang
Ā 
PDF
Computing near-optimal policies from trajectories by solving a sequence of st...
Université de Liège (ULg)
Ā 
PDF
QMC: Transition Workshop - Applying Quasi-Monte Carlo Methods to a Stochastic...
The Statistical and Applied Mathematical Sciences Institute
Ā 
PPTX
ML unit-1.pptx
SwarnaKumariChinni
Ā 
PDF
Reinforcement Learning: Hidden Theory and New Super-Fast Algorithms
Sean Meyn
Ā 
PDF
PMHMathematicaSample
Peter Hammel
Ā 
PDF
Hands-On Algorithms for Predictive Modeling
Arthur Charpentier
Ā 
Hybrid dynamics in large-scale logistics networks
MKosmykov
Ā 
Improved Trainings of Wasserstein GANs (WGAN-GP)
Sangwoo Mo
Ā 
H2O World - Consensus Optimization and Machine Learning - Stephen Boyd
Sri Ambati
Ā 
LMM, linear models with random effects, lecture 10
CharlesMBlangerNzaki
Ā 
Time-Series Analysis on Multiperiodic Conditional Correlation by Sparse Covar...
Michael Lie
Ā 
SIAM - Minisymposium on Guaranteed numerical algorithms
Jagadeeswaran Rathinavel
Ā 
MUMS: Transition & SPUQ Workshop - Practical Bayesian Optimization for Urban ...
The Statistical and Applied Mathematical Sciences Institute
Ā 
Logisticregression
sujimaa
Ā 
Logisticregression
rnunoo
Ā 
Need for Controllers having Integer Coefficients in Homomorphically Encrypted D...
CDSL_at_SNU
Ā 
logisticregression.ppt
ShrutiPanda12
Ā 
logisticregression
SahilShahPhD2020
Ā 
unconditional binary logisticregression.ppt
mikaelgirum
Ā 
NTHU AI Reading Group: Improved Training of Wasserstein GANs
Mark Chang
Ā 
Computing near-optimal policies from trajectories by solving a sequence of st...
Université de Liège (ULg)
Ā 
QMC: Transition Workshop - Applying Quasi-Monte Carlo Methods to a Stochastic...
The Statistical and Applied Mathematical Sciences Institute
Ā 
ML unit-1.pptx
SwarnaKumariChinni
Ā 
Reinforcement Learning: Hidden Theory and New Super-Fast Algorithms
Sean Meyn
Ā 
PMHMathematicaSample
Peter Hammel
Ā 
Hands-On Algorithms for Predictive Modeling
Arthur Charpentier
Ā 
Ad

More from Sri Ambati (20)

PDF
H2O Label Genie Starter Track - Support Presentation
Sri Ambati
Ā 
PDF
H2O.ai Agents : From Theory to Practice - Support Presentation
Sri Ambati
Ā 
PDF
H2O Generative AI Starter Track - Support Presentation Slides.pdf
Sri Ambati
Ā 
PDF
H2O Gen AI Ecosystem Overview - Level 1 - Slide Deck
Sri Ambati
Ā 
PDF
An In-depth Exploration of Enterprise h2oGPTe Slide Deck
Sri Ambati
Ā 
PDF
Intro to Enterprise h2oGPTe Presentation Slides
Sri Ambati
Ā 
PDF
Enterprise h2o GPTe Learning Path Slide Deck
Sri Ambati
Ā 
PDF
H2O Wave Course Starter - Presentation Slides
Sri Ambati
Ā 
PDF
Large Language Models (LLMs) - Level 3 Slides
Sri Ambati
Ā 
PDF
Data Science and Machine Learning Platforms (2024) Slides
Sri Ambati
Ā 
PDF
Data Prep for H2O Driverless AI - Slides
Sri Ambati
Ā 
PDF
H2O Cloud AI Developer Services - Slides (2024)
Sri Ambati
Ā 
PDF
LLM Learning Path Level 2 - Presentation Slides
Sri Ambati
Ā 
PDF
LLM Learning Path Level 1 - Presentation Slides
Sri Ambati
Ā 
PDF
Hydrogen Torch - Starter Course - Presentation Slides
Sri Ambati
Ā 
PDF
Presentation Resources - H2O Gen AI Ecosystem Overview - Level 2
Sri Ambati
Ā 
PDF
H2O Driverless AI Starter Course - Slides and Assignments
Sri Ambati
Ā 
PPTX
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
Ā 
PDF
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
Sri Ambati
Ā 
PPTX
Generative AI Masterclass - Model Risk Management.pptx
Sri Ambati
Ā 
H2O Label Genie Starter Track - Support Presentation
Sri Ambati
Ā 
H2O.ai Agents : From Theory to Practice - Support Presentation
Sri Ambati
Ā 
H2O Generative AI Starter Track - Support Presentation Slides.pdf
Sri Ambati
Ā 
H2O Gen AI Ecosystem Overview - Level 1 - Slide Deck
Sri Ambati
Ā 
An In-depth Exploration of Enterprise h2oGPTe Slide Deck
Sri Ambati
Ā 
Intro to Enterprise h2oGPTe Presentation Slides
Sri Ambati
Ā 
Enterprise h2o GPTe Learning Path Slide Deck
Sri Ambati
Ā 
H2O Wave Course Starter - Presentation Slides
Sri Ambati
Ā 
Large Language Models (LLMs) - Level 3 Slides
Sri Ambati
Ā 
Data Science and Machine Learning Platforms (2024) Slides
Sri Ambati
Ā 
Data Prep for H2O Driverless AI - Slides
Sri Ambati
Ā 
H2O Cloud AI Developer Services - Slides (2024)
Sri Ambati
Ā 
LLM Learning Path Level 2 - Presentation Slides
Sri Ambati
Ā 
LLM Learning Path Level 1 - Presentation Slides
Sri Ambati
Ā 
Hydrogen Torch - Starter Course - Presentation Slides
Sri Ambati
Ā 
Presentation Resources - H2O Gen AI Ecosystem Overview - Level 2
Sri Ambati
Ā 
H2O Driverless AI Starter Course - Slides and Assignments
Sri Ambati
Ā 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
Ā 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
Sri Ambati
Ā 
Generative AI Masterclass - Model Risk Management.pptx
Sri Ambati
Ā 

Recently uploaded (20)

PDF
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
Ā 
PDF
Market Insight : ETH Dominance Returns
CIFDAQ
Ā 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
Ā 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
Ā 
PDF
The Future of Artificial Intelligence (AI)
Mukul
Ā 
PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
Ā 
PDF
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
Ā 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
Ā 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
Ā 
PDF
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
Ā 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
Ā 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
Ā 
PPTX
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
Ā 
PDF
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
Ā 
PDF
Per Axbom: The spectacular lies of maps
Nexer Digital
Ā 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
Ā 
PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
Ā 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
Ā 
PPTX
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
Ā 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
Ā 
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
Ā 
Market Insight : ETH Dominance Returns
CIFDAQ
Ā 
Brief History of Internet - Early Days of Internet
sutharharshit158
Ā 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
Ā 
The Future of Artificial Intelligence (AI)
Mukul
Ā 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
Ā 
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
Ā 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
Ā 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
Ā 
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
Ā 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
Ā 
cloud computing vai.pptx for the project
vaibhavdobariyal79
Ā 
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
Ā 
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
Ā 
Per Axbom: The spectacular lies of maps
Nexer Digital
Ā 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
Ā 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
Ā 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
Ā 
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
Ā 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
Ā 

Glm talk Tomas

  • 1. Distributed GLM Implementation on H2O platform Tomas Nykodym, 0xDATA
  • 2. Linear Regression Data: x, y + noise Goal: predict y using x i.e. find a,b s.t. y = a*x + b
  • 3. Linear Regression Least Squares Fit Real Relation: y=3x+10+N(0,20) Best Fit: y = 3.08*x + 6
  • 4. Prostate Cancer Example Data: x = PSA (prostate-specific antigen) y = CAPSULE 0 = no tumour 1 = tumour Goal: predict y using x
  • 5. Prostate Cancer Example Linear Regression Fit Data: x = PSA (prostate-specific antigen) y = CAPSULE 0 = no tumour 1 = tumour Fit: Least squares fit
  • 6. Generalized Linear Model Generalizes linear regression by: – adding a link function g to transform the output z = g(y) – new response variable – noise (i.e.variance) does not have to be constant – fit is maximal likelihood instead of least squares
  • 7. Prostate Cancer Logistic Regression Fit Data: x = PSA (prostate-specific antigen) y = CAPSULE 0 = no tumour 1 = tumour GLM Fit: – Binomial family – Logit link – Predict probability of CAPSULE=1.
  • 8. Implementation - Solve GLM by IRLSM Input: – X: data matrix N*P – Y: response vector (N rows) – family, link function, α,β INNER LOOP: Solve elastic net: ADMM(Boyd 2010, page 43): OUTER LOOP: While β changes, compute: zk +1=β k +( yāˆ’Ī¼ k ) d Ī· d μ W k +1 āˆ’1 =( d Ī· d μ ) 2 Var(μ k ) γ l+1 =( X T WX +ρ I ) āˆ’1 X T Wz+ρ (β l āˆ’u l ) β l+1 =SĪ» /ρ (γ l+1 +ul ) ul+1 =uk +γ l+1 āˆ’Ī²l+1 Output: – β vector of coefficients, solution to max-likellihood XX = X T W k+1 X Xz= X T Wzk +1
  • 9. H2O Implementation Outer Loop: (Map Reduce Task) public class SimpleGLM extends MRTask { @Override public void map(Chunk c) { res = new double [p][p]; for(double [] x:c.rows()){ double eta,mu,var; eta = computeEta(x); mu = _link.linkInv(eta); var = Math.max(1e-5,_family.variance(mu)); double dp = _link.linkInvDeriv(eta); double w = dp*dp/var; for(int i = 0; i < x.length; ++i) for(int j = 0; j < x.length; ++j) res[i][j] += x[i]*x[j]*w; } } @Override public void reduce(SimpleGLM g) { for(int i = 0; i < res.length; ++i) for(int j = 0; i < res.length; ++i) res[i][j] += g.res[i][j]; } } Inner Loop: (ADMM solver) public double [] solve(Matrix xx, Matrix xy) { // ADMM LSM Solve CholeskyDecomposition lu; // cache decomp! lu = new CholeskyDecomposition(xx); for( int i = 0; i < 1000; ++i ) { // Solve using cached Cholesky decomposition! xm = lu.solve(xyPrime); // compute u and z update for( int j = 0; j < N-1; ++j ) { double x_hat = xm.get(j, 0); x_norm += x_hat * x_hat; double zold = z[j]; z[j] = shrinkage(x_hat + u[j], kappa); u[j] += x_hat - z[j]; u_norm += u[j] * u[j]; } } } double shrinkage(double x, double k) { return Math.max(0,x-k)-Math.max(0,-x-k); }
  • 10. Regularization Elastic Net (Zhou, Hastie, 2005): ā— Added L1 and L2 penalty to β to: – avoid overfitting, reduce variance – obtain sparse solution (L1 penalty) – avoid problems with correlated covariates No longer analytical solution. Options: LARS, ADMM, Generalized Gradient, ... β =argmin( X β āˆ’ y) T ( X β āˆ’y)+α ∄β∄1+(1āˆ’Ī± )∄β∄2 2
  • 11. Linear Regression Least Squares Method Find β by minimizing the sum of squared errors: Analytical solution: Easily parallelized if XT X is reasonably small. β =(X T X )āˆ’1 X T y=( 1 n āˆ‘ xi xi T ) āˆ’1 1 n āˆ‘ xi y β =argmin( X β āˆ’ y) T ( X β āˆ’y)
  • 12. Generalized Linear Model ā— Generalizes linear regression by: – adding a link function g to transform the response z = g(y) – new response variable Ī· = Xβ – linear predictor μ = g-1 (Ī·) – y has a distribution in the exponential family – variance depends on μ e.g var(μ) = μ*(1-μ) for Binomial family. – fit by maximizing the likelihood of the model