WebPredictionResult class

Represents the result of a web-based mosquito species prediction.

This model contains prediction results from remote classification services, including species identification, confidence scores, probability distributions across all possible species, and associated metadata. It's used when classification is performed on external servers rather than locally on the device.

The prediction result includes comprehensive probability data for transparency and supports both single-prediction and multi-class classification scenarios.

Usage Example

// Typically received from API response
final result = WebPredictionResult(
  id: 'pred_123456',
  scientificName: 'Aedes aegypti',
  probabilities: {
    'Aedes aegypti': 0.87,
    'Aedes albopictus': 0.08,
    'Culex pipiens': 0.03,
    'Anopheles gambiae': 0.02,
  },
  modelId: 'culico-net-cls-v1',
  confidence: 0.87,
  imageUrlSpecies: 'https://api.culicidaelab.org/species/aedes_aegypti.jpg',
);

print('Top prediction: ${result.scientificName}');
print('Confidence: ${result.confidencePercentage}');
print('Alternative species: ${result.alternativeSpecies}');

Server Integration

This model is designed to work with the CulicidaeLab server API:

  • Receives predictions from /predict endpoint
  • Includes full probability distribution for transparency
  • Supports model versioning and tracking
  • Provides species image URLs for display

Comparison with Local Classification

Unlike ClassificationResult which is used for local PyTorch Lite predictions, this model represents server-side classification results with additional features like probability distributions and remote image URLs.

See also:

Constructors

WebPredictionResult({required String id, required String scientificName, required Map<String, double> probabilities, required String modelId, required double confidence, String? imageUrlSpecies})
Creates a new WebPredictionResult instance.
WebPredictionResult.fromJson(Map<String, dynamic> json)
Creates a WebPredictionResult from a JSON map.
factory

Properties

alternativeSpecies Map<String, double>
Gets alternative species with their probabilities.
no setter
confidence double
Confidence score of the top prediction (0.0 to 1.0).
final
confidenceLevel String
Gets a human-readable confidence level description.
no setter
confidencePercentage String
Gets the confidence as a percentage string.
no setter
hasCloseAlternatives bool
Checks if there are close alternative predictions.
no setter
hashCode int
Returns the hash code for this prediction result.
no setteroverride
id String
Unique identifier for this prediction.
final
imageUrlSpecies String?
Optional URL to the species reference image.
final
isHighConfidence bool
Checks if the prediction has high confidence.
no setter
modelId String
Identifier of the AI model used for prediction.
final
probabilities Map<String, double>
Probability distribution across all possible species.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scientificName String
Scientific name of the predicted mosquito species.
final
topProbability double
Gets the probability of the predicted species.
no setter

Methods

getTopAlternatives([int count = 3]) List<String>
Gets the top N alternative species predictions.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts this WebPredictionResult to a JSON map.
toString() String
Returns a string representation of this prediction result.
override

Operators

operator ==(Object other) bool
Checks if two WebPredictionResult instances are equal.
override

Static Methods

fromJsonString(String str) WebPredictionResult
Creates a WebPredictionResult from a JSON string.