Make Money with Tensorflow 2.0

Siraj Raval · Beginner ·🧠 Large Language Models ·7y ago

Key Takeaways

The video demonstrates how to use Tensorflow 2.0 to build an automated trading bot, NeuralFund, that makes predictions about stock prices and uses Stripe API for payments, deploying to the web for user access. It covers various aspects of Tensorflow 2.0, including its high-level API, eager execution mode, and model serving using Tensorflow Serving.

Full Transcript

hello world it's Suraj and I've built an automated trading bot called neural fund and I built it with a machine learning library called tensor flow and not just any tensor flow the new version of tensor flow tensor flow 2.0 and in this video I'm going to show you how I built this and what the important features of tensor flow 2.0 are so that you can make money with it and by make money I mean build an AI start up work at a company that requires that as a dependency of knowledge do something great with this knowledge that will impact people's lives and make you money that's the point of this video and let me start off by showing you how neural Fund my automated investment AI works what it does is it makes predictions about stock prices in the future for various companies in a sector that the user selects a technology so within technology Apple Google and say Amazon or three different stocks and it's gonna use an AI model to predict future prices for each of these stocks and then based on the stock that is it predicts to be the highest price it will buy that for you so it's like an automated hedge fund manager and rather than having a 20% cut which hedge fund managers take it's going to take a 2% cut so let me go ahead and demo this for you so the first step for us is to sign up for neural Fund and to sign up I'm going to give it a name and then I'll type in a password and then I'll hit submit great so I've signed up and now what I have to do is select the industry that I want my a AI to invest in so I'll select technology and it's gonna pick some stocks to invest in for me and I'll click on invest and now what's gonna happen is it's gonna ask me to complete my charge so it's gonna ask me for a hundred bucks and I'm gonna fill this out using a fake credit card for testing purposes and this is using the stripe API and once I pay it's going to take two percent of that so two bucks and it's gonna invest the rest for me so I'll pay and once I've paid see the balance is right now 98 USD it took the rest it's going to so I chose to invest in Apple stock based on its predictions and so this is just a chart of Apple stock but the point is that in background it is continuously learning about stock prices in the future using tensorflow serving I'm going to talk about how that works in the background and it's tensional a 2.0 this is a this is an automated investment bot and I'm going to show you how I built this alright so in this tutorial there are 10 steps we're gonna start by looking at what some prerequisite videos you should watch are then we're gonna talk about the problems with tensorflow 1.0 how times flow 2.0 fixes those problems will build this stock prediction model in in collab will download that model will serve it using tensor flow surveying and then we'll add some extra functionality like user's authentication payments and then finally we'll deploy it to the web so users can actually use it at the end we'll talk about ways of improving that app alright so first of all if you haven't go ahead and watch four videos right so one is called how to make money with tensor flow so that was for 1.0 but a lot of the concepts still apply then watch seven ways to make money with machine learning and then watch them one of my most recent videos watch me build an AI start-up and then watch this playlist called intro to tensor flow just on youtube search intro to tensor flow Siraj and it'll show up and once you do that let's talk about some of the problems with tensor flow 1.0 so first of all there is this programming paradigm called data flow the tensor flow team did not invent this this existed for a while and the idea of behind behind data flow is that it creates what's called a static computation graph so imagine any set of operations in any function or in any equation we can represent that as a graph where different nodes are operations like add subtract multiply divide write and data will flow through these computation graphs operation by operation let's say first that you want to add and you want to subtract and then you want to divide right so there's a there's a sequence of operations and a static computation graph can represent these operations and one way of representing data in these computation graphs is by considering them as tensors and what are tensors tensors are n dimensional arrays so that means they are groups of numbers with n dimensions this could be one dimension this could be two dimensions this could be three dimensions this could be a million dimensions right which we can visualize and the idea is that these tensions flow through the graph from input to output and they make a prediction when the prediction could would be the output of the function tensorflow and this is great and the reason they did this is because creating a computation graph in this way a static computation graph allows for very easy parallelism it's easy to distribute computation across different nodes if you abstract the idea of operations to objects in what is considered object-oriented programming it makes it easier to have distributed execution across multiple machines and it's easier to compile and it's more portable because when a static computation graph is created in one language let's say Python we can then export it and load it up in a different language because it is language agnostic all great things so the idea behind tensorflow 1.0 was we import our data define our model this is a static model at runtime the data will flow through this static graph and then we'll get some output and here's an example of some tensorflow 2.0 code right here and let me also just write out something very simple so you could see what I mean so once we've imported tensorflow then we can define two constants right so the first constant is going to be called a the second constant is going to be called B and both of these represent single values the first represents 2 and the second represents 3 and once we have these constants these tensorflow variables we can perform operations on these constants like let's say C is going to be equal to a plus B whereas D is going to be equal to a times B and then once we've done that then we launch our graph by using what's called the session object we have a TF session and then inside of that session we perform our operations let's say it's ad or it's multiply and when we do this we can see that it computed this operation but the problem is that it computed it when we ran that computation graph so right here is where this operation a plus B occurred right so if we wanted to say well let's see what B is right over here it's not going to work right because it is a static computation graph first we have to define the graph then we can the graph we can't just debug inside of the graph as it's being built and this is a problem the second problem is verbosity so there's so many concepts in tension flow placeholders variables hyper parameter values formatting convention there's a lot to learn and we haven't even begun to talk about deep learning theory here and so this is an example of verbosity I basically just copied and pasted some code from what's called ADC Dan it's a type of generative adversarial network the convolutional generator adversarial Network and I basically just copied some tension flow 1.0 code here to show you that there's a lot happening here and this can be confusing for beginners even if you have coded before they could still be confusing because there's so many different tensorflow specific naming conventions here that we have to get to know you know global variables initializer the session the different types of optimizers the saver right so it's very verbose code and there's also very messy api's because they're always adding more to the api's over time there's a lot of deprecated API s a lot of new packages are being added to this and I made this meme like should I use this sequence the sequence or this one I don't know and lastly it's very hard to debug right so if we have some value here like X and it's a value called zero and then we're we have another value called Y and we say well Y is going to be this value the log of X plus 1 divided by X so we're dividing by 0 and then we say Y plus 1 is C and then inside of our session we'll have to say well print out that value of C let's see what what Z evaluates to and of course it's gonna evaluate as n a n and a n but the the problem was Y but we didn't we couldn't we couldn't see that it was Y because if we print out y it's not gonna tell us hey the problem was here because Y hasn't been compiled it hasn't been computed yet it's waiting until the graph is built so that's what they wanted to fix with tension flow 2.0 so there are actually a lot of features that tensorflow 2.0 has that 1.0 doesn't but what I've done is I picked the three or four of them that I consider to be the most important sorry six or seven of them that I consider to be the most port important and here they are the first one is that it allows for rapid prototyping by having what's called eager execution mode as the default mode right and so eager execution mode is it is an imperative programming paradigm that doesn't create a static computation graph it creates what's called a dynamic computation graph and this is more pythonic it's more in line with how Python was built and this makes it much easier to debug it makes it much easier to read the code it's less verbose so just having this alone is such an important feature hi torch already does this in fact chain or did this about three years ago but now this is a native concept in tensorflow which makes things much simpler to to understand and I have this code right here which I'll compile so right here you can see I'm installing the latest version of tension flow 2.0 with this pip command and then I'll import tensorflow it's executing eagerly I'll create this value for X and then I'll do perform a matrix multiplication using X and notice how I can then print out that value M which is x times X or X dot product X before creating a session in fact there are no sessions anymore right all of this can is being computed with each line and this is super valuable in fact we can also use numpy natively right so we can use numpy functions to perform operations on these TF variables like C this constants etc and notice there's there's our output exactly as we wanted that to work there were no errors and like I said this makes it easier to debug because we can just print out hey what's the value of M before computing you know anything else later on and it's gonna tell us what that value is so it makes debugging a lot easier it's less verbose and one major reason for this is because they are now using Karos as the high level the official high level API of tension flow 2.0 which is awesome and so this code right here is an example of training a model and it takes about 45 seconds to train in collab which is super good super short and the whole point here is all we have to do is we have to import tensorflow we're not importing Karros why because Kaos is now built into tensorflow and what that means is there we can call Kaos just like that see this TF Kaos module right here and we're downloading the MN ist data set we trained it we tested it and this will finish training in about you know a few more seconds but that's all it took for us to train our model on data using tensor flow we built a neural network right here in a few lines using the care of sequential API it trained it it tested it and in in five epoxy we're done with training there you go there's our it trained right there right so that's super easy and there's more granular control as well in that we not only do they have chaos as a new high level API they have a full lower level API that allows you to access those native internal operations that tensorflow is using using what's called TF dot raw ops but the thing about that tensorflow team which they're definitely watching I tried to search for this in the documentation that it did not find it so definitely make that easier for developers to find okay but that's another point that it allows for more granular control at the low level as well as high level and you might be thinking well I wrote a bunch of code in tentacle a 1.0 how am I going to convert it to 2.0 they have this nifty little command called TF upgrade v2 and all you have to do is say here's my old tensorflow 1.0 file and here's my new ten flow one point of ohio and it will make all those changes automatically for you which is awesome so backwards compatibility and here's perhaps my favorite feature tensor board is now available inside of collab now tensor board if you don't know is tensor flows way of visualizing your model during training you can visualize the hyper parameters you can visualize a lot while it's happening and it's super super useful and using n grok which is a tunnel to be able to access this we can we have tensor board right there and now we can perform all sorts of visual visualizations as per necessary you know we don't have a model right now but we could perform you know any kind of visualization right in the cloud we don't have to download anything so those are the main points about tension flow 2.0 that I thought were worth mentioning because it makes it easier for anybody to enter into this field and that will make it easier for you to build something of value for other people right if as long as you can understand these tools at a high level you can put pieces together to make a prototype and then you can generate value using that right so here's what we're gonna do we're gonna build this stock prediction model with tensorflow 2.0 in this collab notebook and then we're gonna train it in the cloud then we'll download it and then we'll create a web app around that alright so let's go to this stock prediction example right here so inside of this example what I'm going to do is I'm going to use what's called a transformer neural network to predict prices for one company stock and I'm just gonna randomly pick a General Electric or Apple whatever you want to pick it doesn't matter so what I'm first gonna do is import the data and once I have that data then I can view that data and see what it is and so what I did was I pulled the data from Yahoo Finance for GE right here as a text file and it downloaded that and it showed it to me right here and we can actually just if we wanted to we could manually download it by saying download data right here and it will download it as a CSV file and then we upload it to collab and so once we have that we will be able to visualize it as a data frame right these are all the prices for for about 90 days of historical data and once we have that we're going to visualize it right here okay the data is going up over time makes sense and then once we have that data we're going to perform a bunch of pre-processing on it I'm gonna skim through this because there's a lot a pre-processing here but it's very basic stuff we want to reformat it and you can really just find copy and paste a lot of this pre-processing code and then once we have that we can show what it looks like over time and then we get to the fun part which is building our model which is called the transformer Network now the transformer network has replaced all variations of recurrent networks that includes LS TM networks gru networks for time series predictions for sequence prediction let me clarify for sequel prediction and Google invented this for specifically for language translation and their model Bert uses a transformer network open a eyes modeled GPT 2 uses a transformer network to make word predictions which allows for text generation and have two great videos on how this works in detail see both of these opening I text generator and natural language processing now what we're gonna do is we're gonna repurpose this transformer network because it's so new for asset price prediction and that is the exciting part taking some of these bleeding-edge models and reapplying them to use cases that nobody thought about that is the value that we can bring to people and this is an example of a transformer network right here now remember all of these machine learning models these neural models there are collections of different matrix operations add subtract multiply divide and what we do is these boxes represent these matrix operations and once you get to know a funeral architectures fee forward or current you know hopfield networks once you get to know a few you realize that they're all just the same thing but just different ordering of operations so you kind of just jumble up this pile of matrix math and that's your new neural network that's your new architecture and sometimes you'll achieve state-of-the-art performance with that that's really how it works that is AI researcher jumbling up these what are called differentiable blocks and seeing what's going to give a better output and so this is one example it's an encoder decoder architecture right so input sequence of past prices output will be the sequence of the next prices based on what it's gonna predict and both of those videos should show you in detail how the transformer works so how did I build a transformer for tensorflow 2.0 because I couldn't find one I could not find a transformer on github unbelievably that was written in tensorflow 2.0 so what did i do did I build it from scratch no what I did was I found an existing transformer that this guy built on Kaggle Shuja on shout out to shuji on so this was an existing transformer network that this guy built on Kaggle and it was built for tensorflow 1.0 and what I did was I copied and pasted it and I repurposed it for tension flow 2.0 so you might be asking how did you repurpose that for tension flow 2.0 and the answer is that it didn't work at first once I installed tensor flow 2.0 what I could have done is I could have used that script that I talked about that converts everything to 2.0 but instead what I did was I just like manually went through and I changed it myself just to learn what the differences are and it turns out that the only difference was rather than using check this out rather than using from chaos models all of these imports just said Karos what I did was I just have to change it to tensor flow dr.oz and then it compiled for tension flow 2.0 why because like I said before chaos is now a part of tension flow 2.0 and so there we go we got a bleeding edge model never been built before in 2.0 at least publicly definitely internally they have this at Google and then it's gonna compile and hopefully this works great just like that see and this a big model it's it's got a lot there's a lot there but we're not gonna go in through all that theory we built it there and then we fit it and I already have this right here for you my training code it's gonna be in the get in the video description this actually took a while to train a while meaning 20 minutes which is not that long and then we have a prediction of the price right here okay so it's not that good but it's it's not bad it's like there so we just need more data but the point is that we train this in the cloud we didn't have to use any of our local GPUs and we saved the model by this single line model does say my model h5 so this will save it and then we can download it by just saying let me download whatever file is here and using this sidebar we can download whatever file is there so great now that we have trained a model we want to serve this model to a user in the form of a web app so let me take some time to help explain tensorflow serving to you I really think this is one of the most powerful tools in the entire machine learning pipeline and it's because sometimes you want you want a model to be able to continuously learn from data right you don't want to just train a model it's training data it's static you serve it to a user and it's just always there you want it to continuously learn over time and tension flows serving allows your model to gracefully do this because there's a lot of things that can go wrong here and that's why Google built it for themselves because they have these continuous training pipelines internally for tools like search and maps etc so the idea is that there it's got this version control system built in or you have a version of the model let's call it model one and it's trained on some data and and users are making requests to this model post requests get requests for inference and this is happening but in the background another version of this model is training on new data and once this model has fully trained on new data it will gracefully phase out that original model and it will phase in the newly trained model and then once that's in it's gonna be training another one now this is just one version of how you could do this right you can do this several ways you can have multiple models you can have multiple models training multiple models serving you can combine data from multiple outputs to create some ensemble technique there's a lot we can do but to be very simple about this tensorflow serving allows you to create models that serve users in a production environment that allows you to experiment very fast and so think about how the data science pipeline looks and if we look at the production grade ml pipeline writing that ml code that we just did is such a small part of it right this configuration there's monitoring and this is all considered DevOps right serving analysis machine resource management there's a lot so tensorflow serving takes care of all of that for us which is awesome so you might be thinking well why can't I just use a regular web framework like Django or you know what have you like flask to do this well you could you could wrap a simple model with an API like flask or whatever but there's some really good reasons we don't want to do that the first reason is that serving is faster because it was optimized for a continuous versioned model environment because that's what they do at Google bright they have CPUs and GPUs and sometimes GPUs and they have to allocate resources efficiently both in terms of memory and in terms of space so it has better time complexity to be computer science II about it and it has better space efficiency and this version control system that's built in is just amazing that's exactly what we want to happen and more importantly they use it for their you know very scale very great products so we should use it as well and you might be thinking well does it use HTTP does it use G RPC and it used to use G RPC and is this great talk by my previous company Tulio L love you too leo that explains how G RPC works but recently they added HTTP support as well so that's a great thing as well so it uses both now let's consider some concepts inside of tensorflow serving ok so this is a this is a an image of the pipeline the lifecycle of what's called a servable and a serving bowl is the central abstraction of tensorflow serving it's just a name of an object you know an object can be named anything and inside of this programming paradigm a servable represents a model so it's fully trained model but it doesn't just have to be a model it can also be some other algorithms you know some kind of any kind of algorithm but server Bowls are that central layer of abstraction that users users will perform inference on or with so the idea is that for a servable a server ball could be let's say in our case it's going to be that fully trained stock prediction model okay so that's our server Bowl now this server Bowl will have versions to it there's a first version the second version a third version and if we take those versions we can consider it as a stream and so in get the analogy would be a dag right a directed acyclic graph to be computer science II about it but in the tension flow serving paradigm there the server bowls make up a stream with all of their versions in it and models in in the serving paradigm can represent multiple server bowls so an actual model can represent multiple models but we don't have to consider models right now let's consider server bowls because we're not gonna have to deal with that ourselves then there are loaders so loaders will manage a server bowls life cycle and a loader will pull a servable using a source so the source object has direct input outputs access to your file system so a source will pull that model from your file the loader will use the source to load that model into into memory and then a manager which is kind of the controller in this pipeline will detect what the inspired version is in which we can write logic for like which version of a model do we want to serve to a user the newest one one that's trained you know in 30 days attention flow has some default inspired versions for us which we can use as well but the manager will handle the full lifecycle of a servable the manager will say ok we want to use this inspired version okay in court is the highest level superclass of everything tension tension flow serving core which graps everything here so let me outline this steps here so first of all we train a model call the transformer on data and use it for inference then we train it on newer data so a user is inferencing this version of our transformer in real time a meanwhile we're training on it again on newer stock data that it's pulling from the web via an API and so the source plug-in creates a loader for specific version of this model and this loader has all the metadata necessary to load this server bowl computation graph it points to it on the disk the source at the source then notifies the manager of the aspired version which is this one right here this green graph the loader will then tell the source ok load the new version based on that version policy would specify the aspired version and then it will pull that from the file system into the source into the loader the loader will then give it to the manager the manager will then hand that servable that the result of that inference request back to the client and that's how it works so this is so this version system is happening in real time and that's how tension flow serving works at a high level it has HTTP and G RPC support and now it's we're on to step 6 of this tutorial we want to build tensor flow serving so how are we going to do this well the easiest way I found was to use this base repository called simple simple tensorflow serving great stuff what this guy did was he implemented all of these serving features writes restful HTTP api's supporting inference acceleration for GPU supporting dynamic online and offline model versions basically everything we would want that we would have to build from scratch which we don't have to remember this is a mentality that I want you guys you Wizards the loves of my life this is a mentality that I want you to adopt because it's my mentality this mentality of rapid experimentation of not doing anything that is unnecessary fastest methods to prototype if there exists if there exists pieces of a puzzle in terms of code on github we don't have to build that ourselves right the first version of uber just combined a bunch of existing api's together and slapped a pretty interface on it right uber use payments from stripe maps from Google which did everything it showed where drivers were it even did routing for them of course nowadays they have their own routing algorithms using deep RL and some amazing work but my point is when it comes to a prototype just put pieces of the puzzle together to get something very basic out there and then improve it over time so my point of saying all of that is that we're going to build off of this existing simple tensorflow serving demo add all of our functionality to it and that is the first version of our app so let's get right to it I'll first of all download this app and it's gonna take a while to download let's see what it asks us to do ok so we just have to install it we could either install it with pip from the source so we'll go ahead and install it from the source so what we have to do is say setup that PI as it's saying right here and github me you make this bigger terminal is my safe space install huh awesome now we will develop as he says here or she develop great and lastly we'll do a basil build of it awesome ok so that all of that worked so now what we're gonna do is we're going to start the server with a saved model so this app allows us to load different types of models by specifying ok simple times real serving and then what's the model that we want to load and hopefully this works ok so now we have this app running on our local machine called tip simple tensorflow serving and it allows us to load up any type of model that we want and there are a lot of different models that this guy has put into this app and we can see those models right here so models in fact we'll just look at it on our local machine let's check it out all these different models 4mn ist for detecting iris flowers you know all those different types of models we have here models that were trained in MX nets that we can then convert into tension flow using onyx and different language agnostic tools library agnostic tools the whole point is notice how the models are stored right here and they have both a protobuf file and a variables file those are the only two dependencies so using this boilerplates template application we can train a model like we just did in the cloud load it or serve it via this web app and wrap all sorts of functionality around it like user authentication etc and it will be able to predict using that data just like we saw right here so let's take a look at this code and see what exactly it's doing and how it's doing what it's doing so if we go into this code let me make it a little bit bigger let's go into what looks like the main code server server dot PI that looks important so in server dot PI we see that it's using flask and it's wrapping it's both using flask and tensorflow serving so flask creates an AP on HTTP API and then internally it's using serving for model versioning and inside of this we'll see that depending on which model you choose a different inference service is loaded up right so we kept we can have Onix we could have a PI torch model we could have a tensor flow model and so in that example we loaded up a tensor flow model then there's the route there there are the routes the routes for the different web pages that we have and we just need to add routes for user login and then you know a payment like purchase and then then we can leverage these existing routes these existing functions like do inference so ok but I'm very curious as to what this tensorflow inference service looks like because that's the one we're using here so for tension flow inference service what it's doing is exactly what we talked about see there's a function right here for dynamically reloading models right so it starts a new thread to load models periodically so it'll load up a model to start off and this is just continuously running it'll load the model to start off that we feed it when we when we launch it and then it's got functions for dynamically reloading models creating new threads loading saved models and it's gonna call these as per the managers requests right so a lot of this boilerplate is already abstracted away from us so all we have to do is define what that initial model looks like and then it's going to load up new versions of that model however we do have to define where that data that new training data is coming from and so what we can do is we can find in this code where it's asking for training data and then we can modify it so inference right here so inference is happening within the context of dynamically loading and reloading models right so inference is what's constantly happening ok so inside of this training dot PI file right here we'll notice that it is preparing training data from a local directory so we can modify this so that it will download data using the Yahoo Finance API from a specific date it will format that data it will turn it into a request and it will then make a prediction using it but right now we don't want to make a prediction we just want to download that data as a request and then format it as an input and then we'll say we'll create a placeholder around it shape equals none and then we will say this request JSON data it's not like that this is input data do you have that placeholder this is our train data actually so there so this is the training file so whenever a model needs to Train is going to use this and it's going to continuously use that new data that we are pulling from the web via this API then inside of inference is going to make it's going to perform inference and these models are going to be trained dynamically right so all of these functions load saved model version dynamically reload models load custom operations this is happening in real time as part as part of our tensorflow inference service which is all we needed to do was define where that new data input is coming from we already we've already trained that they from the previous stock data and then we'll define an interval like let's say every 30 days or sorry every two hours we'll train a new model every one hour you know we can change that up but the point is using a timer but the point is that we now have an inference service it's running in real time and now we want to we want to create user authentication we want to create payment functionality and we want to add that to our existing tensorflow serving app so how do we do that well it turns out that just last week I made this AI start a prototype which did a lot of this boilerplate code which I can copy and paste so basically in the layout I said you know here's my background color I generated that logo using the tool brand mark that IOI talked about before and then I said okay so here's the here's the logo right here that I just added as a source I uploaded it to imager right roll fund named it that place it there and then I use stripe to create that payments file which is in layout dot HTML so here's the paper here's the payment page right so if these are as if the user has authenticated make them pay and then it's going to make a charge to post so I'll just take these files and copy them to this existing repository and once those files are in my templates file now it's going to instakill II took all that existing code I'm only using the back end coats and none of that front end code whenever user logs in it's going to use a sequel database to store that username and password then it's going to say we'll pay with stripe and then the user pays with stripe a hundred bucks which I hard-coded and it could be anything it's gonna take two of those bucks send them to my personal stripe accounts and then the rest of it the $98 it's going to invest using the cuándo api and then any other api is we want to invest with and we're gonna we're gonna store all of those tokens that token for a specific user ID a token for the specific payment ID that this user made and the specific model that the user is using inside of the sequel database as row and that makes it easy to find an index and once we have that then we can add that the rest of the logic for so we have the inference logic we have the user off logic we have the payment logic it's just a simple stripe and then the rest of it is just formatting HTML so it looks nice so recall how in the original demo that I had here I basically just copied and pasted this line chart to just show the Apple price and I also hard-coded it to choose Apple but what we can do is we can but it's predicting using that time series data right what the next best price would be what we can do is have it perform inference on several different stock prices find the Delta between the prediction and the actual result and whichever one has a smaller Delta we'll use that one and we'll invest in that so we'll do a stock price not invest whatever the price is right so we need to authenticate with some sock API but which you know there's several I like the cuando one but there's there's several of them alpaca commission free api stock brokerage you can build and trade with real-time market data for free you get an API key and then you can you know use it with 0 Commission which is awesome so we have connected our API for stock price pulling and making purchases we have integrated that with stripe user auth and inference and not just any inference dynamically continuously training inference using tensorflow serving and not just any tension flow serving tensorflow 2.0 there's a lot more to this code you'll find it all in the video description if you have any questions any comments let me know in the comment section I'm always trying to improve my content improve my code quality improve the topics that I'm talking about to make sure that I am providing as much value as possible for you guys it is a Saturday morning and I'm here recording this because I love you guys and I want this to be released very soon so I hope you found this video Education's an inspiration what's the next a I startup you're gonna build let me know in the in section and please subscribe for more programming videos for now I've got to invest in myself so thanks for watching

Original Description

I've built an app called NeuralFund that uses Tensorflow 2.0 to make automated investment decisions. I used Tensorflow 2.0 to train a transformer network on time series data that i downloaded using the Yahoo Finance API. Then, I used Tensorflow Serving + Flask to create a simple web app around it. I'll explain what the important parts you should know in Tensorflow 2.0 are, then I'll guide you through my code & thought process of building an AI startup using it. Enjoy! Code for this video: https://github.com/llSourcell/Make_Money_with_Tensorflow_2.0 Please Subscribe! And like. And comment. That's what keeps me going. Want more education? Connect with me here: Twitter: https://twitter.com/sirajraval Facebook: https://www.facebook.com/sirajology instagram: https://www.instagram.com/sirajraval How to Make Money with Tensorflow: https://www.youtube.com/watch?v=HhqhFbwiaig 7 Ways to Make Money with Machine Learning: https://www.youtube.com/watch?v=mrRfpiAwad0&t=2s Watch me Build an AI Startup: https://www.youtube.com/watch?v=NzmoPqte4V4&t=1823s Intro to Tensorflow: https://www.youtube.com/watch?v=2FmcHiLCwTU&list=PL2-dafEMk2A7EEME489DsI468AB0wQsMV Join us in the Wizards Slack channel: http://wizards.herokuapp.com/ Hit the Join button above to sign up to become a member of my channel for access to exclusive live streams! Join us at the School of AI: https://theschool.ai/ Signup for my newsletter for exciting updates in the field of AI: https://goo.gl/FZzJ5w And please support me on Patreon: https://www.patreon.com/user?u=3191693 Join my AI community: http://chatgptschool.io/ Sign up for my AI Sports betting Bot, WagerGPT! (500 spots available): https://www.wagergpt.xyz
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Siraj Raval · Siraj Raval · 0 of 60

← Previous Next →
1 What is Bitcoin?
What is Bitcoin?
Siraj Raval
2 5 Ways to Use Bitcoin
5 Ways to Use Bitcoin
Siraj Raval
3 BTC Fever - Siraj [Music Video]
BTC Fever - Siraj [Music Video]
Siraj Raval
4 5 Reasons to Build Decentralized Apps
5 Reasons to Build Decentralized Apps
Siraj Raval
5 The Interplanetary File System
The Interplanetary File System
Siraj Raval
6 How to Build a Dapp in 3 min
How to Build a Dapp in 3 min
Siraj Raval
7 Life Before Smartphones
Life Before Smartphones
Siraj Raval
8 4 Ways to Use Smart Contracts
4 Ways to Use Smart Contracts
Siraj Raval
9 3 Dapps You HAVE to See
3 Dapps You HAVE to See
Siraj Raval
10 Char's Life as a BitTorrent Engineer
Char's Life as a BitTorrent Engineer
Siraj Raval
11 4 Reasons AlphaGo is a Huge Deal
4 Reasons AlphaGo is a Huge Deal
Siraj Raval
12 Build a Neural Net in 4 Minutes
Build a Neural Net in 4 Minutes
Siraj Raval
13 Sentiment Analysis in 4 Minutes
Sentiment Analysis in 4 Minutes
Siraj Raval
14 The Hackathon Life
The Hackathon Life
Siraj Raval
15 Your First ML App - Machine Learning for Hackers #1
Your First ML App - Machine Learning for Hackers #1
Siraj Raval
16 Build an AI Composer - Machine Learning for Hackers #2
Build an AI Composer - Machine Learning for Hackers #2
Siraj Raval
17 Build a Game AI - Machine Learning for Hackers #3
Build a Game AI - Machine Learning for Hackers #3
Siraj Raval
18 Build a Movie Recommender - Machine Learning for Hackers #4
Build a Movie Recommender - Machine Learning for Hackers #4
Siraj Raval
19 Build an AI Artist - Machine Learning for Hackers #5
Build an AI Artist - Machine Learning for Hackers #5
Siraj Raval
20 Build a Chatbot - ML for Hackers #6
Build a Chatbot - ML for Hackers #6
Siraj Raval
21 Build an AI Reader - Machine Learning for Hackers #7
Build an AI Reader - Machine Learning for Hackers #7
Siraj Raval
22 Build an AI Writer - Machine Learning for Hackers #8
Build an AI Writer - Machine Learning for Hackers #8
Siraj Raval
23 Build a Chatbot w/ an API - ML for Hackers #9
Build a Chatbot w/ an API - ML for Hackers #9
Siraj Raval
24 One-Shot Learning - Fresh Machine Learning #1
One-Shot Learning - Fresh Machine Learning #1
Siraj Raval
25 Generative Adversarial Nets - Fresh Machine Learning #2
Generative Adversarial Nets - Fresh Machine Learning #2
Siraj Raval
26 Tone Analysis - Fresh Machine Learning #3
Tone Analysis - Fresh Machine Learning #3
Siraj Raval
27 Generate Rap Lyrics - Fresh Machine Learning #4
Generate Rap Lyrics - Fresh Machine Learning #4
Siraj Raval
28 Build an Autoencoder in 5 Min - Fresh Machine Learning #5
Build an Autoencoder in 5 Min - Fresh Machine Learning #5
Siraj Raval
29 Build a Self Driving Car in 5 Min - Fresh Machine Learning #6
Build a Self Driving Car in 5 Min - Fresh Machine Learning #6
Siraj Raval
30 Build an Antivirus in 5 Min - Fresh Machine Learning #7
Build an Antivirus in 5 Min - Fresh Machine Learning #7
Siraj Raval
31 TensorFlow in 5 Minutes (tutorial)
TensorFlow in 5 Minutes (tutorial)
Siraj Raval
32 Build a Recurrent Neural Net in 5 Min
Build a Recurrent Neural Net in 5 Min
Siraj Raval
33 Build a Simulation in 5 Min
Build a Simulation in 5 Min
Siraj Raval
34 Build a TensorFlow Image Classifier in 5 Min
Build a TensorFlow Image Classifier in 5 Min
Siraj Raval
35 Tensorboard Explained in 5 Min
Tensorboard Explained in 5 Min
Siraj Raval
36 Generate Music in TensorFlow
Generate Music in TensorFlow
Siraj Raval
37 Build a Game Bot (LIVE)
Build a Game Bot (LIVE)
Siraj Raval
38 Deep Learning Frameworks Compared
Deep Learning Frameworks Compared
Siraj Raval
39 Introduction - Learn Python for Data Science #1
Introduction - Learn Python for Data Science #1
Siraj Raval
40 Build a Neural Network (LIVE)
Build a Neural Network (LIVE)
Siraj Raval
41 Twitter Sentiment Analysis - Learn Python for Data Science #2
Twitter Sentiment Analysis - Learn Python for Data Science #2
Siraj Raval
42 Recommendation Systems - Learn Python for Data Science #3
Recommendation Systems - Learn Python for Data Science #3
Siraj Raval
43 Predicting Stock Prices - Learn Python for Data Science #4
Predicting Stock Prices - Learn Python for Data Science #4
Siraj Raval
44 Pong Neural Network (LIVE)
Pong Neural Network (LIVE)
Siraj Raval
45 Deep Dream in TensorFlow - Learn Python for Data Science #5
Deep Dream in TensorFlow - Learn Python for Data Science #5
Siraj Raval
46 Visualizing Data with D3.js (LIVE)
Visualizing Data with D3.js (LIVE)
Siraj Raval
47 Genetic Algorithms - Learn Python for Data Science #6
Genetic Algorithms - Learn Python for Data Science #6
Siraj Raval
48 Enter Siraj [Music Video]
Enter Siraj [Music Video]
Siraj Raval
49 Build a Web Scraper (LIVE)
Build a Web Scraper (LIVE)
Siraj Raval
50 Why is P vs NP Important?
Why is P vs NP Important?
Siraj Raval
51 How to Make a Neural Network (LIVE)
How to Make a Neural Network (LIVE)
Siraj Raval
52 How to Make an Amazing Tensorflow Chatbot Easily
How to Make an Amazing Tensorflow Chatbot Easily
Siraj Raval
53 How to Make an Amazing Video Game Bot Easily
How to Make an Amazing Video Game Bot Easily
Siraj Raval
54 How to Make a Tensorflow Neural Network (LIVE)
How to Make a Tensorflow Neural Network (LIVE)
Siraj Raval
55 How to Make a Simple Tensorflow Speech Recognizer
How to Make a Simple Tensorflow Speech Recognizer
Siraj Raval
56 Joel Shor - Really Quick Questions with an Awesome Google Engineer
Joel Shor - Really Quick Questions with an Awesome Google Engineer
Siraj Raval
57 How to Make a Path Planning Algorithm Easily (LIVE)
How to Make a Path Planning Algorithm Easily (LIVE)
Siraj Raval
58 The Best Way to Prepare a Dataset Easily
The Best Way to Prepare a Dataset Easily
Siraj Raval
59 Catherine Olsson - Really Quick Questions with an OpenAI Engineer
Catherine Olsson - Really Quick Questions with an OpenAI Engineer
Siraj Raval
60 How to Make a Tic Tac Toe Neural Network Easily (LIVE)
How to Make a Tic Tac Toe Neural Network Easily (LIVE)
Siraj Raval

This video teaches how to build an automated trading bot using Tensorflow 2.0, covering topics such as model building, serving, and versioning, as well as user authentication and payment functionality. It provides a comprehensive overview of Tensorflow 2.0 and its applications in finance.

Key Takeaways
  1. Install Tensorflow 2.0 and import necessary libraries
  2. Build a transformer network for stock price prediction
  3. Use Tensorflow Serving for model versioning and serving
  4. Create user authentication and payment functionality using Stripe
  5. Deploy the model to the web for user access
💡 Tensorflow 2.0 provides a high-level API and eager execution mode, making it easier to build and deploy machine learning models, including automated trading bots.

Related Reads

📰
Getting Started with Microsoft Foundry Local: Running AI Models Without the Cloud
Run AI models locally without the cloud using Microsoft Foundry Local and build a fully local RAG assistant
Medium · Python
📰
Inkling by Mira Murati: US Best open-weights AI Model is here
Learn how to use Inkling, the US Best open-weights AI Model, for free and unlock its potential in machine learning applications
Medium · Machine Learning
📰
Inkling by Mira Murati: US Best open-weights AI Model is here
Learn how to use Inkling, the US best open-weights AI model, for free and unlock its potential
Medium · Data Science
📰
I Deleted the Viral CLAUDE.md File. My Code Got Better.
Deleting the viral CLAUDE.md file improved code quality, learn how to apply this insight to your own ML projects
Medium · Machine Learning
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch →