A Python package for calculating information gain.
Project description
infoGain 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.1.tar.gz
(2.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file informationgain-0.1.1.tar.gz.
File metadata
- Download URL: informationgain-0.1.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
365fcb480e47937dfa97cc4cb40167e9a4be0aaf356d1b50364e91ebcd2ca29b
|
|
| MD5 |
bbfed1605a9903f3c6c6fe8c37f54ff7
|
|
| BLAKE2b-256 |
d1a8d896b556880ec8de40448f04b30636c1b34722b58388b1ba51d8500f8bdd
|
File details
Details for the file informationgain-0.1.1-py3-none-any.whl.
File metadata
- Download URL: informationgain-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2da0a0c28e94d054eef79d465318eebb33f7ec580617ef5e408109b1fde3a03
|
|
| MD5 |
257a2aeff43c5077b15e474f569406cd
|
|
| BLAKE2b-256 |
595fb081e66cd49c9b113cba80df4d324d07fc5450b8cb13095a05fa3450afb9
|