Skip to content

Commit

Permalink
update readmes
Browse files Browse the repository at this point in the history
  • Loading branch information
fulpm committed Oct 3, 2024
1 parent c8e1d26 commit 03d621d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ This major change refactors the client and types for all Howso Engine operations
- The client's `ClientOptions.libDir` property has been removed.
- The client constructor now expects an instance of an `AbstractFileSystem` as its second parameter.
A `BrowserFileSystem` and `NodeFileSystem` are provided for use in their respective environments.
- The `train` method no longer batches requests to the Amalgam worker service automatically. Use `batchTrain` instead.
- The `createTrainee` method no longer sets feature attributes. Call `setFeatureAttributes` manually instead
(this also returns the updated object back).
- The `Trainee` object returned from the client now provides all Trainee operation methods directly. Such as train, react, etc.
- The `client/capabilities/*` interfaces have been removed.
- The return value of all Trainee operations has been changed to be an object with properties:
`payload` (this matches the previous return value format) and `warnings` (a list of warning messages, if applicable).
- The `train` method no longer batches requests to the Amalgam worker service automatically. Use `Trainee.batchTrain` instead.
- The `react` method now uses `context_values` instead of `context` and `action_values` instead of `actions`.
- `local_*` react features have been removed. Use their unqualified versions instead.

Expand Down
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,29 @@ import { type ClientOptions, HowsoWorkerClient, BrowserFileSystem } from "@howso
const getClient = async (options?: ClientOptions): Promise<HowsoWorkerClient> => {
const worker = new Worker(new URL("@/workers/AmalgamWorker", import.meta.url), { type: "module" });
const fs = new BrowserFileSystem(worker);
const client = new HowsoWorkerClient(worker, fs, {
return await HowsoWorkerClient.create(worker, fs, {
howsoUrl,
migrationsUrl, // Optional, used for upgrading Trainees saved to disk.
...options,
});
return client.setup();
};
```

Once you have a client you can then start creating your Trainees:

```ts
const client: HowsoWorkerClient = getClient();
const trainee = await client.createTrainee({ name: "MyTrainee" });
await trainee.setFeatureAttributes({ feature_attributes });
await trainee.batchTrain({ cases: dataset.data, columns: dataset.columns });
await trainee.analyze();
const { payload, warnings } = await trainee.react({
context_values: [[1, 2], [3, 4]],
context_features: ["a", "b"],
action_features: ["target"],
});
```

## Publishing

Documentation changes do not require a version publishing.
Expand Down

0 comments on commit 03d621d

Please sign in to comment.