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
Using this version
Install via github:
pip install git+https://github.com/phenology/merf
Instantiate the dummy model:
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):
from sklearn.ensemble import RandomForestRegressor
rf = RandomForestRegressor(n_estimators=300, n_jobs=-1)
me_rf = MixedEffectsModel(rf)
me_rf.fit(X, y)
Metadata
Release files for DumME 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| DumME-0.1.0.tar.gz | 14.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| DumME-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.4 kB
Release files / DumME-0.1.0.tar.gz
| Download URL | DumME-0.1.0.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
30b83ccfad3bc4cd2c2ed824226ef1efd1da205a03e102a7184d095a37941eab
|
|
BLAKE2b-256 checksum How to use checksums |
dfd0cca14c29ae9e3342453307a76d1551e0faab1abdecb8d073a4e85ff06f0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.0
|
Release files / DumME-0.1.0-py3-none-any.whl
| Download URL | DumME-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
92684bee7ba9a8a0f1c35e49cdb90b55c6960874f769ae73a4a7a39b8f071c4a
|
|
BLAKE2b-256 checksum How to use checksums |
9c02c54fc6a17222cc484bb70ff1b83793a5b54530891c7e6efd7a82340237b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.0
|