Skip to main content

A Python package for calculating information gain.

Project description

informationGain Library

This module helps you calculate Information Gain for categorical data using entropy.


Class

infoGain.calculate(data, target, fIndex=True)


Parameters

Parameter Type Description Default
data DataFrame Dataset in pandas dataframe format Required
target String Output column (the target variable) Required
fIndex Boolean Specifies if the first column of the dataset is an index column True

Description

  • Calculates Information Gain for each feature/column in the dataset with respect to the target column.
  • Useful for decision tree splitting based on entropy.
  • Returns: A dictionary where keys are feature/column names and values are their corresponding Information Gain with respect to the target column.

Example Usage

from informationGain import infoGain

import pandas as pd

# Load dataset
data = pd.read_csv('your_dataset.csv')

# Initialize
ig = infoGain()

# Calculate Information Gain
result = ig.calculate(data, target='Output', fIndex=True)

print(result)
# Example Output:
# {'Feature1': 0.25, 'Feature2': 0.18, 'Feature3': 0.0}

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

informationgain-0.1.2.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

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

informationgain-0.1.2-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file informationgain-0.1.2.tar.gz.

File metadata

  • Download URL: informationgain-0.1.2.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for informationgain-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8efedb986bffd6558714cd28b0e1b15c74992484af02622d970e031e18cf8624
MD5 700b78a3a12d790bbe5dc5f26ce491eb
BLAKE2b-256 faadf460332b5d2761ef30ea1657228715f4eec9567767eb33970f01c73bce33

See more details on using hashes here.

File details

Details for the file informationgain-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for informationgain-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a26fd00962f9e60e91e4b9baad90926f96c550ed96259beb05d5f4bba69447c2
MD5 1403b2ef7e4d61b64f70925ba2099e27
BLAKE2b-256 06a39c59e01702e27f0f6f4ae15fd9083c1f4a6075186cfe76dd4fbe0f34d3a5

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