{"id":20057669,"url":"https://github.com/todesking/platebuilder","last_synced_at":"2025-08-17T11:06:36.815Z","repository":{"id":136156250,"uuid":"79329129","full_name":"todesking/platebuilder","owner":"todesking","description":"Typesafe plate notation builder","archived":false,"fork":false,"pushed_at":"2017-08-04T09:53:57.000Z","size":228,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-02T09:45:08.853Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scala","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/todesking.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-18T10:25:37.000Z","updated_at":"2020-10-09T00:51:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"3ef66007-e0bb-42e7-9395-acb430b440d4","html_url":"https://github.com/todesking/platebuilder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/todesking/platebuilder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/todesking%2Fplatebuilder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/todesking%2Fplatebuilder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/todesking%2Fplatebuilder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/todesking%2Fplatebuilder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/todesking","download_url":"https://codeload.github.com/todesking/platebuilder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/todesking%2Fplatebuilder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270837583,"owners_count":24654391,"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","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-11-13T12:59:52.052Z","updated_at":"2025-08-17T11:06:36.800Z","avatar_url":"https://github.com/todesking.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Platebuilder: Typesafe plate notation (graphical model) builder\n\nTypesafe Scala DSL to build graphical model.\n\n![Graphical models of LDA and firends](https://rawgit.com/todesking/platebuilder/master/img/ldas.svg)\n\n```scala\n// example/src/main/scala/Demo.scala\nobject Demo {\n  object Unigram extends PlateBuilder {\n    import builder.dsl._\n\n    val V = size.V(\"Number of vocabularies\")\n    val D = size.D(\"Number of documents\")\n    val N = size.N(\"Number of words for each documents\") * D\n\n    // hyperparameters\n    val beta = given.beta.realVec(V)\n\n    // variables\n    val phi = hidden.phi.realVec(V)\n    val w = observed.w.category(V) * (D, N)\n\n    phi ~ dirichlet(beta)\n\n    for (d \u003c- D) {\n      for (n \u003c- N(d)) {\n        w(d, n) ~ categorical(phi)\n      }\n    }\n  }\n\n  val MixtureOfUnigrams = Model.define(\"MixtureOfUnigrams\") { implicit builder =\u003e\n    import builder.dsl._\n    val K = size.K(\"Number of topics\")\n    val V = size.V(\"Number of vocabularies\")\n    val D = size.D(\"Number of documents\")\n    val N = size.N(\"Number of words for each documents\") * D\n\n    // hyperparameters\n    val alpha = given.alpha.realVec(K)\n    val beta = given.beta.realVec(V)\n\n    // variables\n    val phi = hidden.phi.realVec(V) * K\n    val theta = hidden.theta.realVec(K)\n    val z = hidden(\"z\", \"Hidden topic for each document\").category(K) * D\n    val w = observed.w.category(V) * (D, N)\n\n    for (k \u003c- K) {\n      phi(k) ~ dirichlet(beta)\n    }\n\n    theta ~ dirichlet(alpha)\n\n    for (d \u003c- D) {\n      z(d) ~ categorical(theta)\n      for (n \u003c- N(d)) {\n        w(d, n) ~ categorical(phi(z(d)))\n      }\n    }\n  }\n\n  val LDA = Model.define(\"LDA\") { implicit builder =\u003e\n    import builder.dsl._\n    val K = size.K(\"Number of topics\")\n    val V = size.V(\"Number of vocabularies\")\n    val D = size.D(\"Number of documents\")\n    val N = size.N(\"Number of words for each documents\") * D\n\n    // hyperparameters\n    val alpha = given.alpha.realVec(K)\n    val beta = given.beta.realVec(V)\n\n    // variables\n    val phi = hidden.phi.realVec(V) * K\n    val theta = hidden.theta.realVec(K) * D\n    val z = hidden(\"z\", \"Hidden topic for each word\").category(K) * (D, N)\n    val w = observed.w.category(V) * (D, N)\n\n    for (k \u003c- K) {\n      phi(k) ~ dirichlet(beta)\n    }\n\n    for (d \u003c- D) {\n      theta(d) ~ dirichlet(alpha)\n      for (n \u003c- N(d)) {\n        z(d, n) ~ categorical(theta(d))\n        w(d, n) ~ categorical(phi(z(d, n)))\n      }\n    }\n  }\n\n  val basic = Seq(Unigram.model, MixtureOfUnigrams, LDA)\n\n  def main(args: Array[String]): Unit = {\n    println(Model.toDot(basic))\n  }\n}\n```\n\n## Demo\n\n```shellsession\n$ sbt --error 'set showSuccess := false' 'example/runMain Demo' \u003e demo.dot\n$ dot -Tpng demo.dot \u003e demo.png\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftodesking%2Fplatebuilder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftodesking%2Fplatebuilder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftodesking%2Fplatebuilder/lists"}