TensorFlow

TensorFlow is a opensource library for machine learning base on an original library created by Google(core in C++ with bindings in Python).TensorFlow.js is a javascript library capable of learning in the browser with training sets and test sets.Tensors are numbers eg; numbers,vectors,matrixs. These tensors are used not by the CPU but the GPU(Graphical Processing Unit).GPU make use of the WEBGL library based in OPENGL Technology.Images are sets of numbers in matrixs, every single pixel is a RGB alpha(transparency,ocapacity) numbers. With the training sets we have thousands of sample images that are used for training our neural network. Every hidden layer of the neural network is a different feature, eg; Contour, cornets,groups of pixels. After training the tensors are been optimised witha function producing the minimum distance between all the images like in a linial regression or polinomial regression. As a students you need to explain an example using neural network eg; MNIST example uses sixty thousand training images of twenty eight pair twenty eight pixels of numbers and ten thousand examples of test images.

MNIST data base

This is an example of a computer vision software developed at our school capable of analyzing high performance thin layer chromatography, that is to analyze the composition of a plant automatically from HPTLC Algorithm

Sentiments with TensorFlow

Here I explain how to creat an example of an learning machine with tensorflow.js

First Create a new directory and plop a good ol’ index.html boilerplate file in there. Then create three JS files: brain.js, training-data.js, and scripts.js (or whatever generic term you use for your default JS file) and, of course, import all of these at the bottom of your index.html file.Now go to download the Brain.js. Copy & paste the whole thing into your empty brain.js file, save out of 4 files are finished.

Now we have to think what we wanto to creat and train with deep learning.In my case I want to create a Machine that according to what you write, check if I am happy or not and that you know if the phrase is positive or negative

Now we do the setup & data-handling of the brain.All that’s left to do is set up Brain.js in our scripts.js file and feed it some training data in our training-data.js file.Setting up Brain.js is extremely easy so we won’t spend too much time on that. Every one of them would come out as black if you were to actually use it. That’s because input values have to be between 0 and 1 in order for Brain.js to work with them. So, in the above example, each color had to be processed in order to make it work. And we’ll be doing the same thing.

So if we want out neural network to identify our sentiment as an input, we’ll need to run them through an similar function (called encode() below) that will turn every character in a string into a value between 0 and 1 and store it in an array. Fortunately, Javascript has a native method for converting any character into ASCII code called charCodeAt(). So we’ll use that and divide the outcome by the max value for Extended ASCII characters: 255 which will ensure that we get a value

Now we are in the process of training our machine,Also, we’ll be storing our training data as plain text, not as the encoded data that we’ll ultimately be feeding into our A.I. - you’ll thank me for this later. So we’ll need another function (called processTrainingData() below) that will apply the previously mentioned encoding function to our training data, selectively converting the text into encoded characters, and returning an array of training data that will play nicely with Brain.js.

Finally , to run your newly-trained neural network just throw an extra line at the bottom of your ‘script.js’ file that calls the execute() function

Conclusion

Now you have a neural network that can be trained on any text that you want! You could easily adapt this to identify the sentiment of an email or your company’s online reviews, identify spam, classify blog posts, determine whether a message is urgent or not, or any of a thousand different applications. And as useless as our tweet identifier is, it still illustrates a really interesting point: that a neural network like this can perform tasks as nuanced as identifying someone based on the way they write.