{"id":16599250,"url":"https://github.com/adrianulbona/hmm","last_synced_at":"2026-02-20T22:40:22.490Z","repository":{"id":57732255,"uuid":"49547701","full_name":"adrianulbona/hmm","owner":"adrianulbona","description":"Hidden Markov Models Java Library","archived":false,"fork":false,"pushed_at":"2016-12-20T07:57:08.000Z","size":56,"stargazers_count":41,"open_issues_count":0,"forks_count":19,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-07-23T19:06:18.374Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://adrianulbona.github.io/hmm/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adrianulbona.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-01-13T03:48:08.000Z","updated_at":"2025-02-05T07:13:29.000Z","dependencies_parsed_at":"2022-09-10T19:51:41.821Z","dependency_job_id":null,"html_url":"https://github.com/adrianulbona/hmm","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/adrianulbona/hmm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianulbona%2Fhmm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianulbona%2Fhmm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianulbona%2Fhmm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianulbona%2Fhmm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrianulbona","download_url":"https://codeload.github.com/adrianulbona/hmm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianulbona%2Fhmm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29667093,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T19:49:36.704Z","status":"ssl_error","status_checked_at":"2026-02-20T19:44:05.372Z","response_time":59,"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":[],"created_at":"2024-10-12T00:10:57.124Z","updated_at":"2026-02-20T22:40:22.473Z","avatar_url":"https://github.com/adrianulbona.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## HMM abstractions in Java 8 \n\n[![Build Status](https://travis-ci.org/adrianulbona/hmm.svg)](https://travis-ci.org/adrianulbona/hmm)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.adrianulbona/hmm/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.adrianulbona/hmm)\n\nBesides the basic abstractions, a most probable state sequence solution is implemented based on the Viterbi algorithm.\n\n### The library is hosted on Maven Central:\n\n#### Maven\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.adrianulbona\u003c/groupId\u003e\n    \u003cartifactId\u003ehmm\u003c/artifactId\u003e\n    \u003cversion\u003e0.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n#### Gradle\n```groovy\ncompile 'io.github.adrianulbona:hmm:0.1.0'\n```\n\n### How to use it:\n\n#### Getting the most probable sequence of states based on a sequence of observations:\n\n```java\nModel\u003cMedicalState, Symptom\u003e model = WikipediaViterbi.INSTANCE.model;\nList\u003cSymptom\u003e symptoms = asList(NORMAL, COLD, DIZZY);\nList\u003cMedicalState\u003e evolution = new MostProbableStateSequenceFinder\u003c\u003e(model).basedOn(symptoms);\n```\n\n#### How to define a model: \n\n```java\npublic enum WikipediaViterbi {\n\tINSTANCE;\n\n\tpublic final Model\u003cMedicalState, Symptom\u003e model;\n\n\tWikipediaViterbi() {\n\t\tmodel = new Model\u003c\u003e(probabilityCalculator(), reachableStatesFinder());\n\t}\n\n\tpublic enum MedicalState implements State {\n\t\tHEALTHY,\n\t\tFEVER;\n\t}\n\t\n\tpublic enum Symptom implements Observation {\n\t\tNORMAL,\n\t\tCOLD,\n\t\tDIZZY;\n\t}\n\t\n\tprivate ProbabilityCalculator\u003cMedicalState, Symptom\u003e probabilityCalculator() {\n\t\treturn new ProbabilityCalculator\u003c\u003e(StartProbabilities.INSTANCE.data::get,\n\t\t\t\tEmissionProbabilities.INSTANCE.data::get, \n\t\t\t\tTransitionProbabilities.INSTANCE.data::get);\n\t}\n\n\tprivate ReachableStateFinder\u003cMedicalState, Symptom\u003e reachableStatesFinder() {\n\t\treturn observation -\u003e asList(MedicalState.values());\n\t}\n\n\tprivate enum StartProbabilities {\n\t\tINSTANCE;\n\n\t\tpublic final Map\u003cMedicalState, Double\u003e data;\n\n\t\tStartProbabilities() {\n\t\t\tdata = new HashMap\u003c\u003e();\n\t\t\tdata.put(MedicalState.HEALTHY, 0.6);\n\t\t\tdata.put(MedicalState.FEVER, 0.4);\n\t\t}\n\t}\n\n\tprivate enum TransitionProbabilities {\n\t\tINSTANCE;\n\n\t\tpublic final Map\u003cTransition\u003cMedicalState\u003e, Double\u003e data;\n\n\t\tTransitionProbabilities() {\n\t\t\tdata = new HashMap\u003c\u003e();\n\t\t\tdata.put(new Transition\u003c\u003e(MedicalState.HEALTHY, MedicalState.HEALTHY), 0.7);\n\t\t\tdata.put(new Transition\u003c\u003e(MedicalState.HEALTHY, MedicalState.FEVER), 0.3);\n\t\t\tdata.put(new Transition\u003c\u003e(MedicalState.FEVER, MedicalState.HEALTHY), 0.4);\n\t\t\tdata.put(new Transition\u003c\u003e(MedicalState.FEVER, MedicalState.FEVER), 0.6);\n\t\t}\n\t}\n\n\tprivate enum EmissionProbabilities {\n\t\tINSTANCE;\n\n\t\tpublic final Map\u003cEmission\u003cMedicalState, Symptom\u003e, Double\u003e data;\n\n\t\tEmissionProbabilities() {\n\t\t\tdata = new HashMap\u003c\u003e();\n\t\t\tdata.put(new Emission\u003c\u003e(MedicalState.HEALTHY, Symptom.NORMAL), 0.5);\n\t\t\tdata.put(new Emission\u003c\u003e(MedicalState.HEALTHY, Symptom.COLD), 0.4);\n\t\t\tdata.put(new Emission\u003c\u003e(MedicalState.HEALTHY, Symptom.DIZZY), 0.1);\n\t\t\tdata.put(new Emission\u003c\u003e(MedicalState.FEVER, Symptom.NORMAL), 0.1);\n\t\t\tdata.put(new Emission\u003c\u003e(MedicalState.FEVER, Symptom.COLD), 0.3);\n\t\t\tdata.put(new Emission\u003c\u003e(MedicalState.FEVER, Symptom.DIZZY), 0.6);\n\t\t}\n\t}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianulbona%2Fhmm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrianulbona%2Fhmm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianulbona%2Fhmm/lists"}