How to Use GitHub Copilot for Data Science (Python + VS Code)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
svm regressor wow the support Vector machine is now in here if you are not using GitHub go pilot for your data science projects yet then you are really missing out so I've been playing with this tool for the past two months or so and all I can say is that I'm really impressed by it and working with it is just so much fun in this video I'm going to show you how I use it the benefits and also how you can get started with it as well so let's get into it I basically like to think about it as code Auto completion but really on steroids I've loaded a data set over here from one of my previous videos Amazon headphone reviews I want to get the average rating for each brand so what then I would do next is I would say I'm going to get this data frame and then I'm going to do a group buy and boom see what it's doing over here so it's suggesting okay you want probably want to group by brand because it's for each brand you want to take the mean and then you want to show just the rating and it's already suggesting to make a plot out of it so let's see what we have over here wow so this is working it's not too great but that is just because there are too many brands in here so we can easily say that we only want the head of this and then boom we have the first five or let's say we want the first 10. so instant plot so now let's say we want to do this for every product so okay let's see if it understands what we're trying to do now so I'm gonna say DF again and then now it says Group by product and then it remembers you probably want the first 10 as well so boom here we have it so product is not in there and that is because it should be product name and now we have it for the products already sorted again a nice plot and now when we can create a function so it is now suggesting split product rating object is this working I'm not sure it looks like something that could work and it's working so 5 Star 4 star one star three star two star so what was it was like five seconds I just basically explained what I wanted to do and then boom function and then boom here's how you apply it as well so this is so nice it's just like as you are typing as you are coding it's like suggesting hey here's probably what you want to do and then boom you insert it alright so I hope that by now I have convinced you that this is awesome and you want this in your workflow as well so let me actually give you some tips how you can get the most out of this and how to actually make it more awesome using another extension so basically what you have to do to get started is go to GitHub co-pilot and you can find the link in this document which I will link in the description there are no affiliate links or whatsoever in this this is all just linking to the official website over here but here you can basically start a free trial with your AI pair programmer and there is a very nice 60-day free trial you so you can really try it out so I did it as well for 60 days and then I decided to hop on the subscription of ten dollars a month because I need this in my life but here you can also see some more information about GitHub copilot but you basically want to sign up using your GitHub account and then start a trial so that is the first thing that you have to do and then you have to check if your IDE is supported so one of those over here and then the next thing you have to do is you have to come up to your extensions and then basically search for copilot over here and then make sure to install this extension so GitHub copilot and then once that is installed you can come to the bottom over here you have this little icon and you can basically configure it and you can enable or disable it globally so once you've done that so GitHub account trial vs code extension and then you're good to go so basically as you start to type it's going to suggest all kinds of things so that is how you get going but now some additional tips to make it even better and first of all we have some shortcuts so we can toggle through options with options and then using the brackets and we can also generate more results with control and enter so let me first show you the toggle options so I have a basic plot over here and let's say we want to add a title in here so it's suggesting already average rating for each product but if I hover on this I can see this is one of two options so I can now press option and then the right bracket and then I can basically toggle so it is adding rating in there as well now for example if we say let's turn this into a function we comment over here then type Def and it will provide us with some results and we have three over here so we can basically say okay we can toggle through it with option any brackets and then we can basically see what the kind of nuances are and pick the best one so we toggle through it and then I decide okay this is the one that we want right now boom we got the title we got the label we got the legend All right so we have everything so we literally turned this code into a function in a matter of like two seconds or so alright so that was the toggle option with option plus the brackets so let's now look at how we can use Ctrl enter to generate results so I'm inside another project over here where we have a data frame with bike rentals and let's just ask it to create a machine learning model for this so let's first gather the columns and I will ask you to create a train test split and a random forest model to predict y from X and now we hit Ctrl enter so now it's going to synthesize the results for us so here it will basically provide us with all kinds of things that we can import so this is really exciting so now we can just say accept solution and then of course we have to import random Force regressor so it knows that and boom we have our model so here we have our predictions so easy machine Learning Easy random forest in a matter of seconds now there's one additional thing that I want to show you and this will basically supercharge everything that I've just shown you and that is GitHub called pilot labs and I wasn't aware of this I only found out about this recently but this is a vs code X extension for experimental features of GitHub called Pilots so they have some exciting stuff coming in the future they also recently announced GitHub co-pilot X which is what Microsoft's believes to be the future of programming so if you have a look at what they are planning to do with this this will be so awesome coding will be so much fun but you can already test somewhat of the functionality that they are plotting that they are talking about with GitHub copilot x with this YouTube co-pilot Labs extension so all you have to do is come to Fierce codes come to the extensions and then co-pilot Labs just search for this and it will be this one over here so it's from GitHub as well so this is another free extension that you can just install and it will just sync basically to your GitHub account so also if you have the trial going on it's not a separate subscription it's just an addition so here we have another script and let me show you what you can do right now so now once you have GitHub copilot labs this little buddy will appear over here and look we now have an explain a language translation we have some brushes and we have test generation and now explain is really cool because it can basically explain what you're doing so you can literally say like hey what is it doing over here and then you say explain code but this is not much different from how you would do it for example with using chat gdpt so this could be really nice but where it gets really powerful is the brushes so here you have some buttons that you can hit and you can basically make code more readable at types fix bugs so let's see how cool this is so for example we can start off with for example this for the first few lines over here we can say make it readable boom it's loading and voila so it's adding comments and also oh I see that it's first defining the features in a list and then the target as well and then here it's specifying the X and UI so before it was basically split up and now you can really easily see like okay here's the X here's the Y so it just makes your code more readable with just one click of a button so now next add data types so here we have a function say add types okay wait for it loading boom specifying okay X has to be a bonus data frame we need a series and this will output the scores to a dictionary all right pretty neat right you don't have to do it yourself if there are any bugs in here you can also fix it so let's for example say you have a you're missing a t over here so now this has a bug so it's not working it's pretty obvious but let's see if it can fix it boom fixed it so now next what we can also do is we can make it more robust so this will put in some exception some error handling so let's see what it can come up with boom it will try accept everything and then basically if it's not able to run it will print an error error with linear regression how cool is that this takes so much time if you really want to make neat gold and add this all by yourself so here we have another function let's see what it can do over here so types over here make it more robust we have some error handling in here and now we can also say okay we want to document this and we have a very nice description of what is going on over here so you can basically see how you can just start to code like you normally would and then every once in a while you come over here you just make everything more nice and clean readable you add the types if there are any box you hit the debugging mode all right now the final thing that I want to show you because this is also really cool this is the custom option so let's say for example I select this function over here that's already optimized and I do custom and let's have a look at the model so if a linear regression random Forest gradient boosting and XG boost let's say we want at an svm regressor it's in there support Vector machine so now we have added the support Factor Machine by just selecting it and asking it to add it in and it will just follow the same syntax the same style and it will just work so to me like this is the future of coding like you have your AI assistant over here it is you that has to do like the creative thinking the creative work but actually like typing out everything and figuring out what what is svm is called in the sklearn library and what you have to import that is all done by AI so you can actually focus on all the fun stuff this like really blows my mind but this really get a go pilot combined with GitHub go by Labs is such an amazing combination and believe me once you get used to working like this you can't really go back because it just makes your life as a data scientist so much better and it's so exciting at least for me that we are still at the beginning of all of these tools and Ai and it's going to make our life so much better so if you haven't already I would really suggest checking out GitHub copilot X watch this video it's really exciting what Microsoft soft and open AI have planned for the future this will be so cool and we can build so many cool stuff with this so again this document will be in the description you can find all the links over here that you need to get started I would really suggest hoping on the free 60-day trial because really this is the future of coding and if you want to stay relevant in a year from now five years from now 10 years from now you really have to learn how to work with these tools because otherwise other people will just blow you out of the water and be 10 times even 100 times more productive than people that are not using these tools and now if you want to make your workflow even faster then check out this video next where I will share my top 17 physical tips for data science
Info
Channel: Dave Ebbelaar
Views: 2,940
Rating: undefined out of 5
Keywords: github copilot, github copilot python, data science, machine learning, vscode, vs code, copilot vscode, copilot python, github copilot python review, github copilot python machine learning, github copilot python demo, github copilot python vscode, github copilot labs, chat gpt 4, chatgpt, python, ai coding, ai, github copilot x, copilot x, chatgpt vscode, github copilot vscode, github copilot tutorial, github copilot chat, github copilot vs chat gpt, github copilot review
Id: alMEtTzsDu8
Channel Id: undefined
Length: 11min 58sec (718 seconds)
Published: Thu Mar 23 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.