Last active
December 7, 2017 14:53
-
-
Save robertleeplummerjr/4aaf8afb177c9c80f8452d5025117e26 to your computer and use it in GitHub Desktop.
a brain.js feed-forward layer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
add, | |
multiply, | |
random, | |
sigmoid | |
} from './'; | |
export default function feedForward(settings, input) { | |
const { width, height } = settings; | |
const weights = random({ width, height }); | |
const bias = random({ width }); | |
return sigmoid( | |
add( | |
multiply( | |
input, | |
weights | |
), | |
bias | |
) | |
); | |
} |
This will be available soon, and usable like:
import {
input as inputLayer,
feedForward as FeedForwardLayer,
output as outputLayer
} from 'brain.js/layer';
const net = new brain.FeedForward({
inputLayer: (input) => inputLayer({ width: inputWidth }, input),
hiddenLayers: => [
(input) => feedForwardLayer({ width: inputWidth, height: hiddenHeight }, input)
],
outputLayer: {input) => outputLayer({ width: outputWidth })
});
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No talk of tensors, matrices, no gpu's, though it has all that. Just sweet sweet simple math with a little programming.