{"id":13671008,"url":"https://github.com/bluehalo/akin","last_synced_at":"2025-07-09T21:30:41.624Z","repository":{"id":57099429,"uuid":"75029470","full_name":"bluehalo/akin","owner":"bluehalo","description":"Node.js Recommendation Engine based on Collaborative Filtering","archived":false,"fork":false,"pushed_at":"2021-10-02T13:06:56.000Z","size":41,"stargazers_count":92,"open_issues_count":5,"forks_count":11,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-06-29T18:02:38.026Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bluehalo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-29T01:14:59.000Z","updated_at":"2025-04-29T10:22:11.000Z","dependencies_parsed_at":"2022-08-20T19:10:44.835Z","dependency_job_id":null,"html_url":"https://github.com/bluehalo/akin","commit_stats":null,"previous_names":["asymmetrik/akin"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/bluehalo/akin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluehalo%2Fakin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluehalo%2Fakin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluehalo%2Fakin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluehalo%2Fakin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bluehalo","download_url":"https://codeload.github.com/bluehalo/akin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluehalo%2Fakin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264503949,"owners_count":23618762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T09:00:55.663Z","updated_at":"2025-07-09T21:30:41.352Z","avatar_url":"https://github.com/bluehalo.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# @asymmetrik/akin\n\n[![Build Status](https://travis-ci.org/Asymmetrik/akin.svg?branch=master)](https://travis-ci.org/Asymmetrik/akin)\n[![Code Climate](https://codeclimate.com/github/Asymmetrik/akin/badges/gpa.svg)](https://codeclimate.com/github/Asymmetrik/akin)\n[![Test Coverage](https://codeclimate.com/github/Asymmetrik/akin/badges/coverage.svg)](https://codeclimate.com/github/Asymmetrik/akin/coverage)\n[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n\n\u003e Recommendation Engine Library based on Collaborative Filtering. Node.js implementation using MongoDB via Mongoose.\n\n\u003e Provides hooks for logging user activity on items referenced by an ObjectID and an optional item type. Additional methods provide execution of a scalable, collaborative filtering algorithm that outputs recommendation results for each user into a namespaced Mongo collections. These results can then be retrieved and integrated into the application as desired.\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [API](#api)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\nInclude this module as a dependency of your application in the `package.json` file. It also requires that MongooseJS is available as a peer dependency. For example:\n```\n{\n  ...\n  dependencies: {\n    \"mongoose\": \"~4.6\",\n    \"@asymmetrik/akin\": \"latest\"\n  }\n  ...\n}\n```\n\n## Usage\n\nInclude the module via `require` wherever applicable:\n```\nvar akin = require('@asymmetrik/akin');\n```\n\nThe most fundamental use case of logging user activity, running the engine, and retrieving recommendations for a user is achieved via:\n```\nakin.activity.log(userId, itemId, { type: 'itemType' }, 'action');\n...\nakin.run();\n...\nakin.recommendation.getAllRecommendationsForUser(userId);\n```\n\nThere are four classes that allow for managing activity logs and recalculating recommendations at a more granular level:\n### akin.model\nManages query execution for schemas\n\n### akin.activity\n1. Manage (add or remove) a user's activity for any item.\n1. Calculates the first phase of the recommendation engine: user's weighted scores on items\n\n### akin.similarity\n1. Calculates the second phase of the recommendation engine: user's similarity to other users\n\n### akin.recommendation\n1. Calculates the third and final phase of the recommendation engine: collaborative filtering to generate recommendations\n1. Allows for retrieval of all or a weighted random sample of recommendations\n1. Marking items as `do not recommend` for a user to stop them from returning in the sampling query\n\n## API\n\n### recalculate all recommendations\nExecute the recommendation engine based on the data supplied to the activity.log() API\n\u003e akin.run();\n\n### activity\nAdd a user's activity on an item\n\u003e akin.activity.log(userId, itemId, { type: 'itemType' }, 'actionType');\n\nRemove a user's activity on an item\n\u003e akin.activity.removeLog(userId, itemId, 'actionType');\n\n### retrieve recommendations\nGet all recommendations created for a user\n\u003e akin.recommendation.getAllRecommendationsForUser(userId);\n\nGet a sampling of recommendations created for a user based on a weighted cumulative distribution function\n\u003e akin.recommendation.sampleRecommendationsForUser(userId, numberOfSamples);\n\n## Contribute\n\nPRs accepted.\n\nSmall note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\n`@asymmetrik/akin` is [MIT licensed](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluehalo%2Fakin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbluehalo%2Fakin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluehalo%2Fakin/lists"}