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 .


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
criteria String Splitting criteria to use: "gini" or "entropy" "gini"

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

Uploaded Source

Built Distribution

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

informationgain-2.0.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for informationgain-2.0.0.tar.gz
Algorithm Hash digest
SHA256 dc3e20d27a15a0250cfaf01b71553af7a5c6d7a846c1f7f829e01715bd0e5ecf
MD5 f8703b4ea63e1321b82ea4f285a66056
BLAKE2b-256 b3fba990329b1145a3711bae340be0565ca8d2d72a1ecf0559b3b52440e0c6fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for informationgain-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d2c7825f7af94e977ee0506ee22852c995d819786353e6ee6674fb7a6aa0b47
MD5 d6a0ee2517b8ddf5c40f148bd0305e1c
BLAKE2b-256 b391b24f40ebb68cadaafea25674bc10567bf06fec904c7df1d1f6e3598ce3e4

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