0

I want to know is there any way to see "under the hood" on other python sklearn algorithms. For example, I have created a decision tree classifier using sklearn and have been able to export the exact structure of the tree but would like to also be able to do this with other algorithms, for example KNN classification. Is this possible?

Sjoseph
  • 853
  • 2
  • 14
  • 23
  • 3
    Grab your favorite ML-book and read it. In KNN, there is no fitting, and besides optimizing the internal-storage for fast lookups (kd-tree, ball-tree, ...), there is no internal-state. All is done during prediction-time. All the others of course have attributes you can call -> SVMs: support-vectors; LinearModels: coefficients and so on... What's wrong with the docs? – sascha Sep 07 '17 at 11:31
  • @sascha, Thanks for that. That clears it up for me. I will read up on KNN properly and reread the documentation! – Sjoseph Sep 07 '17 at 11:37
  • 1
    For every classifier/regressor there is a API-page like [this](http://scikit-learn.org/stable/modules/generated/sklearn.svm.LinearSVC.html). The part within *attributes* is the stuff you can query. Everything else is hidden and not directly supported. [Somewhat bigger example: MLP](http://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPClassifier.html). – sascha Sep 07 '17 at 11:39

1 Answers1

1

I would recommend looking up this book.

Introduction to Machine Learning with Python A Guide for Data Scientists by Andreas C. Müller, Sarah Guido

The book has code written to visualise various outputs for Machine Learning algorithms.