Comments (6)
I think this is basically a feature request, something that the library doesn't do at the moment (rather than a bug).
I'd be happy to have a think about doing this provided that
- You'd be happy to apply it consistently to all models.
- The result doesn't complicate the code much.
One pointer for opening issues: it may be nicer to the maintainer if you don't start by assuming something is broken when it doesn't behave exactly as you want.
from spotlight.
I'm sorry, I didn't intend this to sound offensive. It seemed broken, since doing something quite intuitive resulted in an obscure pytorch error, but I agree I'm at fault here.
I can try to add this feature in the near future, but for now perhaps it would be nice to add a helpful error
message when user_ids
is an array, but item_ids
is None
?
from spotlight.
Hi @maciejkula and @elanmart , would like to know if there is an update on this issue.
I am trying the same thing and got the same error.
E.g., I trained a factorization model by using the following codes:
from spotlight.cross_validation import random_train_test_split
from spotlight.datasets.movielens import get_movielens_dataset
from spotlight.evaluation import rmse_score
from spotlight.factorization.explicit import ExplicitFactorizationModel
dataset = get_movielens_dataset(variant='1M')
train, test = user_based_train_test_split(dataset, test_percentage=0.25)
model = ExplicitFactorizationModel(n_iter=1)
model.fit(train)
Then when I predict recommendation scores by using the test data with
model.predict(test.user_ids)
I got error of
RuntimeError: The expanded size of the tensor (3707) must match the existing size (258400) at non-singleton dimension 0. at /opt/conda/conda-bld/pytorch_1518241081361/work/torch/lib/TH/generic/THTensor.c:309
So I used one user id instead (e.g., the first one in the array)
model.predict(test.user_ids[0])
It worked and returned me with an array of item recommendation scores.
Another question is, if I use one user id for prediction, what are the item IDs corresponding to the scores?
Any advice will be very much appreciated! :)
Best, Le
from spotlight.
I think I get some useful information from #30
from spotlight.
@yueguoguo @elanmart to document current implementation better, how does the following sound? #109
from spotlight.
Much better! Thanks @maciejkula
from spotlight.
Related Issues (20)
- Spotlight not working with Python 3.7 ? HOT 5
- Does spotlight have tensorboard integration? HOT 1
- Evaluation schema
- Loss improves super slowly after first epoch in LSTM based sequential model.
- Does spotlight include 'iMF' by Hu Yifan? HOT 1
- Hyper parameter tuning HOT 1
- How to predict in sequential models ? HOT 3
- Fix simple typo: predicition -> prediction
- Fix simple typo: siginficant -> significant
- Importing data directly from a Sparse Matrix
- is sequence model only a function of item sequence?
- classification : synthetic unbalanced data generating
- generate not sequential data by spotlight.datasets.synthetic.generate_sequential
- Where to find the code for the experiments around casual convolutions? HOT 1
- why don't we need to take logarithm in pointwise_loss?
- Error in BPR loss function
- How can I train a model when adding a new user or item?
- ModuleNotFoundError: No module named "spotlight.interactions" HOT 2
- Is there guide to use models for "retrieval stage" (namely candidate generation) ?
- Cannot install from conda HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spotlight.