siafun
Version:
A collection of structure induction algorithms
57 lines (56 loc) • 2.62 kB
TypeScript
export declare const QUANT_FUNCS: {
IDENTITY: typeof identity;
CONSTANT: typeof getConstant;
ROUND: typeof getRound;
ORDER: typeof getOrder;
SUMMARIZE: typeof getSummarize;
SORTED_SUMMARIZE: typeof getSortedSummarize;
TRANSP_SORTED_SUMMARIZE: typeof getTransposedSortedSummarize;
ABOVE_MEAN: typeof getAboveMean;
ABOVE_STD: typeof getAboveStd;
DISCRETIZE: typeof getDiscretize;
CLUSTER: typeof getCluster;
SCALE: typeof scale;
NORMALIZE: typeof normalize;
INTERVALS: typeof toIntervals;
};
/** maps over arrays of values */
export interface ArrayMap {
(values: (number | number[])[]): (number | number[])[];
}
declare function identity(): ArrayMap;
/** maps all values of an array to the given constant */
declare function getConstant(value: number): ArrayMap;
/** returns a function that rounds all numbers in an array to the given precision */
declare function getRound(precision?: number): ArrayMap;
/** returns a function that maps all numbers in an array onto their index */
declare function getOrder(): ArrayMap;
/** returns a function that maps all arrays in an array onto the outDims highest values */
declare function getSummarize(outDims: number): ArrayMap;
/** returns a function that summarizes and sorts the arrays of an array */
declare function getSortedSummarize(outDims: number): ArrayMap;
/** returns a function that maps all arrays onto the values above their average */
declare function getAboveMean(): ArrayMap;
/** returns a function that maps all arrays onto the values above their average */
declare function getAboveStd(): ArrayMap;
declare function getTransposedSortedSummarize(outDims: number): ArrayMap;
/** returns a function that maps all numbers in an array onto a discrete segment [0,...,numValues-1] */
declare function getDiscretize(numValues: number): ArrayMap;
declare function getCluster(numClusters: number): ArrayMap;
/** scales all values in an array to [0,1] */
declare function scale(values: number[]): number[];
/** normalizes all values in an array */
declare function normalize(values: number[]): number[];
/** maps all values onto the interval by which they are reached */
declare function toIntervals(values: number[]): number[];
export declare class Quantizer {
private dimFuncs;
constructor(dimFuncs: ArrayMap[]);
getQuantizedPoints(points: (number | number[])[][]): number[][];
/**
* TODO WHERE TO PUT?
* returns a map with a normalized vector for each given dymo. if reduce is true, multidimensional ones are reduced
*/
normalize(vectors: number[][]): number[][];
}
export {};