Click here to Skip to main content
15,884,986 members
Articles / Artificial Intelligence / Machine Learning

JavaScript Machine Learning and Neural Networks with Encog

Rate me:
Please Sign up or sign in to vote.
4.88/5 (7 votes)
16 Oct 2012Apache18 min read 88.5K   1.4K   27  
Use Encog genetic algorithms, simulated annealing, neural networks and more with HTML5 Javascript.
var TESTLIB=TESTLIB||{};TESTLIB.namespace=function(a){"use strict";var b=a.split("."),c=TESTLIB,d;if(b[0]==="TESTLIB"){b=b.slice(1)}for(d=0;d<b.length;d+=1){if(typeof c[b[d]]==="undefined"){c[b[d]]={}}c=c[b[d]]}return c};TESTLIB.namespace("TESTLIB.Vector");TESTLIB.namespace("TESTLIB.VectorUtil");TESTLIB.Vector=function(){"use strict"};TESTLIB.Vector.prototype={data:{},sum:function(){"use strict";var a=0,b;for(b=0;b<this.data.length;b+=1){a+=this.data[b]}return a},count:function(){"use strict";return this.data.length},length:function(){"use strict";var a,b;b=0;for(a=0;a<this.data.length;a+=1){b+=Math.pow(this.data[a],2)}return Math.sqrt(b)},clear:function(a){"use strict";var b,c;this.data=[];c=a||this.data.length;for(b=0;b<c;b+=1){this.data[b]=0}},toString:function(){return"["+this.data.join(",")+"]"}};TESTLIB.Vector.create=function(a){"use strict";var b=new TESTLIB.Vector;if(a instanceof Array){b.data=a.splice(0)}else{b.clear(a||0)}return b};TESTLIB.VectorUtil=function(){"use strict"};TESTLIB.VectorUtil.distance=function(a,b){"use strict";var c=0,d,e;for(d=0;d<a.data.length;d+=1){e=a.data[d]-b.data[d];c+=e*e}return Math.sqrt(c)};TESTLIB.VectorUtil.add=function(a,b){"use strict";var c,d;c=TESTLIB.Vector.create(a.count());for(d=0;d<a.data.length;d+=1){c.data[d]=a.data[d]+b.data[d]}return c}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0


Written By
Publisher
United States United States
Jeff Heaton, Ph.D., is a data scientist, an adjunct instructor for the Sever Institute at Washington University, and the author of several books about artificial intelligence. Jeff holds a Master of Information Management (MIM) from Washington University and a PhD in computer science from Nova Southeastern University. Over twenty years of experience in all aspects of software development allows Jeff to bridge the gap between complex data science problems and proven software development. Working primarily with the Python, R, Java/C#, and JavaScript programming languages he leverages frameworks such as TensorFlow, Scikit-Learn, Numpy, and Theano to implement deep learning, random forests, gradient boosting machines, support vector machines, T-SNE, and generalized linear models (GLM). Jeff holds numerous certifications and credentials, such as the Johns Hopkins Data Science certification, Fellow of the Life Management Institute (FLMI), ACM Upsilon Pi Epsilon (UPE), a senior membership with IEEE. He has published his research through peer reviewed papers with the Journal of Machine Learning Research and IEEE.

Comments and Discussions