{ "info": { "author": "Gabriel Lerner & Nathan Toubiana", "author_email": "toubiana.nathan@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "[![Documentation Status](https://readthedocs.org/projects/scitime/badge/?version=latest)](https://scitime.readthedocs.io/en/latest/?badge=latest)\n[![Build Status](https://travis-ci.org/simkimsia/UtilityBehaviors.png)](https://travis-ci.com/nathan-toubiana/scitime) [![Build status](https://ci.appveyor.com/api/projects/status/f6xp39veawdd4y43?svg=true)](https://ci.appveyor.com/project/nathan-toubiana/scitime-2l382)\n [![codecov](https://codecov.io/gh/nathan-toubiana/scitime/branch/master/graph/badge.svg?token=yWAeEV2qWc)](https://codecov.io/gh/nathan-toubiana/scitime) [![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)\n [![PyPI version](https://badge.fury.io/py/scitime.svg)](https://badge.fury.io/py/scitime) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/scitime.svg)](https://anaconda.org/conda-forge/scitime) [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/scitime.svg)](https://anaconda.org/conda-forge/scitime)\n [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)\n\n# scitime\nTraining time estimation for scikit-learn algorithms. Method explained in this [article](https://medium.freecodecamp.org/two-hours-later-and-still-running-how-to-keep-your-sklearn-fit-under-control-cc603dc1283b?source=friends_link&sk=98e79add47516c38eeec59cf755df938)\n\nCurrently supporting:\n- RandomForestRegressor\n- SVC\n- KMeans\n- RandomForestClassifier\n\n### Environment setup\nPython version: 3.6 or higher\n\nPackage dependencies:\n- scikit-learn (>=0.19.1)\n- pandas (>=0.20.3)\n- joblib (>=0.12.5)\n- psutil (>=5.4.7)\n\n#### Install scitime\n```\n\u2771 pip install scitime\nor \n\u2771 conda install -c conda-forge scitime\n```\n\n### Usage\n\n#### How to compute a runtime estimation\n\n- Example for RandomForestRegressor\n\n```python\nfrom sklearn.ensemble import RandomForestRegressor\nimport numpy as np\nimport time\n\nfrom scitime import Estimator\n\n# example for rf regressor\nestimator = Estimator(meta_algo='RF', verbose=3)\nrf = RandomForestRegressor()\n\nX,y = np.random.rand(100000,10),np.random.rand(100000,1)\n# run the estimation\nestimation, lower_bound, upper_bound = estimator.time(rf, X, y)\n\n# compare to the actual training time\nstart_time = time.time()\nrf.fit(X,y)\nelapsed_time = time.time() - start_time\nprint(\"elapsed time: {:.2}\".format(elapsed_time))\n```\n\n- Example for KMeans\n\n```python\nfrom sklearn.cluster import KMeans\nimport numpy as np\nimport time\n\nfrom scitime import Estimator\n\n# example for kmeans clustering\nestimator = Estimator(meta_algo='RF', verbose=3)\nkm = KMeans()\n\nX = np.random.rand(100000,10)\n# run the estimation\nestimation, lower_bound, upper_bound = estimator.time(km, X)\n\n# compare to the actual training time\nstart_time = time.time()\nkm.fit(X)\nelapsed_time = time.time() - start_time\nprint(\"elapsed time: {:.2}\".format(elapsed_time))\n```\n\nThe Estimator class arguments:\n\n- **meta_algo**: The estimator used to predict the time, either RF or NN \n- **verbose**: Controls the amount of log output (either 0, 1, 2 or 3)\n- **confidence**: Confidence for intervals (defaults to 95%)\n\nParameters of the estimator.time function:\n- **X**: np.array of inputs to be trained\n- **y**: np.array of outputs to be trained (set to None for unsupervised algo)\n- **algo**: algo whose runtime the user wants to predict\n\n### --- FOR TESTERS / CONTRIBUTORS ---\n\n\n#### Local Testing\nInside virtualenv (with pytest>=3.2.1):\n```\n(env)$ python -m pytest\n```\n#### How to use _data.py to generate data / fit models?\n```\n$ python _data.py --help\n\nusage: _data.py [-h] [--drop_rate DROP_RATE] [--meta_algo {RF,NN}]\n [--verbose VERBOSE]\n [--algo {RandomForestRegressor,RandomForestClassifier,SVC,KMeans}]\n [--generate_data] [--fit FIT] [--save]\n\nGather & Persist Data of model training runtimes\n\noptional arguments:\n -h, --help show this help message and exit\n --drop_rate DROP_RATE\n drop rate of number of data generated (from all param\n combinations taken from _config.json). Default is\n 0.999\n --meta_algo {RF,NN} meta algo used to fit the meta model (NN or RF) -\n default is RF\n --verbose VERBOSE verbose mode (0, 1, 2 or 3)\n --algo {RandomForestRegressor,RandomForestClassifier,SVC,KMeans}\n algo to train data on\n --generate_data do you want to generate & write data in a dedicated\n csv?\n --fit FIT do you want to fit the model? If so indicate the csv\n name\n --save (only used for model fit) do you want to save /\n overwrite the meta model from this fit?\n```\n(_data.py uses _model.py behind the scenes)\n#### How to run _model.py?\n\nAfter pulling the master branch (`git pull origin master`) and setting the environment (described above),\nrun `ipython` and:\n\n```python\nfrom scitime._model import Model\n\n# example of data generation for rf regressor\ntrainer = Model(drop_rate=0.99999, verbose=3, algo='RandomForestRegressor')\ninputs, outputs, _ = trainer._generate_data()\n\n# then fitting the meta model\nmeta_algo = trainer.model_fit(generate_data=False, inputs=inputs, outputs=outputs)\n# this should not locally overwrite the pickle file located at scitime/models/{your_model}\n# if you want to save the model, set the argument save_model to True\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/nathan-toubiana/scitime", "keywords": "machine-learning,scikit-learn,training-time", "license": "", "maintainer": "", "maintainer_email": "", "name": "scitime", "package_url": "https://pypi.org/project/scitime/", "platform": "", "project_url": "https://pypi.org/project/scitime/", "project_urls": { "Homepage": "http://github.com/nathan-toubiana/scitime" }, "release_url": "https://pypi.org/project/scitime/0.0.2/", "requires_dist": [ "joblib (>=0.12.5)", "pandas (>=0.20.3)", "psutil (>=5.4.7)", "scikit-learn (>=0.19.1)" ], "requires_python": ">=3", "summary": "Training time estimator for scikit-learn algorithms", "version": "0.0.2" }, "last_serial": 5233394, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "6bad44114b38605fb4f03132fbd19269", "sha256": "7f04c413e7aea1acb1dac44136fe3063e262838e3c50c4632bdc58d71be883af" }, "downloads": -1, "filename": "scitime-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "6bad44114b38605fb4f03132fbd19269", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 39992768, "upload_time": "2019-02-07T03:58:41", "url": "https://files.pythonhosted.org/packages/b5/48/93a9ca9cb6ff6d0fcfe5ff877ee937c9d155cfabcf114fab1e11ba86830e/scitime-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bd81e0393f8819bcb33e54cd3d16e6e4", "sha256": "3129a99ddee6f18acdefd319ad072db57fe74edd90a877b945ca4409d879b733" }, "downloads": -1, "filename": "scitime-0.0.1.tar.gz", "has_sig": false, "md5_digest": "bd81e0393f8819bcb33e54cd3d16e6e4", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 12806, "upload_time": "2019-02-07T03:58:45", "url": "https://files.pythonhosted.org/packages/c9/26/f4577606bd2606b6844a8c1c3557f54da244d801cc9a80c5aada72fe1354/scitime-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "8bad81fc20baac2bccc882fe465cb048", "sha256": "d551974bcb2c971a8c855b7bac03ace4c80573a549377c0442995c9dd73401f3" }, "downloads": -1, "filename": "scitime-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "8bad81fc20baac2bccc882fe465cb048", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 45883501, "upload_time": "2019-05-06T14:48:16", "url": "https://files.pythonhosted.org/packages/72/89/70f693c181ce1bc607765dde514202e26bfe165a54fff2c9a2ac85f41814/scitime-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "377361905144df925a3e8e4b686b5c33", "sha256": "af1869452bd76d0ba4cf40ad1b66246f88513d5e4c81f2981c449206b81a8f34" }, "downloads": -1, "filename": "scitime-0.0.2.tar.gz", "has_sig": false, "md5_digest": "377361905144df925a3e8e4b686b5c33", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 15299, "upload_time": "2019-05-06T14:48:20", "url": "https://files.pythonhosted.org/packages/d2/6a/079572f5db27f655f63fef8a3133d7ad00852de43750fd1f5a57cec7a9df/scitime-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8bad81fc20baac2bccc882fe465cb048", "sha256": "d551974bcb2c971a8c855b7bac03ace4c80573a549377c0442995c9dd73401f3" }, "downloads": -1, "filename": "scitime-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "8bad81fc20baac2bccc882fe465cb048", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 45883501, "upload_time": "2019-05-06T14:48:16", "url": "https://files.pythonhosted.org/packages/72/89/70f693c181ce1bc607765dde514202e26bfe165a54fff2c9a2ac85f41814/scitime-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "377361905144df925a3e8e4b686b5c33", "sha256": "af1869452bd76d0ba4cf40ad1b66246f88513d5e4c81f2981c449206b81a8f34" }, "downloads": -1, "filename": "scitime-0.0.2.tar.gz", "has_sig": false, "md5_digest": "377361905144df925a3e8e4b686b5c33", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 15299, "upload_time": "2019-05-06T14:48:20", "url": "https://files.pythonhosted.org/packages/d2/6a/079572f5db27f655f63fef8a3133d7ad00852de43750fd1f5a57cec7a9df/scitime-0.0.2.tar.gz" } ] }