<div dir="ltr"><div class="gmail_default" style="font-size:large;color:rgb(0,0,0)">Greetings,<br><br></div><div class="gmail_default" style="font-size:large;color:rgb(0,0,0)">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 of the MLPRegressor (I have modified scikit-learn's implementation to accept an arbitrary loss function), I cannot do the same with RandomForestRegressor, and hence I have to rely on 'mse' which is not in accordance with the loss functions I use in MLPs. Today I was looking at the _criterion.pyx file:<br><br><a href="https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/tree/_criterion.pyx">https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/tree/_criterion.pyx</a><br><br></div><div class="gmail_default" style="font-size:large;color:rgb(0,0,0)">However, the code is in Cython and I find it hard to follow. I know that for Regression the relevant class are Criterion(), RegressionCriterion(Criterion), and MSE(RegressionCriterion). My question is: is it possible to write a class that takes an arbitrary function "loss(predictions, targets)" to calculate the loss and impurity of the nodes? <br><br></div><div class="gmail_default" style="font-size:large;color:rgb(0,0,0)">thanks,<br></div><div class="gmail_default" style="font-size:large;color:rgb(0,0,0)">Thomas<br clear="all"></div><br><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div>                              <p style="margin-bottom:0cm" align="LEFT"><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2">======================================================================</font></span></span></p>
<p style="margin-bottom:0cm" align="LEFT"><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2">Dr Thomas Evangelidis</font></span></span></p>
<p style="margin-bottom:0cm" align="LEFT"><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2">Post-doctoral Researcher<br></font></span></span></p><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2">CEITEC - Central European Institute of Technology<br>Masaryk University<br>Kamenice 5/A35/2S049, <br>62500 Brno, Czech Republic <br></font></span></span></div><div dir="ltr"><span style="color:rgb(0,0,0)"><br></span><p style="margin-bottom:0cm" align="LEFT"><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2">email: <a href="mailto:tevang@pharm.uoa.gr">tevang@pharm.uoa.gr</a></font></span></span></p>
<p style="margin-bottom:0cm" align="LEFT"><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2">                <a href="mailto:tevang3@gmail.com">tevang3@gmail.com</a></font></span></span></p>
<p style="margin-bottom:0cm" align="LEFT"><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif"><font size="2"><br>website: <a href="https://sites.google.com/site/thomasevangelidishomepage/">https://sites.google.com/site/thomasevangelidishomepage/</a></font></span></span></p><span style="color:rgb(0,0,0)"><br></span><p style="margin-bottom:0cm" align="LEFT">
</p>
</div></div></div></div></div></div></div></div>
</div>