Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Samuel Martin
@smartinio
alright, thanks! @mdekstrand
Samuel Martin
@smartinio
so I’ve migrated to integer Id’s and everything seems right. but when attempting to get recommendations I get 0.
are there any common pitfalls that lead to 0 recommended items? @mdekstrand
Michael Ekstrand
@mdekstrand
Users with no history will often get no recommendations.
What algorithm & configuration are you using?
Samuel Martin
@smartinio
@mdekstrand for now I’m just trying the user-user CF algorithm
private static LenskitConfiguration getAlgorithmConfig() {
        LenskitConfiguration cfg = new LenskitConfiguration();

        // lenskit.org/documentation/algorithms/user-user/
        cfg.bind(ItemScorer.class).to(UserUserItemScorer.class);
        cfg.bind(BaselineScorer.class, ItemScorer.class).to(UserMeanItemScorer.class);
        cfg.bind(UserMeanBaseline.class, ItemScorer.class).to(ItemMeanRatingItemScorer.class);
        cfg.within(UserVectorNormalizer.class).bind(VectorNormalizer.class).to(MeanCenteringVectorNormalizer.class);
        cfg.set(NeighborhoodSize.class).to(30);

        return cfg;
    }

private static EventDAO getEventDAO(String dataPath) {
        File file = new File(dataPath);
        EventFormat fmt = DelimitedColumnEventFormat
                .create(LikeBuilder.class)
                .setFields("user", "item", "timestamp")
                .setDelimiter(",");
        return TextEventDAO.create(file, fmt, CompressionMode.AUTO);
    }
Samuel Martin
@smartinio
// user passed in
Long uid = Long.valueOf(user.getId());
LenskitConfiguration cfg = getAlgorithmConfig();
EventDAO dao = getEventDAO("dataset.csv");
cfg.addComponent(dao);

LenskitRecommenderEngine engine = LenskitRecommenderEngine.build(cfg);
ItemRecommender recommender = engine.createRecommender(cfg).getItemRecommender();
ResultList items = recommender.recommendWithDetails(uid, 10, null, null); // 0 items
the user I’m testing with has history
@mdekstrand
Michael Ekstrand
@mdekstrand
When you turn up the logging level (e.g. DEBUG), what kinds of messages do you see?
Most likely scenario is that it can't find any items the user has not rated that for which neighborhoods can be computed.
@smartinio
Samuel Martin
@smartinio
@mdekstrand I’m not sure how to change the log level. I have the following set up for logging:
<dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>1.7.25</version>
</dependency>
Michael Ekstrand
@mdekstrand
SLF4J-simple does not support any configuration.
For real applications i recommend Logback.
Its configuration file will letyou set a logging level, output log files, etc.
Carsten Klaus
@CarKla_gitlab

Hello Lenskit Team,
We are working on a recommender project and would like to use the Lenskit SVD algorithm by Simon Funk.
We configured our model as shown on http://lenskit.org/documentation/algorithms/svd/
Our question: It is enough to just hand over the sparse User-Item-Rating Matrix, right?
How can we do that (A code snippet of such a call would be nice)
Thanks a lot!

Best,
CarKla

Michael Ekstrand
@mdekstrand
@CarKla_gitlab LensKit algorithms are very difficult to use on their own, without the overall framework of the rest of the data processing layer.
(we're working on fixing this, but that code is still in progress)
Ezekiel Elin
@ezfe

Hi @mdekstrand, I'm looking to use LensKit in the context of an actual application performing recommending, and I had a few questions

I've set up the configuration very similarly to the tutorial for now, like so:

LenskitConfiguration config = new LenskitConfiguration();

config.bind(ItemScorer.class).to(ItemItemScorer.class);
config.bind(BaselineScorer.class, ItemScorer.class).to(UserMeanItemScorer.class);
config.bind(UserMeanBaseline.class, ItemScorer.class).to(ItemMeanRatingItemScorer.class);

config.bind(UserVectorNormalizer.class).to(BaselineSubtractingUserVectorNormalizer.class);

config.bind(EventDAO.class).to(this.createDAO());

PreferenceDomainBuilder pdbuilder = new PreferenceDomainBuilder(-10, 10).setPrecision(0.01);
PreferenceDomain pd = pdbuilder.build();
config.bind(PreferenceDomain.class).to(pd);

LenskitRecommender rec = LenskitRecommender.build(config);

RatingPredictor pred = rec.getRatingPredictor();
double predicted = pred.predict(userId, jokeId);

Will the predicted value be de-normalized? And if I ask for an existing value, should it match exactly or only closely? Lastly, is there a way to add a single rating to a LenskitRecommender without rebuilding it?

Michael Ekstrand
@mdekstrand
(1) yes, pedictions will be de-normalized.
(2) closely - it will generate a prediction, it will not return the existing rating.
(3) not currently
@ezfe hope that helps
Ezekiel Elin
@ezfe
Thanks!
bielovico
@bielovico
Hi, I was just wondering if you happen to know why lenskit is not available at Kaggle Kernel to be added as a custom package (not with pip nor from github which I don`t know if is any different). The output from their interface is only "Error: The command '/bin/sh -c pip install git+https://github.com/lenskit/lkpy' returned a non-zero code: 1" Thanks!
Michael Ekstrand
@mdekstrand
Not sure - would need to see additional outputs.
The pip install does work elsewhere, or at least it did last I tested it.
Do Kaggle kernels support Conda packages?
bielovico
@bielovico
Yeah I was able to pip install it elsewhere too I just wanted to use Kaggle cloud computing and some packages and datasets already included.
image.png
I don´t think they do support conda, their only option in their UI is pip (from github)
Michael Ekstrand
@mdekstrand
That picture indicates it's being installed from PyPI, not GitHub - the same error happens when you install the GitHub version?
The PyPI version may have a dependency that doesn't work on Kaggle.
Michael Ekstrand
@mdekstrand
I am looking at how Kaggle configures Python, and while it should be possible to make it work, I expect sub-optimal performance.
Michael Ekstrand
@mdekstrand
@bielovico could you try again? it seems we had a syntax error in setup.py on github!
bielovico
@bielovico
image.png
I tried both, but failed every time. Tried it again and still same output:
bielovico
@bielovico
Thanks for your time @mdekstrand either way. I tried reaching Kaggle's Q&A (https://www.kaggle.com/questions-and-answers/71160#418923) with no results yet. If it`s not something that you would be able to easily fix, I can just wait for any idea on Kaggle's side and then just leave it be, I guess.
Michael Ekstrand
@mdekstrand
I have found the problem.
Kaggle's Python image already includes Numba and llvmlite, installed via Conda, but LensKit requires a newer version.
Pip canot upgrade the Conda versions to those required by LensKit, so the install fails
I expect it will probably work the next time Kaggle rebuilds their Python base image.
Michael Ekstrand
@mdekstrand
I am testing to see if we can get away with the older Numba
it does look like older Numba is ok (all tests pass), so I have downgraded that minimum version
bielovico
@bielovico
Thank you @mdekstrand, you're the best! I installed github version and everything looks just fine now.
Nikhil
@NickKartha
Hi, how can I get started with lenskit? I'd like to build a quick recommender engine. Just as proof of concept.
Michael Ekstrand
@mdekstrand
@NickKartha the Getting Started guide walks through setting up a couple of algorithms: http://lkpy.lenskit.org/en/latest/GettingStarted.html
Michael Ekstrand
@mdekstrand
This channel is attached to the Java LensKit repository. It is now deprecated. I don't know if we'll use Gitter or not for the Python code, but in the mean time, use the Google Group: https://groups.google.com/forum/#!forum/lenskit-recsys