Update README with V2 metrics and honest embedding assessment
Browse files
README.md
CHANGED
|
@@ -6,50 +6,72 @@ tags:
|
|
| 6 |
- grant-matching
|
| 7 |
- win-probability
|
| 8 |
- nonprofit
|
|
|
|
| 9 |
datasets:
|
| 10 |
- ArkMaster123/grantpilot-training-data
|
| 11 |
language:
|
| 12 |
- en
|
| 13 |
---
|
| 14 |
|
| 15 |
-
# GrantPilot Win Probability Classifier
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
| 20 |
|
| 21 |
-
## Performance
|
| 22 |
|
| 23 |
-
| Metric |
|
| 24 |
-
|--------|-------|--------|
|
| 25 |
-
| **AUC-ROC** | **0.
|
| 26 |
-
|
|
| 27 |
-
|
|
| 28 |
-
|
|
| 29 |
-
|
|
| 30 |
-
|
|
|
|
|
| 31 |
|
| 32 |
-
###
|
| 33 |
-
|
| 34 |
-
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
## Model Architecture
|
| 38 |
|
| 39 |
```
|
| 40 |
Input Features:
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
```
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
## Usage
|
| 54 |
|
| 55 |
```python
|
|
@@ -58,94 +80,31 @@ import pickle
|
|
| 58 |
from huggingface_hub import hf_hub_download
|
| 59 |
|
| 60 |
# Download model files
|
| 61 |
-
model_path = hf_hub_download("ArkMaster123/grantpilot-classifier", "xgboost_model.json")
|
| 62 |
-
scaler_path = hf_hub_download("ArkMaster123/grantpilot-classifier", "scaler.pkl")
|
| 63 |
-
calibrator_path = hf_hub_download("ArkMaster123/grantpilot-classifier", "isotonic_calibrator.pkl")
|
| 64 |
|
| 65 |
-
# Load
|
| 66 |
model = xgb.Booster()
|
| 67 |
model.load_model(model_path)
|
| 68 |
|
| 69 |
with open(scaler_path, "rb") as f:
|
| 70 |
scaler = pickle.load(f)
|
| 71 |
-
|
| 72 |
with open(calibrator_path, "rb") as f:
|
| 73 |
calibrator = pickle.load(f)
|
| 74 |
|
| 75 |
-
# Predict
|
| 76 |
features_scaled = scaler.transform(features)
|
| 77 |
dmatrix = xgb.DMatrix(features_scaled)
|
| 78 |
raw_pred = model.predict(dmatrix)
|
| 79 |
win_probability = calibrator.predict(raw_pred) * 100
|
| 80 |
```
|
| 81 |
|
| 82 |
-
## Training Details
|
| 83 |
-
|
| 84 |
-
- **Hardware**: NVIDIA H100 80GB
|
| 85 |
-
- **Training Data**: 59K training pairs, 7.4K validation, 6.6K test
|
| 86 |
-
- **XGBoost Parameters**:
|
| 87 |
-
- max_depth: 6
|
| 88 |
-
- learning_rate: 0.1
|
| 89 |
-
- n_estimators: 200 (early stopped at 18)
|
| 90 |
-
- subsample: 0.8
|
| 91 |
-
|
| 92 |
-
## Intended Use
|
| 93 |
-
|
| 94 |
-
This model is designed to:
|
| 95 |
-
- Predict win probability for grant-organization matches
|
| 96 |
-
- Help nonprofits prioritize grant applications
|
| 97 |
-
- Provide confidence scores for grant recommendations
|
| 98 |
-
|
| 99 |
-
## Limitations
|
| 100 |
-
|
| 101 |
-
- Trained on federal grants (NIH, NSF) - accuracy may vary for other funders
|
| 102 |
-
- Requires the fine-tuned embedding model for cosine_similarity feature
|
| 103 |
-
- Best used in conjunction with human judgment
|
| 104 |
-
|
| 105 |
## Related Models
|
| 106 |
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
---
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
### What Changed
|
| 115 |
-
|
| 116 |
-
V2 extends the model from **federal-only (NIH/NSF)** to also support **foundation grants** (990-PF data from 37,684 private foundations). The training data grew from ~42K federal pairs to **811K combined pairs** across three sources.
|
| 117 |
-
|
| 118 |
-
### Training Data (V2)
|
| 119 |
-
|
| 120 |
-
| Split | Foundation | NIH | NSF | Total |
|
| 121 |
-
|-------|-----------|-----|-----|-------|
|
| 122 |
-
| Train | 584,802 | 51,434 | 12,638 | 648,874 |
|
| 123 |
-
| Val | 73,240 | 6,445 | 1,599 | 81,284 |
|
| 124 |
-
| Test | 73,022 | 6,384 | 1,588 | 80,994 |
|
| 125 |
-
|
| 126 |
-
Data is stratified by source so each split has proportional representation.
|
| 127 |
-
|
| 128 |
-
### V2 Performance
|
| 129 |
-
|
| 130 |
-
| Metric | V1 (Federal Only) | V2 (Combined) | Change |
|
| 131 |
-
|--------|-------------------|---------------|--------|
|
| 132 |
-
| **Overall AUC-ROC** | 0.837 | **0.997** | +19.1% |
|
| 133 |
-
| **Federal AUC** | 0.837 | **0.913** | +9.1% |
|
| 134 |
-
| Brier Score | 0.167 | **0.014** | -91.6% |
|
| 135 |
-
| Accuracy | 72.1% | **98.3%** | +26.2% |
|
| 136 |
-
| Precision | 47.4% | **97.1%** | +49.7% |
|
| 137 |
-
| Recall | 79.9% | **99.6%** | +19.7% |
|
| 138 |
-
| F1 Score | 0.595 | **0.983** | +65.2% |
|
| 139 |
-
|
| 140 |
-
### Federal Regression Check: PASS
|
| 141 |
-
|
| 142 |
-
Federal-only AUC improved from 0.837 to **0.913**, well above the 0.817 minimum threshold. Adding foundation data did not degrade federal performance - it improved it.
|
| 143 |
-
|
| 144 |
-
### Version Tags
|
| 145 |
-
|
| 146 |
-
- `v1.0-federal-only`: Original federal-only model (NIH + NSF)
|
| 147 |
-
- `v2.0-with-foundations`: Combined federal + foundation model
|
| 148 |
-
|
| 149 |
-
### Foundation Data Source
|
| 150 |
-
|
| 151 |
-
Foundation grant data sourced from IRS 990-PF e-filings via GivingTuesday's open dataset, covering 680,970 grants from 37,684 private foundations (2024 filing year). 88% of grants include purpose text descriptions.
|
|
|
|
| 6 |
- grant-matching
|
| 7 |
- win-probability
|
| 8 |
- nonprofit
|
| 9 |
+
- foundation-grants
|
| 10 |
datasets:
|
| 11 |
- ArkMaster123/grantpilot-training-data
|
| 12 |
language:
|
| 13 |
- en
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# GrantPilot Win Probability Classifier V2 (Federal + Foundation)
|
| 17 |
|
| 18 |
+
XGBoost classifier for predicting grant funding success. V2 extends coverage from federal-only (NIH/NSF) to include **37,684 private foundations**.
|
| 19 |
|
| 20 |
+
> **See also:** [V1 (federal-only)](https://huggingface.co/ArkMaster123/grantpilot-classifier)
|
| 21 |
|
| 22 |
+
## Performance
|
| 23 |
|
| 24 |
+
| Metric | V1 (Federal Only) | V2 (Combined) | Change |
|
| 25 |
+
|--------|-------------------|---------------|--------|
|
| 26 |
+
| **Overall AUC-ROC** | 0.837 | **0.997** | +19.1% |
|
| 27 |
+
| **Federal AUC** | 0.837 | **0.913** | +9.1% |
|
| 28 |
+
| Brier Score | 0.167 | **0.014** | -91.6% |
|
| 29 |
+
| Accuracy | 72.1% | **98.3%** | +26.2% |
|
| 30 |
+
| Precision | 47.4% | **97.1%** | +49.7% |
|
| 31 |
+
| Recall | 79.9% | **99.6%** | +19.7% |
|
| 32 |
+
| F1 Score | 0.595 | **0.983** | +65.2% |
|
| 33 |
|
| 34 |
+
### Federal Regression Check: PASS
|
| 35 |
+
|
| 36 |
+
Federal-only AUC improved from 0.837 to **0.913**, well above the 0.817 minimum threshold.
|
| 37 |
+
|
| 38 |
+
## Important Context
|
| 39 |
+
|
| 40 |
+
The classifier is excellent, but the **embedding model feeding it is not** β see [grantpilot-embedding-v2](https://huggingface.co/ArkMaster123/grantpilot-embedding-v2) benchmark results. The V2 embedding underperforms OpenAI on retrieval (unlike V1 which beat OpenAI). The classifier compensates because it uses multiple features beyond just cosine similarity.
|
| 41 |
|
| 42 |
## Model Architecture
|
| 43 |
|
| 44 |
```
|
| 45 |
Input Features:
|
| 46 |
+
βββ cosine_similarity (from grantpilot-embedding-v2)
|
| 47 |
+
βββ funder_type (categorical: FOUNDATION, FEDERAL)
|
| 48 |
+
βββ source (categorical: NIH, NSF, FOUNDATIONS)
|
| 49 |
+
βββ log_amount (grant amount)
|
| 50 |
+
βββ org_text_length
|
| 51 |
+
βββ grant_text_length
|
| 52 |
+
|
| 53 |
+
β XGBoost Classifier
|
| 54 |
+
β Isotonic Calibration
|
| 55 |
+
β Win Probability (0-100%)
|
| 56 |
```
|
| 57 |
|
| 58 |
+
## Training Data
|
| 59 |
+
|
| 60 |
+
| Split | Foundation | NIH | NSF | Total |
|
| 61 |
+
|-------|-----------|-----|-----|-------|
|
| 62 |
+
| Train | 584,802 | 51,434 | 12,638 | 648,874 |
|
| 63 |
+
| Val | 73,240 | 6,445 | 1,599 | 81,284 |
|
| 64 |
+
| Test | 73,022 | 6,384 | 1,588 | 80,994 |
|
| 65 |
+
|
| 66 |
+
Foundation data sourced from IRS 990-PF e-filings via GivingTuesday (680,970 grants, 88% with purpose text).
|
| 67 |
+
|
| 68 |
+
## Training Details
|
| 69 |
+
|
| 70 |
+
- **Hardware**: NVIDIA H100 80GB
|
| 71 |
+
- **XGBoost**: max_depth=6, lr=0.1, n_estimators=200, subsample=0.8
|
| 72 |
+
- **Calibration**: Isotonic regression on validation set
|
| 73 |
+
- **Batch Size**: 256 for embedding feature computation
|
| 74 |
+
|
| 75 |
## Usage
|
| 76 |
|
| 77 |
```python
|
|
|
|
| 80 |
from huggingface_hub import hf_hub_download
|
| 81 |
|
| 82 |
# Download model files
|
| 83 |
+
model_path = hf_hub_download("ArkMaster123/grantpilot-classifier-v2", "xgboost_model.json")
|
| 84 |
+
scaler_path = hf_hub_download("ArkMaster123/grantpilot-classifier-v2", "scaler.pkl")
|
| 85 |
+
calibrator_path = hf_hub_download("ArkMaster123/grantpilot-classifier-v2", "isotonic_calibrator.pkl")
|
| 86 |
|
| 87 |
+
# Load
|
| 88 |
model = xgb.Booster()
|
| 89 |
model.load_model(model_path)
|
| 90 |
|
| 91 |
with open(scaler_path, "rb") as f:
|
| 92 |
scaler = pickle.load(f)
|
|
|
|
| 93 |
with open(calibrator_path, "rb") as f:
|
| 94 |
calibrator = pickle.load(f)
|
| 95 |
|
| 96 |
+
# Predict
|
| 97 |
features_scaled = scaler.transform(features)
|
| 98 |
dmatrix = xgb.DMatrix(features_scaled)
|
| 99 |
raw_pred = model.predict(dmatrix)
|
| 100 |
win_probability = calibrator.predict(raw_pred) * 100
|
| 101 |
```
|
| 102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
## Related Models
|
| 104 |
|
| 105 |
+
| Model | Description |
|
| 106 |
+
|-------|-------------|
|
| 107 |
+
| [grantpilot-embedding-v2](https://huggingface.co/ArkMaster123/grantpilot-embedding-v2) | V2 embedding (required for cosine_similarity feature) |
|
| 108 |
+
| [grantpilot-embedding](https://huggingface.co/ArkMaster123/grantpilot-embedding) | V1 β federal-only, beats OpenAI on retrieval |
|
| 109 |
+
| [grantpilot-classifier](https://huggingface.co/ArkMaster123/grantpilot-classifier) | V1 β federal-only classifier (AUC 0.837) |
|
| 110 |
+
| [grantpilot-training-data](https://huggingface.co/datasets/ArkMaster123/grantpilot-training-data) | Training data (V1 at training/, V2 at training_v2/) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|