I am using FIGSRegressor in combination with VotingRegressor and StackingRegressor but I keep getting the following error whenever I run the fit function.
ValueError: The estimator FIGSRegressor should be a regressor.
Please check this example. Is there a workaround or am I missing something?
import numpy as np
from sklearn.ensemble import RandomForestRegressor
from sklearn.ensemble import StackingRegressor,VotingRegressor
from sklearn.linear_model import LinearRegression
from imodels import FIGSRegressor
np.random.seed(123)
# generate X and y
n, p = 500, 10
X_sim = np.random.randn(n, p)
y_sim = 1 * X_sim[:, 0] + 2 * X_sim[:, 1] - 1 * X_sim[:, 2] + np.random.randn(n)
base_models = [('figs', FIGSRegressor()),
('random_forest', RandomForestRegressor())]
comb_model = VotingRegressor(estimators=base_models,
n_jobs=10,
verbose=2)
comb_model=comb_model.fit(X_sim, y_sim)
meta_model = LinearRegression()
stacking_model = StackingRegressor(estimators=base_models,
final_estimator=meta_model,
passthrough=False,
cv=5,
verbose=2)
stacking_model=stacking_model.fit(X_sim, y_sim)
Hi @athammad :wave: Thanks for your interest in this package and for finding this issue! We've just resolved it in our latest commit and this issue should be resolved if you pip install --upgrade the package :)
Hi guys,
I am using
FIGSRegressor
in combination withVotingRegressor
andStackingRegressor
but I keep getting the following error whenever I run the fit function.ValueError: The estimator FIGSRegressor should be a regressor.
Please check this example. Is there a workaround or am I missing something?