ML Foundations: week 2

Coursera’s Lab was running slowly, so explored Google’s Colab as an alternative.

A few nice features: CPU and RAM usage indicators let me know if I’m close to a limit; the run, create and move buttons on each cell are convenient.

In Coursera, download the FND02-NB01.ipynb.zip and home_data.sframe.zip files and unzip.

In Colab, click on “File > Upload notebook” and upload the unzipped notebook.

Add a cell to install Turi Create:

%%bash
pip install turicreate

Add another cell to authorize Colab to read files from Drive:

from google.colab import drive
drive.mount('/content/drive')

In Drive, select “upload folder” and upload the unzipped folder.

In Colab’s left rail, click on the little the stylized folder icon (๐Ÿ—‚) and browse Drive for the uploaded folder. Right-click on the folder and select “Copy path”.

Update the SFrame creation to use the copied path:

sales = turicreate.SFrame('/content/drive/MyDrive/home_data.sframe')

Credit to the “Bonus Method โ€” My Drive” section of “Get Started: 3 Ways to Load CSV files into Colab” for describing the basics.

Aaand of course now that I’ve set up Colab, I see Coursera’s Lab is running faster ๐Ÿคทโ€โ™‚๏ธ

Out of curiosity, I see the intercept is negative, indicating buyers require a minimum square footage. Solving for x when y=0, I see it’s ~180. I can plug that back into the model:

sqft_model.predict([{'sqft_living': 180}])

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s