Nzinga-xgb-model / README.md
mjpsm's picture
Update README.md
9a2a561 verified
metadata
language: en
tags:
  - regression
  - soulprint
  - courage
  - xgboost
license: mit
datasets:
  - custom/Nzinga-regression-dataset
metrics:
  - mse
  - r2
model-index:
  - name: Nzinga-xgb-model
    results:
      - task:
          type: regression
          name: Courage Regression
        dataset:
          name: Nzinga-regression-dataset
          type: custom
        metrics:
          - name: MSE
            type: mean_squared_error
            value: 0.0173
          - name: 
            type: r2
            value: 0.8182

Nzinga-xgb-model

🧾 Model Description

The Nzinga XGBoost Regression Model is part of the Soulprint Archetype Series. It predicts a courage score (0.0 – 1.0) from input text, reflecting levels of hesitation, partial action, steady resolve, and fearless conviction.

This model is named after Queen Nzinga of Ndongo and Matamba, representing courage, resistance, and unshakable determination.

  • Architecture: XGBoost Regressor
  • Input: Text (embedded using all-mpnet-base-v2)
  • Output: Continuous courage score (float, 0–1)

📚 Training Data

  • Source: Custom Nzinga regression dataset (balanced across 4 ranges).

  • Size: 1368 examples

  • Balance: 342 rows per range:

    • Low (0.0–0.3): hesitant, almost-action, retreating moments

    • Mid (0.3–0.6): measured firmness, small everyday acts of courage

    • High (0.6–0.9): strong steady action, visible resolve

    • Peak (0.9–1.0): fearless symbolic acts, full conviction

Sentence lengths were cycled (1, 2–3, 4–5 sentences) to encourage generalization. Contexts include family, healthcare, online spaces, sports, workplaces, and public gatherings.

🧪 Evaluation

  • Test Metrics:

    • MSE: 0.0173
    • R²: 0.8182

This indicates the model explains ~82% of the variance in courage scores and has low error, making it robust for prediction tasks.

🚀 Example Usage

import xgboost as xgb
from sentence_transformers import SentenceTransformer
from huggingface_hub import hf_hub_download

# -----------------------------
# 1. Download model
# -----------------------------
REPO_ID = "mjpsm/Nzinga-xgb-model"
FILENAME = "Nzinga_xgb_model.json"

model_path = hf_hub_download(repo_id=REPO_ID, filename=FILENAME)

# -----------------------------
# 2. Load model + embedder
# -----------------------------
model = xgb.XGBRegressor()
model.load_model(model_path)

embedder = SentenceTransformer("all-mpnet-base-v2")

# -----------------------------
# 3. Example prediction
# -----------------------------
text = "I stood before the crowd and spoke with steady confidence."
embedding = embedder.encode([text])
score = model.predict(embedding)[0]

print("Predicted Nzinga Score:", round(float(score), 3))