Table of Contents

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

List<string>

Date

Gets or sets the date the model was created or last updated.

public DateTime Date { get; set; }

Property Value

DateTime

Developers

Gets or sets the model developers or organization.

public string Developers { get; set; }

Property Value

string

EthicalConsiderations

Gets or sets ethical considerations and potential biases.

public List<string> EthicalConsiderations { get; set; }

Property Value

List<string>

FairnessMetrics

Gets or sets fairness metrics across different demographic groups.

public Dictionary<string, Dictionary<string, double>> FairnessMetrics { get; set; }

Property Value

Dictionary<string, Dictionary<string, double>>

IntendedUses

Gets or sets the intended use cases for the model.

public List<string> IntendedUses { get; set; }

Property Value

List<string>

Limitations

Gets or sets known limitations of the model.

public List<string> Limitations { get; set; }

Property Value

List<string>

ModelName

Gets or sets the model name and version.

public string ModelName { get; set; }

Property Value

string

ModelType

Gets or sets the model type (e.g., "Classification", "Regression", "LLM").

public string ModelType { get; set; }

Property Value

string

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

List<string>

PerformanceMetrics

Gets or sets performance metrics on different datasets.

public Dictionary<string, Dictionary<string, double>> PerformanceMetrics { get; set; }

Property Value

Dictionary<string, Dictionary<string, double>>

Recommendations

Gets or sets recommendations for responsible use.

public List<string> Recommendations { get; set; }

Property Value

List<string>

RobustnessMetrics

Gets or sets robustness evaluation results.

public Dictionary<string, double> RobustnessMetrics { get; set; }

Property Value

Dictionary<string, double>

TrainingData

Gets or sets the training data description.

public string TrainingData { get; set; }

Property Value

string

Version

Gets or sets the model version identifier.

public string Version { get; set; }

Property Value

string

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

modelName string

The name of the model.

modelType string

The type of the model (e.g., "Classification", "Regression").

performanceMetrics Dictionary<string, double>

Performance metrics for the model. Can be null.

robustnessMetrics Dictionary<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

filePath string

The path where the Model Card should be saved.

Exceptions

ArgumentException

Thrown when file path is null or empty.