npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@andrewshell/okay-recs

v0.2.0

Published

An okay way to find user recommendations and similar users

Downloads

7

Readme

Okay Recommendations

NPM

User Recommendations

Takes a structure of users and what they've rated various programs and find a list of other programs they might like based on similar ratings.

Rating is the average (mean) score of people who rated movies similar to you. Confidence is the number of users that contributed to that rating.

Similar Users

Takes a structure of users and what they've rated various programs and find a list of other users with similar ratings.

Rating is the sum of scores (2 points for exact match, 1 point for close match) Confidence is the number of program matches that contributed to that rating.

Example:

There is a full example in example folder.

const okayRecs = require('@andrewshell/okay-recs');

// Source of all user ratings in system.
const allUserRatings = {
    "user0": {
        "https://www.metacritic.com/tv/112263": 1,
        "https://www.metacritic.com/tv/24": 4,
        "https://www.metacritic.com/tv/30-rock": 3,
        "https://www.metacritic.com/tv/alias": 2,
        "https://www.metacritic.com/tv/archer": 2,
        "https://www.metacritic.com/tv/arrested-development": 2,
        "https://www.metacritic.com/tv/band-of-brothers": 3,
        ...
    },
    "user1": {
        "https://www.metacritic.com/tv/3rd-rock-from-the-sun": 2,
        "https://www.metacritic.com/tv/adventure-time": 4,
        "https://www.metacritic.com/tv/archer": 1,
        "https://www.metacritic.com/tv/arrested-development": 3,
        "https://www.metacritic.com/tv/better-call-saul": 4
        ...
    },
    ...
};

// Subset of user ratings that you want recommendations and similar users for.
// Note: This example shows one user, but can work for multiple users at once.
const subUserRatings = {
    user10: allUserRatings['user10']
};

// Sum of scores of people who gave program 1 a rating of x gave to program 2
// Intermediate structure for user recommendations. Should be cached.
const allProgramScores = okayRecs.programScores(allUserRatings);

// What programs are the users most likely to like?
const subUserRecommendations = okayRecs.userRecommendations(allProgramScores, subUserRatings);

// What other users is this user similar to?
const subUserSimilarUsers = okayRecs.similarUsers(allUserRatings, subUserRatings);

Output

// subUserRecommendations
{
    "user10": [
        {
            "idprogram": "https://www.metacritic.com/tv/what-we-do-in-the-shadows-2019",
            "rating": 4,
            "confidence": 16
        },
        {
            "idprogram": "https://www.metacritic.com/tv/gentleman-jack",
            "rating": 4,
            "confidence": 13
        },
        {
            "idprogram": "https://www.metacritic.com/tv/the-first",
            "rating": 4,
            "confidence": 11
        },
        {
            "idprogram": "https://www.metacritic.com/tv/shangri-la-2019",
            "rating": 4,
            "confidence": 11
        },
        {
            "idprogram": "https://www.metacritic.com/tv/immigration-nation",
            "rating": 4,
            "confidence": 7
        },
        ...
}

// subUserSimilarUsers
{
    "user10": [
        {
            "screenname": "user23",
            "rating": 31,
            "confidence": 28
        },
        {
            "screenname": "user85",
            "rating": 31,
            "confidence": 24
        },
        {
            "screenname": "user65",
            "rating": 30,
            "confidence": 22
        },
        {
            "screenname": "user123",
            "rating": 29,
            "confidence": 22
        },
        {
            "screenname": "user139",
            "rating": 29,
            "confidence": 21
        },
        {
            "screenname": "user14",
            "rating": 29,
            "confidence": 20
        },
        ...
    ]
}