Giter VIP home page Giter VIP logo

pycorr's Introduction

PyCorr

A simple library to calculate correlation between variables. Currently provides correlation between nominal variables.

Based on statistical methodology like Cramer'V and Tschuprow'T allows to gauge the correlation between categorical variables. Ability to plot the correlation in form of heatmap is also provided.

Usage example

import pandas as pd
from pycorrcat.pycorrcat import plot_corr, corr_matrix

df = pd.DataFrame([('a', 'b'), ('a', 'd'), ('c', 'b'), ('e', 'd')],
                  columns=['dogs', 'cats'])

correlation_matrix = corr_matrix(data, ['dogs', 'cats'])
plot_corr(df, ['dogs','cats'] )

Development setup

Create a virtualenv and install dependencies:

  • pip install -r requirements.dev.txt
  • pip install -r requirements.txt Then install the pre-commit hooks: pre-commit install and continue with code change.

Run pre-commit locally to check files

pre-commit run --all-files

Release History

  • 0.1.4
    • CHANGE: Changed the documentation (no code change)
  • 0.1.3
    • ADD: Ability to pass dataframe to get correlation matrix
    • ADD: Ability to plot the correlation in form of heatmap
  • 0.1.2
    • Added as first release
  • 0.1.1
    • Test release

Author and Contributor

Anurag Kumar Mishra โ€“ Connect on github or drop a mail

Distributed under the GNU license. See LICENSE for more information.

Github repo link https://github.com/MavericksDS/pycorr

Contributing

  1. Fork it (https://github.com/MavericksDS/pycorr)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

pycorr's People

Contributors

anuragithub avatar dafrenchyman avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

dafrenchyman

pycorr's Issues

Yate's correction factor

I could be totally wrong on this, but should you be using the Yate's correction factor on a 2x2 matrix? Since you've already introduced the bias correction factor into Cramer's V.

I feel like the call to: stats.chi2_contingency(crosstab_matrix)
should be : stats.chi2_contingency(crosstab_matrix, correction=False) if we have a 2x2.

If I submit something that's perfectly correlated, I seem to get results closer to 1. If I leave it at the default True the results are further from 1.

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.