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-1.0.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

informationgain-1.0.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for informationgain-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a63be314d7e574bd3b6cf46535b597080151a34b9f721c40245f6e543e8705b8
MD5 beb3656d6a6832c870d45683c7c2ae2a
BLAKE2b-256 2cc0421f278ff3be1d5000fd358fe0b36597336916cdc65887402bd74dbb8f28

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for informationgain-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46576ea9191627a293c5c7799c21e63da2a916e476c1527edcc0e325e8957f1e
MD5 1879987b5bb1545acf79dee13c62dbc2
BLAKE2b-256 6c76e5bba196f5d379a5411c6e9b1a32ea37a3a4a3fe3256b84021294d84bfe8

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