https://github.com/algebra-fun/neuroflow.jl
NeuroFlow is an experimental deep learning framework written in Julia.
https://github.com/algebra-fun/neuroflow.jl
Last synced: over 1 year ago
JSON representation
NeuroFlow is an experimental deep learning framework written in Julia.
- Host: GitHub
- URL: https://github.com/algebra-fun/neuroflow.jl
- Owner: Algebra-FUN
- License: mit
- Created: 2023-02-14T13:18:08.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-03T09:52:04.000Z (over 3 years ago)
- Last Synced: 2025-01-14T02:44:08.554Z (over 1 year ago)
- Language: Julia
- Homepage:
- Size: 11.7 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NeuroFlow
[](https://github.com/Algebra-FUN/NeuroFlow.jl/actions/workflows/CI.yml?query=branch%3Amain)
`NeuroFlow` is an experimental deep learning framework written in Julia.
It implements `auto-gradient` functionality with an atomic level dynamic computational graph and provides api in `Pytorch` style.
## Installation
```julia
import Pkg
Pkg.add("NeuroFlow")
```
## Quick Start
We start with a simple linear example:
```julia
using NeuroFlow
import Distributions: Uniform, Normal, mean
using Plots
# generate some fake data obeyed the linear model
N = 1000
x = rand(Uniform(-10, 10), N) |> sort
ϵ = rand(Normal(0, 1), N)
# parameters setting
a, b = 2.5, 1.5
y = a .* x .+ b .+ ϵ
# declare parameters which needs to be optimize
â,b̂ = Param(1.), Param(1.)
# define the linear model with parameters
lm(x) = â * x + b̂
# use SGD optimizer
optimizer = SGD([â;b̂]; η=1e-2)
loss_records = []
# train for 100 epochs
for epoch in 1:100
ŷ = lm.(x)
loss = mean((y.-ŷ).^2)
# this three steps are just like pytorch
zero_grad!(optimizer)
backward!(loss)
step!(optimizer)
push!(loss_records, loss.val)
if epoch % 5 == 0
println("epoch=$epoch,loss=$(loss.val)")
end
end
```
> More detail about this example can be seen in [examples/LinearRegression.jl](examples/LinearRegression.jl)
## Examples
More examples can be found in [`examples`](examples/)