UNPKG

@astermind/astermind-elm

Version:

JavaScript Extreme Learning Machine (ELM) library for browser and Node.js.

36 lines (35 loc) 1.2 kB
import { ELMConfig } from '../core/ELMConfig'; import type { PredictResult } from '../core/ELM'; type AugmentOpts = { suffixes?: string[]; prefixes?: string[]; includeNoise?: boolean; noiseRate?: number; charSet?: string; }; export declare class IntentClassifier { private model; private config; private categories; constructor(config: ELMConfig); /** * Train from (text, label) pairs using closed-form ELM solve. * Uses the ELM's UniversalEncoder (token mode). */ train(textLabelPairs: { text: string; label: string; }[], augmentation?: AugmentOpts): void; /** Top-K predictions with an optional probability threshold */ predict(text: string, topK?: number, threshold?: number): PredictResult[]; /** Batched predict */ predictBatch(texts: string[], topK?: number, threshold?: number): PredictResult[][]; /** Convenience: best label + prob (or undefined if below threshold) */ predictLabel(text: string, threshold?: number): { label: string; prob: number; } | undefined; loadModelFromJSON(json: string): void; saveModelAsJSONFile(filename?: string): void; } export {};