{"id":19446138,"url":"https://github.com/stitchfix/arboreal","last_synced_at":"2025-10-29T15:41:32.555Z","repository":{"id":143399434,"uuid":"165912428","full_name":"stitchfix/arboreal","owner":"stitchfix","description":"Tree based modeling for humans","archived":false,"fork":false,"pushed_at":"2019-09-13T20:38:41.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-09T09:19:41.652Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/stitchfix.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":"2019-01-15T19:41:33.000Z","updated_at":"2023-06-09T04:53:10.000Z","dependencies_parsed_at":"2023-09-17T03:33:39.688Z","dependency_job_id":null,"html_url":"https://github.com/stitchfix/arboreal","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stitchfix/arboreal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stitchfix%2Farboreal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stitchfix%2Farboreal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stitchfix%2Farboreal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stitchfix%2Farboreal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stitchfix","download_url":"https://codeload.github.com/stitchfix/arboreal/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stitchfix%2Farboreal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281650117,"owners_count":26537952,"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-10-29T02:00:06.901Z","response_time":59,"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-10T16:13:03.656Z","updated_at":"2025-10-29T15:41:32.526Z","avatar_url":"https://github.com/stitchfix.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Disclaimer\nWe make no warranty as to the quality, functionality, safety, or utility of this software.  This repository contains an exploration of some ideas.  We are making this repository public so that we can collaborate with members of the community outside of Stitch Fix.\n\n# Arboreal\n#### Tree based modeling for humans\n\n\n## What is Arboreal?\nWelcome!  Arboreal is a Python package for tree based machine learning.  It's designed to work with a variety of data types, and has an explicit priority of ease of use and extensibility over speed.\n\n## What does using Arboreal look like?\n```python\n# First, grab a dataset (using the common iris dataset imported from sklearn)\n# Load iris dataset and convert to Pandas DataFrame\nfrom sklearn import datasets\niris = datasets.load_iris()\niris_df = pd.DataFrame(data=np.c_[iris['data'], iris['target']],\n                       columns=iris['feature_names'] + ['target'])\n# Add an explicit identifier column\niris_df['identifier'] = range(1, len(iris_df) + 1)\n# Create the datapoints by converting Pandas rows to dictionaries\ndatapoints = iris_df.to_dict(orient='records')\n# Train/test split\ntrain_fraction = 0.8\nrandom.shuffle(datapoints)  # shuffle dataset\nsplit_index = math.ceil(train_fraction * len(datapoints))\ntrain_datapoints, test_datapoints = datapoints[:split_index], datapoints[split_index:]\n# Double check we're not cheating by letting the target into the test data\ntest_datapoints_for_eval = copy.deepcopy(test_datapoints)\nfor dp in test_datapoints:\n    del dp['target']\n\n\n# And now to use Arboreal...\n\n# Create the Arboreal Metadata for this dataset\nm = Metadata()\nm.identifier = 'identifier'\nm.numericals = ['sepal length (cm)',\n                'sepal width (cm)',\n                'petal length (cm)',\n                'petal width (cm)']\nm.categoricals = ['target']\nm.target = 'target'\n\n# Create an Arboreal Dataset for train and test\ntrain_dataset = Dataset(metadata=m,\n                        datapoints=train_datapoints)\ntest_dataset = Dataset(metadata=m,\n                       datapoints=test_datapoints,\n                       validate_target=False)\n\n# Fit an ArborealTree on the train set\ntree = ArborealTree()  # or DecisionTree() or RandomForest()\ntree.fit(train_dataset)\n\n# Predict data points in the test set\npredictions = tree.transform(test_dataset)\n\n# Evaluate our performance on the test set\nresults = []\nprediction_datatypes = set()\nfor dp in test_datapoints_for_eval:\n    target = dp['target']\n    prediction = predictions[dp['identifier']]\n    predicted_value = prediction[0]\n    prediction_datatype = prediction[1]\n    prediction_datatypes.add(prediction_datatype)\n    assert len(prediction_datatypes) == 1, \"All predictions should be of the same datatype\"\n    results.append((target, predicted_value))\naccuracy = len([r for r in results if r[0] == r[1]]) / len(results)\nprint(f\"ArborealTree Accuracy: {accuracy} (Datatype: {prediction_datatype})\")\nprint(f\"ArborealTree:\")\nprint(tree)\n```\n\n\n## Installation\nTo get started, you'll want to clone this repository and run the tests to ensure Arboreal is working on your system.\n\nTo install Arboreal's test dependencies:\n\n`pip install -r requirements/test.txt`\n\nAnd then to run tests:\n\n`sniffer`\n\nor\n\n`python -m unittest discover`\n\n\n## Examples\nTo see some examples of Arboreal in use, check out `examples/` and the `test/` directory.\n\n## Development\nArboreal has some dependencies that make development nicer.  Try installing the `dev` dependencies with `pip install -r requirements/dev.txt` and then running `sniffer` in your terminal (pro tip: turn your volume down first!).\n\n\n## Dependencies\nArboreal has different sets of dependencies corresponding to use cases.  One set of dependencies is used for tests, for example, while another set is used for development. To ensure you have exactly the dependencies desired for your use case, run:\n\n`pip install -r requirements/{use_case}.txt`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstitchfix%2Farboreal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstitchfix%2Farboreal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstitchfix%2Farboreal/lists"}