Skip to main content

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.

Feature Selection Methods

In addition to Backward Selection, this package includes multiple classical feature selection methods combined with TFFS:

  • Forward Selection (get_features_by_forward_and_tffs)
  • Recursive Feature Elimination (RFE) (get_features_by_recursive_and_tffs)
  • Pearson Correlation (P.C.) (get_features_by_pc_and_tffs)
  • Mutual Information (M.I.) (get_features_by_mi_and_tffs)
  • Fish Score (get_features_by_fs_and_tffs)
  • Lasso Regression (get_features_by_lasso_and_tffs)

Example Usage

import pandas as pd
from hybridtffs import get_features_by_backward_and_tffs

# Create a sample DataFrame
data = pd.DataFrame({
    'class': [0, 1, 0, 1, 2, 0, 1, 2, 0, 1],
    'feature_1': [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0],
    'feature_2': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    'feature_3': [5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
    'feature_4': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    'feature_5': [5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
    'feature_6': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    'feature_7': [2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
    'feature_8': [3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
    'feature_9': [4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
})

# 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

Release files for hybridtffs 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hybridtffs 0.1.7
File Size Uploaded
hybridtffs-0.1.7.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hybridtffs 0.1.7
File Interpreter ABI Platform
hybridtffs-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / hybridtffs-0.1.7.tar.gz

Download URL hybridtffs-0.1.7.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bbb4906c5a6a55c791dc003225932d7ec0d8aed976468edb591faf3dcc7e558f
BLAKE2b-256 checksum
How to use checksums
df368ee714e350d6bc224ce7c01a9e58473eef8f76f0264eb2b37546ef6ce7a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.2

Release files / hybridtffs-0.1.7-py3-none-any.whl

Download URL hybridtffs-0.1.7-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5f172c0b3b61df36361cd6217b14f8329eef6809eaf60bf6b4014b61601577c
BLAKE2b-256 checksum
How to use checksums
f8a7cd1bc3fdf6a68e5f79b6811dc6f5c27b48e83611e2e900ebea6392033874
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page