6.1: Introduction to TensorFlow.js – Intelligence and Learning

hello and welcome to another session of my string oddly organized perhaps hopefully somewhat organized set of videos about intelligence and learning so this where are we right now I am in the moment where I have finished a whole set of tutorials about neural networks and some basic machine learning types of things that one might do with the neural network comprehensive but a few demonstrations I built a little neural network library and JavaScript and went through some matrix math stuff so I'm ready finally at the time I've been saying this all along that I'm making this neural network library and kind of looking at how things work and trying to make some creative examples but later eventually someday I will use a more robust thoughtful well-designed framework as the guts as the as the foundation from which I will build all of my examples and projects I'll use somebody else's machine learning code and so today is the day that I'm going to start talking about doing that and the foundation that I will be using for almost all of these videos is a project called tensorflow Chasse so let's discuss for a moment where where where did tensor flow TAS come from so you might have heard of something called tensor weird to write this down ten surf low now first of all you might even be asking yourself oh why is it even called tensor flow what is this thing called a tensor and now this is gonna be really important because when I start to actually look at the code for tension float yes there's going to be stuff in there called tensors and the tensor is actually a mathematical thing it's a structure that holds numbers in it and it's really basically I mean I should look at the Wikipedia page for tensor probably and it'll give you a good I'll link to that in this video's description but we've been I've been referring to things as vectors well we have scalars which is like a single number like three we have this idea of vector which is a list of numbers like 3 1 4 etc and we also have this idea of a matrix or matrices if I'm being consistent about singular or plural this idea of a matrix and a 2-dimensional matrix might have a grid of numbers like 3 4 1 5 so a tensor is a structure a data structure essentially that really can store any n dimensional version of these types of things so this is the and because the building blocks of any machine learning algorithm are matrices of numbers this idea of tensorflow know let's flow with the tensors insert animation of me flowing down the river of tensors well that happened in post-production I seriously doubt it this is where the name tensor flow comes from so tensor flow is Google's open source machine learning library it is written you might be surprised to hear this because you might think ah tensor flow it's Python right well yes kind of sure there were people who are watching this who know more about me so if you're watching the recorded version of this check the video's description for home the correction I'll go look for all I'll try to met make any Corrections at the end but the tensor flow is actually a library written in C++ it is a low-level C++ library with a lot of functionality for doing machine learning now the reason why you might have thought to yourself oh isn't it Python well there simply is a sort of bindings for Python so to speak a Python a wrapper so to speak for pi so python being a programming language that's primarily used that primarily is but it's very popular in the world of data science it makes sense if you're a data scientist and working with data and you want to do some stuff with machine learning that you would and you're already in Python you want to be able to access something like tensorflow so every most all in every example that you would see working with tensorflow is you're just kind of operating the low-level tensorflow stuff from Python in fact there are also Java bindings for tensorflow and probably other languages as well and in another youniverse if all this JavaScript stuff had never happened oh it's travel back in time and stopped JavaScript from happening maybe what would our life be like should we try that but I don't think better or worse I would probably be investigating here right now talking about the Java bindings for tensorflow in an attempt to maybe go and use them with processing and actually this is something that I really I know that Gough read hater who is the creator of the Raspberry Pi arm version of processing has done some investigation of this and this is actually something I really would like to do but that aside this project tensorflow has been around for quite a while let me go look and find out how long it's been around and then I'll come back ok so I'm back I had to look that up tensorflow was open sourced in 2015 so tasteful actually is a project according to Wikipedia started in 2011 was a proprietary machine learning library used at Google for doing all sorts of stuff with neural networks and deep learning and more and then it was open source in 2015 under the Apache License so here's the thing last year I actually spent some time making some Python examples in tensorflow and I wanted them to talk to JavaScript so what I actually did is I wrote something called a flask server which is a Python flask is kind of like flask is – Python as node is to JavaScript I'm sure that's wrong in many ways and then what I did is I had my p5 sketch talked to that flask server the flask server did Python stuff with tensorflow and then I could do machine learning tasks from within p5 and this is what I want to do I want to be able to straight and make examples and show things about how in a beginner friendly programming library like p5 or just in native vanilla JavaScript or using three Jas or whatever JavaScript world you live in I lived in the p5 world most of the time I want to be able to try to do some tensor flow East stuff and so this was the way I was doing it last year in the nature of code intelligence and learning course that I attempted to teach over the summer I think was last summer a project appeared a project appeared and it was called deep learn is now this is a my sense of this project is that this was a speculative project the idea behind deep learn Dutch s is can we do this kind of stuff in JavaScript and if so how so one of the things that's special about doing machine learning in today's modern era with tensorflow is in addition to this whole landscape of all this stuff where these operations that are written in C++ actually get executed they you have this question of do they get executed on the CPU or do they get executed on the GPU and why should we care about this well the CPU the processing unit the computer's processing unit is the C stands for boy hope so is a little thing that chugs along and kind of does most of the work that your computer has to do some time some time in days of your video games and special effects and graphics needed more and more processing and computing power so graphics processing units were created graphics processing units were created and optimized to work with pictures images pixels what are images they are matrices of pixels remember though is talking about how matrices are important to tensors and deep learning all of the mathematical operations that happen in a neural network our matrix based operations multiply these matrices together add these matrices sum these matrices past this activation function over this matrix that sort of stuff so the fact that over years and years and years that graphics processing units got optimized heavily to work with two-dimensional arrays of color information pixels it so happens that all this matrix stuff could be used with GPUs as well so this is really it's is why we deep the term deep learning from my point of view it's kind of in a way of like a rebrand of neural net machine learning with neural networks but now we live in an age of big data sets and really powerful GPUs and a lot of this modern research is coming from the fact that these older algorithms that we didn't think could do as much can do more now in the context of where we live now ok why am I saying this so how is this gonna work if we have a JavaScript implementation of tensorflow is the idea to just have another set of bindings so you're really just controlling C++ from JavaScript well that is certainly a possibility and I believe that exists or at least is in development there is a node dot J S package for working with tensor flow that actually connects directly to the C++ implementation and has a relationship to the tension flow just enough that I'm going to talk about here but that's not what I'm talking about here what the creators of deep learned is Nikhil and Daniel more information about them and the rest of the research teams that they work with in this video's description and want to miss credit anybody important they didn't actually write something to control native C++ GPU they actually just rewrote all the C++ algorithms loosely I don't know about all what's implemented so far not in JavaScript and isn't that gonna be really slow isn't that a terrible idea well first of all if you're me I like things from slow who cares I just want the stuff to run I want to play with it I want to learn about it I can always use something else to get it to run faster later but maybe in JavaScript alone it would run just way too there happens to be something in the world of JavaScript called WebGL WebGL is the browser's interface to OpenGL for doing operations on the graphics card for drawing and making graphic stuff happen in the browser so if the math operations of tensorflow in c++ can run on the GPU why can't the math operations inside of this thing called deep learning is run via the GPU via WebGL so that's really the magic in my mind of what was accomplished with this original project called deep learn Dutch yes so let's go look at that website for deep learn Dutch is first second on March 30th less than a month ago deep learn Jas became adopt this speculative project of doing these machine learning stuff in JavaScript was adopted by the larger tensorflow project itself and there and and has become this vert this project called tensor flow Jas whoo so tensorflow Jas this is now the project oh we can write that over here by the way if you can't see what's written up there it's just some question marks sorry about that tensor flow Jas so we're gonna circle that we're gonna put some hearts on it and a few stars this is now the framework that I am planning to use in my ended set of tutorials that you may or may not choose to watch I may or may not choose to make cuz that's right now I haven't made them yet but that's my plan all right there's something else that's important as part of the picture here that I want to talk about and to do so I'm gonna just erase this area over here so okay so we have this terminology in programming high-level versus low level and I actually saw discussion about this going on in the chat there are low level programming languages there are high level programming languages one way to think about that is low level is actually you're manipulating the RAM and the data in the central processing unit like you just you're all the way in there and the deepest part of the computer moving the numbers around yourself versus high level is something like really high level is like a scratch programming environment for kids where I'm like moving puzzle pieces and blocks around to try to create an algorithm so that's one way of thinking about high level low level so it's kind of there could be this sort of a level of abstraction so tensorflow if I were to make I guess I should put low on the bottom tensorflow in terms of working with machine learning operations tensorflow is a low-level library to do the actual matrix math and gradient descent learning training algorithms all yourself written into the code yourself with tential it's common operations that are implemented for you but this is really low-level control of the algorithm itself you could invent new machine learning models by writing them in tensorflow yourself then in between that there previously was a proper still is sorry this project called Charis Charis Charis Charis I don't have pronounce it can't laughs I always think everything is French for some reason so and that's probably not even a French pronunciation of that word but that aside sorry sorry that you had to watch that caris was meant to be a higher level API built on top of tensorflow and in fact Caruth was actually originally designed to be a higher level API that could sit on top of a variety of other low-level machine learning frameworks so for example there's something called theano is that it what is called I think it's called Theano there's like pi torch which is maybe well pi tors torch and then there's pi tortures python storage there's all these other machine lower-level machine learning frameworks I clearly have not an expert on but Karis the idea of countess's you could kind of write your code make a machine learning thing and it could it could operate on top of any of these so Karis though however more recently became part of the tensorflow project itself and so Karis is actually and tension flow are linked together so this is a higher level API that's written on that's built on top of tension flow and it exists as part as tensor flow Jas and it's so in tension flow digest there's no actual concept of Keres specifically but there is the core API and then what's called the layers API and the layers API is something that I'm gonna use much more in my video tutorials although I'm gonna start with a few that just look at the core stuff because it's kind of important to have a sense of what that is and how that works but layers so layers in tension flow Janus is the equivalent of this thing called Kerris now a project that's being developed here at New York University with some collaborators from ITP and guests and researchers and students is a project called ml 5 the 5 in ml 5 is an omage homage that's French right to the 5 in p5 in the sense that I mean this is flawed for many reasons but in p5 you could think of as like a wrapper on top of canvas and Dom to jeju's like common creative coding functions to make drawing and making pictures and doing creative sketching projects a bit easier and friendlier in JavaScript ml 5 is yet another layer on top of well sorry I shouldn't put this it's only for JavaScript as a layer on top of tensorflow Jas to do some common to allow to sound of like even abstract the concepts even a bit further and you know I think one of the goals of ML 5 is for it to be a library that high school class could use a kind of weekend workshop for artists could use these sort of context of people wanting to get a basic understanding and try some machine learning stuff out so anyway so this is all the stuff whether it was a long introduction to all these pieces this is all the stuff that I'm hoping to cover over the next several months you can kind of pick and choose ultimately you might be able you'll see what's available for you at the time of watching this but ultimately you might want to skip ahead and look at some of these ml5 tutorials because you don't necessarily to do the ml5 example you don't necessarily need to have a knowledge of the core API of tension flow chess or the layers API even but I'm gonna start even though I might buy the goal for the ml5 librarian examples is to give people a starting place that you don't need to have gone through all the lower-level stuff for my own kind of sanity and figuring this stuff out also ml5 doesn't actually have a public release yet whatever that means but the goal is sort of like have a quote-unquote public release in June with more documentation examples and features my I'm gonna start very first thing I'm gonna do in the next video is just look at the core API in attentive flow chess and see like what some of the things you can make do with it what some of the functionality is and that kind of stuff all right how am i doing I think good I probably made a bunch of mistakes and missed a bunch of things so check the video description because I'll write corrections and stuff in there and also I will in the next video if you continue on whatever the Google's YouTube machine learning algorithm tells you to watch next we'll hopefully have some anything that needs to be corrected alright thanks for watching this I hope this was a helpful picture of my of all these pieces and my thinking as it relates to them look ma ok goodbye

31 thoughts on “6.1: Introduction to TensorFlow.js – Intelligence and Learning”

  1. Thanks ))) A tensor is a generalization of vectors and matrices to higher dimensions. CPU – Central Processing Unit

  2. How was I missing your videos? I love the way you approach to the topics … and you are really fun!… Thank you so much!!

  3. Are those flask examples anywhere? I want to use tfjs but realized that there are still some things I need the python version of tensorflow for. It seems like you didn't end up releasing them but I wanted to check.

  4. Great video!!! Friendly and great beginners. Have seen many tensorflow.js tutorials but it is not at all good for beginner. They tell you hey we are doing this you just collect this kind of data, do this do that.

  5. Thank you for making this so accessible. Even having a decent amount of math under my belt, it is frustrating to be met with a wall of jargon when I'm trying to explore new technologies, AI specifically.

  6. Hello, i am from Indonesia
    in Indonesian language "Keras" is same with "Hard" in English language
    You are brilliant.

  7. WTF, instant likability factor through the roof. Thanks for the energy and enthusiasm man! I'm learning a lot more than tech stuff here. Like a lot.

  8. Daniel, I love you but can you cut down on clowning? Think about it: Even the brightest of us have an limited attention span. How much time do you want to waste on irrelevant things? The video is entitled "Intro to Tensorflow.js". Why talk about all the other stuff that does not apply? Pyton, etc…. Why walk out to find out how long TensorFlow has been around? If it was around for 3 years or 5 years would that make a difference in programing it with JS? Right here , right now?
    I am 10 min in the video and we have not done anything resembling a program.
    Too bad.
     You're brilliant, if you'd find yourself an editor to cut out the useless blabber, you could teach us all so much more by getting to the point. You got a gift that few people have, dont let it dissipate in useless chatter.

    Please dont be offended.

    PS, I would love to see a TensorFlow Processing library. I love Processing, Python is a pain to work with.

  9. keras is the ancient Greek word for horn >> https://en.wikipedia.org/wiki/Cornucopia and Theano is the ancient Greek name Θεανώ

  10. I love how you teach. I learn much more from you than course i am on that cost 2000 usd for one person… I love what you do… And tensorflow is awsome… 🙂

  11. Hey, loved the video but could you possibly create a video where you explain how to create a simple generic algorithm with neural networks using tenserflow.js?

Leave a Reply

Your email address will not be published. Required fields are marked *