Re: [scikit-learn] custom loss function in RandomForestRegressor

2018-02-15 Thread Guillaume Lemaître
> 10 times means that we could write something in the doc :) On 15 February 2018 at 21:27, Andreas Mueller wrote: > > > On 02/15/2018 01:28 PM, Guillaume Lemaitre wrote: > > Yes you are right pxd are the header and pyx the definition. You need to > write a class as MSE. Criterion is an abstract

Re: [scikit-learn] custom loss function in RandomForestRegressor

2018-02-15 Thread Guillaume Lemaître
Calling `python setup.py build_ext --inplace` (also `make in`) will only recompile the files which change without recompiling everything. However, it is true that it can lead to some error which require a clean and recompile everything. On 15 February 2018 at 20:46, Thomas Evangelidis wrote: >

Re: [scikit-learn] custom loss function in RandomForestRegressor

2018-02-15 Thread Andreas Mueller
On 02/15/2018 01:28 PM, Guillaume Lemaitre wrote: Yes you are right pxd are the header and pyx the definition. You need to write a class as MSE. Criterion is an abstract class or base class (I don't have it under the eye) @Andy: if I recall the PR, we made the classes public to enable such

Re: [scikit-learn] custom loss function in RandomForestRegressor

2018-02-15 Thread Thomas Evangelidis
Is it possible to compile just _criterion.pyx and _criterion.pxd files by using "importpyx" or any alternative way instead of compiling the whole sklearn library every time I introduce a change? Dne 15. 2. 2018 19:29 napsal uživatel "Guillaume Lemaitre" < g.lemaitr...@gmail.com>: Yes you are righ

Re: [scikit-learn] custom loss function in RandomForestRegressor

2018-02-15 Thread Guillaume Lemaitre
Yes you are right pxd are the header and pyx the definition. You need to write a class as MSE. Criterion is an abstract class or base class (I don't have it under the eye)@Andy: if I recall the PR, we made the cla

Re: [scikit-learn] custom loss function in RandomForestRegressor

2018-02-15 Thread Thomas Evangelidis
Sorry I don't know Cython at all. _criterion.pxd is like the header file in C++? I see that it contains class, function and variable definitions and their description in comments. class Criterion is an Interface, doesn't have function definitions. By "writing your own criterion with a given loss"

Re: [scikit-learn] custom loss function in RandomForestRegressor

2018-02-15 Thread Andreas Mueller
I wonder whether this (together with the caveat about it being slow if doing python) should go into the FAQ. On 02/15/2018 12:50 PM, Guillaume Lemaître wrote: The ClassificationCriterion and RegressionCriterion are now exposed in the _criterion.pxd. It will allow you to create your own criterio

Re: [scikit-learn] custom loss function in RandomForestRegressor

2018-02-15 Thread Guillaume Lemaître
The ClassificationCriterion and RegressionCriterion are now exposed in the _criterion.pxd. It will allow you to create your own criterion. So you can write your own Criterion with a given loss by implementing the methods which are required in the trees. Then you can pass an instance of this criteri

Re: [scikit-learn] custom loss function in RandomForestRegressor

2018-02-15 Thread Andreas Mueller
Yes, but if you write it in Python, not Cython, it will be unbearably slow. On 02/15/2018 12:37 PM, Thomas Evangelidis wrote: Greetings, The feature importance calculated by the RandomForest implementation is a very useful feature. I personally use it to select the best features because it is

[scikit-learn] custom loss function in RandomForestRegressor

2018-02-15 Thread Thomas Evangelidis
Greetings, The feature importance calculated by the RandomForest implementation is a very useful feature. I personally use it to select the best features because it is simple and fast, and then I train MLPRegressors. The limitation of this approach is that although I can control the loss function