[FAQ]The MambularRegressor throws an error when the number of features exceeds 20.
When the number of features exceeds 20, the MambularRegressor will throw the following error. How can this be resolved?
KeyError Traceback (most recent call last)
21 frames /usr/local/lib/python3.11/dist-packages/pretab/transformers/ple/tree_to_code.py in recurse(node, depth, parent) 50 else: 51 k = k + 1 ---> 52 my_list.append(pathto[parent]) 53 # print(k,')',pathto[parent], tree_.value[node])
Hi @Up-in-the-wind,
Thanks for reporting this — much appreciated.
We’re currently investigating this and will work on a fix. In the meantime, here are a couple of suggestions you can try:
- Temporarily reduce the number of input features to verify that the model and pipeline are otherwise working as expected.
- Alternatively, you could try switching to a different regressor (like
ModernNCARegressor) to see if the issue persists — this can help isolate whether the bug is specific to MambularRegressor.
Also, if possible, could you please share a minimal reproducible example or at least a bit more detail about your input data? Knowing the shape and nature of the features would help us debug and reproduce the error faster.
Thanks again for reporting — we’ll keep you posted as we work on this!