Flux.jl/README.md

43 lines
1.4 KiB
Markdown
Raw Normal View History

2016-04-01 21:11:42 +00:00
# Флукс
2017-08-29 02:13:33 +00:00
[![Build Status](https://travis-ci.org/FluxML/Flux.jl.svg?branch=master)](https://travis-ci.org/FluxML/Flux.jl) [![](https://img.shields.io/badge/docs-stable-blue.svg)](https://fluxml.github.io/Flux.jl/stable/) [![Join the chat at https://gitter.im/FluxML](https://badges.gitter.im/FluxML/Lobby.svg)](https://gitter.im/FluxML/Lobby) [Slack](https://discourse.julialang.org/t/announcing-a-julia-slack/4866)
2016-12-15 21:08:43 +00:00
2017-09-07 05:02:29 +00:00
Flux is a library for machine learning, implemented in Julia. Flux is high-level yet extremely lightweight, providing only simple abstractions on top of Julia's native GPU support and automatic differentiation.
2016-04-01 21:11:42 +00:00
2017-09-07 05:02:29 +00:00
Define a simple model using any Julia code:
2016-09-02 13:18:46 +00:00
2017-05-03 19:13:31 +00:00
```julia
2017-09-07 05:02:29 +00:00
using Flux.Tracker
x, y = rand(10), rand(5) # Dummy input / output
# `track` defines parameters that we can train
W, b = track(randn(5,10)), track(randn(5))
# Transform `x` and calculate the mean squared error
loss = Flux.mse(W*x .+ b, y)
# Calculate and store gradients of `track`ed parameters
back!(loss)
Tracker.grad(W) # Get the gradient of `W` wrt the loss
2017-05-03 19:13:31 +00:00
```
2017-09-07 05:02:29 +00:00
Define a larger model using high-level abstractions:
2017-05-03 19:13:31 +00:00
2017-09-07 05:02:29 +00:00
```julia
using Flux
2016-09-02 13:18:46 +00:00
2017-09-07 05:02:29 +00:00
m = Chain(
Dense(10, 32, relu),
Dense(32, 10), softmax)
2016-09-02 13:18:46 +00:00
2017-09-07 05:02:29 +00:00
m(rand(10))
2016-09-02 13:18:46 +00:00
```
2017-09-07 05:02:29 +00:00
Mix and match the two:
2016-09-02 13:18:46 +00:00
```julia
2017-09-07 05:02:29 +00:00
using Flux.Tracker
x, y = rand(10), rand(5)
d = Dense(10, 5)
loss = Flux.mse(d(x), y)
2016-09-02 13:18:46 +00:00
```
2017-09-07 05:02:29 +00:00
See the [documentation](http://fluxml.github.io/Flux.jl/stable/) or the [model zoo](https://github.com/FluxML/model-zoo/) for more examples.