ThomasBury / arfs

All Relevant Feature Selection
MIT License
114 stars 12 forks source link

arfs.feature_selection module not found #29

Closed xdeltadev closed 1 year ago

xdeltadev commented 1 year ago

ModuleNotFoundError: no module named feature_selection

ThomasBury commented 1 year ago

Hi @xdeltadev. To better understand and address the issue you are facing, could you please provide additional context and a minimal example that can help me reproduce the error? Also, please note that if you are using the latest version, there should not be an import error.

image

xdeltadev commented 1 year ago

Sorry for the vague issue. Using Python 3.7, I recreated the issue using a clean conda environment, and installing arfs via 'pip install arfs' - I am running the code on jupyter lab if that makes a difference.

from IPython.core.display import display, HTML

display(HTML(""))

import catboost import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt import gc import shap from boruta import BorutaPy as bp from sklearn.datasets import fetch_openml from sklearn.inspection import permutation_importance from sklearn.pipeline import Pipeline from sklearn.datasets import fetch_openml from sklearn.inspection import permutation_importance from sklearn.base import clone from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier from lightgbm import LGBMRegressor, LGBMClassifier from xgboost import XGBRegressor, XGBClassifier from catboost import CatBoostRegressor, CatBoostClassifier from sys import getsizeof, path

import arfs import arfs.feature_selection as arfsfs import arfs.feature_selection.allrelevant as arfsgroot from arfs.feature_selection import ( MinRedundancyMaxRelevance, GrootCV, MissingValueThreshold, UniqueValuesThreshold, CollinearityThreshold, make_fs_summary, ) from arfs.utils import LightForestClassifier, LightForestRegressor from arfs.benchmark import highlight_tick, compare_varimp, sklearn_pimp_bench from arfs.utils import load_data

plt.style.use("fivethirtyeight") rng = np.random.RandomState(seed=42)

import warnings

warnings.filterwarnings('ignore')


ModuleNotFoundError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_21744\3187753728.py in 22 23 import arfs ---> 24 import arfs.feature_selection as arfsfs 25 import arfs.feature_selection.allrelevant as arfsgroot 26 from arfs.feature_selection import (

ModuleNotFoundError: No module named 'arfs.feature_selection'

ThomasBury commented 1 year ago

Dear @xdeltadev ,The reason for this issue is that you are using Python version 3.7. This forces pip to install an old and buggy version (0.3) of ARFS. You can use Python version 3.10, which should work without any problems.

I have made updates to the requirements to avoid any dependency conflicts. Specifically, I have constrained the Python version to be greater than or equal to 3.9 to ensure compatibility.

xdeltadev commented 1 year ago

Thank you, I tested with another environment using Python 3.9.16 and confirmed the installation works now.