-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
02.1 Feature importance voting and pre-assessment of features #4
Comments
my python version is 3.11.0b5 |
Thank you very much for your question. I'm sorry you're getting an error. I think this error is caused by Xverse's updates. please make sure you don't have Xverse installed before. and make sure you install the IoTDevID version (git+https://github.com/kahramankostas/XuniVerse) when you reinstall this repository. I recommend you to clean Xverse from your computer and reinstall it |
I recreated a Python 3.9 virtual environment and installed the required packages. In addition, I installed xverse using pip install git+https://github.com/kahramankostas/XuniVerse, but this time another error was reported. KeyError Traceback (most recent call last) File D:\projects\device_detect\IOT\lib\site-packages\xverse\ensemble_voting.py:224, in VotingSelector.fit(self, X, y) File D:\projects\device_detect\IOT\lib\site-packages\xverse\ensemble_voting.py:285, in VotingSelector.train(self, X, y) File D:\projects\device_detect\IOT\lib\site-packages\xverse\ensemble_voting.py:117, in VotingSelector.woe_information_value(self, X, y) File D:\projects\device_detect\IOT\lib\site-packages\sklearn\utils_set_output.py:157, in _wrap_method_output..wrapped(self, X, *args, **kwargs) File D:\projects\device_detect\IOT\lib\site-packages\xverse\transformer_woe.py:310, in WOE.transform(self, X, y) KeyError: 'IP_MF' |
I tried it on windows and ubuntu. it works flawlessly on windows but gives this error on ubuntu. i can't figure out why. i will update the answer if i find a solution. For now you might consider running it on window or skip the Xverse step. |
actually,this error occurs on windows 11, and i And I don't know which step went wrong. Here are my steps: anyio 4.0.0 |
I am sorry to trouble u that this part of code in file 02.1 can't run successfully. I referred to the solution in the issues and ran pip install git+https://github.com/kahramankostas/XuniVerse,Successfully installed contourpy-1.2.0 cycler-0.12.1 fonttools-4.44.3 joblib-1.3.2 kiwisolver-1.4.5 matplotlib-3.8.2 packaging-23.2 patsy-0.5.3 pillow-10.1.0 pyparsing-3.1.1 scikit-learn-1.3.2 scipy-1.11.4 statsmodels-0.14.0 threadpoolctl-3.2.0 xverse-1.0.5. but it did not take effect.
Hope for your early reply. Thanks!
my pandas version is 2.1.3,
AttributeError Traceback (most recent call last)
Cell In[22], line 14
12 clf = VotingSelector()
13 print(X, y)
---> 14 clf.fit(X, y)
15 #Selected features
16 temp="./results/"+i[18:-4]+"FI.csv"
File D:\Python_env\Lib\site-packages\xverse\ensemble_voting.py:224, in VotingSelector.fit(self, X, y)
222 #start training on the data
223 temp_X = X[self.use_features]
--> 224 self.feature_importances_, self.feature_votes_ = self.train(temp_X, y)
226 return self
File D:\Python_env\Lib\site-packages\xverse\ensemble_voting.py:285, in VotingSelector.train(self, X, y)
283 #handle categorical values with either 'woe' or 'le'
284 if self.handle_category == 'woe':
--> 285 transformed_X, self.mapping, iv_df = self.woe_information_value(X, y) #woe transformed_X
286 elif self.handle_category == 'le':
287 transformed_X = X.copy(deep=True)
File D:\Python_env\Lib\site-packages\xverse\ensemble_voting.py:115, in VotingSelector.woe_information_value(self, X, y)
112 def woe_information_value(self, X, y):
114 clf = WOE()
--> 115 clf.fit(X, y)
117 return clf.transform(X), clf.woe_bins, clf.iv_df
File D:\Python_env\Lib\site-packages\xverse\transformer_woe.py:137, in WOE.fit(self, X, y)
132 if self.monotonic_binning:
133 self.mono_bin_clf = MonotonicBinning(feature_names=self.mono_feature_names,
134 max_bins=self.mono_max_bins, force_bins=self.mono_force_bins,
135 cardinality_cutoff=self.mono_cardinality_cutoff,
136 prefix=self.mono_prefix, custom_binning=self.mono_custom_binning)
--> 137 X = self.mono_bin_clf.fit_transform(X, y)
138 self.mono_custom_binning = self.mono_bin_clf.bins
140 #identify the variables to tranform and assign the bin mapping dictionary
File D:\Python_env\Lib\site-packages\sklearn\utils_set_output.py:157, in _wrap_method_output..wrapped(self, X, *args, **kwargs)
155 @wraps(f)
156 def wrapped(self, X, *args, **kwargs):
--> 157 data_to_wrap = f(self, X, *args, **kwargs)
158 if isinstance(data_to_wrap, tuple):
159 # only wrap the first output for cross decomposition
160 return_tuple = (
161 _wrap_data_with_container(method, data_to_wrap[0], X, self),
162 *data_to_wrap[1:],
163 )
File D:\Python_env\Lib\site-packages\xverse\transformer_binning.py:257, in MonotonicBinning.fit_transform(self, X, y)
256 def fit_transform(self, X, y):
--> 257 return self.fit(X, y).transform(X)
File D:\Python_env\Lib\site-packages\xverse\transformer_binning.py:122, in MonotonicBinning.fit(self, X, y)
118 raise ValueError("The input feature(s) should be numeric type. Some of the input features
119 has character values in it. Please use a encoder before performing monotonic operations.")
121 #apply the monotonic train function on dataset
--> 122 fit_X.apply(lambda x: self.train(x, y), axis=0)
123 return self
File D:\Python_env\Lib\site-packages\pandas\core\frame.py:10034, in DataFrame.apply(self, func, axis, raw, result_type, args, by_row, **kwargs)
10022 from pandas.core.apply import frame_apply
10024 op = frame_apply(
10025 self,
10026 func=func,
(...)
10032 kwargs=kwargs,
10033 )
File D:\Python_env\Lib\site-packages\pandas\core\apply.py:837, in FrameApply.apply(self)
834 elif self.raw:
835 return self.apply_raw()
--> 837 return self.apply_standard()
File D:\Python_env\Lib\site-packages\pandas\core\apply.py:963, in FrameApply.apply_standard(self)
962 def apply_standard(self):
--> 963 results, res_index = self.apply_series_generator()
965 # wrap results
966 return self.wrap_results(results, res_index)
File D:\Python_env\Lib\site-packages\pandas\core\apply.py:979, in FrameApply.apply_series_generator(self)
976 with option_context("mode.chained_assignment", None):
977 for i, v in enumerate(series_gen):
978 # ignore SettingWithCopy here in case the user mutates
--> 979 results[i] = self.func(v, *self.args, **self.kwargs)
980 if isinstance(results[i], ABCSeries):
981 # If we have a view on v, we need to make a copy because
982 # series_generator will swap out the underlying data
983 results[i] = results[i].copy(deep=False)
File D:\Python_env\Lib\site-packages\xverse\transformer_binning.py:122, in MonotonicBinning.fit..(x)
118 raise ValueError("The input feature(s) should be numeric type. Some of the input features
119 has character values in it. Please use a encoder before performing monotonic operations.")
121 #apply the monotonic train function on dataset
--> 122 fit_X.apply(lambda x: self.train(x, y), axis=0)
123 return self
File D:\Python_env\Lib\site-packages\xverse\transformer_binning.py:170, in MonotonicBinning.train(self, X, y)
165 """
166 Execute this block when monotonic relationship is not identified by spearman technique.
167 We still want our code to produce bins.
168 """
169 if len(bins_X_grouped) == 1:
--> 170 bins = algos.quantile(X, np.linspace(0, 1, force_bins)) #creates a new binnning based on forced bins
171 if len(np.unique(bins)) == 2:
172 bins = np.insert(bins, 0, 1)
AttributeError: module 'pandas.core.algorithms' has no attribute 'quantile'
The text was updated successfully, but these errors were encountered: