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 custom criterion. However, ‎it is not documented since we were not officially supporting it. So this is an hidden feature. We could always discuss to make this feature more visible and document it. 

Guillaume Lemaitre 
INRIA Saclay Ile-de-France / Equipe PARIETAL
guillaume.lemai...@inria.fr - https://glemaitre.github.io/
From: Thomas Evangelidis
Sent: Thursday, 15 February 2018 19:15
To: Scikit-learn mailing list
Reply To: Scikit-learn mailing list
Subject: Re: [scikit-learn] custom loss function in RandomForestRegressor

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" you mean writing a class like MSE(RegressionCriterion)?
 

On 15 February 2018 at 18:50, Guillaume Lemaître <g.lemaitr...@gmail.com> wrote:
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 criterion to the tree and it should work.





--
Guillaume Lemaitre
INRIA Saclay - Parietal team
Center for Data Science Paris-Saclay
https://glemaitre.github.io/

_______________________________________________
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn




--

======================================================================

Dr Thomas Evangelidis

Post-doctoral Researcher

CEITEC - Central European Institute of Technology
Masaryk University
Kamenice 5/A35/2S049,
62500 Brno, Czech Republic

_______________________________________________
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn

Reply via email to