Giter Site home page Giter Site logo

parameterschedulers.jl's Introduction

ParameterSchedulers

Dev Build Status

ParameterSchedulers.jl provides common machine learning (ML) schedulers for hyper-parameters. Though this package is framework agnostic, a convenient interface for pairing schedules with Flux.jl optimizers is available. Using this package with Flux is as simple as:

using Flux, ParameterSchedulers
using ParameterSchedulers: Scheduler

opt = Scheduler(Exp= 1e-2, γ = 0.8), Momentum())

Available Schedules

This is a table of the common schedules implemented, but ParameterSchedulers provides utilities for creating more exotic schedules as well. The higher order schedules should make it so that you will rarely need to write a schedule from scratch.

You can read this paper for more information on the schedules below.

{cell=table, display=false, output=false, results=false}

using UnicodePlots, ParameterSchedulers
Schedule Description Type Example

Step(;λ, γ, step_sizes)

Exponential decay by γ every step in step_sizes

Decay

{cell=table, display=false}

using UnicodePlots, ParameterSchedulers
t = 1:10 |> collect
s = Step= 1.0, γ = 0.8, step_sizes = [2, 3, 2])
lineplot(t, s.(t); width = 15, height = 3, border = :ascii, labels = false)

Exp(;λ, γ)

Exponential decay by γ every iteration

Decay

{cell=table, display=false}

using UnicodePlots, ParameterSchedulers
t = 1:10 |> collect
s = Exp= 1.0, γ = 0.5)
lineplot(t, s.(t); width = 15, height = 3, border = :ascii, labels = false)

CosAnneal(;λ0, λ1, period)

Cosine annealing

Cyclic

{cell=table, display=false}

using UnicodePlots, ParameterSchedulers
t = 1:10 |> collect
s = CosAnneal(λ0 = 0.0, λ1 = 1.0, period = 4)
lineplot(t, s.(t); width = 15, height = 3, border = :ascii, labels = false)

Triangle(;λ0, λ1, period)

Triangle wave function

Cyclic

{cell=table, display=false}

using UnicodePlots, ParameterSchedulers
t = 1:10 |> collect
s = Triangle(λ0 = 0.0, λ1 = 1.0, period = 2)
lineplot(t, s.(t); width = 15, height = 3, border = :ascii, labels = false)

TriangleDecay2(;λ0, λ1, period)

Triangle wave function with half the amplitude every period

Cyclic

{cell=table, display=false}

using UnicodePlots, ParameterSchedulers
t = 1:10 |> collect
s = TriangleDecay2(λ0 = 0.0, λ1 = 1.0, period = 2)
lineplot(t, s.(t); width = 15, height = 3, border = :ascii, labels = false)

TriangleExp(;λ0, λ1, period, γ)

Triangle wave function with exponential amplitude decay at rate γ

Cyclic

{cell=table, display=false}

using UnicodePlots, ParameterSchedulers
t = 1:10 |> collect
s = TriangleExp(λ0 = 0.0, λ1 = 1.0, period = 2, γ = 0.8)
lineplot(t, s.(t); width = 15, height = 3, border = :ascii, labels = false)

Poly(;λ, p, max_iter)

Polynomial decay at degree p

Decay

{cell=table, display=false}

using UnicodePlots, ParameterSchedulers
t = 1:10 |> collect
s = Poly= 1.0, p = 2, max_iter = t[end])
lineplot(t, s.(t); width = 15, height = 3, border = :ascii, labels = false)

Inv(;λ, γ, p)

Inverse decay at rate (1 + tγ)^p

Decay

{cell=table, display=false}

using UnicodePlots, ParameterSchedulers
t = 1:10 |> collect
s = Inv= 1.0, p = 2, γ = 0.8)
lineplot(t, s.(t); width = 15, height = 3, border = :ascii, labels = false)

Sin(;λ0, λ1, period)

Sine function

Cyclic

{cell=table, display=false}

using UnicodePlots, ParameterSchedulers
t = 1:10 |> collect
s = Sin(λ0 = 0.0, λ1 = 1.0, period = 2)
lineplot(t, s.(t); width = 15, height = 3, border = :ascii, labels = false)

SinDecay2(;λ0, λ1, period)

Sine function with half the amplitude every period

Cyclic

{cell=table, display=false}

using UnicodePlots, ParameterSchedulers
t = 1:10 |> collect
s = SinDecay2(λ0 = 0.0, λ1 = 1.0, period = 2)
lineplot(t, s.(t); width = 15, height = 3, border = :ascii, labels = false)

SinExp(;λ0, λ1, period)

Sine function with exponential amplitude decay at rate γ

Cyclic

{cell=table, display=false}

using UnicodePlots, ParameterSchedulers
t = 1:10 |> collect
s = SinExp(λ0 = 0.0, λ1 = 1.0, period = 2, γ = 0.8)
lineplot(t, s.(t); width = 15, height = 3, border = :ascii, labels = false)

parameterschedulers.jl's People

Contributors

darsnack avatar adinhobl avatar touchesir avatar maximilian-gelbrecht avatar carlolucibello avatar vnegi10 avatar github-actions[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.