You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered an error while using BorutaPy with a RandomForestClassifier model. The error message states "AttributeError: module 'numpy' has no attribute 'bool'." The error suggests that BorutaPy is trying to use numpy.bool, which was a deprecated alias for the built-in bool. To avoid this error in existing code, we should use bool by itself. If the specific intention was to use the numpy scalar type, we should use numpy.bool_.
Also it happening with int values numpy wants numpy.int64 or numpy.int32
import numpy as np
from boruta import BorutaPy
from sklearn.ensemble import RandomForestClassifier
# Create a sample dataset with boolean features and labels
num_samples = 100
num_features = 5
# Generate random binary features (0 or 1)
x_train_rfe = np.random.randint(2, size=(num_samples, num_features), dtype=bool)
# Generate random binary labels (0 or 1)
y_train = np.random.randint(2, size=num_samples)
# Create a BorutaPy instance with a RandomForestClassifier
bl_model_ob = RandomForestClassifier(n_jobs=-1, max_depth=5, random_state=1)
boruta_selection = BorutaPy(estimator=bl_model_ob, n_estimators='auto', verbose=2, random_state=1)
# Attempt to fit the BorutaPy model with the boolean dataset
boruta_selection.fit(x_train_rfe, y_train)
I encountered an error while using BorutaPy with a RandomForestClassifier model. The error message states "AttributeError: module 'numpy' has no attribute 'bool'." The error suggests that BorutaPy is trying to use numpy.bool, which was a deprecated alias for the built-in bool. To avoid this error in existing code, we should use bool by itself. If the specific intention was to use the numpy scalar type, we should use numpy.bool_.
int
values numpy wantsnumpy.int64
ornumpy.int32
Steps to Reproduce:
Bach
Code
Behavior:
Error
Additional Information:
Python Version: 3.9.12
Operating System: Windows
The text was updated successfully, but these errors were encountered: