AiModelResult<T, TInput, TOutput>
Models & Types · AiDotNet.Models.Results
Partial class containing Test-Time Augmentation (TTA) prediction methods.
Implements: IFullModel<T, TInput, TOutput>
For Beginners
Suppose you gave a drug to some patients and not others. Prediction tells you what happens to one patient. These methods tell you what the drug did — the average difference it made, and how confident you can be in that number.
How It Works
Every causal estimator answers a question that Predict cannot: not “what is the
outcome for this row” but “how much did the treatment change the outcome”. Those answers live on
CausalModelBase, which the result wraps, so before these existed the only way to
reach them was to hold the model yourself and step around the builder entirely.
Properties
| Property | Summary |
|---|---|
AccelerationSnapshot AccelerationSnapshot { get; set; } |
Snapshot of the SIMD, GPU, and native-BLAS acceleration state captured when this model was built. |
ActiveLearningSelection<T> ActiveLearningSelection { get; set; } |
The active-learning ranking and selected batch, or null when no active-learning strategy was configured via ConfigureActiveLearning(...). |
AdversarialRobustnessReport<T> AdversarialRobustness { get; set; } |
The empirical adversarial-robustness audit, or null when no attack was configured via ConfigureAdversarialAttack(...). |
AutoMLRunSummary AutoMLSummary { get; set; } |
Gets the AutoML summary for this model, if AutoML was used during building. |
BenchmarkReport BenchmarkReport { get; set; } |
Gets the most recent benchmark report produced for this model, if available. |
CausalDiscoveryResult<T> CausalDiscoveryResult { get; set; } |
Gets the causal discovery result, if causal discovery was configured. |
CertifiedRobustnessReport<T> CertifiedRobustness { get; set; } |
The certified-robustness audit, or null when no certified defense was configured via ConfigureCertifiedDefense(...). |
ClusteringEvaluationResult ClusteringEvaluation { get; set; } |
Gets the clustering evaluation for this model, or null when the built model is not a clustering model. |
ContinualEvaluationResult<T> ContinualLearningReport { get; set; } |
The continual-learning retention report across all tasks learned so far, or null when continual learning was not used. |
ContinualLearningResult<T> ContinualLearningResult { get; set; } |
The outcome of learning this task under continual learning, or null when ConfigureContinualLearning(...) was not used. |
CrossValidationResult<T, TInput, TOutput> CrossValidationResult { get; set; } |
Gets or sets the results from cross-validation. |
DriftMonitor<T> DriftMonitor { get; set; } |
The drift monitor calibrated during Build, or null when no drift detector was configured. |
DriftReport DriftReport { get; set; } |
The attributed drift assessment computed on the held-out test stream, or null when no drift detector was configured via ConfigureDriftDetection(...). |
EvolutionRunSummary EvolutionSummary { get; set; } |
Gets the redacted summary of the evolution run, if evolution was configured. |
Exception CrossValidationError { get; set; } |
The error that occurred if a configured cross-validation ran but failed, or null when cross-validation succeeded or was never configured. |
ExplanationFaithfulnessReport<T> ExplanationFaithfulness { get; set; } |
The auto-audit of explanation faithfulness, or null when no model explainer was configured. |
FinancialEvaluationResult FinancialEvaluation { get; set; } |
The financial evaluation of a forecasting/financial model — how its held-out predictions would have performed as a trading signal (directional accuracy, strategy Sharpe/Sortino, max drawdown, profit factor, information coefficient), or `nul… |
IChunkingStrategy ChunkingStrategy { get; set; } |
Gets the chunking strategy configured for the RAG pipeline, or null if none was configured. |
IContextCompressor<T> ContextCompressor { get; set; } |
Gets the context compressor configured for the RAG pipeline, or null if none was configured. |
IDocumentStore<T> DocumentStore { get; set; } |
Gets the document store backing vector retrieval, or null if none was configured. |
IEmbeddingModel<T> EmbeddingModel { get; set; } |
The embedding model configured via ConfigureEmbeddingModel(...), or null when none was. |
ILossFunction<T> DefaultLossFunction { get; } |
Gets the default loss function used by this model for gradient computation. |
IModelExplainer<T> ModelExplainer { get; set; } |
The model explainer configured via ConfigureModelExplainer(...), or null when none was. |
IReadOnlyDictionary<LayerCategory, int> LayerCategorySummary { get; } |
|
IReadOnlyDictionary<string, T> ConfiguredMetrics { get; } |
Values of the metrics supplied to ConfigureRegressionMetric / ConfigureClassificationMetric, keyed by metric name. |
IReadOnlyList<IAgentTool> ConfiguredTools { get; } |
The tools configured via ConfigureTool(...), available to agents built from this result. |
KnowledgeGraphResult<T> KnowledgeGraphResult { get; set; } |
Gets the knowledge graph processing results including trained embeddings, community structure, and link prediction evaluation. |
ModelCard RobustnessModelCard { get; set; } |
Gets the robustness model card generated at build (AutoGenerateModelCardSections), or null. |
ModelCompressionReport<T> ModelCompression { get; set; } |
The model-compression audit, or null when no strategy was configured via ConfigureModelCompressionStrategy(...) or the model has no compressible parameters. |
ModelEvaluationData<T, TInput, TOutput> Evaluation { get; } |
Gets the trained model’s evaluation metrics, computed once from the data the model was built on and cached. |
ProfileReport ProfilingReport { get; set; } |
Gets the profiling report captured during training and/or inference, if profiling was enabled. |
ProgramEvolutionResult ProgramEvolution { get; set; } |
Gets the program-evolution result, if source code was evolved. |
QuantizationInfo QuantizationInfo { get; set; } |
Gets information about model quantization, including strategy, bit width, and compression statistics. |
SafetyBenchmarkResult RedTeamingReport { get; set; } |
Gets the result of red teaming the safety pipeline at build (EnableRedTeaming), or null. |
SafetyPipeline<T> SafetyPipeline { get; set; } |
Gets the composable safety pipeline for content safety evaluation. |
SegmentationVisualizationConfig SegmentationVisualization { get; set; } |
Gets the segmentation-overlay defaults configured when this result was built. |
SelfSupervisedLearningPretrainingResult<T> SelfSupervisedLearningPretrainingResult { get; set; } |
The self-supervised pretraining report, or null when no SSL method was configured (or an explicit pretrain action was used instead of the default loop). |
TensorsOperationProfile TensorsOperationProfile { get; set; } |
Per-tensor-op performance profile captured when the builder opted in via EnableTensorsOpProfiling(). |
TimeSeriesDecompositionReport<T> TimeSeriesDecomposition { get; set; } |
The time-series decomposition audit, or null when no decomposition was configured via ConfigureTimeSeriesDecomposition(...) or the target could not be analyzed. |
WeightStreamingReport WeightStreamingReport { get; set; } |
Gets the weight-streaming activity report from the underlying WeightRegistry if streaming was engaged during the build (whether explicitly via ConfigureWeightStreaming or auto-detected from parameter count). |
bool CompiledPlansChanged { get; } |
True when this model, loaded from a file, compiled plans for hardware the file had none for. |
bool EarlyStopTriggered { get; set; } |
Gets whether training stopped before running all configured epochs. |
bool HasFewShotExampleSelector { get; } |
Checks whether a few-shot example selector is configured and available for use. |
bool HasPromptAnalyzer { get; } |
Checks whether a prompt analyzer is configured and available for use. |
bool HasPromptCompressor { get; } |
Checks whether a prompt compressor is configured and available for use. |
bool HasPromptOptimizer { get; } |
Checks whether a prompt optimizer is configured and available for use. |
bool HasPromptTemplate { get; } |
Checks whether a prompt template is configured and available for use. |
bool HasTokenizer { get; } |
Gets whether a tokenizer is configured for this model. |
bool IsGenomeOnlyResult { get; } |
Gets whether this result came from an evolution run that did not materialize its winner as a model. |
bool MixedPrecisionEngaged { get; set; } |
Gets whether mixed-precision (FP16) training actually engaged during this run. |
bool SupportsParameterInitialization { get; } |
|
int? LayerCount { get; set; } |
Gets the total number of layers in the model, if the model supports layer-level access. |
int[] LastForecastShape { get; set; } |
The [horizon, variables] shape of the most recent multivariate forecast returned through Predict, or null if the last forecast was univariate / exogenous. |
long ParameterCount { get; } |
Gets the number of parameters in the underlying model, or 0 when the model has no trainable parameter vector (e.g. |
long? TotalEstimatedFlops { get; set; } |
Gets the total estimated FLOPs (floating-point operations) for a single forward pass. |
long? TotalTrainableParameters { get; set; } |
Gets the total number of trainable parameters across all layers. |
string MixedPrecisionStatus { get; set; } |
Gets a human-readable description of the mixed-precision outcome (for example “not requested”, “engaged: FP16”, or “ignored: T is not float”). |
string StopReason { get; set; } |
Gets a human-readable explanation of why training stopped early, or null when training ran to completion. |
Methods
| Method | Summary |
|---|---|
ALEResult<T> GetAccumulatedLocalEffects(Matrix<T> data, int numIntervals) |
Computes Accumulated Local Effects (ALE) for all features in the dataset. |
ALEResult<T> GetFeatureALE(Matrix<T> data, int featureIndex, int numIntervals) |
Computes Accumulated Local Effects for a specific feature. |
AiModelResult<T, TInput, TOutput> LoadModel(string filePath, Func<ModelMetadata<T>, IFullModel<T, TInput, TOutput>> modelFactory) |
Loads a model from a file. |
Architecture<T> DeriveArchitecture() |
Extracts the architecture a neural architecture search settled on. |
AttentionExplanation<T> ExplainWithAttentionVisualization(Vector<T> instance, int numLayers, int numHeads, int sequenceLength, string[] tokenLabels) |
Visualizes attention patterns for transformer-based models. |
CertifiedPrediction<T> PredictCertified(TInput input) |
Predicts the class of input with a certified robustness guarantee. |
CodeGenerationResult GenerateCode(CodeGenerationRequest request) |
Generates source code using the configured program synthesis model. |
CodeSummarizationResult SummarizeCode(CodeSummarizationRequest request) |
Summarizes source code using the configured program synthesis model. |
CodeTaskResultBase ExecuteCodeTask(CodeTaskRequestBase request) |
Executes a structured code task using the configured program synthesis model. |
CodeTokenizationResult TokenizeCode(string code, ProgramLanguage language, EncodingOptions options, CodeTokenizationPipelineOptions pipelineOptions) |
Tokenizes code using the canonical code-tokenization pipeline (supports AST extraction when enabled). |
CompressionResult CompressPrompt(string prompt, CompressionOptions options) |
Compresses a prompt to reduce its token count while preserving essential meaning. |
ContrastiveExplanation<T> GetContrastiveExplanation(Vector<T> instance, int factClass, int foilClass) |
Generates a contrastive explanation answering “Why X and not Y?” |
DataSetStats<T, TInput, TOutput> GetDataSetStats(TInput X, TOutput y, PredictionType? predictionType) |
Gets evaluation statistics for a single dataset. |
DeepLIFTExplanation<T> ExplainWithDeepLIFT(Vector<T> instance, Vector<T> baseline, DeepLIFTRule rule) |
Explains a prediction using DeepLIFT attribution. |
DeploymentRuntime<T> CreateDeploymentRuntime(string modelPath, string modelName, string version) |
Creates a deployment runtime for production features like versioning, A/B testing, caching, and telemetry. |
Dictionary<string, List<double>> GetTrainingMetricsHistory() |
Gets the training metrics history. |
Dictionary<string, T> GetFeatureImportance() |
Gets the feature importance scores from the underlying model. |
Dictionary<string, object> GetHyperparameters() |
Gets the hyperparameters used for training. |
Dictionary<string, object> GetTrainingInfrastructureMetadata() |
Gets training infrastructure metadata as a dictionary. |
EvolutionRunResult<TGenome> GetEvolutionRunResult() |
Gets the engine’s own run result for the genome type the run used. |
ExperimentInfo<T> GetExperimentInfo() |
Gets experiment tracking information as a structured object. |
FeatureImportanceResult<T> GetPermutationFeatureImportance(Matrix<T> X, Vector<T> y, Func<Vector<T>, Vector<T>, T> scoreFunction) |
Computes permutation feature importance for the model. |
FeatureInteractionResult<T> GetFeatureInteractions(Matrix<T> data, int gridSize) |
Detects and quantifies feature interactions using Friedman’s H-statistic. |
FederatedLearningMetadata GetFederatedLearningMetadata() |
Gets federated learning training metadata if this model was produced via federated learning. |
GlobalSHAPExplanation<T> ExplainGlobalWithSHAP(Matrix<T> data, Matrix<T> backgroundData) |
Explains multiple predictions using SHAP values and returns global feature importance. |
GradCAMExplanation<T> ExplainWithGradCAM(Vector<T> instance, int[] inputShape, int[] featureMapShape, bool useGradCAMPlusPlus) |
Generates a Grad-CAM heatmap for CNN model predictions. |
GradientSHAPExplanation<T> ExplainWithGradientSHAP(Vector<T> instance, Matrix<T> backgroundData, int numSamples, int numSteps) |
Explains a prediction using GradientSHAP (combines Integrated Gradients with SHAP). |
GroundedAnswer<T> GenerateAnswer(string query, int? topK, int? topKAfterRerank, Dictionary<string, object> metadataFilters) |
Generates a grounded answer using the configured RAG pipeline during inference. |
HyperparameterOptimizationResult<T> GetHyperparameterOptimizationResult() |
Gets the hyperparameter optimization result, if optimization was used. |
IAgent<T> CreateAgent(IChatClient<T> chatClient, AgentExecutorOptions options, bool guardTools, bool groundWithModel) |
Creates an agent, driven by the supplied chat client, that can call every configured tool plus the trained model itself (exposed as a prediction tool). |
IAgent<T> CreateModelAnalystAgent(IChatClient<T> chatClient, AgentExecutorOptions options) |
Creates a leaf agent whose only tool is the trained model — a “model analyst” specialist to place inside a supervisor/swarm alongside other specialists (each of which the coordinator can call as a tool). |
ICheckpointManager<T, TInput, TOutput> GetCheckpointManager() |
Gets the checkpoint manager for model persistence operations. |
IEnumerable<Document<T>> RetrieveDocuments(string query, int? topK, bool applyReranking, Dictionary<string, object> metadataFilters) |
Retrieves relevant documents without generating an answer during inference. |
IEnumerable<GraphEdge<T>> GetNodeRelationships(string nodeId, EdgeDirection direction) |
Gets all edges (relationships) connected to a node in the knowledge graph. |
IEnumerable<GraphNode<T>> QueryKnowledgeGraph(string query, int topK) |
Queries the knowledge graph to find related nodes by entity name or label. |
IEnumerable<GraphNode<T>> TraverseGraph(string startNodeId, int maxDepth) |
Traverses the knowledge graph starting from a node using breadth-first search. |
IEnumerable<int> GetActiveFeatureIndices() |
Gets the indices of features that are actively used by the underlying model. |
IExperimentRun<T> GetExperimentRun() |
Gets the experiment run associated with this model, if experiment tracking was configured. |
IExperimentTracker<T> GetExperimentTracker() |
Gets the experiment tracker used during training, if configured. |
IFullModel<T, TInput, TOutput> Clone() |
Creates a copy of this AiModelResult. |
IFullModel<T, TInput, TOutput> DeepCopy() |
Creates a copy of this AiModelResult with deep-copied core model components. |
IFullModel<T, TInput, TOutput> WithParameters(Vector<T> parameters) |
Creates a new instance with the specified parameters. |
IModelRegistry<T, TInput, TOutput> GetModelRegistry() |
Gets the model registry for version and lifecycle management. |
IPromptTemplate OptimizePrompt(string initialPrompt, Func<string, T> evaluationFunction, int maxIterations) |
Optimizes a prompt to improve its effectiveness using an evaluation function. |
IReadOnlyDictionary<AdversarialAttackMethod, RobustnessStats<T>> EvaluateConfiguredRobustness(TInput[] testInputs, TOutput[] testLabels) |
Runs every attack in the configured AttackMethods and returns the robustness metrics of each. |
IReadOnlyList<FewShotExample> SelectFewShotExamples(string query, int maxExamples) |
Selects relevant few-shot examples for a given query or context. |
IReadOnlyList<PromptIssue> ValidatePrompt(string prompt, ValidationOptions options) |
Validates a prompt and returns any detected issues or warnings. |
ITrainingMonitor<T> GetTrainingMonitor() |
Gets the training monitor for accessing training diagnostics. |
InferenceSession<T, TInput, TOutput> BeginInferenceSession() |
Begins an inference session for stateful inference features (e.g., KV-cache). |
IntegratedGradientsExplanation<T> ExplainWithIntegratedGradients(Vector<T> instance, Vector<T> baseline, int numSteps) |
Explains a prediction using Integrated Gradients attribution. |
LIMEExplanationResult<T> ExplainWithLIME(Vector<T> instance) |
Explains a single prediction using LIME (Local Interpretable Model-agnostic Explanations). |
LRPExplanation<T> ExplainWithLRP(Vector<T> instance, LRPRule rule, double epsilon) |
Explains a prediction using Layer-wise Relevance Propagation (LRP). |
List<RetrievalResult<T>> HybridRetrieve(Vector<T> queryEmbedding, int topK, int expansionDepth, int maxResults) |
Retrieves results using hybrid vector + graph search for enhanced context retrieval. |
List<TokenizationResult> TokenizeBatch(List<string> texts) |
Tokenizes multiple texts in a batch. |
List<string> FindPathInGraph(string startNodeId, string endNodeId) |
Finds the shortest path between two nodes in the knowledge graph. |
Matrix<T> GenerateSamples(int numSamples, Vector<T> conditionColumn, Vector<T> conditionValue) |
Draws synthetic rows from a fitted generator. |
Matrix<T> ReshapeForecastToMatrix(Vector<T> flatForecast) |
Reshapes a flat multivariate forecast vector (as returned by Predict for a multivariate model) back into its [horizon x variables] matrix using LastForecastShape — so callers recover the natural 2-D forecast without needing to know th… |
MetaAdaptationResult<T> AdaptAndEvaluate(MetaLearningTask<T, TInput, TOutput> task) |
Adapts the meta-learned model to one new task and reports how it did. |
ModelEvaluationData<T, TInput, TOutput> EvaluateFull(OptimizationInputData<T, TInput, TOutput> inputData, PredictionType? predictionTypeOverride) |
Evaluates the model across training, validation, and test datasets. |
ModelMetadata<T> GetModelMetadata() |
Gets the metadata associated with the model. |
ModelPredictionTool CreateModelPredictionTool(string name) |
Builds the trained model itself as a callable agent tool, or null when the model shape is not supported (only matrix-input tabular models are exposed as tools). |
ModelRegistryInfo<T, TInput, TOutput> GetModelRegistryInfo() |
Gets model registry information as a structured object. |
PromptMetrics AnalyzePrompt(string prompt) |
Analyzes a prompt and returns detailed metrics about its structure and characteristics. |
PrototypeExplanation<T> ExplainWithPrototypes(Vector<T> instance, Matrix<T> prototypes, Vector<T> prototypeLabels, int numNeighbors, DistanceMetric metric) |
Explains a prediction using similar examples from a prototype set. |
RobustnessStats<T> EvaluateRobustness(TInput[] testInputs, TOutput[] testLabels) |
Evaluates the model’s robustness with a PGD attack built from the configured attack settings. |
RobustnessStats<T> EvaluateRobustness(TInput[] testInputs, TOutput[] testLabels, IAdversarialAttack<T, TInput, TOutput> attack) |
Evaluates the model’s robustness with a PGD attack of the given budget and the configured attack settings. |
RobustnessStats<T> EvaluateRobustness(TInput[] testInputs, TOutput[] testLabels, double epsilon) |
Evaluates the model’s robustness with a PGD attack of the given budget and the configured attack settings. |
RobustnessStats<T> EvaluateRobustnessWithAutoAttack(TInput[] testInputs, TOutput[] testLabels, double? epsilon) |
Evaluates the model’s robustness using AutoAttack (ensemble of diverse attacks). |
SHAPExplanation<T> ExplainWithSHAP(Vector<T> instance, Matrix<T> backgroundData) |
Explains a single prediction using SHAP (SHapley Additive exPlanations) values. |
SafetyBenchmarkResult RunSafetyBenchmarks() |
Runs the comprehensive safety benchmark suite against the configured safety pipeline. |
SafetyConfig GetSafetyConfig() |
Gets the overall safety configuration report for the current pipeline. |
SafetyReport DetectHallucinations(string outputText) |
Detects potential hallucinations in the given output text. |
SafetyReport DetectPII(string text) |
Detects personally identifiable information (PII) in the given text. |
SafetyReport DetectWatermark(string text) |
Detects watermarks in the given text content. |
SafetyReport EvaluateAudioSafety(Vector<T> audioSamples, int sampleRate) |
Evaluates audio content for safety using the configured safety pipeline. |
SafetyReport EvaluateFairness(string text) |
Evaluates text for bias and fairness issues. |
SafetyReport EvaluateImageSafety(Tensor<T> image) |
Evaluates image content for safety using the configured safety pipeline. |
SafetyReport EvaluateTextSafety(string text) |
Evaluates text content for safety using the configured safety pipeline. |
SafetyReport EvaluateVideoSafety(IReadOnlyList<Tensor<T>> frames, double frameRate) |
Evaluates video content for safety using the configured safety pipeline. |
SafetyReport GetSafetyReport() |
Gets a full safety report by evaluating all configured safety modules on the last prediction output. |
SafetyReport ValidateInputSafety(string inputText) |
Validates input content for safety before passing it to the model. |
SafetyReport ValidateOutputSafety(string outputText) |
Validates output content for safety after model prediction. |
SaliencyMapExplanation<T> GetSaliencyMap(Vector<T> instance, SaliencyMethod method, int smoothGradSamples, double smoothGradNoise) |
Generates a saliency map showing input gradients. |
SupervisorAgent<T> CreateSupervisor(IChatClient<T> coordinator, IReadOnlyList<IAgent<T>> workers, SupervisorOptions options) |
Creates a supervisor that coordinates a team of specialist agents (each exposed to the coordinator as a callable tool). |
SurrogateExplanation<T> GetGlobalSurrogateExplanation(Matrix<T> X) |
Trains a global surrogate model to approximate the complex model’s behavior. |
TInput GenerateAdversarialExample(TInput input, TOutput trueLabel, double? epsilon) |
Generates an adversarial example for a given input. |
TOutput Predict(TInput newData) |
Makes predictions using the trained model on the provided input data. |
TOutput PredictText(IEnumerable<string> documents) |
Predicts directly from raw text using the fitted text vectorizer captured during training. |
TOutput PredictWithDefense(TInput input) |
Makes a prediction with adversarial preprocessing applied if configured. |
Task<AgentRunResult> RunAgentAsync(IChatClient<T> chatClient, string task, AgentExecutorOptions options, bool guardTools, bool groundWithModel, LearnedToolRouter router, CancellationToken cancellationToken) |
Runs an agent on a single task. |
Task<BenchmarkReport> EvaluateBenchmarksAsync(BenchmarkingOptions options, CancellationToken cancellationToken) |
Forwarding overload for callers that supply only a chat client (reasoning / generative suites with default options). |
Task<BenchmarkReport> EvaluateBenchmarksAsync(BenchmarkingOptions options, IChatClient<T> chatClient, CancellationToken cancellationToken) |
Runs benchmark suites against this model using the unified benchmark runner, with an optional chat client for reasoning / generative benchmark suites. |
Task<BenchmarkReport> EvaluateBenchmarksAsync(IChatClient<T> chatClient, CancellationToken cancellationToken) |
Forwarding overload for callers that supply only a chat client (reasoning / generative suites with default options). |
Task<BenchmarkResult<T>> EvaluateHumanEvalPassAtKAsync(int passK, int? sampleSize, CancellationToken cancellationToken) |
Evaluates the model on HumanEval using the configured dataset path (via env var) and returns a benchmark report. |
Task<BenchmarkResult<TScore>> EvaluateBenchmarkAsync(IBenchmark<TScore> benchmark, IChatClient<T> chatClient, int? sampleSize, CancellationToken cancellationToken) |
Evaluates a reasoning benchmark using the configured facade (prompt chain or agent reasoning). |
Task<CodeTaskResultBase> ExecuteCodeTaskAsync(CodeTaskRequestBase request, CancellationToken cancellationToken) |
Executes a structured code task, optionally delegating to AiDotNet.Serving when configured and preferred. |
Task<IPromptTemplate> OptimizePromptAsync(string initialPrompt, Func<string, Task<T>> evaluationFunction, int maxIterations, CancellationToken cancellationToken) |
Optimizes a prompt asynchronously using an async evaluation function. |
Task<ProgramEvaluateIoResponse> EvaluateProgramIoAsync(ProgramEvaluateIoRequest request, CancellationToken cancellationToken) |
Evaluates a program against input/output test cases via AiDotNet.Serving. |
Task<ProgramExecuteResponse> ExecuteProgramAsync(ProgramExecuteRequest request, CancellationToken cancellationToken) |
Executes a sandboxed program via AiDotNet.Serving. |
Task<ReasoningResult<T>> DeepReasonAsync(string problem, IChatClient<T> chatClient, CancellationToken cancellationToken) |
Performs deep, thorough reasoning on a complex problem using extensive exploration and verification. |
Task<ReasoningResult<T>> ReasonAsync(string problem, IChatClient<T> chatClient, ReasoningMode mode, ReasoningConfig config, CancellationToken cancellationToken) |
Solves a problem using advanced reasoning strategies like Chain-of-Thought, Tree-of-Thoughts, or Self-Consistency. |
Task<ReasoningResult<T>> ReasonWithConsensusAsync(string problem, IChatClient<T> chatClient, int numAttempts, CancellationToken cancellationToken) |
Solves a problem multiple times using different approaches and returns the consensus answer. |
Task<SqlExecuteResponse> ExecuteSqlAsync(SqlExecuteRequest request, CancellationToken cancellationToken) |
Executes SQL via AiDotNet.Serving. |
Task<string> QuickReasonAsync(string problem, IChatClient<T> chatClient, CancellationToken cancellationToken) |
Quickly solves a problem with minimal reasoning overhead for fast answers. |
Tensor<T> WatermarkGeneratedImage(Tensor<T> image) |
Watermarks a generated image with the configured secret key when image watermarking is enabled. |
TestTimeAugmentationResult<TOutput> PredictWithTestTimeAugmentation(TAugData data, Func<TAugData, TInput> convertToModelInput, Func<TOutput, Vector<T>> convertFromModelOutput, IAugmentationPolicy<T, TAugData> augmentationPipeline) |
Makes a prediction using Test-Time Augmentation for improved accuracy. |
TestTimeAugmentationResult<TOutput> PredictWithTestTimeAugmentation(TInput data, IAugmentationPolicy<T, TInput> augmentationPipeline) |
Makes a prediction using Test-Time Augmentation when input/output types match augmentation types. |
TokenizationResult Tokenize(string text) |
Tokenizes text using the configured tokenizer. |
UncertaintyPredictionResult<T, TOutput> PredictWithUncertainty(TInput newData, int? numSamples) |
Makes a prediction together with an estimate of how uncertain the model is about it. |
ValueTuple<T, T> EstimateATE(Matrix<T> x, Vector<int> treatment, Vector<T> outcome) |
Estimates the Average Treatment Effect: how much the treatment changed the outcome, averaged over everyone in the sample. |
ValueTuple<T, T> EstimateATT(Matrix<T> x, Vector<int> treatment, Vector<T> outcome) |
Estimates the Average Treatment effect on the Treated: the effect among the subjects who actually received the treatment, rather than over everyone. |
Vector<T> ComputeAnomalyScores(Vector<T> timeSeries) |
Scores how unusual each point of a series is, given what the fitted model expected. |
Vector<T> ComputeGradients(TInput input, TOutput target, ILossFunction<T> lossFunction) |
Computes gradients of the loss function with respect to model parameters WITHOUT updating parameters. |
Vector<T> EstimateTreatmentEffect(Matrix<T> features) |
Estimates the treatment effect for each individual row, rather than one number for the sample. |
Vector<T> Forecast(Vector<T> history, int horizon, Matrix<T> exogenousVariables) |
Forecasts forward from a history you supply, optionally with exogenous drivers. |
Vector<T> Forecast(int horizon, int startIndex) |
Forecasts forward from the series the model was fitted on. |
Vector<T> GetClusterLabels() |
Gets the cluster each training row was assigned to. |
Vector<T> GetFrequencies() |
Gets the frequencies at which the spectral model evaluated the series. |
Vector<T> GetParameters() |
Gets the parameters of the underlying model. |
Vector<T> GetPeriodogram() |
Gets the periodogram: how much of the series’ variance sits at each frequency. |
Vector<T> GetSeasonal() |
Gets the seasonal component the model separated out of the series. |
Vector<T> GetTrend() |
Gets the trend component the model separated out of the series. |
Vector<T> Predict(Vector<T> lookback, int horizon) |
Multi-horizon Predict overload: predicts horizon future steps at once from a single lookback window. |
Vector<T> SanitizeParameters(Vector<T> parameters) |
|
bool IsFeatureUsed(int featureIndex) |
Checks if a specific feature is used by the underlying model. |
bool IsSafeOutput(string outputText) |
Quickly checks whether the given text output is safe according to the configured safety pipeline. |
byte[] Serialize() |
Serializes the model to a byte array. |
string Detokenize(List<int> tokenIds, bool skipSpecialTokens) |
Decodes token IDs back into text. |
string FormatPrompt(Dictionary<string, string> variables) |
Formats a prompt using the configured prompt template. |
string GenerateSegmentationHtmlOverlay(Tensor<T> image, SegmentationOutput<T> output, SegmentationVisualizationConfig config, string title) |
Creates a self-contained HTML page containing a rendered segmentation overlay and legend. |
string GenerateText(string prompt, int maxNewTokens, double temperature, int? seed, IReadOnlyList<string> stopSequences) |
Generates text autoregressively from prompt using the configured or auto-discovered tokenizer and KV-cached causal decoding when supported by the underlying model. |
string PredictNextWord(string prompt, int maxSubwordTokens) |
Predicts the single next whole word following prompt using full-context, KV-cached greedy subword completion, stopping automatically at the first whitespace or punctuation boundary. |
void Adapt(TInput supportX, TOutput supportY, int steps, double learningRate) |
Quickly adapts the model to a new task using a few examples (few-shot learning). |
void ApplyGradients(Vector<T> gradients, T learningRate) |
Applies pre-computed gradients to update the model parameters. |
void Deserialize(byte[] data) |
Deserializes a model from a byte array. |
void Dispose() |
|
void EnforceSafetyPolicy(SafetyReport report, bool isInput) |
Enforces the safety policy on a report, throwing if the content is blocked. |
void ExportToCoreML(string outputPath) |
Exports the model to CoreML format for deployment on Apple devices (iOS, macOS). |
void ExportToOnnx(string outputPath) |
Exports the model to ONNX format for cross-platform deployment. |
void ExportToTFLite(string outputPath) |
Exports the model to TensorFlow Lite format for mobile and edge deployment. |
void ExportToTensorRT(string outputPath) |
Exports the model to TensorRT format for high-performance inference on NVIDIA GPUs. |
void FineTune(TInput trainX, TOutput trainY, int epochs, TInput validationX, TOutput validationY, double learningRate) |
Performs comprehensive fine-tuning on a dataset to optimize for a specific task. |
void LoadFromFile(string filePath) |
Loads the model from a file. |
void LoadState(Stream stream) |
Loads the prediction model result’s state from a stream. |
void RenderSegmentationAscii(SegmentationOutput<T> output, string title, int maxWidth, TextWriter writer) |
Writes a compact text view of a segmentation prediction for terminals and CI logs. |
void SaveModel(string filePath) |
Saves the model to a file. |
void SaveState(Stream stream) |
Saves the prediction model result’s current state to a stream. |
void SetActiveFeatureIndices(IEnumerable<int> featureIndices) |
Setting active feature indices is not supported on AiModelResult. |
void SetParameters(Vector<T> parameters) |
Setting parameters is not supported on AiModelResult. |
void Train(TInput input, TOutput expectedOutput) |
Training is not supported on AiModelResult. |