In mutual_info_regression
pre-installed n_neighbors=3
This code works for n_neighbors=3
:
selector = SelectKBest(mutual_info_regression, k='all').fit(X, y)
That request for n_neighbors=2
in mutual_info_regression
?
Don't work variants:
selector = SelectKBest(mutual_info_regression, k='all').fit(X, y,**{'n_neighbors':2})
selector = SelectKBest(mutual_info_regression(**{'n_neighbors':2}), k='all').fit(X, y)
selector = SelectKBest(mutual_info_regression(n_neighbors=2), k='all').fit(X, y)
selector = SelectKBest(mutual_info_regression,n_neighbors=2, k='all').fit(X, y)
scoring = make_scorer(mutual_info_regression, greater_is_better=True, n_neighbors = 2)
selector = SelectKBest(scoring, k='all').fit(feat, targ)
You can use pythons partial
function to create a scorer with non-default values:
from functools import partial
scorer_function = partial(mutual_info_regression, n_neighbors=2)
selector = SelectKBest(scorer_function, k='all').fit(X, y)