{ "info": { "author": "Ha Dinh, Simran Sethi, Ruoqi Xu", "author_email": "dinhhn.ubc@gmail.com, simran.sethi@alumni.ubc.ca, rq658182@dal.ca", "bugtrack_url": null, "classifiers": [], "description": "RegscorePy\n==========\n\n|Build Status| |codecov| |PyPi|\n\nA python package that does model comparison between different regression\nmodels.\n\nInstallation\n------------\n\n.. code:: bash\n\n pip install git+https://github.com/UBC-MDS/RegscorePy.git\n\n #or\n\n pip install RegscorePy\n\n**Function Description And Usage**\n----------------------------------\n\nAIC\n~~~\n\nAIC stands for Akaike\u2019s Information Criterion. It estimates the quality\nof a model, relative to each of other models. The lower AIC score is,\nthe better the model is. Therefore, a model with lowest AIC - in\ncomparison to others, is chosen.\n\n::\n\n AIC = n*log(residual sum of squares/n) + 2K\n\nwhere: - n: number of observations - K: number of parameters (including\nintercept)\n\nFunction\n^^^^^^^^\n\n::\n\n aic(y, y_pred, p)\n\n**Parameters:**\n\n- **y**: array-like of shape = (n\\_samples) or (n\\_samples, n\\_outputs)\n- True target variable(s)\n\n- **y\\_pred**: array-like of shape = (n\\_samples) or (n\\_samples,\n n\\_outputs)\n- Fitted target variable(s) obtained from your regression model\n\n- **p**: int\n- Number of predictive variable(s) used in the model\n\n**Return:** \\* aic\\_score: int \\* AIC score of the model\n\nBIC\n~~~\n\nBIC stands for Bayesian Information Criterion. Like AIC, it also\nestimates the quality of a model. When fitting models, it is possible to\nincrease model fitness by adding more parameters. Doing this may result\nin model overfit. Both AIC and BIC help to resolve this problem by using\na penalty term for the number of parameters in the model. This term is\nbigger in BIC than in AIC.\n\n::\n\n BIC = n*log(residual sum of squares/n) + K*log(n)\n\nwhere: - n: number of observations - K: number of parameters (including\nintercept)\n\nFunction\n^^^^^^^^\n\n::\n\n bic(y, y_pred, p)\n\n**Parameters:** \\* **y**: array-like of shape = (n\\_samples) or\n(n\\_samples, n\\_outputs) \\* True target variable(s)\n\n- **y\\_pred**: array-like of shape = (n\\_samples) or (n\\_samples,\n n\\_outputs)\n- Fitted target variable(s) obtained from your regression model\n\n- **p**: int\n- Number of predictive variable(s) used in the model\n\n**Return:** \\* bic\\_score: int \\* BIC score of the model\n\nMallow's C\\_p\n~~~~~~~~~~~~~\n\nIntroduction\n^^^^^^^^^^^^\n\nMallow's C\\_p is named for Colin Lingwood Mallows. It is used to assess\nthe fit of regression model, finding the best model involving a subset\nof predictive variables available for predicting some outcome.\n\n::\n\n C_p = (SSE_p/MSE) - (n - 2p)\n\nwhere: - SSE\\_k: residual sum of squares for the subset model containing\n``p`` explanatory variables counting the intercept. - MSE: mean squared\nerror for the full model (model containing all ``k`` explanatory\nvariables of interest) - n: number of observations - p: number of subset\nexplanatory variables\n\nFunction\n^^^^^^^^\n\n::\n\n mallow(y, y_pred, y_sub, k, p)\n\n**Parameters:**\n\n- **y**: array-like of shape = (n\\_samples) or (n\\_samples, n\\_outputs)\n- True target variable(s)\n\n- **y\\_pred**: array-like of shape = (n\\_samples) or (n\\_samples,\n n\\_outputs)\n- Fitted target variable(s) obtained from your regression model\n\n- **y\\_sub**: array-like of shape = (n\\_samples) or (n\\_samples,\n n\\_outputs)\n- Fitted target variable(s) obtained from your subset regression model\n\n- **k**: int\n- Number of predictive variable(s) used in the model\n\n- **p**: int\n- Number of predictive variable(s) used in the subset model\n\n**Return:**\n\n- mallow\\_score: int\n- Mallow's C\\_p score of the subset model\n\nUsage\n-----\n\n::\n\n >> from RegscorePy import *\n >> y = [1,2,3,4]\n >> y_pred = [5,6,7,8]\n >> p = 3\n >> aic.aic(y, y_pred, p)\n 17.090354888959126\n >>\n >>\n >> bic.bic(y, y_pred, p)\n 15.249237972318795\n >>\n >>\n >> y_sub = [1,2,3,5]\n >> k = 3\n >> p = 2\n >> mallow.mallow(y, y_pred, y_sub, k, p) \n >> 0.015625\n\n- This usage apply to python3. If you use python2, please run\n ``from __future__ import division`` before run the function.\n\nHow to run tests\n----------------\n\n>From root directory, run all test files in terminal:\n\n::\n\n python -m pytest\n\nYou also have the option to run individual test files by referencing its\npath. For example, if you want to test aic function, you can use the\ncommand below:\n\n::\n\n python -m pytest RegscorePy/test/test_aic.py\n\nLicense\n-------\n\n`MIT `__\n\nContributing\n------------\n\nThis is an open source project. Please follow the guidelines below for\ncontribution. - Open an issue for any feedback and suggestions. - For\ncontributing to the project, please refer to\n`Contributing `__ for details.\n\n.. |Build Status| image:: https://travis-ci.org/UBC-MDS/RegscorePy.svg?branch=master\n :target: https://travis-ci.org/UBC-MDS/RegscorePy\n.. |codecov| image:: https://codecov.io/gh/UBC-MDS/RegscorePy/branch/master/graphs/badge.svg\n :target: https://codecov.io/gh/UBC-MDS/RegscorePy\n.. |PyPi| image:: https://badge.fury.io/py/RegscorePy.svg\n :target: https://pypi.python.org/pypi/RegscorePy\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/UBC-MDS/RegscorePy/archive/0.1.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/UBC-MDS/regscore-py", "keywords": "aic,bic,mallows,regression-score,machine-learning", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "RegscorePy", "package_url": "https://pypi.org/project/RegscorePy/", "platform": "", "project_url": "https://pypi.org/project/RegscorePy/", "project_urls": { "Download": "https://github.com/UBC-MDS/RegscorePy/archive/0.1.tar.gz", "Homepage": "https://github.com/UBC-MDS/regscore-py" }, "release_url": "https://pypi.org/project/RegscorePy/1.1/", "requires_dist": [ "numpy", "pandas" ], "requires_python": "", "summary": "Useful score functions to assist regression model comparison", "version": "1.1" }, "last_serial": 3680324, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "a556e3e43f2955dafbf33e5aa9b41378", "sha256": "b463690b14123716bfbfe1d0b2c97600ec0516b23fbdc9108280be611a00d6c7" }, "downloads": -1, "filename": "RegscorePy-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a556e3e43f2955dafbf33e5aa9b41378", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11195, "upload_time": "2018-03-18T05:03:24", "url": "https://files.pythonhosted.org/packages/d1/fb/16abe1d931e8c4031096c0c683287879d90f5c50418335034fbdf0b0c68d/RegscorePy-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b0a14c869bf7d0450ee324f0b07ca764", "sha256": "8a35e3885e6d186525a14e6e86f2ab71ca90a2eca8414c645f0b1004a40c0416" }, "downloads": -1, "filename": "RegscorePy-1.0.tar.gz", "has_sig": false, "md5_digest": "b0a14c869bf7d0450ee324f0b07ca764", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4800, "upload_time": "2018-03-18T04:16:48", "url": "https://files.pythonhosted.org/packages/6f/b3/28dbc2acb657ca9cca06541d85bc07668be2f94d5ed9fe209b68774d245f/RegscorePy-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "f062ec37461fe4ce9c920415c1e32d37", "sha256": "d92aee57ad070e58d6da629eb0a1281d26ef7f61ea0620cd820dfb005dd892bc" }, "downloads": -1, "filename": "RegscorePy-1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "f062ec37461fe4ce9c920415c1e32d37", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11437, "upload_time": "2018-03-18T06:05:46", "url": "https://files.pythonhosted.org/packages/39/40/e51956be9f942c976c8c45056649b6e2a90dd18a48262396296944900b51/RegscorePy-1.1-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f062ec37461fe4ce9c920415c1e32d37", "sha256": "d92aee57ad070e58d6da629eb0a1281d26ef7f61ea0620cd820dfb005dd892bc" }, "downloads": -1, "filename": "RegscorePy-1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "f062ec37461fe4ce9c920415c1e32d37", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11437, "upload_time": "2018-03-18T06:05:46", "url": "https://files.pythonhosted.org/packages/39/40/e51956be9f942c976c8c45056649b6e2a90dd18a48262396296944900b51/RegscorePy-1.1-py3-none-any.whl" } ] }