{"id":23029724,"url":"https://github.com/antononcube/raku-ml-streamsblendingrecommender","last_synced_at":"2025-07-13T17:35:27.122Z","repository":{"id":44428660,"uuid":"343816302","full_name":"antononcube/Raku-ML-StreamsBlendingRecommender","owner":"antononcube","description":"Raku implementation of a Streams Blending Recommender (SBR).","archived":false,"fork":false,"pushed_at":"2024-09-23T01:53:14.000Z","size":849,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-08T11:13:21.723Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Raku","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antononcube.png","metadata":{"files":{"readme":"README-work.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":"2021-03-02T15:13:45.000Z","updated_at":"2024-09-23T01:53:17.000Z","dependencies_parsed_at":"2023-01-16T17:45:23.734Z","dependency_job_id":null,"html_url":"https://github.com/antononcube/Raku-ML-StreamsBlendingRecommender","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antononcube%2FRaku-ML-StreamsBlendingRecommender","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antononcube%2FRaku-ML-StreamsBlendingRecommender/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antononcube%2FRaku-ML-StreamsBlendingRecommender/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antononcube%2FRaku-ML-StreamsBlendingRecommender/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antononcube","download_url":"https://codeload.github.com/antononcube/Raku-ML-StreamsBlendingRecommender/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246886512,"owners_count":20849881,"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-12-15T14:16:57.433Z","updated_at":"2025-04-02T20:25:50.470Z","avatar_url":"https://github.com/antononcube.png","language":"Raku","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raku Streams Blending Recommender\n\n[![SparkyCI](http://sparrowhub.io:2222/project/gh-antononcube-Raku-ML-StreamsBlendingRecommender/badge)](http://sparrowhub.io:2222)\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n\nRaku implementation of a Streams Blending Recommender (SBR) framework.\n\nGenerally speaking, SBR is a \"computer scientist\" implementation of a recommendation system\nbased on sparse linear algebra. See the article\n[\"Mapping Sparse Matrix Recommender to Streams Blending Recommender\"](https://github.com/antononcube/MathematicaForPrediction/tree/master/Documentation/MappingSMRtoSBR),\n[AA1], for detailed theoretical description of the data structures and operations with them.\n\nThis implementation is loosely based on the:\n\n- Software monad\n[\"MonadicSparseMatrixRecommender\"](https://github.com/antononcube/MathematicaForPrediction/blob/master/MonadicProgramming/MonadicSparseMatrixRecommender.m), [AAp1],\nin Mathematica\n\n- Software monad [\"SMRMon-R\"](https://github.com/antononcube/R-packages/tree/master/SMRMon-R), [AAp2], in R\n\n- Object-Oriented Programming (OOP) implementation\n[\"SparseMatrixRecommender\"](https://pypi.org/project/SparseMatrixRecommender/), [AAp3], in Python\n\n\nInstead of \"monads\" the implementations in this package and [AAp3] use OOP classes. \nInstead of \"monadic pipelines\" method chaining is used. \n\nSee the org-mode file \n[\"Work-plan.org\"](./org/Work-plan.org)\nfor detailed status (including a TODO list.)\n\n--------\n\n## Installation\n\nFrom GitHub:\n\n```shell\nzef install https://github.com/antononcube/Raku-ML-StreamsBlendingRecommender.git\n```\n\nFrom zef-ecosystem:\n\n```shell\nzef install ML::StreamsBlendingRecommender\n```\n\n--------\n\n## Usage \n\nIn this section we show how to use the package by making a (nearest neighbors) classifier with it.\n\nHere are the steps:\n\n1. Take an example dataset\n    \n   - Titanic data from \"Data::Reshapers\", [AAp4].\n\n2. Make a recommender for that dataset\n\n3. Use the `classify` method of the recommender over a random selection of rows.\n\n   - Classify for the labels \"died\" or \"survived\" of Titanic's dataset column \"passengerAge\".  \n\n4. Evaluate the classification results \n  \n   - Using Receiver Operating Characteristic (ROC) statistics via \"ML::ROCFunctions\", [AAp5].\n\n```perl6\nuse Data::Reshapers;\nuse Data::Summarizers;\nmy @dsTitanic = get-titanic-dataset();\nrecords-summary(@dsTitanic)\n```\n\nHere is a sample of the data:\n\n```perl6\nto-pretty-table(@dsTitanic.roll(4));\n```\n\nHere we make the recommender object:\n\n```perl6\nuse ML::StreamsBlendingRecommender;\n\nmy ML::StreamsBlendingRecommender::CoreSBR $sbrObj .= new;\n\n$sbrObj.makeTagInverseIndexesFromWideForm(@dsTitanic, tagTypes =\u003e @dsTitanic[0].keys.grep({ $_ ne 'id' }).Array, itemColumnName =\u003e \u003cid\u003e, :!addTagTypesToColumnNames).transposeTagInverseIndexes;\n```\n\nHere we classify by profile\n\n```perl6\n$sbrObj.classifyByProfile('passengerSurvival', ['1st', 'female']):!object\n```\n\n**Remark:** Since we want to see the result and \"dot-chain\" with further method call we use\nthe adverb `:!object`.\n\nHere are the classification results of 5 randomly selected rows from the dataset:\n\n```perl6\nmy @clRes = @dsTitanic.pick(5).map({ $sbrObj.classifyByProfile('passengerSurvival', $_\u003cpassengerAge passengerClass passengerSex\u003e):!object }).Array;\n```\n\n*TBF...*\n\n\n-------\n\n## Implementation\n\n### UML diagram\n\nHere is a UML diagram that shows package's structure:\n\n![](./resources/class-diagram.png)\n\nThe\n[PlantUML spec](./resources/class-diagram.puml)\nand\n[diagram](./resources/class-diagram.png)\nwere obtained with the CLI script `to-uml-spec` of the package \"UML::Translators\", [AAp6].\n\nHere we get the [PlantUML spec](./resources/class-diagram.puml):\n\n```shell\nto-uml-spec ML::StreamsBlendingRecommender \u003e ./resources/class-diagram.puml\n```\n\nHere get the [diagram](./resources/class-diagram.png):\n\n```shell\nto-uml-spec ML::StreamsBlendingRecommender | java -jar ~/PlantUML/plantuml-1.2022.5.jar -pipe \u003e ./resources/class-diagram.png\n```\n\n## Object-oriented design\n\n\n\n--------\n\n\n## References\n\n### Articles\n\n[AA1] Anton Antonov, \n[\"Mapping Sparse Matrix Recommender to Streams Blending Recommender\"](https://github.com/antononcube/MathematicaForPrediction/tree/master/Documentation/MappingSMRtoSBR), \n(2019),\n[GitHub/antononcube](https://github.com/antononcube).\n\n### Packages, repositories\n\n[AAp1] Anton Antonov,\n[Monadic Sparse Matrix Recommender Mathematica package](https://github.com/antononcube/MathematicaForPrediction/blob/master/MonadicProgramming/MonadicSparseMatrixRecommender.m),\n(2018),\n[GitHub/antononcube](https://github.com/antononcube/).\n\n[AAp2] Anton Antonov,\n[Sparse Matrix Recommender Monad R package](https://github.com/antononcube/R-packages/tree/master/SMRMon-R),\n(2018),\n[R-packages at GitHub/antononcube](https://github.com/antononcube/R-packages).\n\n[AAp3] Anton Antonov,\n[SparseMatrixRecommender Python package](https://github.com/antononcube/Python-packages/tree/main/SparseMatrixRecommender),\n(2021),\n[Python-packages at GitHub/antononcube](https://github.com/antononcube/Python-packages).\n\n[AAp4] Anton Antonov,\n[Data::Reshapers Raku package](https://github.com/antononcube/Raku-Data-Reshapers),\n(2021),\n[GitHub/antononcube](https://github.com/antononcube).\n\n[AAp5] Anton Antonov,\n[ML::ROCFunctions Raku package](https://github.com/antononcube/Raku-ML-ROCFunctions),\n(2022),\n[GitHub/antononcube](https://github.com/antononcube).\n\n[AAp6] Anton Antonov,\n[UML::Translators Raku package](https://github.com/antononcube/Raku-UML-Translators),\n(2022),\n[GitHub/antononcube](https://github.com/antononcube).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantononcube%2Fraku-ml-streamsblendingrecommender","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantononcube%2Fraku-ml-streamsblendingrecommender","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantononcube%2Fraku-ml-streamsblendingrecommender/lists"}