python-machine-learning-book-3rd-edition icon indicating copy to clipboard operation
python-machine-learning-book-3rd-edition copied to clipboard

run on google Colab

Open g-i-o-r-g-i-o opened this issue 4 years ago • 1 comments

Hello, can you please help to run the code on google colab?

How to view images on the colab without doing much work? For each file? Probably creating a directory on the notebook colab folder, where I put all the images?

Right now I get this error:

Image(filename='images/03_01.png', width=400) 
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-149-4c8da45e0c5c> in <module>()
----> 1 Image(filename='images/04_01.png', width=400)

Then there's the watermark problem, which is easy, I've just added pip install to your files:

# add this to run in colab:
!pip install -q -U watermark
# this is the same
%load_ext watermark
%watermark -a "Sebastian Raschka" -u -d -p numpy,pandas,matplotlib,sklearn

g-i-o-r-g-i-o avatar Jul 11 '21 19:07 g-i-o-r-g-i-o

Hi there.

Like you said, the errors are due to the missing images. There are multiple options you can try.

  1. You could download the image folder from https://github.com/rasbt/python-machine-learning-book-3rd-edition/tree/master/ch03/images and then upload it to Google Colab. It should be relatively easy now with their drag and drop interface.

  2. You could comment out or disable those cells because they are not really needed. I just have them in the notebooks so it is easier to find the respective code when looking at the notebooks

  3. You could replace the relative links by links to the images on github, but this would probably be tedious.

rasbt avatar Jul 15 '21 13:07 rasbt