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

'NoneType' object has no attribute 'get_train_triplet' #386

Closed
Maeril opened this issue Jan 28, 2021 · 2 comments
Closed

'NoneType' object has no attribute 'get_train_triplet' #386

Maeril opened this issue Jan 28, 2021 · 2 comments

Comments

@Maeril
Copy link

Maeril commented Jan 28, 2021

Description

Hi, I've been trying to use Cornac to output benchmarks with all the available models.
When I run your "first experiment", it runs fine as is.

But, as soon as I add another model (here for example I added SBPR), I get errors.

The most common one is "'NoneType' object has no attribute 'get_train_triplet'".
Full output is as follows:
`---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
in
51
52 # put it together in an experiment, voilà!
---> 53 cornac.Experiment(eval_method=rs, models=models, metrics=metrics, user_based=True).run()

~/anaconda3/envs/recsysenv/lib/python3.6/site-packages/cornac/experiment/experiment.py in run(self)
128 metrics=self.metrics,
129 user_based=self.user_based,
--> 130 show_validation=self.show_validation,
131 )
132

~/anaconda3/envs/recsysenv/lib/python3.6/site-packages/cornac/eval_methods/base_method.py in evaluate(self, model, metrics, user_based, show_validation)
656
657 start = time.time()
--> 658 model.fit(self.train_set, self.val_set)
659 train_time = time.time() - start
660

cornac/models/sbpr/recom_sbpr.pyx in cornac.models.sbpr.recom_sbpr.SBPR.fit()

cornac/models/sbpr/recom_sbpr.pyx in cornac.models.sbpr.recom_sbpr.SBPR._prepare_social_data()

AttributeError: 'NoneType' object has no attribute 'get_train_triplet'`

I have already tried providing a val_size as well. In that case I wrote "test_size=0.1, val_size=0.1". The error is the same.

I feel like this is probably a versioning issue.

Thank you very much in advance for your assistance.

In which platform does it happen?

OS:
Ubuntu 20.04

Packages:
Python 3.6.4
Tensorflow 1.15
Cython 0.29.21
PyTorch 1.4

How do we replicate the issue?

In first_example.py, add the SBPR model in the corresponding list, then run it.

Expected behavior (i.e. solution)

Experiment should indeed run successfully and output the results.

Other Comments

My goal here is to manage to test as many models as possible at the same time to compare their performances, and to be able to do that on several datasets (ideally movielens, netflix, and filmtrust).

@tqtg
Copy link
Member

tqtg commented Jan 28, 2021

@Maeril SBPR requires additional user social network data, which has to be provided via GraphModality. Please refer to this example of how to run SBPR model for more details.
For other models that require additional modalities, the same logic is applied. You can refer to the list of examples for what is required and how to run the models that you're interested in.

@Maeril
Copy link
Author

Maeril commented Jan 28, 2021

Oh geez. Apologies for not looking into that harder before making a ticket 😦 if I may suggest, could it be possible to clearly indicate it on the “models” page the RTD, in order to easily differentiate models that need additional data from those that don’t ?

I haven’t noticed it at all beforehand, and boy have I spent time trying to figure it out.

Thank you for your swift response !

@Maeril Maeril closed this as completed Jan 28, 2021
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

2 participants