<!--
{
  "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/LinearTransformer",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Create ML Components"
    ],
    "preciseIdentifier" : "s:18CreateMLComponents17LinearTransformerV"
  },
  "title" : "LinearTransformer"
}
-->

# LinearTransformer

A transformer that runs an input through a scale and offset.

```
struct LinearTransformer<Element> where Element : BinaryFloatingPoint, Element : Decodable, Element : Encodable
```

## Topics

### Creating a regressor

[`init(scale: Element, offset: Element)`](/documentation/CreateMLComponents/LinearTransformer/init(scale:offset:))

Creates a linear transformer.

### Getting the properties

[`var offset: Element`](/documentation/CreateMLComponents/LinearTransformer/offset)

The amount to be offset after scaling.

[`var scale: Element`](/documentation/CreateMLComponents/LinearTransformer/scale)

The amount to be scaled.

### Performing the transformation

[`func applied(to:eventHandler:)`](/documentation/CreateMLComponents/LinearTransformer/applied(to:eventHandler:))

Scales an input.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Decodable`](/documentation/Swift/Decodable)

[`Encodable`](/documentation/Swift/Encodable)

[`Transformer`](/documentation/CreateMLComponents/Transformer)

[`Equatable`](/documentation/Swift/Equatable)

[`Sendable`](/documentation/Swift/Sendable)

[`Escapable`](/documentation/Swift/Escapable)

[`Copyable`](/documentation/Swift/Copyable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

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)