Class ModelCard
- Namespace
- AiDotNet.AdversarialRobustness.Documentation
- Assembly
- AiDotNet.dll
Represents a Model Card for documenting AI model characteristics and performance.
public class ModelCard
- Inheritance
-
ModelCard
- Inherited Members
Remarks
Model Cards provide transparent documentation about machine learning models, including their intended use, limitations, performance metrics, and ethical considerations.
For Beginners: A Model Card is like a nutrition label for AI models. Just as food labels tell you what's in your food and its nutritional value, Model Cards tell you what the AI model is for, how well it works, what its limitations are, and any ethical considerations you should know about.
Based on "Model Cards for Model Reporting" by Mitchell et al. (2019)
Constructors
ModelCard()
public ModelCard()
Properties
Caveats
Gets or sets caveats and additional warnings.
public List<string> Caveats { get; set; }
Property Value
Date
Gets or sets the date the model was created or last updated.
public DateTime Date { get; set; }
Property Value
Developers
Gets or sets the model developers or organization.
public string Developers { get; set; }
Property Value
EthicalConsiderations
Gets or sets ethical considerations and potential biases.
public List<string> EthicalConsiderations { get; set; }
Property Value
FairnessMetrics
Gets or sets fairness metrics across different demographic groups.
public Dictionary<string, Dictionary<string, double>> FairnessMetrics { get; set; }
Property Value
IntendedUses
Gets or sets the intended use cases for the model.
public List<string> IntendedUses { get; set; }
Property Value
Limitations
Gets or sets known limitations of the model.
public List<string> Limitations { get; set; }
Property Value
ModelName
Gets or sets the model name and version.
public string ModelName { get; set; }
Property Value
ModelType
Gets or sets the model type (e.g., "Classification", "Regression", "LLM").
public string ModelType { get; set; }
Property Value
OutOfScopeUses
Gets or sets the out-of-scope use cases (what the model should NOT be used for).
public List<string> OutOfScopeUses { get; set; }
Property Value
PerformanceMetrics
Gets or sets performance metrics on different datasets.
public Dictionary<string, Dictionary<string, double>> PerformanceMetrics { get; set; }
Property Value
Recommendations
Gets or sets recommendations for responsible use.
public List<string> Recommendations { get; set; }
Property Value
RobustnessMetrics
Gets or sets robustness evaluation results.
public Dictionary<string, double> RobustnessMetrics { get; set; }
Property Value
TrainingData
Gets or sets the training data description.
public string TrainingData { get; set; }
Property Value
Version
Gets or sets the model version identifier.
public string Version { get; set; }
Property Value
Methods
CreateFromEvaluation(string, string, Dictionary<string, double>?, Dictionary<string, double>?)
Creates a Model Card from evaluation results.
public static ModelCard CreateFromEvaluation(string modelName, string modelType, Dictionary<string, double>? performanceMetrics, Dictionary<string, double>? robustnessMetrics)
Parameters
modelNamestringThe name of the model.
modelTypestringThe type of the model (e.g., "Classification", "Regression").
performanceMetricsDictionary<string, double>Performance metrics for the model. Can be null.
robustnessMetricsDictionary<string, double>Robustness metrics for the model. Can be null.
Returns
- ModelCard
A new ModelCard instance populated with the provided evaluation results.
Exceptions
- ArgumentException
Thrown when modelName is null or empty.
Generate()
Generates a formatted Model Card document.
public string Generate()
Returns
- string
A string containing the formatted Model Card.
SaveToFile(string)
Saves the Model Card to a markdown file.
public void SaveToFile(string filePath)
Parameters
filePathstringThe path where the Model Card should be saved.
Exceptions
- ArgumentException
Thrown when file path is null or empty.