Skip to content

Error when using BorutaPy with LogisticRegression #119

@codewithawr

Description

@codewithawr

I encountered an error while using BorutaPy with a LogisticRegression model. The issue arises when setting the n_estimators parameter to 'auto' in BorutaPy. The LogisticRegression model does not have the n_estimators parameter, which causes a ValueError. My understanding is that BorutaPy is trying to provide specific arguments to the estimator model that are not present in the LogisticRegression model.

Steps to Reproduce:
Install the necessary libraries:

Bash

pip install Boruta==0.3 scikit-learn==1.3.0 pandas==2.1.0

Python

from BorutaPy import BorutaPy
from sklearn.linear_model import LogisticRegression

# Assuming you have x_train_rfe and y_train defined
bl_model_ob = LogisticRegression(random_state=1)
boruta_selection = BorutaPy(bl_model_ob, n_estimators='auto', verbose=2, random_state=1)
boruta_selection.fit(x_train_rfe, y_train)

Behavior:
Errore

--> 372     depth = self.estimator.get_params()['max_depth']
    373     if depth == None:
    374         depth = 10

KeyError: 'max_depth'

Additional Information:

Python Version: 3.9.12
Operating System: Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions