From the course: Applied Machine Learning: Supervised Learning
How to use Codespaces
From the course: Applied Machine Learning: Supervised Learning
How to use Codespaces
- [Instructor] This course uses UV as a tool to install the libraries, and I'm going to be demonstrating that via Codespaces. If you're familiar with UV, you can clone this repository and run uv sync as it says in the readme. Alternatively, if you're not familiar with it, let me show you how to get this going very easily with Codespaces. You're going to click on this green button, make sure that you're logged into GitHub, and you're going to click this plus button to create a Codespace. This will fire off Codespaces. What this is going to do is provision a server and install all the necessary software on it. It's going to use UV under the covers, but you don't have to do anything. You just have to wait and let it happen. It might take a few minutes, up to four or five minutes. When you see VS Code have a dark mode, that should be a hint that you're almost ready to go. Let's give this some time to provision the server for us. Okay, you can see that it looks like it has loaded something. However, we still need to give it some more time, so let's just be patient. You want to wait until it goes into dark mode. Okay, now it's finally finishing up. You can see the spinner here. What this is doing is it is running UV and installing our package behind the scenes into a virtual environment. We'll let the spinner right here finish, and then it should be done. Okay, at this point, the spinner is done, the git pull succeeded, it looks like we're good to go. What you need to do now is click on the supervised.ipynb. This is the notebook for our course. Note that what happened behind the scenes is UV was used to sync all the contents of this pyproject.toml file installing all the dependencies for us. So if you come over to this notebook, and you can go down here to the section where we start using some code here, which is this 2.2. This is VS Code. If you're not familiar with VS Code, it's actually loading a Jupyter Notebook right here. So this is a Code cell, this is a Markdown cell up here, and you need to know how to run code cells for this course. You've got a couple ways to do that. One is you can click this button up here. Alternatively, I like to use the keyboard shortcuts to do that. So the keyboard shortcut is to hold down Control and hit Enter. So I'm going to do that right now. Now, this is not running the first time, it actually comes up with this popup up here, and it says we have to choose a kernel source. So we're going to click Python Environments, and because we waited for it, it should have this one with a star next to it. This is the virtual environment that UV provisioned for us. Let's just click on that. Okay, that looks like it worked, and... It looks like down here, you can see that this is spinning. It's running our code. The first time you import pandas, this is importing pandas, this is the first thing. It takes a little while to import that the first time, and after that subsequent times, it should be fast. And it looks like that did indeed work. Let me give you a few more hints with Jupyter. There's a few commands you might want to know. In Jupyter, there's two modes. One is Command mode and one is Edit mode. If I click inside of this Code cell, you can see that there's a cursor here. I'm now in Edit mode, and I can type things and they just appear inside of the cell. If I hit Escape, you can see that the outline around the cell disappeared. I'm now in Command mode, and Command mode lets me manipulate cells. So I can do things like this where I can say A, create a cell above this, and you can see it created a new cell. I can hit Enter. This will go into Edit mode and I can say like print ('hello'), and then I can hold down Control and hit Enter and it will run this. If I want to delete this cell, I hit D two times. That will delete it. Again, A will make a cell, Enter. We'll go into Edit mode. If I want to escape out of Edit mode without running it, I can hit Escape. If I'm in Edit mode and I want to run it, I hold down Control and hit Enter. With these commands, you should be good to go. There are a few more commands that you can use, like you can use this to delete a cell. But for this course, you just need to know how to make cells and execute them. I highly encourage you to either get this working locally on your machine or to use Codespaces. One of the cool things about this course is that we will be creating a project. This is something that you could put in a portfolio or adapt to your work, and to make this project, you will need to use Jupyter to do it. Have a great course.