# Example of simple 1 layer Perception in Flux

**URL:** <https://discourse.julialang.org/t/example-of-simple-1-layer-perception-in-flux/21413>\
**Category:** Machine Learning\
**Created:** [March 3, 2019, 1:24am UTC](https://discourse.julialang.org/t/example-of-simple-1-layer-perception-in-flux/21413 "2019-03-03T01:24:12Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![samq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samq/32/47935_2.png) [@samq](https://discourse.julialang.org/u/samq)\
**Post date:** [March 3, 2019, 1:24am UTC](https://discourse.julialang.org/t/example-of-simple-1-layer-perception-in-flux/21413/1 "2019-03-03T01:24:12Z")

</div>

I saw the Flux pages, but the examples are not clear to me.  
Since Flux is simple and fast, would someone please post an example of how to make a simple 1 layer Perceptron using Flux?

Such an example would be a springboard to more complicated neural networks.

---

<div class="post-metadata">

**Author:** ![Per](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/per/32/10387_2.png) [@Per](https://discourse.julialang.org/u/Per)\
**Post date:** [March 3, 2019, 7:01am UTC](https://discourse.julialang.org/t/example-of-simple-1-layer-perception-in-flux/21413/2 "2019-03-03T07:01:08Z")

</div>

Maybe look at this code and change the line that reads `m = Chain( ... )` to only contain one layer ?

> <https://github.com/MikeInnes/flux-notebooks/blob/master/mnist/mlp.ipynb>

---

<div class="post-metadata">

**Author:** ![kirtsar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kirtsar/32/7222_2.png) [@kirtsar](https://discourse.julialang.org/u/kirtsar)\
**Post date:** [March 3, 2019, 10:58am UTC](https://discourse.julialang.org/t/example-of-simple-1-layer-perception-in-flux/21413/3 "2019-03-03T10:58:46Z")

</div>

Use just simple `Dense(m, n, foo)`, where foo is some activation function, m is the size of input, n is the size of output. By the way, if you want to dig deeper into Flux, I recommend Julia academy short course on Deep learning.

---

<div class="post-metadata">

**Author:** ![samq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samq/32/47935_2.png) [@samq](https://discourse.julialang.org/u/samq)\
**Post date:** [March 3, 2019, 10:47pm UTC](https://discourse.julialang.org/t/example-of-simple-1-layer-perception-in-flux/21413/4 "2019-03-03T22:47:33Z")

</div>

Thank you!  
Do you happen to have a link to the short course you mentioned?

---

<div class="post-metadata">

**Author:** ![samq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samq/32/47935_2.png) [@samq](https://discourse.julialang.org/u/samq)\
**Post date:** [March 3, 2019, 10:47pm UTC](https://discourse.julialang.org/t/example-of-simple-1-layer-perception-in-flux/21413/5 "2019-03-03T22:47:34Z")

</div>

Thank you so much!  
Do you happen to know if there is an example of doing a Deep Reinforcement Learning network in Flux?

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [March 3, 2019, 10:58pm UTC](https://discourse.julialang.org/t/example-of-simple-1-layer-perception-in-flux/21413/6 "2019-03-03T22:58:43Z")

</div>

Google found for example

> **[GitHub - JuliaReinforcementLearning/ReinforcementLearning.jl: A reinforcement...](https://github.com/JuliaReinforcementLearning/ReinforcementLearning.jl)**
>
> A reinforcement learning package for Julia. Contribute to JuliaReinforcementLearning/ReinforcementLearning.jl development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![samq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samq/32/47935_2.png) [@samq](https://discourse.julialang.org/u/samq)\
**Post date:** [March 3, 2019, 11:16pm UTC](https://discourse.julialang.org/t/example-of-simple-1-layer-perception-in-flux/21413/7 "2019-03-03T23:16:06Z")

</div>

Yes thank you.  
I’ve seen that, but it’s not the same as as an example in Flux of a Deep Reinforcement Learning Network.

---

<div class="post-metadata">

**Author:** ![kirtsar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kirtsar/32/7222_2.png) [@kirtsar](https://discourse.julialang.org/u/kirtsar)\
**Post date:** [March 4, 2019, 5:13pm UTC](https://discourse.julialang.org/t/example-of-simple-1-layer-perception-in-flux/21413/8 "2019-03-04T17:13:09Z")

</div>

You can find it here: [https://academy.juliabox.com/](https://academy.juliabox.com/)  
Also there was a topic about Julia academy on Discourse.

---

<div class="post-metadata">

**Author:** ![samq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samq/32/47935_2.png) [@samq](https://discourse.julialang.org/u/samq)\
**Post date:** [March 4, 2019, 6:38pm UTC](https://discourse.julialang.org/t/example-of-simple-1-layer-perception-in-flux/21413/9 "2019-03-04T18:38:33Z")

</div>

Thank you so much!
