Hi Ian,

2013/7/7 Ian Ozsvald <i...@ianozsvald.com>

> Hi all. I'm following the RandomForest code (in dev from a 1 week old
> checkout). As I understand it (and similar to the previous post - I
> have some RF usage experience but nothing fundamental), RF uses a
> weighted sample of examples to learn *and* a random subset of features
> when building its decision trees.
>

correct - although weighted samples are optional - usually, RF takes a
bootstrap sample and this is implemented via sample_weights (e.g. a sample
that is picked two times for the bootstrap has weight 2.0)

>
> Does the scikit-learn implementation use a random subset of features?
> I've followed the code in forest.py and I can't find where the choice
> might be made. I haven't looked at the C code for the DecisionTree.
>

Its in the implementation of DecisionTree - see sklearn/tree/_tree.pyx -
look for the for loop over ``features``.


>
> I'm interested to learn the lower bound of the number of random
> features that can be chosen.
>

could you elaborate on that?


>
> I'm also curious to understand where we can restrict the depth of the
> RandomForest classifier. All I can see is that in forest.py the
> constructor takes but ignores the max_depth argument:
> class RandomForestClassifier(ForestClassifier):
> ...
>     def __init__(self,
>                  n_estimators=10,
>                  criterion="gini",
>                  max_depth=None,
> ...
>         super(RandomForestClassifier, self).__init__(
>             base_estimator=DecisionTreeClassifier(),
> ...
>
> base.py._make_estimator just clones the existing base_estimator. Am I
> missing something?
>

after cloning it calls ``set_params`` with ``estimator_params`` -
``'max_depth'`` is one of those.

best,
 Peter


>
> Thanks for listening,
> Ian.
>
> --
> Ian Ozsvald (A.I. researcher)
> i...@ianozsvald.com
>
> http://IanOzsvald.com
> http://MorConsulting.com/
> http://Annotate.IO
> http://SocialTiesApp.com/
> http://TheScreencastingHandbook.com
> http://FivePoundApp.com/
> http://twitter.com/IanOzsvald
> http://ShowMeDo.com
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Scikit-learn-general mailing list
> Scikit-learn-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>



-- 
Peter Prettenhofer
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to