Shamoon
Shamoon

Reputation: 43501

Neural network for control application

I am trying to use brain.js or synapse.js (or any other JS NN library) to accomplish the following:

My input looks like:

{
  accelX: 0.12,
  accelY: 0.25,
  accelZ: 0.91,
  powerA: 1,
  powerB: 0.75,
  powerC: 0.44,
  powerD: 0.92
}

I want the output to be the motor powers:

{
  powerA: 1,
  powerB: 0.75,
  powerC: 0.44,
  powerD: 0.92
}

such that the accel's are approaching 0. I imagine I can train it by adjusting the power of each motor randomly and then checking if the accel's are closer to 0. If they are, include it in the training set. If not, then do not include in the training set.

This way, over time, I will have a training set of various states of my 7 inputs and what the appropriate output should be to achieve my desired objective of 0 across the accel's. My question is: how do I structure this? I am still relatively new to ANN. I am not looking for someone to write code for me or solve this for me, but perhaps general pointers in the right direction.

If anything is unclear, please add a comment and I will update the question to clarify.

Thanks

Upvotes: 4

Views: 157

Answers (1)

JeffHeaton
JeffHeaton

Reputation: 3278

First of all, I see that you have the motor power both in the input and the output. By this I assume you mean that you are passing the current power of the motors, along with the current accel values to determine the next power settings for the motors. I also assume that you have some sort of a "physics function" that takes the output from the neural network (the motor powers) and causes the accel values to change appropriately, based on the motors causing movement. The ultimate goal is to come to rest with a 0 value of each accel.

I do not suggest using a training set. What you need to do is to create a scoring function that evaluates the effectiveness of a neural network. A really easy one might be to run the neural network through 100 cycles and then take the mean accel for that neural network as the score. The goal now becomes to minimize the score.

Set the neural network weights to random values. And apply an optimization algorithms to the weights of the neural network. Optimization algorithms adjust the parameters (weights) to lower the score function. No training data is needed.

There are many different optimization functions. Simulated annealing is probably the easiest to implement, yet quite effective optimization algorithm I can think of. Other possibilities include Nelder Mead, Genetic Algorithms, or Hill Climbing.

Upvotes: 1

Related Questions