Skip to main content

Generalized correlation measures

Project description

A Python library for generalized correlation

A Python implementation of generalized correlation measure. For development status and source code, see https://github.com/r-suzuki/gcor-py.

Note that this project is in an early stage of development, so changes may occur frequently.

Installation

PyPI

pip install gcor

GitHub (development version)

pip install git+https://github.com/r-suzuki/gcor-py.git

Examples

Generalized correlation measure takes values in $[0, 1]$ and can capture both linear and nonlinear associations. It naturally handles mixed data types, including numerical and categorical variables.

Scalar example

from gcor import gcor

x = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]
y = [1, 2, 3, 4, 5, 3, 4, 5, 6, 7]

g = gcor(x, y)
print(g)
0.5345224838248488

Matrix example (mixed numeric and categorical data)

import pandas as pd

df = pd.DataFrame({
    "x": x,
    "y": y,
    "z": ["a", "a", "b", "b", "c", "c", "d", "d", "e", "e"],
})

gmat = gcor(df)
print(gmat)
          x         y         z
x  1.000000  0.534522  0.838289
y  0.534522  1.000000  0.763233
z  0.838289  0.763233  1.000000

Documentation

Method Overview

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gcor-0.1.1.tar.gz (184.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gcor-0.1.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file gcor-0.1.1.tar.gz.

File metadata

  • Download URL: gcor-0.1.1.tar.gz
  • Upload date:
  • Size: 184.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for gcor-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a6e296b3107bbceb2c6fd3877c68732939e0b290324533b354a8027337824e15
MD5 4980bcfa156e488d06d5a2647b199bfe
BLAKE2b-256 8414ede38513638e0b0cad8a376677673f8aa603cf6d8ca6d29a8feb60e4e58a

See more details on using hashes here.

File details

Details for the file gcor-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: gcor-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for gcor-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6efe38e5aeaf4337db23a2943be276c56954b92cb532e20f99ecb9cbd0bfad2b
MD5 3a4846ab37a47d35b0bbbfe2f1553b3b
BLAKE2b-256 c637a310a0efc1f0a52132850399c8e44a8bceecdb73cda6d144206460be42ba

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page