I don't have any nice solutions here. It's a matter of working out what
inheritance means.

I don't know if it's useful as such, but `_LearntSelectorMixin.transform`
handles the non-l1 case for linear models, setting the default threshold to
mean, as it does with feature_importances_


On Sat, Jul 20, 2013 at 11:01 PM, Mathieu Blondel
<notifications@github.com>wrote:

> In sklearn/linear_model/ridge.py:
>
> > +
> > +    sample_weight : float or numpy array of shape [n_samples]
> > +        Individual weights for each sample
> > +    """
> > +    y, alpha, ravel = _check_params(K, y, alpha)
> > +
> > +    dual_coef = _solve_dense_cholesky_kernel(K, y, alpha,
> > +                                             sample_weight=sample_weight)
> > +
> > +    if ravel:
> > +        # When y was passed as a 1d-array, we flatten the coefficients.
> > +        dual_coef = dual_coef.ravel()
> > +
> > +    return dual_coef
> > +
> > +
> >  class _BaseRidge(six.with_metaclass(ABCMeta, LinearModel)):
>
> Creating kernel-specific classes would increase the number of classes by
> 4: one for Ridge, RidgeCV, RidgeClassifier and RidgeClassifierCV. This was
> my main motivation for reusing the same classes, together with the fact
> that you can grid search the kernel parameter, yet use efficient dedicated
> solvers for the linear kernel case.
>
> Technically, a kernel induces a feature space in which the model is linear
> so I'm not too concerned about the name "linear". But we could perhaps
> create a KernelizableModel base class if it's a concern for others.
>
> If I remember correctly, SVC does have both coef_ and dual_coef_ if the
> kernel is linear, BTW.
>
> One concern I have is that in the linear case, the current implementation
> already solves the kernelized problem if it's more efficient (n_samples <
> n_features). So having kernel-specific classes would be redundant in the
> case of a linear kernel.
>
> Is _LearntSelectorMixin useful for L2-regularized models such as Ridge or
> other kernelized models?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/scikit-learn/scikit-learn/pull/2165/files#r5306939>
> .
>