{"id":38828314,"url":"https://github.com/mochatek/cbrecommender","last_synced_at":"2026-01-17T13:15:39.649Z","repository":{"id":50491050,"uuid":"235372551","full_name":"mochatek/cbrecommender","owner":"mochatek","description":"Python library for implementing Content-Based Recommendation Engines with ease!","archived":false,"fork":false,"pushed_at":"2022-07-30T04:35:42.000Z","size":22,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-02T23:24:06.108Z","etag":null,"topics":["content-based-recommendation","python3","recommendation-engine"],"latest_commit_sha":null,"homepage":"","language":"Python","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/mochatek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-21T15:17:13.000Z","updated_at":"2022-08-05T15:25:05.000Z","dependencies_parsed_at":"2022-09-21T08:54:07.509Z","dependency_job_id":null,"html_url":"https://github.com/mochatek/cbrecommender","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mochatek/cbrecommender","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mochatek%2Fcbrecommender","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mochatek%2Fcbrecommender/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mochatek%2Fcbrecommender/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mochatek%2Fcbrecommender/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mochatek","download_url":"https://codeload.github.com/mochatek/cbrecommender/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mochatek%2Fcbrecommender/sbom","scorecard":{"id":655621,"data":{"date":"2025-08-11","repo":{"name":"github.com/mochatek/cbrecommender","commit":"720531209e9b28734e296694701901758a87ccb5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/14 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-to-pypi.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/mochatek/cbrecommender/publish-to-pypi.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-to-pypi.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/mochatek/cbrecommender/publish-to-pypi.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/publish-to-pypi.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/mochatek/cbrecommender/publish-to-pypi.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/publish-to-pypi.yml:26","Warn: pipCommand not pinned by hash: .github/workflows/publish-to-pypi.yml:27","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Info: topLevel 'contents' permission set to 'read': .github/workflows/publish-to-pypi.yml:11","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-21T14:34:24.112Z","repository_id":50491050,"created_at":"2025-08-21T14:34:24.112Z","updated_at":"2025-08-21T14:34:24.112Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28508989,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T11:50:55.898Z","status":"ssl_error","status_checked_at":"2026-01-17T11:50:55.569Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["content-based-recommendation","python3","recommendation-engine"],"created_at":"2026-01-17T13:15:39.564Z","updated_at":"2026-01-17T13:15:39.641Z","avatar_url":"https://github.com/mochatek.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cbrecommender\r\n\r\n[![Downloads](https://static.pepy.tech/personalized-badge/cbrecommender?period=total\u0026units=international_system\u0026left_color=grey\u0026right_color=green\u0026left_text=Downloads)](https://pepy.tech/project/cbrecommender)\r\n[![Downloads](https://static.pepy.tech/personalized-badge/cbrecommender?period=month\u0026units=international_system\u0026left_color=grey\u0026right_color=blue\u0026left_text=Downloads/Month)](https://pepy.tech/project/cbrecommender)\r\n[![Downloads](https://static.pepy.tech/personalized-badge/cbrecommender?period=week\u0026units=international_system\u0026left_color=grey\u0026right_color=orange\u0026left_text=Downloads/Week)](https://pepy.tech/project/cbrecommender)\r\n\r\ncbrecommender is a Python library for implementing Content-Based Recommendation Engines with ease!\r\n\r\n**A Content-Based Recommender** is a form of **Personalized recommendation System** that maintains a user profile and tries to match the items with the taste profile of a user before presenting them as a recommendation to the user.\r\n\r\n`The key ideas are:`\r\n\r\n\u003e - Model items according to relevant attributes derived from the content.\r\n\r\n\u003e - Develop a user profile either from their implicit actions (clicks, time spend on a video etc.), explicit actions(purchase, rating etc.) or by combining both.\r\n\r\n\u003e - Use these profiles to provide recommendations.\r\n\r\n## Installation\r\n\r\nInstall from pypi with `pip` :\r\n\r\n```shell\r\npip install cbrecommender\r\n```\r\n\r\n## Usage\r\n\r\n**1. Importing and initializing :**\r\n\r\n```python\r\nfrom cbrecommender import CBRecommender\r\n\r\nrecommender = CBRecommender()\r\n```\r\n\r\n**2. Creating _Item Profiles_ :**\r\n\r\nIn Content-Based Recommender, we must build a profile for each item, which will represent the important characteristics of that item.\r\n\r\n```python\r\nitem_profiles = recommender.create_item_profile(features)\r\n```\r\n\r\n- `features: DataFrame` must be relevant attributes of the item that signifies the user's preferences. For example: movie genres, news topics, post tags etc.\r\n\r\n- `create_item_profile() -\u003e DataFrame` will return the item_profiles created from the supplied features.\r\n\r\n**3. Creating _User Profile_ :**\r\n\r\n```python\r\nuser_profile = recommender.fit(train_item_profiles, scores)\r\n```\r\n\r\n- `fit() -\u003e DataFrame` is where we extract user preferences from the item-profiles and associated scores, and then construct the user-profile.\r\n\r\n- `train_item_profiles: DataFrame` must be a subset of the item-profiles created at _step 2_. For example, it can be the item-profiles of the movies already watched by the user (watch history).\r\n\r\n- `scores: List[float]` must be a list of some measure corresponding to each item in _train_item_profiles_, denoting how much the user liked that item. For example: Rating for a watched movie, song etc.\r\n\r\n**4. Get recommendations based on _User Profile_ :**\r\n\r\n```python\r\nrecommendations = recommender.recommend(test_items, test_item_profiles, min_score, limit)\r\n```\r\n\r\n- `test_items: DataFrame` must be those items that the user have not used for training and from which we need recommendations. For example: Unwatched movies.\r\n\r\n- `test_item_profiles: DataFrame` must be the item-profiles of _test_items_.\r\n\r\n- `min_score: float` must be a numerical value (1-10) that specifies the minimum score for recommending items. Default is 7.5.\r\n\r\n- `limit: int` must be an integer that denotes the number of items to recommended.\r\n\r\n## Example\r\n\r\n```python\r\nfrom cbrecommender import CBRecommender\r\nfrom pandas import DataFrame\r\n```\r\n\r\n```python\r\ndata = DataFrame(\r\n{'movie':['Endgame','Avatar','Titanic','Infinity War','Jurassic World','Black Panther',\r\n          'Harry Potter-II','The Last Jedi'],\r\n 'genre':['Action,Adventure,Drama','Action,Adventure,Fantasy','Drama,Romance',\r\n          'Action,Adventure,Sci-Fi','Action,Adventure,Sci-Fi','Action,Adventure,Sci-Fi',\r\n          'Adventure,Drama,Fantasy','Action,Adventure,Fantasy']\r\n})\r\nprint(data)\r\n```\r\n\r\n| movie           | genre                    |\r\n| --------------- | ------------------------ |\r\n| Endgame         | Action,Adventure,Drama   |\r\n| Avatar          | Action,Adventure,Fantasy |\r\n| Titanic         | Drama,Romance            |\r\n| Infinity War    | Action,Adventure,Sci-Fi  |\r\n| Jurassic World  | Action,Adventure,Sci-Fi  |\r\n| Black Panther   | Action,Adventure,Sci-Fi  |\r\n| Harry Potter-II | Adventure,Drama,Fantasy  |\r\n| The Last Jedi   | Action,Adventure,Fantasy |\r\n\r\n```python\r\nrecommender = CBRecommender()\r\n\r\n# We are considering genre alone as the feature. You can include other features as well.\r\nmovie_profiles = recommender.create_item_profile(data[['genre']])\r\nprint(movie_profiles)\r\n```\r\n\r\n| action | adventure | drama | fantasy | romance | sci-fi |\r\n| ------ | --------- | ----- | ------- | ------- | ------ |\r\n| 1      | 1         | 1     | 0       | 0       | 0      |\r\n| 1      | 1         | 0     | 1       | 0       | 0      |\r\n| 0      | 0         | 1     | 0       | 1       | 0      |\r\n| 1      | 1         | 0     | 0       | 0       | 1      |\r\n| 1      | 1         | 0     | 0       | 0       | 1      |\r\n| 1      | 1         | 0     | 0       | 0       | 1      |\r\n| 0      | 1         | 1     | 1       | 0       | 0      |\r\n| 1      | 1         | 0     | 1       | 0       | 0      |\r\n\r\n```python\r\n# Consider we had watched the first 4 movies. So we use it as training data to extract preferences.\r\n# We use the user rating for the watched movies as the preference score.\r\nwatched_movie_profiles = movie_profiles.iloc[:4, :]\r\nwatched_movie_ratings = [8.5,7.8,7.8,8.5]\r\n\r\nuser_profile = recommender.fit(watched_movie_profiles, watched_movie_ratings)\r\nprint(recommender.user_profile)\r\n```\r\n\r\n| action | adventure | drama  | fantasy | romance | sci-fi |\r\n| ------ | --------- | ------ | ------- | ------- | ------ |\r\n| 0.2755 | 0.2755    | 0.1811 | 0.0866  | 0.0866  | 0.0944 |\r\n\r\n```python\r\n# We use the remaining 4 unwatched movies as test data to get recommendations from.\r\nunwatched_movies = data[['movie']].iloc[4:,:]\r\nunwatched_movie_profiles = movie_profiles.iloc[4:,:]\r\n\r\n# Recommend top 3 movies with minimum expected rating of 5.0\r\nrecommendations = recommender.recommend(unwatched_movies, unwatched_movie_profiles, 5.0, 3)\r\nprint(recommendations)\r\n```\r\n\r\n| item           | expected score |\r\n| -------------- | -------------- |\r\n| Jurassic World | 6.45           |\r\n| Black Panther  | 6.45           |\r\n| The Last Jedi  | 6.37           |\r\n\r\n## Contributing\r\n\r\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\r\n\r\n## License\r\n\r\n[MIT License ](https://github.com/mochatek/cbrecommender/blob/master/LICENSE.txt)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmochatek%2Fcbrecommender","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmochatek%2Fcbrecommender","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmochatek%2Fcbrecommender/lists"}