Skip to content
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

Error in training #11

Closed
ayush488 opened this issue Jul 1, 2022 · 12 comments
Closed

Error in training #11

ayush488 opened this issue Jul 1, 2022 · 12 comments

Comments

@ayush488
Copy link

ayush488 commented Jul 1, 2022

I am getting the following error while training;

SystemError: <built-in function _abc_instancecheck> returned a result with an error set

my input as follows:

rec = BanditRecommender(LearningPolicy.LinGreedy(epsilon=0.1), top_k=4)

# Train on (user, item, response) interactions in train data using user features 
train(rec, data=X_train, 
      user_features=df_users,
      item_features=df_mailers,
      user_id_col= 'ID',
      item_id_col= 'MailerID',
      response_col = 'sales_net'
      )

all user and mailer feature are categorical (not one hot encoded)

What could be the reason?

@skadio
Copy link
Collaborator

skadio commented Jul 1, 2022

Thank you for sharing @ayush488 !

The code looks fine at a first glance, but devils might be in the details. Do you have unit-test with some sample input so that we can reproduce the error on our side? Also, could you share more of the Trace of the error.

This may or may not related, please make sure you have installed libraries in requirements.txt with correct versions.

@ayush488
Copy link
Author

ayush488 commented Jul 1, 2022

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "C:\Users\ayush\AppData\Local\Temp\2\ipykernel_5524\998028027.py", line 9, in <module>
    response_col = 'sales_net'

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\site-packages\mab2rec\pipeline.py", line 131, in train
    recommender.fit(df[item_id_col], df[response_col], df[feature_cols])

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\site-packages\mab2rec\rec.py", line 219, in fit
    self.mab.fit(decisions, rewards, contexts)

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\site-packages\mabwiser\mab.py", line 1092, in fit
    self._imp.fit(decisions, rewards, contexts)

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\site-packages\mabwiser\linear.py", line 139, in fit
    self._parallel_fit(decisions, rewards, contexts)

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\site-packages\mabwiser\base_mab.py", line 193, in _parallel_fit
    for arm in self.arms)

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\site-packages\joblib\parallel.py", line 1043, in __call__
    if self.dispatch_one_batch(iterator):

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\site-packages\joblib\parallel.py", line 861, in dispatch_one_batch
    self._dispatch(tasks)

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\site-packages\joblib\parallel.py", line 779, in _dispatch
    job = self._backend.apply_async(batch, callback=cb)

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\site-packages\joblib\_parallel_backends.py", line 208, in apply_async
    result = ImmediateResult(func)

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\site-packages\joblib\_parallel_backends.py", line 572, in __init__
    self.results = batch()

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\site-packages\joblib\parallel.py", line 263, in __call__
    for func, args, kwargs in self.items]

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\site-packages\joblib\parallel.py", line 263, in <listcomp>
    for func, args, kwargs in self.items]

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\site-packages\mabwiser\linear.py", line 181, in _fit_arm
    lr.fit(X, y)

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\site-packages\mabwiser\linear.py", line 54, in fit
    self.A = self.A + np.dot(Xt, X)

  File "<__array_function__ internals>", line 6, in dot

  File "pandas\_libs\interval.pyx", line 427, in pandas._libs.interval.Interval.__mul__

  File "C:\ProgramData\Anaconda3\envs\test_env\lib\abc.py", line 139, in __instancecheck__
    return _abc_instancecheck(cls, instance)

SystemError: <built-in function _abc_instancecheck> returned a result with an error set


@bkleyn
Copy link
Contributor

bkleyn commented Jul 1, 2022

Hey @ayush488.

Based on the trace, I'm guessing the error is caused by an incorrect data type in one of the inputs. Can you confirm that the user features only have numerical float or integer values? And that there are no missing, NaN, None values?

@ayush488
Copy link
Author

ayush488 commented Jul 1, 2022

sample_train.csv
sample_userdata.csv
here is sample data.

@ayush488
Copy link
Author

ayush488 commented Jul 1, 2022

the data was categorical data.. It may be having NaN values..
so the input should be either numerical or one hot endoded?

@bkleyn
Copy link
Contributor

bkleyn commented Jul 1, 2022

Correct, only numeric inputs are supported.

@ayush488
Copy link
Author

ayush488 commented Jul 1, 2022

ok .let me correct.
so is it more efficient to use numerical features or discretize them and then one hot encode them

@ayush488
Copy link
Author

ayush488 commented Jul 1, 2022

so is it more efficient to use numerical features or discretize them and then one hot encode them?

@ayush488
Copy link
Author

ayush488 commented Jul 1, 2022

will it work with categorical features if I remove the null values?

@skadio
Copy link
Collaborator

skadio commented Jul 1, 2022

Yes, numerica data should not have null/nan values by definition, it is a standard data pre-processing step. Glad we found the root cause of the issue --thank you for the help @bkleyn!

As far as what is more efficient, that depends on your data, application, have many categories are involved etc. You might also benefit from standardizing your numeric user features so that they are in the same scale. Good luck!

@ayush488
Copy link
Author

ayush488 commented Jul 1, 2022

Thank you.

@skadio
Copy link
Collaborator

skadio commented Jul 1, 2022

you are most welcome!

@skadio skadio closed this as completed Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants