{"id":13995497,"url":"https://github.com/Entscheider/stamm","last_synced_at":"2025-07-22T22:31:02.361Z","repository":{"id":50285031,"uuid":"106116515","full_name":"Entscheider/stamm","owner":"Entscheider","description":"Generic decision trees for rust","archived":false,"fork":false,"pushed_at":"2018-09-02T12:34:20.000Z","size":16,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-17T22:12:57.555Z","etag":null,"topics":["decision-tree","decision-trees","random-forest","regression-trees","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/Entscheider.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":"2017-10-07T17:21:52.000Z","updated_at":"2025-05-10T05:23:53.000Z","dependencies_parsed_at":"2022-08-25T14:40:47.181Z","dependency_job_id":null,"html_url":"https://github.com/Entscheider/stamm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Entscheider/stamm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Entscheider%2Fstamm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Entscheider%2Fstamm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Entscheider%2Fstamm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Entscheider%2Fstamm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Entscheider","download_url":"https://codeload.github.com/Entscheider/stamm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Entscheider%2Fstamm/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266585663,"owners_count":23952163,"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-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["decision-tree","decision-trees","random-forest","regression-trees","rust"],"created_at":"2024-08-09T14:03:26.790Z","updated_at":"2025-07-22T22:31:02.060Z","avatar_url":"https://github.com/Entscheider.png","language":"Rust","funding_links":[],"categories":["Rust","Machine Learning"],"sub_categories":[],"readme":"# Stamm\n\nStamm is a rust library for creating [decision trees](https://en.wikipedia.org/wiki/Decision_tree) and [random forests](https://en.wikipedia.org/wiki/Random_forest) in a very general way. \nDecision trees are used in machine learning for classification and regression. A random forest bundles some decision trees for making a more precise classification or regression.\n\nThis library allows to specify the data and features of the nodes within a tree and the criteria for training. Any data can be used for classification and any data can be the output of a tree. Therefore, a probability output can be used for classification and a numeric output for regression.\nFurthermore, this is also true for a random forest.\n\nTo give an example, I've written a [hough forest](https://www.robots.ox.ac.uk/~vilem/cvpr2009.pdf) using this library a while ago.\nI published the code [here](https://github.com/Entscheider/depthhead).\n\nThis library can use [rayon](https://github.com/rayon-rs/rayon) to parallelize the training and prediction of a random forest.\nFor serialization and deserialization [serde](https://github.com/serde-rs/serde) is used. So you can save the trees and random forests as json, yaml, MessagePack and in many more formats (see [here](https://serde.rs/#data-formats)).\n\nA numeric tree implementation using Stamm can be found in the library. An example using this numeric tree is discoverable in the `examples` directory.\n\n## Documentation\n\nSee https://docs.rs/stamm\n\n## Usage\nAs always in Rust add Stamm as a dependency in Cargo.toml\n\n```rust\n[dependencies]\nstamm = \"*\"\n```\n\nand then add to your main.rs or lib.rs\n\n\n```rust\nextern crate stamm;\n```\n\nIf you want to create your own tree, you've to implement the `TreeLearnFunctions` trait. \nYou can train your tree with something like this\n\n```rust\nlet trainings_set = vec![some awesome training data];\nlet learn_function = MySpecialTreeLearnFunction::new();\nlet learner = TreeParameters::new();\nlet learned_tree = learner.learn_tree(learn_function, \u0026trainings_set);\n```\n\nand use your learned tree like this \n\n```rust\nlet to_predict = some_awesome_data_to_predict;\nlet result = learned_tree.predict(\u0026to_predict);\n```\n\nTraining a random forest is straight forward:\n\n```rust\nlet forest_learner = RandomForestLearnParam::new(\n    10 /* number of trees */,\n    50 /* size of the trainings subset used for a tree */,\n    learn_function /* see above */);\nlet trained_forest = forest_learner.train_forest(\u0026trainings_set).unwrap();\n// Or if the types you are using support it - train the forest parallel\nlet trained_forest = forest_learner.train_forest_parallel(\u0026trainings_set).unwrap();\n```\n\nUsing it:\n\n```rust\nlet result_list = \ntrained_forest.forest_predictions(\u0026to_predict);\n// Or to parallelize it\nlet result_list = \ntrained_forest.forest_predictions_parallel(\u0026to_predict);\n```\n\nYou get a vector which contains the result of every tree the forest has. You can combine them as you wish. E.g. if you want to predict, you can compute the average over all predictions to obtain a single result.\n\n## License\nStamm is distributed under the terms of the Apache License, Version 2.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEntscheider%2Fstamm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FEntscheider%2Fstamm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEntscheider%2Fstamm/lists"}