"Domain error in arguments" exception after lime update
See original GitHub issueHey,
I updated lime package from lime==0.1.1.34 to lime==0.1.1.35 version. After that LimeTabularExplainer raised ValueError: Domain error in arguments.
explainer = LimeTabularExplainer(
training_data=X_train.toarray(),
mode='classification',
feature_names=feature_names,
class_names=[0, 1],
feature_selection='highest_weights',
random_state=42
)
X_train object is a sparse matrix and feature_names is a list of strings.
- Python 3.6.8 x64
- numpy 1.16.4
- scipy 1.3.0
Exception details:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-22-68c347456caa> in <module>
8 ],
9 feature_selection='highest_weights',
---> 10 random_state=42
11 )
/project/env/lib/python3.6/site-packages/lime/lime_tabular.py in __init__(self, training_data, mode, training_labels, feature_names, categorical_features, categorical_names, kernel_width, kernel, verbose, class_names, feature_selection, discretize_continuous, discretizer, sample_around_instance, random_state, training_data_stats)
214 self.discretizer = QuartileDiscretizer(
215 training_data, self.categorical_features,
--> 216 self.feature_names, labels=training_labels)
217 elif discretizer == 'decile':
218 self.discretizer = DecileDiscretizer(
/project/env/lib/python3.6/site-packages/lime/discretize.py in __init__(self, data, categorical_features, feature_names, labels, random_state)
185 BaseDiscretizer.__init__(self, data, categorical_features,
186 feature_names, labels=labels,
--> 187 random_state=random_state)
188
189 def bins(self, data, labels):
/project/env/lib/python3.6/site-packages/lime/discretize.py in __init__(self, data, categorical_features, feature_names, labels, random_state, data_stats)
97 self.maxs[feature] = qts.tolist() + [boundaries[1]]
98 [self.get_undiscretize_value(feature, i)
---> 99 for i in range(n_bins + 1)]
100
101 @abstractmethod
/project/env/lib/python3.6/site-packages/lime/discretize.py in <listcomp>(.0)
97 self.maxs[feature] = qts.tolist() + [boundaries[1]]
98 [self.get_undiscretize_value(feature, i)
---> 99 for i in range(n_bins + 1)]
100
101 @abstractmethod
/project/env/lib/python3.6/site-packages/lime/discretize.py in get_undiscretize_value(self, feature, val)
136 scipy.stats.truncnorm.rvs(
137 minz, maxz, loc=means[val], scale=stds[val],
--> 138 random_state=self.random_state, size=self.precompute_size))
139 idx = self.undiscretize_idxs[feature][val]
140 ret = self.undiscretize_precomputed[feature][val][idx]
/project/env/lib/python3.6/site-packages/scipy/stats/_distn_infrastructure.py in rvs(self, *args, **kwds)
960 cond = logical_and(self._argcheck(*args), (scale >= 0))
961 if not np.all(cond):
--> 962 raise ValueError("Domain error in arguments.")
963
964 if np.all(scale == 0):
ValueError: Domain error in arguments.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (1 by maintainers)
Top Results From Across the Web
LimeTabularExplainer function from lime.lime_tabular doesn't ...
python - LimeTabularExplainer function from lime. lime_tabular doesn't work: ValueError: Domain error in arguments - Stack Overflow. Stack Overflow for Teams – ...
Read more >How to fix "Domain error" when using posterior predictive ...
I get the following error: ValueError Traceback (most recent call last) C:\ProgramData\Anaconda3\lib\site-packages\pymc3\distributions\ ...
Read more >LIME user manual - LIME documentation - Read the Docs
The first thing that happens after compilation is that LIME allocates memory for the grid and the molecular data based on the parameter...
Read more >More explicit domain error handling and fewer exceptions with ...
Side note: the Accept method receiving a parameter of a generic type that implements the IErrorVisitor interface, instead of using the interface ...
Read more >Optional settings - LimeSurvey Manual
Other sessions update. If you use SSL ('https') for your LimeSurvey installation, adding the following lines to your config.php will ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ronykroy yes, setting the parameter, discretize_continuous=False solved this issue for me.
hi there… Could you try with setting the discretize_continuous=True parameter to False… my use case: newsGroups20 dataset h20 w2v vectorizer 200 cols values in the 200 cols after vectorization is almost continuous, going by the name of the parameter discretize_continuous … it doesnt make sense to set it to true here…
thats my guess… a better explanation is welcome though