Prediction

data class Prediction(val content: String, val confidence: Float, val type: String, val metadata: Map<String, Any>? = emptyMap(), val alternatives: List<String>? = null)(source)

Represents an AI-generated prediction, suggestion, or recommendation from the KARL system.

Prediction objects are the primary output of the KARL learning system, delivering intelligent insights and suggestions based on learned user behavior patterns. They provide structured, actionable information that applications can use to enhance user experience through personalized recommendations and proactive assistance.

Prediction structure and components:

Core prediction content:

  • Primary suggestion or recommendation text

  • Confidence level indicating prediction reliability

  • Type classification for appropriate handling and presentation

  • Supporting metadata for context and explanation

  • Alternative options for user choice and diversity

Confidence scoring and interpretation:

  • 0.0 - 0.3: Low confidence, experimental or exploratory suggestions

  • 0.3 - 0.7: Moderate confidence, plausible suggestions with some uncertainty

  • 0.7 - 0.9: High confidence, well-supported suggestions based on clear patterns

  • 0.9 - 1.0: Very high confidence, highly likely suggestions with strong evidence

Prediction types and usage patterns:

Action suggestions ("action"):

  • Next likely user actions based on current context

  • Workflow optimization and shortcut recommendations

  • Error prevention and recovery suggestions

  • Efficiency improvements and automation opportunities

Content recommendations ("content"):

  • Relevant documents, articles, or media based on interests

  • Related items and discovery suggestions

  • Personalized content filtering and prioritization

  • Cross-reference and citation recommendations

Navigation assistance ("navigation"):

  • Optimal paths through complex interfaces or workflows

  • Frequently accessed features and shortcuts

  • Context-aware menu and option highlighting

  • Progressive disclosure based on user expertise level

Contextual insights ("insight"):

  • Pattern recognition and behavior analysis feedback

  • Performance metrics and improvement opportunities

  • Learning progress and skill development indicators

  • Comparative analysis and benchmarking information

Adaptive customization ("customization"):

  • Interface layout and feature arrangement suggestions

  • Preference and setting optimization recommendations

  • Accessibility and usability improvements

  • Personalization based on usage patterns and preferences

Metadata structure and information:

Explanation and reasoning:

  • "rationale": Human-readable explanation of why this prediction was generated

  • "evidence": Supporting data points or patterns that inform the prediction

  • "pattern_strength": Statistical strength of the underlying behavioral pattern

  • "learning_maturity": How much training data supports this type of prediction

Context and relevance:

  • "context_match": How well current context matches prediction training scenarios

  • "temporal_relevance": Time-based factors affecting prediction accuracy

  • "user_segment": User behavior classification that informs the prediction

  • "domain_specificity": How specialized or general the prediction domain is

Presentation and interaction:

  • "urgency": Time sensitivity of the prediction or recommendation

  • "presentation_style": Suggested UI treatment (notification, inline, modal, etc.)

  • "interaction_mode": How user should engage with the prediction

  • "dismissible": Whether the prediction can be ignored or permanently dismissed

Quality and validation:

  • "source_interactions": Number of interactions supporting the prediction

  • "validation_score": Cross-validation or holdout testing performance

  • "novelty": Whether this represents a new pattern or established behavior

  • "risk_assessment": Potential negative consequences of following the prediction

Alternative suggestions and diversity:

Diversity mechanisms:

  • Provide multiple options to avoid prediction tunnel vision

  • Include contrarian or minority pattern suggestions

  • Balance between exploitation of known patterns and exploration of new behaviors

  • Ensure alternatives span different categories and approaches

Ranking and prioritization:

  • Order alternatives by confidence, relevance, or user preference

  • Include confidence scores for each alternative when available

  • Consider user's historical acceptance patterns for similar suggestions

  • Balance familiar options with novel exploration opportunities

Quality assurance and validation:

Prediction filtering:

  • Minimum confidence thresholds based on user preferences

  • Content appropriateness and safety filtering

  • Relevance scoring based on current context and user goals

  • Duplicate detection and consolidation

Continuous improvement:

  • Track prediction acceptance and rejection rates

  • Monitor long-term outcomes of followed predictions

  • Adapt confidence calibration based on real-world performance

  • Learn from user feedback and correction signals

Error handling and edge cases:

  • Graceful handling of predictions that become invalid due to context changes

  • Clear communication when predictions are uncertain or experimental

  • Fallback suggestions when primary predictions are not applicable

  • Error recovery assistance when predictions lead to undesired outcomes

Constructors

Link copied to clipboard
constructor(content: String, confidence: Float, type: String, metadata: Map<String, Any>? = emptyMap(), alternatives: List<String>? = null)

Properties

Link copied to clipboard
val alternatives: List<String>? = null

Optional list of alternative suggestions that provide user choice and prevent prediction tunnel vision. Should be ordered by relevance or confidence and represent diverse approaches to achieving the user's inferred goals.

Link copied to clipboard

A floating-point value between 0.0 and 1.0 indicating the system's confidence in the prediction accuracy. Higher values represent greater certainty based on stronger behavioral patterns and more comprehensive training data.

Link copied to clipboard

The primary recommendation or suggestion text that should be presented to the user. Should be clear, actionable, and appropriate for the current context. May include structured data or markup for rich presentation.

Link copied to clipboard

Optional map containing additional context, explanation, and presentation information for the prediction. Keys should follow established conventions and values should be serializable types. Used for rich presentation and debugging purposes.

Link copied to clipboard

A categorical identifier that describes the nature and purpose of the prediction. Common types include "action", "content", "navigation", "insight", and "customization". Used for appropriate handling and presentation by consuming applications.