@astermind/astermind-pro
Version:
Astermind Pro - Premium ML Toolkit with Advanced RAG, Reranking, Summarization, and Information Flow Analysis
75 lines • 1.86 kB
TypeScript
export interface SparseELMOptions {
categories: string[];
hiddenUnits?: number;
maxLen?: number;
useTokenizer?: boolean;
activation?: 'relu' | 'tanh' | 'sigmoid' | 'linear';
regularization: {
type: 'l1' | 'l2' | 'elastic';
lambda: number;
alpha?: number;
};
sparsityTarget?: number;
pruneThreshold?: number;
}
export interface SparseELMResult {
label: string;
prob: number;
}
/**
* Sparse ELM with regularization and feature selection
* Features:
* - L1/L2/Elastic net regularization
* - Weight pruning for sparsity
* - Feature importance ranking
* - Interpretable models
*/
export declare class SparseELM {
private elm;
private options;
private trained;
private weightMask;
private featureImportance;
constructor(options: SparseELMOptions);
/**
* Train sparse ELM with regularization
*/
train(X: number[][], y: number[] | string[]): void;
/**
* Predict with sparse model
*/
predict(X: number[] | number[][], topK?: number): SparseELMResult[];
/**
* Apply regularization to weights
*/
private _applyRegularization;
/**
* Prune small weights for sparsity
*/
private _pruneWeights;
/**
* Compute current sparsity ratio
*/
private _computeSparsity;
/**
* Enforce target sparsity by pruning more weights
*/
private _enforceSparsityTarget;
/**
* Compute feature importance based on weight magnitudes
*/
private _computeFeatureImportance;
/**
* Get feature importance scores
*/
getFeatureImportance(): number[];
/**
* Get sparsity statistics
*/
getSparsityStats(): {
sparsity: number;
activeWeights: number;
totalWeights: number;
};
}
//# sourceMappingURL=sparse-elm.d.ts.map