@astermind/astermind-premium
Version:
Astermind Premium - Premium ML Toolkit
62 lines • 1.7 kB
TypeScript
export interface AttentionEnhancedELMOptions {
categories: string[];
hiddenUnits?: number;
attentionHeads?: number;
attentionDim?: number;
useSelfAttention?: boolean;
activation?: 'relu' | 'tanh' | 'sigmoid' | 'linear';
maxLen?: number;
useTokenizer?: boolean;
}
export interface AttentionEnhancedELMResult {
label: string;
prob: number;
attentionWeights?: number[][];
}
/**
* Attention-Enhanced ELM with attention mechanisms
* Features:
* - Query-key-value attention in hidden layer
* - Self-attention for sequences
* - Multi-head attention support
* - Context-aware classification
*/
export declare class AttentionEnhancedELM {
private elm;
private categories;
private options;
private attentionWeights;
private trained;
constructor(options: AttentionEnhancedELMOptions);
/**
* Train with attention-enhanced features
*/
train(X: number[][], y: number[] | string[]): void;
/**
* Predict with attention
*/
predict(X: number[] | number[][], topK?: number, returnAttention?: boolean): AttentionEnhancedELMResult[];
/**
* Extract features with attention mechanism
*/
private _extractAttentionFeatures;
/**
* Compute attention for a sequence
*/
private _computeAttention;
/**
* Project input to attention dimension
*/
private _project;
/**
* Project attention output to hidden units size
*/
private _projectToHiddenSize;
private _softmax;
private _hash;
/**
* Get attention weights for last prediction
*/
getAttentionWeights(): number[][][];
}
//# sourceMappingURL=attention-enhanced-elm.d.ts.map