From c4c85ed0dea38485b51ef3b3f0c6e76517b2cc2c Mon Sep 17 00:00:00 2001 From: Jack Gerrits Date: Thu, 20 Jul 2023 13:28:39 -0400 Subject: [PATCH] docs: update wasm docs (#4626) --- wasm/documentation.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/wasm/documentation.md b/wasm/documentation.md index fa854ceb187..4dfbc354611 100644 --- a/wasm/documentation.md +++ b/wasm/documentation.md @@ -323,6 +323,7 @@ ES6 wrapper around the Vowpal Wabbit C++ library. * [new Workspace([args_str], [model_array])](#new_Workspace_new) * [new Workspace([args_str], [model_file], [model_array])](#new_Workspace_new) * [.parse(line)](#Workspace+parse) ⇒ + * [.createExampleFromDense(features, label)](#Workspace+createExampleFromDense) ⇒ * [.predict(example)](#Workspace+predict) ⇒ * [.learn(example)](#Workspace+learn) * [.finishExample(example)](#Workspace+finishExample) @@ -410,6 +411,25 @@ finishExample() must be called and then delete() on the example, when it is no l | --- | --- | | line | string | + + +### workspace.createExampleFromDense(features, label) ⇒ +Creates a new example from a dense array of features, where the key of the map is the namespace. + +**Kind**: instance method of [Workspace](#Workspace) +**Returns**: a parsed vw example that can be used for prediction or learning + +| Param | Type | Description | +| --- | --- | --- | +| features | Map.<string, Array.<number>> | | +| label | string | Empty label by default | + +**Example** +```js +let example = model.create_example_from_dense({ + my_namespace: [0.3, 0.2, 0.1, 0.3, 0.5, 0.9] +}); +``` ### workspace.predict(example) ⇒ @@ -945,6 +965,7 @@ Nodejs wrapper around the Vowpal Wabbit C++ library. * [new Workspace([args_str], [model_array])](#new_Workspace_new) * [new Workspace([args_str], [model_file], [model_array])](#new_Workspace_new) * [.parse(line)](#Workspace+parse) ⇒ + * [.createExampleFromDense(features, label)](#Workspace+createExampleFromDense) ⇒ * [.predict(example)](#Workspace+predict) ⇒ * [.learn(example)](#Workspace+learn) * [.finishExample(example)](#Workspace+finishExample) @@ -1032,6 +1053,25 @@ finishExample() must be called and then delete() on the example, when it is no l | --- | --- | | line | string | + + +### workspace.createExampleFromDense(features, label) ⇒ +Creates a new example from a dense array of features, where the key of the map is the namespace. + +**Kind**: instance method of [Workspace](#Workspace) +**Returns**: a parsed vw example that can be used for prediction or learning + +| Param | Type | Description | +| --- | --- | --- | +| features | Map.<string, Array.<number>> | | +| label | string | Empty label by default | + +**Example** +```js +let example = model.create_example_from_dense({ + my_namespace: [0.3, 0.2, 0.1, 0.3, 0.5, 0.9] +}); +``` ### workspace.predict(example) ⇒