Flux.jl/README.md

51 lines
1.3 KiB
Markdown
Raw Normal View History

2016-04-01 21:11:42 +00:00
# Флукс
2016-12-15 21:08:43 +00:00
[![Build Status](https://travis-ci.org/MikeInnes/Flux.jl.svg?branch=master)](https://travis-ci.org/MikeInnes/Flux.jl)
2017-01-15 23:52:37 +00:00
Flux is a high-level API for machine learning, implemented in Julia.
2016-04-01 21:11:42 +00:00
2017-01-15 23:52:37 +00:00
Flux aims to provide a concise and expressive syntax for architectures that are hard to express within other frameworks. The notation should be familiar and extremely close to what you'd find in a paper or description of the model.
2016-09-02 13:18:46 +00:00
2017-01-15 23:52:37 +00:00
The current focus is on ANNs with TensorFlow or MXNet as a backend. While it's in a very early working-prototype stage, you can see what works so far in the [examples folder](/examples).
2016-09-02 13:18:46 +00:00
2017-01-15 23:52:37 +00:00
## Brief Examples
2016-09-02 13:18:46 +00:00
2017-01-15 23:52:37 +00:00
Simple multi-layer-perceptron for MNIST:
2016-09-02 13:18:46 +00:00
```julia
2017-01-15 23:52:37 +00:00
Chain(
2016-09-02 13:18:46 +00:00
Input(784),
2016-11-14 22:16:00 +00:00
Affine(128), relu,
Affine( 64), relu,
Affine( 10), softmax)
2016-09-02 13:18:46 +00:00
```
2017-01-15 23:52:37 +00:00
LSTM example:
2016-09-02 13:18:46 +00:00
```julia
2017-01-15 23:52:37 +00:00
@net type LSTM
Wxf; Wyf; bf
Wxi; Wyi; bi
Wxo; Wyo; bo
Wxc; Wyc; bc
y; state
2016-09-02 13:18:46 +00:00
function (x)
2017-01-15 23:52:37 +00:00
# Gates
forget = σ( x * Wxf + y{-1} * Wyf + bf )
input = σ( x * Wxi + y{-1} * Wyi + bi )
output = σ( x * Wxo + y{-1} * Wyo + bo )
# State update and output
state = tanh( x * Wxc + y{-1} * Wyc + bc )
state = forget .* state{-1} + input .* state
y = output .* tanh(state)
2016-09-02 13:18:46 +00:00
end
end
2016-04-01 21:11:42 +00:00
2017-01-15 23:52:37 +00:00
Chain(
Input(N),
LSTM(N, 256),
LSTM(256, 256),
Affine(256, N),
softmax)
2016-09-02 13:18:46 +00:00
```