ObjMLScorecard provides machine learning model scorecards for tracking model performance, versioning, and evaluation metrics over time.
Module: factory.core/ObjMLScorecard.py
Inherits from: ObjData.ObjData
Database table: def_scorecard
| Field | Type | Description |
|---|---|---|
| ScorecardGuid | VARCHAR | Unique identifier |
| ModelName | VARCHAR | Name of ML model |
| ModelVersion | VARCHAR | Version number |
| Accuracy | FLOAT | Accuracy metric |
| Precision | FLOAT | Precision score |
| Recall | FLOAT | Recall score |
| F1Score | FLOAT | F1 score |
| Metadata | JSON | Additional metrics |
| TrainingDate | DATETIME | When model was trained |
| CreatedAt | DATETIME | Record creation |
from ObjMLScorecard import ObjMLScorecard
# Create instance
scorecard = ObjMLScorecard()
# Record model evaluation
scorecard.record_evaluation(
model_name="customer_churn_predictor",
model_version="1.0.2",
metrics={
"accuracy": 0.89,
"precision": 0.87,
"recall": 0.91,
"f1_score": 0.89,
"auc": 0.93
},
metadata={
"training_samples": 10000,
"features": 25,
"algorithm": "XGBoost",
"hyperparameters": {"max_depth": 6, "learning_rate": 0.1}
}
)
# Get all versions of a model
versions = scorecard.get_model_versions("customer_churn_predictor")
# Compare performance
best_model = scorecard.get_best_model(
model_name="customer_churn_predictor",
metric="f1_score"
)
print(f"Best model: {best_model['ModelVersion']}")
print(f"F1 Score: {best_model['F1Score']}")
# Get performance trends
history = scorecard.get_performance_history(
model_name="customer_churn_predictor",
metric="accuracy"
)
# Plot trends
import matplotlib.pyplot as plt
plt.plot(history['dates'], history['accuracy'])
plt.xlabel('Date')
plt.ylabel('Accuracy')
plt.title('Model Accuracy Over Time')
plt.show()
ObjML.py - Machine learning operationsObjMLDatasets.py - Dataset managementObjLearning.py - ML training workflowsmigrate_def_scorecard.py