明确概念
Strategies of learning: Supervised learning(有测试集结果), Unsupervised learning(无测试集结果), Reinforcement learning(有环境感知)
Perception algorithm: input by its weight, sum all of the weighted inputs, Compute the perception output
lerp: lerp(start,stop,amt), 一个变量在 start 和 stop 之间按照 amt 取值指定一个数,the lerp function is convenient for creating motion along a straight path and for drawing dotted lines.
明确功能
1.通过感知算法判断一个点落在线的左边还是右边
-Provide perception inputs and known answer
-Ask perception to guess the answer
-Compute the error
=desired - guess
=input * (desired - guess)
=weight + input * (desired - guess)
=weight + input * (desired - guess) * learning rate
-Adjust all the weights according to the error
-Repeat N times to get appropriate input weights
功能设计
类:Perception
属性:weights
方法:guess, feedforward
伪代码
setup(){
}
draw(){
}
class Perception{
定义属性
Perception(){}
定义方法
}
正式代码
见:
Processing/Neural_networks at master · JoeyQiang/Processing · GitHub
代码优化
1.点集出现“虚拟线”的左右两侧
2.Neural networks diagram
网友评论