LoginSignup
9
8

More than 5 years have passed since last update.

Pythonのクラス定義のファイルの場所を知る。

Posted at

ipythonの%pinfoを使いましょう

~/Documents/.../python/numpy $ ipython                                                        git[branch:master]
from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifierPython 2.7.3 (default, Apr 13 2012, 00:05:08) 
Type "copyright", "credits" or "license" for more information.

IPython 0.13 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifier

In [2]: %p
%%perl      %paste      %pdef       %pinfo      %pprint     %prun       %pushd      %pylab      
%%prun      %pastebin   %pdoc       %pinfo2     %precision  %psearch    %pwd        
%page       %pdb        %pfile      %popd       %profile    %psource    %pycat      

In [2]: %pinfo RandomForestClassifier

String Form:<class 'sklearn.ensemble.forest.RandomForestClassifier'>
File:       /Library/Python/2.7/site-packages/scikit_learn-0.13.1-py2.7-macosx-10.8-intel.egg/sklearn/ensemble/forest.py
Docstring:
A random forest classifier.

A random forest is a meta estimator that fits a number of classifical
decision trees on various sub-samples of the dataset and use averaging
to improve the predictive accuracy and control over-fitting.

...
9
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
8