Skip to main content

Mo ta ngan

Project description

get_features_by_backward_and_tffs

Description

The get_features_by_backward_and_tffs function performs feature selection based on Backward Selection combined with Feature Selection based on Top Frequency (TFFS). This function helps identify important features in a dataset by leveraging the TFFS algorithm from the pypi-tffs repository and Backward Selection.

Parameters

Parameter Data Type Description
data pd.DataFrame The input dataset containing features to be selected. The first column should represent the class label for the classification process.
percent_tffs float The percentage of features to retain after applying TFFS. This value should be greater than percent_backward to ensure effective selection.
number_run int The number of times the Random Forest model is built during the TFFS process.
n_estimators int The number of decision trees in the Random Forest model used to assess feature importance.
percent_backward float The percentage of features to retain after applying Backward Selection.

Workflow

  1. Feature Selection based on Top Frequency (TFFS):

    • Apply the TFFS algorithm from pypi-tffs to identify features that frequently appear as important across multiple Random Forest model runs.
    • Retain the top percent_tffs% most frequently selected features.
  2. Backward Selection:

    • Iteratively remove the least important features and evaluate model performance to identify those with the least impact.
  3. Backward Selection:

    • From the set of features selected in the TFFS step, retain percent_backward% of the most impactful features.

Return Value

The function returns a list of the most important features after applying both the TFFS and Backward Selection methods.

Example Usage

import pandas as pd
from hybridtffs import get_features_by_backward_and_tffs

# Create a sample DataFrame with the target column as the first column
data = pd.DataFrame({
    'target': [0, 1, 0, 1],
    'feature_1': [0.1, 0.2, 0.3, 0.4],
    'feature_2': [1, 2, 3, 4],
    'feature_3': [5, 6, 7, 8]
})

# Run the function
selected_features = get_features_by_backward_and_tffs(
    data,
    percent_tffs=50,
    number_run=10,
    n_estimators=100,
    percent_backward=30
)

print("Selected features:", selected_features)

Author

Vu Thi Kieu Anh


© 2025,

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

hybridtffs-0.1.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

hybridtffs-0.1.2-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for hybridtffs-0.1.2.tar.gz
Algorithm Hash digest
SHA256 669dcb7d29caae7f17d48b6b8abf602636003d5ff652ac4be447c74025ef4d08
MD5 95e37ca3973447cb0d7dbffaa55f2bdf
BLAKE2b-256 47956104225255a109e9bb005fb3c2c7c8f45399c2129b40ae833dad182e6ef5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hybridtffs-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.2

File hashes

Hashes for hybridtffs-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 74349663fcd95aa9fc7905f8259932240da186cb9653472bf470128878857bc7
MD5 77df71389fe59a77134dc3d5112fbe10
BLAKE2b-256 6fdaa542b1c3f0da811344892e6100708b6cf60adc9428201cf54cc881d39fd5

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