How can I implement a multilayer social network in R?

How would you implement a neural network on a web application?

  • Probably a stupid question, but I'm new to web development.   How would I implement a neural network as part of a web application?   What language would be best for this: HTML5, JavaScript, etc.?

  • Answer:

    A neural net implementation, or any learner implementation, contains two parts: training and scoring [1]. You should implement the net trainer offline, in any language of your choice, then export the model [2] for scoring by the client code. The scoring code is usually very thin and can be implemented quickly, even in JavaScript. For neural net, it is just a forward propagation. Notes [1] I have explained this in a related question [2] If your net is a simple fully connected network, the model is just a set of layer weights.

Kenneth Tran at Quora Visit the source

Was this solution helpful to you?

Other answers

I would do it on the back-end using what technology is most applicable to the problem you are trying to solve.  A specialized back-end server that supplies a RESTFul service as an interface to the UI.  Good luck using JavaScript on the browser for something like this.

Jack Menendez

Why do you want to do that? If you want to build a website that uses some neural network based machine learning, you can just write it as server code in whatever language you want, and take advantage of the many machine learning libraries in C++, python, etc. I don't really see any use case for implementing a neural network on the client side aside from a toy program on a website that teaches neural networks. If that's what you want to do, the simplest solution (but certainly not the most elegant) would probably be a Java applet. A pure javascript implementation with an HTML5 UI is certainly a possibility but that would be some significant work and the result would likely be slow. (Or would it? I don't know so much about modern Web tech and I know that javascript interpreters made huge progress in the last years, but still, backpropagation training on large many-dimensional sets demands significant computing power) A javascript/HTML5 interface interacting with an efficient server side implementation would probably be a better idea.

Alexandre Coninx

Someone's already done this in JavaScript: check out https://github.com/harthur/brain on Github. The client-side version is at https://github.com/harthur/brain/blob/gh-pages/brain-0.6.3.js As the author of the project notes, "Training is computationally expensive, so you should try to train the network offline (or on a Worker)." So you're going to either be doing this as a part of an offline HTML5 application or using it on a Web Worker. The brain.js library then provides a 'toFunction' method which allows you to turn the trained network into a normal JavaScript function. There's also a toJSON() method if you want to use that to serialise the neural network and save it for later. This is a pretty basic example of the brain.js library, for guesstimating colour contrast: [code js] var net = new brain.NeuralNetwork(); net.train([{input: { r: 0.03, g: 0.7, b: 0.5 }, output: { black: 1 }},           {input: { r: 0.16, g: 0.09, b: 0.2 }, output: { white: 1 }},           {input: { r: 0.5, g: 0.5, b: 1.0 }, output: { white: 1 }}]); var output = net.run({ r: 1, g: 0.4, b: 0 });  // { white: 0.99, black: 0.002 }[/code]

Thomas Foster

I vote for do ann on the backend answer. :) But, if you are insisting on doing it in web up front, you can try crowding ann learning to several mobiles / desktops, borrowing their computing power, basically like a combi of what cluster computing, distributed computing, and crowdsourcing do. I just don't know the real life situation perfect for this project though. And also sorry, I forgot which project actually had done this (If I am not mistaken, it is mentioned in Tanenbaum Book of Operating System)

Renan Prasta Jenie

IMO, Training process should be handled in "backend" with power server, then trained ANN could be used in frontend by js

Ricky Nguyen

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.