<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateMLComponents",
  "identifier" : "/documentation/CreateMLComponents/LinearRegressor/Configuration-swift.struct/l2Penalty",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Create ML Components"
    ],
    "preciseIdentifier" : "s:18CreateMLComponents15LinearRegressorV13ConfigurationV9l2PenaltySdvp"
  },
  "title" : "l2Penalty"
}
-->

# l2Penalty

Weight of the L2 regularization term.

```
var l2Penalty: Double
```

## Discussion

The larger this weight, the more the model coefficients shrink toward 0. This introduces bias into the model
but decreases variance, potentially leading to better predictions. The default value is 0.01; setting this
parameter to 0 corresponds to unregularized logistic regression.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)