ContentClassifierBase<T>

Base Classes · AiDotNet.AdversarialRobustness.Safety

Base class for ML-based content classifiers.

Implements: IContentClassifier<T>, IModelSerializer, IModelShape

Known derived types: RuleBasedContentClassifier<T>

For Beginners

This is a template that makes it easier to build different types of content classifiers. It handles the common tasks like comparing scores to thresholds and formatting results, so you can focus on the actual classification logic in your subclass.

How It Works

This abstract class provides common functionality for content classifiers, including threshold-based filtering, category management, and result formatting. Subclasses implement the actual ML model for classification.

Methods

Method Summary
ContentClassificationResult<T> Classify(Vector<T> content)
ContentClassificationResult<T> ClassifyText(string text)
ContentClassificationResult<T>[] ClassifyBatch(Matrix<T> contents)
DynamicShapeInfo GetDynamicShapeInfo()
bool IsReady()
byte[] Serialize()
int[] GetInputShape()
int[] GetOutputShape()
string[] GetSupportedCategories()
void Deserialize(byte[] data)
void LoadModel(string filePath)
void SaveModel(string filePath)