Skip to content

Commit 8131d0b

Browse files
committed
Update namespace Typescript definitions
1 parent 2b8f536 commit 8131d0b

File tree

12 files changed

+363
-29
lines changed

12 files changed

+363
-29
lines changed

lib/node_modules/@stdlib/array/docs/types/index.d.ts

+79
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,19 @@ import convertArray = require( '@stdlib/array/convert' );
2828
import convertArraySame = require( '@stdlib/array/convert-same' );
2929
import arrayCtors = require( '@stdlib/array/ctors' );
3030
import DataView = require( '@stdlib/array/dataview' );
31+
import datespace = require( '@stdlib/array/datespace' );
3132
import arrayDataType = require( '@stdlib/array/dtype' );
3233
import arrayDataTypes = require( '@stdlib/array/dtypes' );
3334
import filledarray = require( '@stdlib/array/filled' );
3435
import Float32Array = require( '@stdlib/array/float32' );
3536
import Float64Array = require( '@stdlib/array/float64' );
3637
import iterator2array = require( '@stdlib/array/from-iterator' );
38+
import incrspace = require( '@stdlib/array/incrspace' );
3739
import Int8Array = require( '@stdlib/array/int8' );
3840
import Int16Array = require( '@stdlib/array/int16' );
3941
import Int32Array = require( '@stdlib/array/int32' );
42+
import linspace = require( '@stdlib/array/linspace' );
43+
import logspace = require( '@stdlib/array/logspace' );
4044
import arrayMinDataType = require( '@stdlib/array/min-dtype' );
4145
import arrayNextDataType = require( '@stdlib/array/next-dtype' );
4246
import typedarraypool = require( '@stdlib/array/pool' );
@@ -266,6 +270,36 @@ interface Namespace {
266270
*/
267271
DataView: typeof DataView;
268272

273+
/**
274+
* Generates an array of linearly spaced dates.
275+
*
276+
* @param start - start time as either a `Date` object, Unix timestamp, JavaScript timestamp, or date string
277+
* @param stop - stop time as either a `Date` object, Unix timestamp, JavaScript timestamp, or date string
278+
* @param length - output array length (default: 100)
279+
* @param options - function options
280+
* @param options.round - specifies how sub-millisecond times should be rounded: [ 'floor', 'ceil', 'round' ] (default: 'floor' )
281+
* @throws length argument must a positive integer
282+
* @throws must provide valid options
283+
* @returns array of dates
284+
*
285+
* @example
286+
* var stop = '2014-12-02T07:00:54.973Z';
287+
* var start = new Date( stop ) - 60000;
288+
*
289+
* var arr = ns.datespace( start, stop, 6 );
290+
* // returns [...]
291+
*
292+
* @example
293+
* // Equivalent of Math.ceil():
294+
* var arr = ns.datespace( 1417503655000, 1417503655001, 3, { 'round': 'ceil' } );
295+
* // returns [...]
296+
*
297+
* // Equivalent of Math.round():
298+
* var arr = ns.datespace( 1417503655000, 1417503655001, 3, { 'round': 'round' } );
299+
* // returns [...]
300+
*/
301+
datespace: typeof datespace;
302+
269303
/**
270304
* Returns the data type of an array.
271305
*
@@ -359,6 +393,21 @@ interface Namespace {
359393
*/
360394
iterator2array: typeof iterator2array;
361395

396+
/**
397+
* Generates a linearly spaced numeric array using a provided increment.
398+
*
399+
* @param x1 - first array value
400+
* @param x2 - array element bound
401+
* @param increment - increment (default: 1)
402+
* @throws length of created array must be less than `4294967295` (`2**32 - 1`)
403+
* @returns linearly spaced numeric array
404+
*
405+
* @example
406+
* var arr = ns.incrspace( 0, 11, 2 );
407+
* // returns [ 0, 2, 4, 6, 8, 10 ]
408+
*/
409+
incrspace: typeof incrspace;
410+
362411
/**
363412
* Typed array constructor which returns a typed array representing an array of twos-complement 8-bit signed integers in the platform byte order.
364413
*/
@@ -374,6 +423,36 @@ interface Namespace {
374423
*/
375424
Int32Array: typeof Int32Array;
376425

426+
/**
427+
* Generates a linearly spaced numeric array.
428+
*
429+
* @param x1 - first array value
430+
* @param x2 - last array value
431+
* @param len - length of output array (default: 100)
432+
* @throws third argument must be a nonnegative integer
433+
* @returns linearly spaced numeric array
434+
*
435+
* @example
436+
* var arr = ns.linspace( 0, 100, 6 );
437+
* // returns [ 0, 20, 40, 60, 80, 100 ]
438+
*/
439+
linspace: typeof linspace;
440+
441+
/**
442+
* Generates a logarithmically spaced numeric array.
443+
*
444+
* @param a - exponent of start value
445+
* @param b - exponent of end value
446+
* @param len - length of output array (default: 10)
447+
* @throws third argument must be a nonnegative integer
448+
* @returns logarithmically spaced numeric array
449+
*
450+
* @example
451+
* var arr = ns.logspace( 0, 2, 6 );
452+
* // returns [ 1, ~2.5, ~6.31, ~15.85, ~39.81, 100 ]
453+
*/
454+
logspace: typeof logspace;
455+
377456
/**
378457
* Returns the minimum array data type of the closest "kind" necessary for storing a provided scalar value.
379458
*

lib/node_modules/@stdlib/assert/docs/types/index.d.ts

+34
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import deepEqual = require( '@stdlib/assert/deep-equal' );
2626
import deepHasOwnProp = require( '@stdlib/assert/deep-has-own-property' );
2727
import deepHasProp = require( '@stdlib/assert/deep-has-property' );
2828
import hasArrayBufferSupport = require( '@stdlib/assert/has-arraybuffer-support' );
29+
import hasArrowFunctionSupport = require( '@stdlib/assert/has-arrow-function-support' );
2930
import hasAsyncAwaitSupport = require( '@stdlib/assert/has-async-await-support' );
3031
import hasAsyncIteratorSymbolSupport = require( '@stdlib/assert/has-async-iterator-symbol-support' );
3132
import hasBigIntSupport = require( '@stdlib/assert/has-bigint-support' );
@@ -76,6 +77,7 @@ import isArrayLike = require( '@stdlib/assert/is-array-like' );
7677
import isArrayLikeObject = require( '@stdlib/assert/is-array-like-object' );
7778
import isArrayBuffer = require( '@stdlib/assert/is-arraybuffer' );
7879
import isArrayBufferView = require( '@stdlib/assert/is-arraybuffer-view' );
80+
import isArrowFunction = require( '@stdlib/assert/is-arrow-function' );
7981
import isASCII = require( '@stdlib/assert/is-ascii' );
8082
import isBetween = require( '@stdlib/assert/is-between' );
8183
import isBetweenArray = require( '@stdlib/assert/is-between-array' );
@@ -473,6 +475,17 @@ interface Namespace {
473475
*/
474476
hasArrayBufferSupport: typeof hasArrayBufferSupport;
475477

478+
/**
479+
* Tests for native arrow function support.
480+
*
481+
* @returns boolean indicating if an environment has native arrow function support
482+
*
483+
* @example
484+
* var bool = ns.hasArrowFunctionSupport();
485+
* // returns <boolean>
486+
*/
487+
hasArrowFunctionSupport: typeof hasArrowFunctionSupport;
488+
476489
/**
477490
* Tests for native `async/await` support.
478491
*
@@ -1266,6 +1279,27 @@ interface Namespace {
12661279
*/
12671280
isArrayBufferView: typeof isArrayBufferView;
12681281

1282+
/**
1283+
* Tests if a value is an arrow function.
1284+
*
1285+
* @param value - value to test
1286+
* @returns boolean indicating whether value is an arrow function
1287+
*
1288+
* @example
1289+
* var arrow = () => {};
1290+
* var bool = ns.isArrowFunction( arrow );
1291+
* // returns true
1292+
*
1293+
* @example
1294+
* function beep() {
1295+
* return 'beep';
1296+
* }
1297+
1298+
* var bool = ns.isArrowFunction( beep );
1299+
* // returns false
1300+
*/
1301+
isArrowFunction: typeof isArrowFunction;
1302+
12691303
/**
12701304
* Tests whether a character belongs to the ASCII character set and whether this is true for all characters in a provided string.
12711305
*

lib/node_modules/@stdlib/buffer/docs/types/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ interface Namespace {
6060
* var ctor = require( `@stdlib/buffer/ctor` );
6161
*
6262
* var b = new ctor( [ 1, 2, 3, 4 ] );
63-
* // returns <Buffer>
63+
* // returns <ns.Buffer>
6464
*/
6565
Buffer: typeof Buffer;
6666

lib/node_modules/@stdlib/constants/docs/types/index.d.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ import float64 = require( '@stdlib/constants/float64' );
3030
import int8 = require( '@stdlib/constants/int8' );
3131
import int16 = require( '@stdlib/constants/int16' );
3232
import int32 = require( '@stdlib/constants/int32' );
33-
import string = require( '@stdlib/constants/string' );
33+
import path = require( '@stdlib/constants/path' );
3434
import time = require( '@stdlib/constants/time' );
3535
import uint8 = require( '@stdlib/constants/uint8' );
3636
import uint16 = require( '@stdlib/constants/uint16' );
3737
import uint32 = require( '@stdlib/constants/uint32' );
38+
import unicode = require( '@stdlib/constants/unicode' );
3839

3940
/**
4041
* Interface describing the `constants` namespace.
@@ -86,9 +87,9 @@ interface Namespace {
8687
int32: typeof int32;
8788

8889
/**
89-
* Standard string constants.
90+
* Standard string path constants.
9091
*/
91-
string: typeof string;
92+
path: typeof path;
9293

9394
/**
9495
* Time constants.
@@ -109,6 +110,11 @@ interface Namespace {
109110
* 32-bit unsigned integer mathematical constants.
110111
*/
111112
uint32: typeof uint32;
113+
114+
/**
115+
* Standard string unicode constants.
116+
*/
117+
unicode: typeof unicode;
112118
}
113119

114120
/**

lib/node_modules/@stdlib/fs/docs/types/index.d.ts

+35
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import readJSON = require( '@stdlib/fs/read-json' );
3131
import readWASM = require( '@stdlib/fs/read-wasm' );
3232
import rename = require( '@stdlib/fs/rename' );
3333
import resolveParentPath = require( '@stdlib/fs/resolve-parent-path' );
34+
import resolveParentPathBy = require( '@stdlib/fs/resolve-parent-path-by' );
3435
import unlink = require( '@stdlib/fs/unlink' );
3536
import writeFile = require( '@stdlib/fs/write-file' );
3637

@@ -334,6 +335,40 @@ interface Namespace {
334335
*/
335336
resolveParentPath: typeof resolveParentPath;
336337

338+
/**
339+
* Asynchronously resolves a path according to a predicate function by walking parent directories.
340+
*
341+
* @param path - path to resolve
342+
* @param options - function options
343+
* @param options.dir - base directory
344+
* @param predicate - predicate function
345+
* @param clbk - callback to invoke after resolving a path
346+
* @throws must provide valid options
347+
*
348+
* @example
349+
* ns.resolveParentPathBy( 'package.json', predicate, onPath );
350+
*
351+
* function predicate( path, next ) {
352+
* next( null, true );
353+
* }
354+
*
355+
* function onPath( error, path ) {
356+
* if ( error ) {
357+
* throw error;
358+
* }
359+
* console.log( path );
360+
* }
361+
*
362+
* @example
363+
* function predicate() {
364+
* return true;
365+
* }
366+
*
367+
* var path = ns.resolveParentPathBy.sync( 'package.json', predicate );
368+
* // e.g., returns '...'
369+
*/
370+
resolveParentPathBy: typeof resolveParentPathBy;
371+
337372
/**
338373
* Asynchronously removes a directory entry.
339374
*

lib/node_modules/@stdlib/math/base/docs/types/index.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
/* tslint:disable:max-file-line-count */
2323

2424
import assert = require( '@stdlib/math/base/assert' );
25-
import complex = require( '@stdlib/math/base/complex' );
25+
import ops = require( '@stdlib/math/base/ops' );
2626
import special = require( '@stdlib/math/base/special' );
2727
import tools = require( '@stdlib/math/base/tools' );
2828
import utils = require( '@stdlib/math/base/utils' );
@@ -37,9 +37,9 @@ interface Namespace {
3737
assert: typeof assert;
3838

3939
/**
40-
* Standard library base complex number math functions.
40+
* Standard library base math operators.
4141
*/
42-
complex: typeof complex;
42+
ops: typeof ops;
4343

4444
/**
4545
* Standard library base special math functions.

lib/node_modules/@stdlib/ml/incr/docs/types/index.d.ts

+30-21
Original file line numberDiff line numberDiff line change
@@ -30,44 +30,53 @@ import incrSGDRegression = require( '@stdlib/ml/incr/sgd-regression' );
3030
*/
3131
interface Namespace {
3232
/**
33-
* Online learning for classification using stochastic gradient descent (SGD).
33+
* Returns an accumulator function which incrementally performs binary classification using stochastic gradient descent (SGD).
3434
*
3535
* ## Method
3636
*
37-
* The sub-gradient of the loss function is estimated for each datum and the classification model is updated incrementally, with a decreasing learning rate and regularization of the feature weights based on L2 regularization.
37+
* - The sub-gradient of the loss function is estimated for each datum and the classification model is updated incrementally, with a decreasing learning rate and regularization of model feature weights using L2 regularization.
38+
* - Stochastic gradient descent is sensitive to the scaling of the features. One is advised to either scale each feature to `[0,1]` or `[-1,1]` or to transform each feature into z-scores with zero mean and unit variance. One should keep in mind that the same scaling has to be applied to training data in order to obtain accurate predictions.
39+
* - In general, the more data provided to an accumulator, the more reliable the model predictions.
3840
*
3941
* ## References
4042
*
4143
* - Shalev-Shwartz, S., Singer, Y., Srebro, N., & Cotter, A. (2011). Pegasos: Primal estimated sub-gradient solver for SVM. Mathematical Programming, 127(1), 3–30. doi:10.1007/s10107-010-0420-4
4244
*
45+
* @param N - number of features
4346
* @param options - options object
44-
* @param options.epsilon - insensitivity parameter (default: 0.1)
45-
* @param options.eta0 - constant learning rate (default: 0.02)
46-
* @param options.lambda - regularization parameter (default: 1e-3)
47-
* @param options.learningRate - string denoting the learning rate to use. Can be `constant`, `pegasos`, or `basic` (default: 'basic')
48-
* @param options.loss - string denoting the loss function to use. Can be `hinge`, `log`, `modifiedHuber`, `perceptron`, or `squaredHinge` (default: 'log')
49-
* @param options.intercept - boolean indicating whether to include an intercept (default: true)
47+
* @param options.lambda - regularization parameter (default: `1.0e-4`)
48+
* @param options.learningRate - learning rate function and associated parameters (default: `['basic']`)
49+
* @param options.loss - loss function (default: `'log'`)
50+
* @param options.intercept - boolean indicating whether to include an intercept (default: `true`)
51+
* @throws first argument must be a positive integer
5052
* @throws must provide valid options
51-
* @returns classification model
53+
* @returns accumulator function
5254
*
5355
* @example
54-
* var ns.incrBinaryClassification = require( `@stdlib/streams/ml/incr/sgd-classification` );
56+
* var Float64Array = require( `@stdlib/array/float64` );
57+
* var array = require( `@stdlib/ndarray/array` );
5558
*
56-
* var accumulator = ns.incrBinaryClassification({
57-
* 'intercept': true
58-
* 'lambda': 1e-5
59+
* // Create an accumulator:
60+
* var accumulator = ns.incrBinaryClassification( 3, {
61+
* 'intercept': true,
62+
* 'lambda': 1.0e-5
5963
* });
6064
*
61-
* // Update model as observations come in:
62-
* var y = -1;
63-
* var x = [ 2.3, 1.0, 5.0 ];
64-
* accumulator( x, y );
65+
* // ...
6566
*
66-
* // Predict new observation:
67-
* var yHat = accumulator.predict( x );
67+
* // Update the model:
68+
* var x = array( new Float64Array( [ 2.3, 1.0, 5.0 ] ) );
69+
* var coefs = accumulator( x, 1 );
70+
* // returns <ndarray>
6871
*
69-
* // Retrieve coefficients:
70-
* var coefs = accumulator.coefs;
72+
* // ...
73+
*
74+
* // Create a new observation vector:
75+
* x = array( new Float64Array( [ 2.3, 5.3, 8.6 ] ) );
76+
*
77+
* // Predict the response value:
78+
* var yhat = accumulator.predict( x );
79+
* // returns <ndarray>
7180
*/
7281
incrBinaryClassification: typeof incrBinaryClassification;
7382

0 commit comments

Comments
 (0)