Go to Post Is any robot ever actually done? - BlondeNerd [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rating: Thread Rating: 14 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #16   Spotlight this post!  
Unread 04-15-2015, 02:10 AM
faust1706's Avatar
faust1706 faust1706 is offline
Registered User
FRC #1706 (Ratchet Rockers)
Team Role: College Student
 
Join Date: Apr 2012
Rookie Year: 2011
Location: St Louis
Posts: 498
faust1706 is infamous around these partsfaust1706 is infamous around these parts
Re: Tired of tuning pesty PID loops for hours? Try Neural Networks!

Quote:
Originally Posted by lopsided98 View Post
I now have a much better understanding of how the network works but I am still confused by a couple of things.

The simplest use case I have to test the use of a neural network is to replace the PID controller that controls the heading of the robot. From what I understand, the input data could be the difference in the current heading from the desired heading, and the target data value would be 0 in that case. The output value would be the rate of rotation of the robot and I would train the network by making the robot rotate to different headings. Does this sound right?

Also, is there any technical/mathematical reason why the network cannot use other transfer functions, or have you just not written that part yet? I was wondering because I am thinking about adding that functionality to my port.

This is probably a little irrelevant, but why do you only set the output value for the bias node of the output layer, not all of the layers?

Sorry for all the questions, but I am really interested in this.
That is exactly what 1706 has done since 2012. So long as everything is set up properly, it will work. You might want to add in a feature to save a network state before you do serious testing, otherwise you'll have to retrain every time you run the program as the weights will be set to random and not saved. (The thing you need to save is the architecture as well as the weights. You could get by with just saving the weights if you use the same architecture, but why limit yourself?)

If you look at the readme that is nowhere near complete, I talk about different transfer functions. You can use any function you want that will map an input x, where x ∈ ℝ such that f(x) has a range of [-1, 1] (or [0,1]) and f is strictly increasing on any interval [a,b] (for any b > a, then f(b) > f(a)) Or in other words, f'(x) ≥ 0, where f'(x) is the first derivative of f with respect to x. There are a few transfer functions that I intend to code in but I haven't gotten to it yet. One transfer function, called the step function, only has two outputs: -1 or 1. This is used for binary classification and can be adjusted to multiclass classification if you give it more discrete outputs, such as -2 -1 0 1 2. To implement another transfer function, you must calculate the derivative of it with respect to your input. If you haven't taken calculus yet, you can look it up online or ask a mentor (or fellow student who has taken calculus) to find the derivative for you.

As for the bias node question. That was a mistake, that is why. That line of code:
layers.back().back().setOutputValue(1.0);
was suppose to be in the for loop right above it....thanks for pointing this out to me. I'm sure there are other things that are wrong in this code base as I haven't rigorously looked through it, but it works for the training data I gave it (the xor classifier), so it shouldn't be too devastatingly wrong.

Asking questions is the best way of learning in my opinion. This was all rather new to me as well when I was a student in FRC. Then I went through a textbook on neural networks my last semester of high school (Neural Networks and Learning Machines by Simon Haykin). If you have the math background (that is, calculus III) then go for it, it could be a great way to fill your free time. Even if you don't have quite that extensive of a math background, you can still learn a lot by trying to go through it. If you never expose yourself to new material, you will never learn.

A great resource for me several years ago was a online class over machine learning put on by Andrew Ng (https://www.coursera.org/course/ml). He founded google brain, which in the end resulted in android's speech recognition program. The guy know's what he's talking about.

Edit the following morning: I added the capacity to save the state of a network. It hasn't been tested and I wrote it in one continuous go. There is most likely a bug in it. I'll look over it tonight and fix whatever I find and then test it.
__________________
"You're a gentleman," they used to say to him. "You shouldn't have gone murdering people with a hatchet; that's no occupation for a gentleman."

Last edited by faust1706 : 04-15-2015 at 09:14 AM. Reason: grammer, typos.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:46 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi