Open nosacapital opened 1 year ago
Have you tried removing the GammaRegressor model from the list of regressors.
In lazypredict/Supervised.py, by default regressor = "all"
def __init__(
self,
verbose=0,
ignore_warnings=True,
custom_metric=None,
predictions=False,
random_state=42,
regressors="all",
)
Instead you could put in an list of models:
if self.regressors == "all":
self.regressors = REGRESSORS
else:
try:
temp_list = []
for regressor in self.regressors:
full_name = (regressor.__name__, regressor)
temp_list.append(full_name)
self.regressors = temp_list
except Exception as exception:
print(exception)
print("Invalid Regressor(s)")
So your code could be like this:
from sklearn.linear_model import LinearRegression, Ridge, Lasso
from sklearn.tree import DecisionTreeRegressor
from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor
from sklearn.neighbors import KNeighborsRegressor
from sklearn.svm import SVR
from lazypredict.Supervised import LazyRegressor
REGRESSORS = [LinearRegression, Ridge, Lasso, DecisionTreeRegressor, RandomForestRegressor, GradientBoostingRegressor, KNeighborsRegressor, SVR]
reg = LazyRegressor(verbose=0, ignore_warnings=False, custom_metric=None, regressors=REGRESSORS)
models, predictions = reg.fit(X_train, X_test, y_train.values.ravel(), y_test)
I finally got Lazypredict to work on the M1 Mac but have encountered another problem. Without too much emphasis on the whole file, here is the last bit of code I am running:
All seems well until I get to 24% when I get the following message: GammaRegressor model failed to execute Some value(s) of y are out of the valid range of the loss 'HalfGammaLoss'.
Before using the ravel function, I got suggestions to use the function, hence, the code above. Any suggestions would be quite appreciated.
Thanks