{ "info": { "author": "Shane Stephenson / metriczulu", "author_email": "stephenson.shane.a@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# Ensemblizer\n\n**ensemblizer** is a small package for various ensemble methods\n\n**ModelCollection** is a simple way to aggregate models so that they can be trained together.\n\n**CatEnsemble** takes a **ModelCollection** object (or the same input as one) with an additional ensemble model. The ensemble model will train on the predicted probabilities (or just predictions) of the **ModelCollection** and make a separate prediction. This ensemble method allows for different weighting schemes of the outputs of each model as well as stacking the original data with the predictions when training the ensemble model. Additionally, this ensemble class allows you to pretrain the **ModelCollection** object prior to training the ensemble model or training the **ModelCollection** object *with* the ensemble model. This allows for more efficient hyperparameter tuning (albeit much longer training and tuning times).\n\nHyperparameters can be trained like any other scikit-learn-esque model. When setting parameters for the ensemble model, parameters that begin with *name__* will set the hyperparameter of the *name* model in the collection or ensemble model (default name for ensemble model is \"ensemble\"). Parameters that start with *__name* will update the weight of the *name* model in the collection. This allows the weighting scheme of the ensemble to be tuned with all other parameters using any scikit-learn tuning package.\n\n## Current Version is v0.04\n\nThis package is currently in the beginning stages but future work is planned.\n\n## Installation\n\n\tpip install ensemblizer\n\n## Usage\n\n\timport numpy as np\n\tfrom sklearn.linear_model import LogisticRegression\n\tfrom sklearn.naive_bayes import MultinomialNB\n\tfrom sklearn.neighbors import KNeighborsClassifier\n\tfrom sklearn.metrics import accuracy_score\n\tfrom ensemblizer import ModelCollection, CatEnsemble\n\t\n\tnp.random.seed(0)\n\tx_train = np.random.randint(0, 10, (80, 3))\n\tx_test = np.random.randint(0, 10, (20, 3))\n\ty_train = np.random.randint(0, 2, 80)\n\ty_test = np.random.randint(0, 2, 20)\n\t\n\tmodels = ModelCollection([('log', LogisticRegression(random_state=0)),('nb', MultinomialNB())])\n\ttest.fit(x_train, y_train)\n\t\n\tensemble = CatEnsemble(test, KNeighborsClassifier())\n\tensemble.fit(x_train, y_train)\n\ttest_preds = ensemble.predict(x_test)\n\tprint(f\"Accuracy on test set is {accuracy_score(y_test, test_preds)}\"\n\t\n\t#change the C param of the 'log' model to 15, the alpha param of the 'nb' model to 1,\n\t#the n_neighbors param of the ensemble model to 10, and the weight of the 'log' model to 3 \n\tens.set_params('log__C': 15, 'nb__alpha': 1, 'ensemble__n_neighbors': 10, '__log': 3})\n\tens.fit(x_train, y_train)\n\ttest_preds = ensemble.predict(x_test)\n\tprint(f\"Accuracy on test set is {accuracy_score(y_test, test_preds)}\"\n\t\n## Future Plans\n\nThe next step is to create an ensemble regressor model.\n\n## License\n\nLol", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/metriczulu/ensemblizer/archive/v0.06.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/metriczulu/ensemblizer", "keywords": "", "license": "None", "maintainer": "", "maintainer_email": "", "name": "ensemblizer", "package_url": "https://pypi.org/project/ensemblizer/", "platform": "", "project_url": "https://pypi.org/project/ensemblizer/", "project_urls": { "Download": "https://github.com/metriczulu/ensemblizer/archive/v0.06.tar.gz", "Homepage": "https://github.com/metriczulu/ensemblizer" }, "release_url": "https://pypi.org/project/ensemblizer/0.6/", "requires_dist": null, "requires_python": "", "summary": "Package for ensembling models together", "version": "0.6" }, "last_serial": 5778834, "releases": { "0.5": [ { "comment_text": "", "digests": { "md5": "ad5e343669268136083e89abba8e3e76", "sha256": "aca8b6f4fed86f3ea6bacb5ad54da8d5008c3c121555a537974dce938cf6770b" }, "downloads": -1, "filename": "ensemblizer-0.5.tar.gz", "has_sig": false, "md5_digest": "ad5e343669268136083e89abba8e3e76", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4381, "upload_time": "2019-09-02T20:56:05", "url": "https://files.pythonhosted.org/packages/17/3d/14ff11e26f56dfe9647bd44a92729eff822e863e390b0c01b27b1e735df5/ensemblizer-0.5.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "c761d8076ce30c7ebed4d2c4f1ccfddf", "sha256": "9eb2c459dfa790e3f97c2ed3e566328ddfc3d80ec8e08c8af624c7b60305a899" }, "downloads": -1, "filename": "ensemblizer-0.6.tar.gz", "has_sig": false, "md5_digest": "c761d8076ce30c7ebed4d2c4f1ccfddf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4392, "upload_time": "2019-09-04T01:39:21", "url": "https://files.pythonhosted.org/packages/2d/20/e8fad5973e33f4c3fea3eb5279fe216168a49acac675e96f75e690aeb62e/ensemblizer-0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c761d8076ce30c7ebed4d2c4f1ccfddf", "sha256": "9eb2c459dfa790e3f97c2ed3e566328ddfc3d80ec8e08c8af624c7b60305a899" }, "downloads": -1, "filename": "ensemblizer-0.6.tar.gz", "has_sig": false, "md5_digest": "c761d8076ce30c7ebed4d2c4f1ccfddf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4392, "upload_time": "2019-09-04T01:39:21", "url": "https://files.pythonhosted.org/packages/2d/20/e8fad5973e33f4c3fea3eb5279fe216168a49acac675e96f75e690aeb62e/ensemblizer-0.6.tar.gz" } ] }