thoughtmcp
Version:
AI that thinks more like humans do - MCP server with human-like cognitive architecture for enhanced reasoning, memory, and self-monitoring
120 lines • 3.87 kB
TypeScript
/**
* Predictive Processing Implementation
*
* Implements predictive processing mechanisms inspired by the predictive brain hypothesis:
* - Top-down prediction generation based on current context
* - Prediction error computation and model updating
* - Bayesian belief updating mechanisms
* - Hierarchical predictive models
*/
import { ComponentStatus, IPredictiveProcessor, Prediction } from "../interfaces/cognitive.js";
import { Context } from "../types/core.js";
export interface PredictionError {
magnitude: number;
direction: "positive" | "negative";
confidence: number;
source: string;
timestamp: number;
}
export interface GenerativeModel {
id: string;
parameters: Map<string, number>;
prior_beliefs: Map<string, number>;
confidence: number;
last_updated: number;
prediction_accuracy: number;
}
export interface HierarchicalLevel {
level: number;
predictions: Prediction[];
errors: PredictionError[];
model: GenerativeModel;
parent_level?: HierarchicalLevel;
child_levels: HierarchicalLevel[];
}
export interface BayesianUpdate {
prior: number;
likelihood: number;
evidence: number;
posterior: number;
confidence_change: number;
}
/**
* PredictiveProcessor implements predictive processing mechanisms
* Based on the predictive brain hypothesis and hierarchical temporal memory
*/
export declare class PredictiveProcessor implements IPredictiveProcessor {
private generative_models;
private hierarchical_levels;
private prediction_history;
private error_history;
private max_history_size;
private prediction_error_threshold;
private learning_rate;
private confidence_decay;
private status;
/**
* Initialize the predictive processor with configuration
*/
initialize(config: Record<string, unknown>): Promise<void>;
/**
* Main processing method - implements predictive processing pipeline
*/
process(input: unknown): Promise<{
predictions: Prediction[];
errors: PredictionError[];
model_updates: GenerativeModel[];
}>;
/**
* Generate top-down predictions based on current context
*/
generatePredictions(context: Context): Prediction[];
/**
* Compute prediction error between prediction and actual input
*/
computePredictionError(prediction: Prediction, actual: unknown): number;
/**
* Update generative model based on prediction error
*/
updateModel(error: number, prediction: Prediction): void;
/**
* Perform Bayesian belief updating
*/
getBayesianUpdate(prior: number, likelihood: number, evidence: number): number;
/**
* Reset processor state
*/
reset(): void;
/**
* Get current component status
*/
getStatus(): ComponentStatus;
private initializeHierarchicalLevels;
private initializeGenerativeModels;
private createDefaultModel;
private extractContext;
private generateLevelPredictions;
private generateModelPredictions;
private computePredictionErrors;
private updateModelsFromErrors;
private updateHistory;
private extractFeatures;
private computeFeatureErrors;
private aggregateErrors;
private getModelIdFromPrediction;
private getContextKey;
private updateModelParameters;
private generateSensoryPredictions;
private generatePerceptualPredictions;
private generateConceptualPredictions;
private generateAbstractPredictions;
private generateLinguisticPrediction;
private generateTemporalPrediction;
private generateCausalPrediction;
private generateSpatialPrediction;
private computeTextComplexity;
private computeSentiment;
private computeObjectDepth;
private areContentTypesVeryDifferent;
}
//# sourceMappingURL=PredictiveProcessor.d.ts.map