Coder Social home page Coder Social logo

ajayarunachalam / regressormetricgraphplot Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 1.0 316 KB

Python package to simplify plotting of common evaluation metrics for regression models. Metrics included are pearson correlation coefficient (r), coefficient of determination (r-squared), mean squared error (mse), root mean squared error(rmse), root mean squared relative error (rmsre), mean absolute error (mae), mean absolute percentage error (mape), etc.

License: MIT License

Jupyter Notebook 99.10% Python 0.90%
regression metrics graph evaluation-metrics rmse correlation-coefficient coefficient-of-determination rmse-score python metrics-visualization

regressormetricgraphplot's Introduction

Common Evaluation metrics graph plot for Regression Problem

Description

PyPI: https://pypi.org/project/regressormetricgraphplot/

Python implementations for comparing different Regression Models and Plotting with their most common evaluation metrics.

The purpose of this package is to help users plot the graph at ease with different widely used metrics for regression model evaluation for comparing them at a glance

Figure: Model evaluation plot with widely used metrics

Illustration Example

# Importing libraries 
from sklearn.datasets import make_regression
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from regressormetricgraphplot import *
%matplotlib inline
#Let's load a simple dataset and make a train & test set :
X, y = make_regression(n_samples=1000, n_features=10, n_informative=7, n_targets=1, random_state=0)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=10)
# Train the regressor and predict on test set 
# Fitting training set to linear regression model
lr = LinearRegression(n_jobs=-1)
lr.fit(X_train, y_train)
# Predicting
y_pred = lr.predict(X_test)

We can now use R2AndRMSE to compute & output R-squared, and Root Mean Square Error.

# Metrics
CompareModels.R2AndRMSE(y_test=y_test, y_pred=y_pred)

Make object of the class CompareModels

plot = CompareModels()

We can now use add & show method to add the built model & plot the graph at ease with all the evaluated metrics.

plot.add(model_name='Linear Regression', y_test=y_test, y_pred=y_pred)
plot.show(figsize=(10, 5))

Table of Contents

Installation

$ pip install regressormetricgraphplot

     OR

$ git clone https://github.com/ajayarunachalam/RegressorMetricGraphPlot
$ cd RegressorMetricGraphPlot
$ python setup.py install

Notebook

!pip install regressormetricgraphplot & import as 'from regressormetricgraphplot import *'

     OR

!git clone https://github.com/ajayarunachalam/RegressorMetricGraphPlot.git
cd RegressorMetricGraphPlot/

Just replace the line 'from CompareModels import *' with 'from regressormetricgraphplot import CompareModels' 

Follow the rest as demonstrated in the demo example [here] -- (https://github.com/ajayarunachalam/RegressorMetricGraphPlot/blob/main/regressormetricgraphplot/demo.ipynb)

Installation with Anaconda

If you installed your Python with Anacoda you can run the following commands to get started:

# Clone the repository 
git clone https://github.com/ajayarunachalam/RegressorMetricGraphPlot.git
cd RegressorMetricGraphPlot
# Create new conda environment with Python 3.6
conda create --new your-env-name python=3.6
# Activate the environment
conda activate your-env-name
# Install conda dependencies
conda install --yes --file conda_requirements.txt
# Instal pip dependencies
pip install requirements.txt

Examples

Navigate to the demo example in a form of iPython notebooks: -- here

Demo

 * demo.ipynb 

Contact

If there's some implementation you would like to see here or add in some examples feel free to do so. You can reach me at email

regressormetricgraphplot's People

Contributors

ajayarunachalam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

aysemm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.