Metadata-Version: 2.4
Name: trustgfs
Version: 0.1.0
Summary: TRUST-GFS feature selection for tabular classification
Author: Shily
License: MIT
Project-URL: Homepage, https://github.com/your-username/trustgfs
Project-URL: Repository, https://github.com/your-username/trustgfs
Keywords: feature selection,trust-gfs,classification,machine learning
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.23
Requires-Dist: scipy>=1.10
Requires-Dist: scikit-learn>=1.2
Dynamic: license-file

# trustgfs

`trustgfs` packages the TRUST-GFS feature selector for tabular classification.

It supports two input modes:

1. `fit(X_train, y_train)`
   - the package creates an outer train/validation split internally
   - then runs TRUST-GFS on the recombined outer split, matching the locked script behavior

2. `fit(X_train, y_train, X_val, y_val)`
   - the package directly combines train and validation
   - then runs TRUST-GFS on that combined data

The implementation preserves the locked TRUST-GFS-only logic, including:

- Stage 1 bootstrap evidence scoring
- null-threshold zoning into Strong / Mid / Weak
- Soft-Weak rescue against Strong anchors
- Stage 2 occlusion energy/support analysis
- feasible add-on pool selection
- genetic search over add-on subsets
- final selected subset output

## Installation

### Local editable install

```bash
pip install -e .
```

### From GitHub later

```bash
pip install "trustgfs @ git+https://github.com/YOUR_USERNAME/trustgfs.git"
```

### From PyPI later

```bash
pip install trustgfs
```

## Quick usage

```python
from trustgfs import TRUSTGFSSelector

selector = TRUSTGFSSelector(feature_names=feature_names)
selector.fit(X_train, y_train)

print(selector.selected_features_)
X_selected = selector.transform(X_train)
```

With explicit validation data:

```python
from trustgfs import TRUSTGFSSelector

selector = TRUSTGFSSelector(feature_names=feature_names)
selector.fit(X_train, y_train, X_val=X_val, y_val=y_val)

print(selector.selected_features_)
```

## Convenience function

```python
from trustgfs import run_trust_gfs

selected_idx, info = run_trust_gfs(
    X_train=X_train,
    y_train=y_train,
    feature_names=feature_names,
)
```

This prints only:

- `TRUST_GFS_STAGE1_FLOW_COUNTS`
- `TRUST_GFS_STAGE1_GROUP_FEATURES`
- `TRUST_GFS_FINAL_SELECTED_FEATURES`

## Notes

- For exact old TRUST-GFS behavior, `y` should already be integer-encoded as `0..C-1`.
- `transform()` returns the selected columns from the given matrix.
- The package does not include the older benchmark feature selectors or model-comparison loop.
