Last updated:
0 purchases
analyzefit 0.3.8
[![PyPI](https://img.shields.io/pypi/v/analyzefit.svg)](https://pypi.python.org/pypi/analyzefit/)[![Build Status](https://travis-ci.org/wsmorgan/analyzefit.svg?branch=master)](https://travis-ci.org/wsmorgan/analyzefit)[![codecov](https://codecov.io/gh/wsmorgan/analyzefit/branch/master/graph/badge.svg)](https://codecov.io/gh/wsmorgan/analyzefit)[![Code Health](https://landscape.io/github/wsmorgan/analyzefit/master/landscape.svg?style=flat)](https://landscape.io/github/wsmorgan/analyzefit/master)# analyzefitAnalyze fit is a python package that performs standard analysis on thefit of a regression model. The analysis class validate method willcreate a residuals vs fitted plot, a quantile plot, a spread locationplot, and a leverage plot for the model provided as well as print theaccuracy scores for any metric the user likes. For example:![alt_text](../master/support/images/validation.png)If a detailed plot is desired then the plots can also be generatedindividually using the methods res_vs_fit, quantile, spread_loc, andleverage respectively. By default when the plots are createdindividually they are rendered in an interactive inverontment usingthe bokeh plotting package. For example:![alt text](../master/support/images/interactive.pdf)This allows the user to determine which points the model is failing topredict.Full API Documentation available at: [github pages](https://wsmorgan.github.io/analysefit/).## Installing the codeTo install analyzefit you may either pip install:```pip install analyzefit```or clone this repository and install manually:```python setup.py install```# Validating a ModelTo use analyze fit simply pass the feature matrix, target values, andthe model to the analysis class then call the validate method, (or anyother plotting method). For example:```import pandas as pdimport numpy as npfrom sklearn.linear_model import LinearRegressionfrom sklearn.metrics import mean_squared_error, r2_scorefrom sklearn.model_selection import train_test_splitfrom analyzefit import Analysisdf = pd.read_csv('https://archive.ics.uci.edu/ml/machine-learning-databases/housing/housing.data', header=None,sep="\s+")df.columns = ["CRIM","ZN","INDUS","CHAS","NOX","RM","AGE","DIS","RAD","TAX","PTRATIO","B","LSTAT","MEDV"]X = df.iloc[:,:-1].valuesy = df[["MEDV"]].valuesX_train, X_test,y_train,y_test = train_test_split(X,y, test_size=0.3,random_state=0)slr = LinearRegression()slr.fit(X_train,y_train)an = Analysis(X_train, y_train, slr)an.validate()an.validate(X=X_test, y=y_test, metric=[mean_squared_error, r2_score])an.res_vs_fit()an.quantile()an.spread_loc()an.leverage()```## Python Packages Used- numpy- matplotlib- bokeh- sklearn
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.