Property Confidence
- Namespace
- LMKit.TextAnalysis
- Assembly
- LM-Kit.NET.dll
Confidence
Confidence of the last categorization process, expressed as a floating-point value ranging from 0 to 1. A value closer to 1 indicates higher confidence in the classification accuracy.
public float Confidence { get; }
Property Value
Examples
using LMKit.Model;
using LMKit.TextAnalysis;
using System;
using System.Collections.Generic;
class Example
{
static void Main()
{
Uri modelUri = new Uri("https://your-model-link-here");
LM model = new LM(modelUri);
Categorization categorization = new Categorization(model);
var categories = new List<string> { "politics", "health", "sports" };
string text = "The athlete won a gold medal at the championship.";
int index = categorization.GetBestCategory(categories, text);
if (index != -1)
{
Console.WriteLine($"Category: {categories[index]}");
}
else
{
Console.WriteLine("No suitable category found.");
}
// Reading confidence
float confidenceScore = categorization.Confidence;
Console.WriteLine($"Confidence: {confidenceScore:P1}");
}
}