-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
138 lines (110 loc) · 6.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!DOCTYPE html>
<html>
<head>
<title>The Fido Project</title>
<meta charset="UTF-8">
<meta name="description" content="An open-source machine learning library targeted towards embedded electronics and robotics.">
<meta name="author" content="Michael Truell and Joshua Gruenstein">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/normalize.css" />
<link rel="stylesheet" href="css/skeleton.css" />
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.3.0/styles/default.min.css" />
<link rel="stylesheet" href="css/index.css">
</head>
<body>
<div class="container">
<div class="row" id="navbar">
<ul>
<li><a data-scroll href="#about">about</a></li>
<li><a data-scroll href="#start">start</a></li>
<li><a data-scroll href="#examples">examples</a></li>
<li><a data-scroll href="#who">who</a></li>
<li><a href="/research">research</a></li>
<li><a href="/docs/html">docs</a></li>
<li><a href="https://github.com/FidoProject/Fido">github</a></li>
</ul>
</div>
<h2>The Fido Project</h2>
<p>An open source C++ machine learning library targeted towards embedded electronics and robotics.</p>
<hr>
<div class="sec" id="about">
<h4>about fido</h4>
<p>Fido is a light-weight, open-source, and highly modular C++ machine learning library. The library is targeted towards embedded electronics and robotics. Fido includes implementations of <b>trainable neural networks, reinforcement learning methods, genetic algorithms, and a full-fledged robotic simulator</b>. Fido also comes packaged with a human-trainable robot control system as described in <a href="https://github.com/FidoProject/Research">Truell and Gruenstein</a>.</p>
</div>
<div class="sec" id="start">
<h4>getting started</h4>
<p>Download and unzip the latest <a href="https://github.com/FidoProject/Fido/releases">release</a>. Navigate to the Fido directory and run: </p>
<pre>$ sudo make install</pre>
<p>And you're done! To use Fido, just include <code>Fido/Fido.h</code> in your C++ code and link <code>/usr/local/lib/fido.a</code>. For more information please visit the <a href="/docs/html">docs</a>.</p>
</div>
<div class="sec" id="examples">
<h4>quick examples</h4>
<h5>neural networks</h5>
<p>Here is a quick example of training a neural network using backpropagation. We will train the network to perform linear regression.</p>
<pre><code>net::NeuralNet neuralNetwork = net::NeuralNet(1, 1, 2, 4, "sigmoid");
neuralNetwork.setOutputActivationFunction("simpleLinear");
std::vector< std::vector<double> > input = { {1}, {2}, {5}, {6} };
std::vector< std::vector<double> > correctOutput = { {2}, {4}, {10}, {12} };
net::Backpropagation backprop = net::Backpropagation();
backprop.train(&neuralNetwork, input, correctOutput);
</code></pre>
<h5>genetic algorithms</h5>
<p>Here is a quick example of generating neural networks using genetic algorithms. We will train the network to perform linear regression.</p>
<pre><code>#include "Fido/GeneticAlgo.h"
#include <math.h>
std::vector<double> getPopulationFitness(const std::vector<net::NeuralNet> &population) {
std::vector<double> fitnesses;
for(net::NeuralNet network : population) {
double totalError = 0;
for(double input = 1; input < 4; input++) {
totalError += pow(input*2 - network.getOutput({input})[0], 2);
}
fitnesses.push_back(1/totalError);
}
return fitnesses;
}
int main() {
srand(time(NULL));
gen::GeneticAlgo geneticAlgo = gen::GeneticAlgo(20, 0.4, 0.5, 10, getPopulationFitness);
net::NeuralNet modelNetwork = net::NeuralNet(1, 1, 1, 4, "simpleLinear");
net::NeuralNet bestNetwork = geneticAlgo.getBestNeuralNetwork(600, modelNetwork);
}
</code></pre>
<h5>simulator</h5>
<p>Move a robot in a circle in Fido's robotic simulator.</p>
<img src="img/simulator.gif" alt="Simulator gif" style="width:50%;height:50%;">
<pre><code>Simlink simulator;
while(true) {
simulator.setMotors(10, 5, 10, 10);
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}</code></pre>
<p>While the simulator is not in the most recent release (as it is currently undocumented), it can be found for experimentation on the simulator branch.</p>
<h5>reinforcement learning</h5>
<p>Here is a quick example of using the Fido library to train a robot in our simulator to perform line following using reinforcement learning.</p>
<pre><code>rl::FidoControlSystem learner = rl::FidoControlSystem(1, 2, {-1, -1}, {1, 1}, 3);
Simlink simulator;
int goodIterations = 0;
while(goodIterations < 5) {
rl::Action action = learner.chooseBoltzmanAction({ simulator.isLeftOfLine() }, 0.2);
double originalDistance = simulator.distanceFromLine();
sf::Vector2f displacement = sf::Vector2f(action[0], action[1]);
sf::Vector2f newPosition = simulator.robot.getPosition() + displacement;
simulator.robot.setPosition(newPosition);
double newDistance = simulator.distanceFromLine();
double rewardValue = (fabs(originalDistance) - fabs(newDistance - originalDistance)) / sqrt(2);
learner.applyReinforcementToLastAction(rewardValue, { simulator.isLeftOfLine() });
if(simulator.distanceFromLine() < 80) goodIterations++;
else goodIterations = 0;
}</code></pre>
</div>
<div class="sec" id="who">
<h4>who is fido</h4>
<p>Fido was created by programmers <span id="nameOne"><a href="https://github.com/joshuagruenstein/">Joshua Gruenstein</a></span> and <span id="nameTwo"><a href="https://github.com/truell20/">Michael Truell</a></span> from the Horace Mann School. The project was started as a universal robot control system using limited feedback, which can be read about <a href="research">here</a>. Fido still continues to be developed in this direction. Fido is open source licensed under the <a href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
</div>
</div>
<script src="js/smooth-scroll.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.3.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="js/index.js"></script>
</body>
</html>