DumME


NameDumME JSON
Version 0.1.0 PyPI version JSON
download
home_page
SummaryMixed Effects Dummy Model
upload_time2024-01-30 08:08:33
maintainer
docs_urlNone
author
requires_python>=3.9
license
keywords random forest machine learning mixed effects
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10588922.svg)](https://doi.org/10.5281/zenodo.10588922)

# DumME: Mixed Effects Dummy Model

This is an adaptation of MERF (https://github.com/manifoldai/merf). The main
difference is that this version is fully compliant with the scikit-learn API.

Other difference include:

- The name: MERF was renamed to the more general MixedEffectsModel
- The default fixed-effects model: dummy model instead of random forest
- The package structure: stripped down to its core and then upgraded to use
  modern standards
- Test suite: using pytest instead of unittest

> [!CAUTION]
> We are currently not maintaining or developing this further. Ideally we would
> contribute our changes to the original version of MERF
> (see https://github.com/manifoldai/merf/issues/68).
> Do reach out if you want to build upon or collaborate with us on this.

## Using this version

Install via github:

```bash
pip install git+https://github.com/phenology/merf
```

Instantiate the dummy model:

```python
from dumme.dumme import MixedEffectsModel
from dumme.utils import DummeDataGenerator

# Get some sample data
dg = DummeDataGenerator(m=0.6, sigma_b=4.5, sigma_e=1)
df, _ = dg.generate_split_samples([1, 3], [3, 2], [1, 1])
y = df.pop("y")
x = df

# Fit a dummy model
# Notice the signature of the `fit` method: first X and y, and the other args are optional.
me_dummy = MixedEffectsModel()
me_dummy.fit(X, y)

# or
me_dummy.fit(X, y, cluster_column="cluster", fixed_effects=["X_0", "X_1", "X_2"], random_effects=["Z"])

# Predict only accepts X as input. It is assumed new data is structured
# in the same way as the original training data.
new_X = X.copy()
me_dummy.predict(new_X)
```

To get the "original" MERF (but still with the new fit signature):

```python
from sklearn.ensemble import RandomForestRegressor

rf = RandomForestRegressor(n_estimators=300, n_jobs=-1)
me_rf = MixedEffectsModel(rf)
me_rf.fit(X, y)
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "DumME",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "random forest,machine learning,mixed effects",
    "author": "",
    "author_email": "\"Peter Kalverla.\" <p.kalverla@esciencecenter.nl>, \"Stefan Verhoeven.\" <s.verhoeven@esciencecenter.nl>",
    "download_url": "https://files.pythonhosted.org/packages/df/d0/cca14c29ae9e3342453307a76d1551e0faab1abdecb8d073a4e85ff06f0e/DumME-0.1.0.tar.gz",
    "platform": null,
    "description": "[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10588922.svg)](https://doi.org/10.5281/zenodo.10588922)\n\n# DumME: Mixed Effects Dummy Model\n\nThis is an adaptation of MERF (https://github.com/manifoldai/merf). The main\ndifference is that this version is fully compliant with the scikit-learn API.\n\nOther difference include:\n\n- The name: MERF was renamed to the more general MixedEffectsModel\n- The default fixed-effects model: dummy model instead of random forest\n- The package structure: stripped down to its core and then upgraded to use\n  modern standards\n- Test suite: using pytest instead of unittest\n\n> [!CAUTION]\n> We are currently not maintaining or developing this further. Ideally we would\n> contribute our changes to the original version of MERF\n> (see https://github.com/manifoldai/merf/issues/68).\n> Do reach out if you want to build upon or collaborate with us on this.\n\n## Using this version\n\nInstall via github:\n\n```bash\npip install git+https://github.com/phenology/merf\n```\n\nInstantiate the dummy model:\n\n```python\nfrom dumme.dumme import MixedEffectsModel\nfrom dumme.utils import DummeDataGenerator\n\n# Get some sample data\ndg = DummeDataGenerator(m=0.6, sigma_b=4.5, sigma_e=1)\ndf, _ = dg.generate_split_samples([1, 3], [3, 2], [1, 1])\ny = df.pop(\"y\")\nx = df\n\n# Fit a dummy model\n# Notice the signature of the `fit` method: first X and y, and the other args are optional.\nme_dummy = MixedEffectsModel()\nme_dummy.fit(X, y)\n\n# or\nme_dummy.fit(X, y, cluster_column=\"cluster\", fixed_effects=[\"X_0\", \"X_1\", \"X_2\"], random_effects=[\"Z\"])\n\n# Predict only accepts X as input. It is assumed new data is structured\n# in the same way as the original training data.\nnew_X = X.copy()\nme_dummy.predict(new_X)\n```\n\nTo get the \"original\" MERF (but still with the new fit signature):\n\n```python\nfrom sklearn.ensemble import RandomForestRegressor\n\nrf = RandomForestRegressor(n_estimators=300, n_jobs=-1)\nme_rf = MixedEffectsModel(rf)\nme_rf.fit(X, y)\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Mixed Effects Dummy Model",
    "version": "0.1.0",
    "project_urls": {
        "Original": "https://github.com/manifoldai/merf",
        "Repository": "https://github.com/phenology/dumme"
    },
    "split_keywords": [
        "random forest",
        "machine learning",
        "mixed effects"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9c02c54fc6a17222cc484bb70ff1b83793a5b54530891c7e6efd7a82340237b4",
                "md5": "188ae823ca17be894e1c7226904e6644",
                "sha256": "92684bee7ba9a8a0f1c35e49cdb90b55c6960874f769ae73a4a7a39b8f071c4a"
            },
            "downloads": -1,
            "filename": "DumME-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "188ae823ca17be894e1c7226904e6644",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 12189,
            "upload_time": "2024-01-30T08:08:31",
            "upload_time_iso_8601": "2024-01-30T08:08:31.133236Z",
            "url": "https://files.pythonhosted.org/packages/9c/02/c54fc6a17222cc484bb70ff1b83793a5b54530891c7e6efd7a82340237b4/DumME-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dfd0cca14c29ae9e3342453307a76d1551e0faab1abdecb8d073a4e85ff06f0e",
                "md5": "5886aa6a285b8333c47e184467a5f15c",
                "sha256": "30b83ccfad3bc4cd2c2ed824226ef1efd1da205a03e102a7184d095a37941eab"
            },
            "downloads": -1,
            "filename": "DumME-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5886aa6a285b8333c47e184467a5f15c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 14235,
            "upload_time": "2024-01-30T08:08:33",
            "upload_time_iso_8601": "2024-01-30T08:08:33.178284Z",
            "url": "https://files.pythonhosted.org/packages/df/d0/cca14c29ae9e3342453307a76d1551e0faab1abdecb8d073a4e85ff06f0e/DumME-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-30 08:08:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "manifoldai",
    "github_project": "merf",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "dumme"
}
        
Elapsed time: 0.17548s