create account

Clojure Machine Learning - Generating Art (Feed Forward, Hill Climb) by tensor

View this thread on: hive.blogpeakd.comecency.com
· @tensor · (edited)
$6.36
Clojure Machine Learning - Generating Art (Feed Forward, Hill Climb)
#### What Will I Learn?

- You will learn how to create a feed forward neural network in Clojure
- You will learn how to build a hill climb algorithm 
- You will learn how to use Clojure Quil to sketch drawings 

#### Requirements

- A firm knowledge of Lisp or Clojure
- A decent knowledge of Linear Algebra and Machine Learning concepts
- The Clojure Leiningen build tool and Java JDK 8+

#### Difficulty

- Advanced

#### Description

In this **Clojure tutorial**, we use the **Quil library** to build out a picture/sketch generating **Feed Forward**, **Hill Climbing Neural Network**.  There are various ways to approach this type of problem in Clojure. Clojure has such a small but powerful core set of language features that we can leverage to build our **Feed Forward Neural Network** with very few lines of code.  

First, we build out a bunch of **generic mathematical functions**.  We need functions to help us preform **Linear Algebra** on the **Clojure Vector data type**.  This includes functions that allow us to preform **Multiplication**, **Subtraction** and the **Dot Product**.  We also create a few functions that allow us to **generate random Matrices and Vectors** based on the inputs. We then implement basic versions of the **Sigmoid function** and the **Tangent Hyperbolic function** which we will use as our Transfer Functions.  These functions allow us to **normalize the inputs and outputs** based on the weighs that we get from our network.  

Next, we build out a library that allows us to actually construct our **Feed Forward Neural Network**. We use **Clojure Records** to build a network of layers which we can then **recursively iterate** through and preform operations on.  We add some basic **genetic algorithms** in the form of our **Hill Climb Algorithm**.  we use an arbitrary value to incrementally search for numbers that work as solutions to our problem.  We have expected outputs which we are trying to train our network to work towards. 

We finally use the network inputs and outputs along with the **Quil library** to actually draw out random pictures.  The inputs work as points that exist between our **X and Y coordinates** of the window and our outputs are used to assign values to the colors that fill the created shapes.  The more **Neurons, Layers and Outputs** assigned to the **Neural Network**, the more complex and interesting the sketch will be.  More complex **Networks** will also tax the computer's resources as a result of a lack of GPU optimization in this particular implementation.     

The source code for this project can be found [here](https://github.com/tensor-programming/Clojure_Nerual_Art)

#### Video Tutorial
<iframe width="560" height="315" src="https://www.youtube.com/embed/u7qg-anw2io" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>

    

<br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@tensor/clojure-machine-learning-generating-art-feed-forward-hill-climb">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 48 others
properties (23)
authortensor
permlinkclojure-machine-learning-generating-art-feed-forward-hill-climb
categoryutopian-io
json_metadata{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":747512,"name":"clojure","full_name":"clojure/clojure","html_url":"https://github.com/clojure/clojure","fork":false,"owner":{"login":"clojure"}},"pullRequests":[],"platform":"github","type":"video-tutorials","tags":["utopian-io","steemstem","steemiteducation","programming","science"],"links":["https://github.com/tensor-programming/Clojure_Nerual_Art","https://www.youtube.com/embed/u7qg-anw2io","https://utopian.io/utopian-io/@tensor/clojure-machine-learning-generating-art-feed-forward-hill-climb"],"image":["https://img.youtube.com/vi/u7qg-anw2io/0.jpg"],"moderator":{"account":"amosbastian","time":"2018-02-23T10:09:42.781Z","flagged":true,"reviewed":false,"pending":false},"questions":[],"score":0}
created2018-02-23 02:53:45
last_update2018-02-23 10:09:42
depth0
children3
last_payout2018-03-02 02:53:45
cashout_time1969-12-31 23:59:59
total_payout_value4.719 HBD
curator_payout_value1.639 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,048
author_reputation87,856,203,149,624
root_title"Clojure Machine Learning - Generating Art (Feed Forward, Hill Climb)"
beneficiaries
0.
accountutopian.pay
weight2,500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id39,753,463
net_rshares1,421,162,775,736
author_curate_reward""
vote details (112)
@amosbastian ·
Your contribution cannot be approved because it does not follow the [Utopian Rules](https://utopian.io/rules), and is considered as **plagiarism**. Plagiarism is not allowed on Utopian, and posts that engage in plagiarism will be flagged and hidden forever.

Plagiarised from [here](https://github.com/pearman/neural-network-art).

You can contact us on [Discord](https://discord.gg/uTyJkNm).
**[[utopian-moderator]](https://utopian.io/moderators)**
properties (22)
authoramosbastian
permlinkre-tensor-clojure-machine-learning-generating-art-feed-forward-hill-climb-20180223t101128611z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-02-23 10:11:30
last_update2018-02-23 10:11:30
depth1
children0
last_payout2018-03-02 10:11:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length449
author_reputation174,473,586,900,705
root_title"Clojure Machine Learning - Generating Art (Feed Forward, Hill Climb)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id39,832,821
net_rshares0
@minnowsupport ·
<p>Congratulations!  This post has been upvoted from the communal account, @minnowsupport, by Tensor from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows.  Please find us at the <a href="https://discord.gg/HYj4yvw"> Peace, Abundance, and Liberty Network (PALnet) Discord Channel</a>.  It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.</p> <p>If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: <a href="https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&amp;delegatee=minnowsupport&amp;vesting_shares=102530.639667%20VESTS">50SP</a>, <a href="https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&amp;delegatee=minnowsupport&amp;vesting_shares=205303.639667%20VESTS">100SP</a>, <a href="https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&amp;delegatee=minnowsupport&amp;vesting_shares=514303.639667%20VESTS">250SP</a>, <a href="https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&amp;delegatee=minnowsupport&amp;vesting_shares=1025303.639667%20VESTS">500SP</a>, <a href="https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&amp;delegatee=minnowsupport&amp;vesting_shares=2053030.639667%20VESTS">1000SP</a>, <a href="https://v2.steemconnect.com/sign/delegateVestingShares?delegator=&amp;delegatee=minnowsupport&amp;vesting_shares=10253030.639667%20VESTS">5000SP</a>. <br><strong>Be sure to leave at least 50SP undelegated on your account.</strong></p>
properties (22)
authorminnowsupport
permlinkre-clojure-machine-learning-generating-art-feed-forward-hill-climb-20180223t050357
categoryutopian-io
json_metadata""
created2018-02-23 05:03:57
last_update2018-02-23 05:03:57
depth1
children0
last_payout2018-03-02 05:03:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,702
author_reputation148,902,805,319,183
root_title"Clojure Machine Learning - Generating Art (Feed Forward, Hill Climb)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id39,776,096
net_rshares0
@steemstem-bot ·
$0.71
<center><a href="www.steemit.com/@steemstem"><img src="https://media.discordapp.net/attachments/384404201544876032/405507994583957505/steemSTEM.png"></a><br><table><tr><th> </th><th> </th><th><a href="https://steemit.com/steemstem/@steemstem/helpful-guidelines-for-crafting-steemstem-content">Guidelines</a></th><th><a href="https://steemit.com/steemstem/@steemstem/steemstem-winter-2017-2018-project-update">Project Update</a></th><th> </th><th> </th></tr></table><br><a href="https://steemit.com/steemstem/@steemstem/being-a-member-of-the-steemstem-community"><b>Being A SteemStem Member</b></a></center>
👍  
properties (23)
authorsteemstem-bot
permlinkre-clojure-machine-learning-generating-art-feed-forward-hill-climb-20180223t053702
categoryutopian-io
json_metadata""
created2018-02-23 05:37:03
last_update2018-02-23 05:37:03
depth1
children0
last_payout2018-03-02 05:37:03
cashout_time1969-12-31 23:59:59
total_payout_value0.714 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length606
author_reputation3,811,533,615,496
root_title"Clojure Machine Learning - Generating Art (Feed Forward, Hill Climb)"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id39,781,975
net_rshares128,300,562,121
author_curate_reward""
vote details (1)