4

I want to use sklearn.metrics plot_confusion_matrix in Google Colab. It comes with the latest stable update of sklearn 0.22.

https://scikit-learn.org/stable/auto_examples/model_selection/plot_confusion_matrix.html#sphx-glr-auto-examples-model-selection-plot-confusion-matrix-py

I tried this Make colab use the latest installation of a library

But in the end it shows the version of sklearn is still 0.21.

enter image description here

2
  • 3
    Did you try following the advice of the red text in your screenshot? Commented Dec 14, 2019 at 21:26
  • I tried to re-run it. But actually it has to be mannual restarted. Thanks for the tip! Commented Dec 14, 2019 at 21:33

2 Answers 2

7

I uninstalled sklearn from colab like you do in the start of your image and reinstalled it again updating it as it is mentioned in sklearn documentation. The code I used was the following:

!pip uninstall scikit-learn -y

!pip install -U scikit-learn

After I checked if my version was updated with:

import sklearn

sklearn.__version__

'0.24.1'
Sign up to request clarification or add additional context in comments.

Comments

1

Make sure to hit Runtime > Restart Runtime

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.