{"id":15057568,"url":"https://github.com/juliaml/stochasticoptimization.jl","last_synced_at":"2025-10-05T00:30:28.404Z","repository":{"id":148033169,"uuid":"61947822","full_name":"JuliaML/StochasticOptimization.jl","owner":"JuliaML","description":"Implementations of stochastic optimization algorithms and solvers","archived":true,"fork":false,"pushed_at":"2022-05-21T10:46:28.000Z","size":101,"stargazers_count":30,"open_issues_count":8,"forks_count":10,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-09-30T08:41:35.804Z","etag":null,"topics":["julialang","machine-learning","optimization"],"latest_commit_sha":null,"homepage":null,"language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JuliaML.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-06-25T14:52:51.000Z","updated_at":"2024-04-17T14:40:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"41269377-1ceb-483b-85af-3bef6cad5a1a","html_url":"https://github.com/JuliaML/StochasticOptimization.jl","commit_stats":{"total_commits":87,"total_committers":5,"mean_commits":17.4,"dds":0.1954022988505747,"last_synced_commit":"c64c3531dae78504a875e6768028cf2d4d397482"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaML%2FStochasticOptimization.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaML%2FStochasticOptimization.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaML%2FStochasticOptimization.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaML%2FStochasticOptimization.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JuliaML","download_url":"https://codeload.github.com/JuliaML/StochasticOptimization.jl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235330433,"owners_count":18972830,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["julialang","machine-learning","optimization"],"created_at":"2024-09-24T22:08:23.186Z","updated_at":"2025-10-05T00:30:28.080Z","avatar_url":"https://github.com/JuliaML.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DEPRECATED\n\nThis package is deprecated.\n\n# StochasticOptimization\n\n[![Build Status](https://travis-ci.org/JuliaML/StochasticOptimization.jl.svg?branch=master)](https://travis-ci.org/JuliaML/StochasticOptimization.jl)  [![Gitter chat](https://badges.gitter.im/JuliaML/chat.png)](https://gitter.im/JuliaML/chat)\n\nUtilizing the JuliaML ecosystem, StochasticOptimization is a framework for iteration-based optimizers.  Below is a complete example, from creating transformations, losses, penalties, and the combined objective function, to building custom sub-learners for the optimization, to constructing and running a stochastic gradient descent learner.\n\n```julia\nusing StochasticOptimization\nusing ObjectiveFunctions\nusing CatViews\n\n# Build our objective. Note this is LASSO regression.\n# The objective method constucts a RegularizedObjective composed\n#   of a Transformation, a Loss, and an optional Penalty.\nnin, nout = 10, 1\nobj = objective(\n    Affine(nin,nout),\n    L2DistLoss(),\n    L1Penalty(1e-8)\n)\n\n# Create some fake data... affine transform plus noise\nτ = 1000\nw = randn(nout, nin)\nb = randn(nout)\ninputs = randn(nin, τ)\nnoise = 0.1rand(nout, τ)\ntargets = w * inputs + repmat(b, 1, τ) + noise\n\n# Create a view of w and b which looks like a single vector\nθ = CatView(w,b)\n\n# The MetaLearner has a bunch of specialized sub-learners.\n# Our core learning strategy is Adamax with a fixed learning rate.\n# The `maxiter` and `converged` keywords will add `MaxIter`\n#   and `ConvergenceFunction` sub-learners to the MetaLearner.\nlearner = make_learner(\n    GradientLearner(5e-3, Adamax()),\n    maxiter = 5000,\n    converged = (model,i) -\u003e begin\n        if mod1(i,100) == 100\n            if norm(θ - params(model)) \u003c 0.1\n                info(\"Converged after $i iterations\")\n                return true\n            end\n        end\n        false\n    end\n)\n\n# Everything is set up... learn the parameters by iterating through\n#   random minibatches forever until convergence, or until the max iterations.\nlearn!(obj, learner, infinite_batches(inputs, targets, size=20))\n```\n\nWith any luck, you'll see something like:\n\n```\nINFO: Converged after 800 iterations\n```\n\n### Notes:\n\nEach sub-learner might only implement a subset of the iteration API:\n- `pre_hook(learner, model)`\n- `learn!(model, learner, data)`\n- `iter_hook(learner, model, i)`\n- `finished(learner, model, i)`\n- `post_hook(learner, model)`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliaml%2Fstochasticoptimization.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliaml%2Fstochasticoptimization.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliaml%2Fstochasticoptimization.jl/lists"}