> ranks = np.argsort(np.sum(estimator.coef_ ** 2, axis=0))
>
> My question is: Why the summation of the squared weight matrix is used?
> What is the logic behind it?

This is used for handling estimators that assign several weights to
the same feature. Indeed, if several weights are assigned to a each
feature, then they can no longer be ranked (which weight to use to
rank them?). Hence, a fair choice is to rank the features according to
the norm of their respective weights.

Note that when there is exactly one weight for each feature, this line
of code boils down to

ranks = np.argsort(estimator.coef_, axis=0))

As a side note, keep in mind that this trick, as the whole RFE
algorithm is just an heuristic. There is not theoretical guarantees
that the algorithm will find be the best subset of features.

Gilles

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to