Public API

Documentation for AffineScaler.jl's public interface.

See the Internals section of the manual for internal package docs covering all submodules.

Contents

Index

Public interface

Types

AffineScaler.ScalerType
Scaler(k, b)

Create a linear transformation y = k x + b.

Throw an ArgumentError if k is zero.

Examples

julia> Scaler(2.0, 1)
y = 2.0 x + 1

julia> Scaler(-1, 1.4)
y = -x + 1.4

julia> Scaler(1.0, 2)
y = x + 2

julia> Scaler(1, 2)
y = x + 2

julia> Scaler(1, 2).(1:4)
4-element Vector{Int64}:
 3
 4
 5
 6

julia> Scaler(1, 2)(I)
UniformScaling{Int64}
3*I
source

Functions

Base.invFunction
inv(s::Scaler)

Compute the inverse of a linear transformation.

Examples

julia> s = Scaler(2.0, 1.0)
y = 2.0 x + 1.0

julia> inv(s)
y = 0.5 x - 0.5

julia> inv(inv(s)) == s
true
source
AffineScaler.rescale_zero_oneFunction
rescale_zero_one(𝐱)
rescale_zero_one(x...)

Map the minimum of 𝐱 to 0 and the maximum to 1.

Examples

julia> 𝐱 = [2.0, 4.0, 6.0];

julia> s = rescale_zero_one(𝐱)
y = 0.25 x - 0.5

julia> s.(𝐱)
3-element Vector{Float64}:
 0.0
 0.5
 1.0
source
AffineScaler.rescale_one_zeroFunction
rescale_one_zero(𝐱)
rescale_one_zero(x...)

Map the minimum of 𝐱 to 1 and the maximum to 0.

Examples

julia> 𝐱 = [2.0, 4.0, 6.0];

julia> s = rescale_one_zero(𝐱)
y = -0.25 x + 1.5

julia> s.(𝐱)
3-element Vector{Float64}:
 1.0
 0.5
 0.0
source