Reputation: 187
I saw the command listed as below for sklearn.tree.tree
from ._tree import Criterion, Splitter, Tree
from . import _tree
Yet in the same tree folder I cannot find any file or class named _tree
. Can anyone tell me where exactly I can find this class?
Upvotes: 1
Views: 324
Reputation: 14377
The module you are looking for is written in Cython. The corresponding file is called _tree.pyx
. It can be found in .../scikit-learn/sklearn/tree/_tree.pyx
, if you have the scikit learn sources, e.g. in form of the git repo, on your computer.
Cython is translated to C code, which can be found in _tree.c
.
The compiled C code is what is imported in the lines you found, and the corresponding file is called _tree.so
. In a typical scikit-learn installation, this may be the only file you find. It is not human-readable, so if you are interested in the source, check it out here
Upvotes: 1