There's more...

The amount of shrinkage for parameters varies by parameter selection, but the presence of collinearity is required for the weights to shrink. You can demonstrate this to yourself by using truly random (IID explanatory variables generated by a random generator) versus features that are highly dependent on one another (for example, waist line and weight).

Here are two examples of extreme regularization values and their effect on model weights and shrinkage:

val regularizationParam = .00001(Model Weights:,[-0.0373404807799996, 0.25499013376755847, 0.0049174051853082094, 0.0046110262713086455, 0.027391063252456684, 0.6401656691002464, 0.1911635644638509, 0.4085780172461439 ]) val regularizationParam = 50(Model Weights:,[-0.012912409941749588, ...

Get Apache Spark 2.x Machine Learning Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.