Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Compatibility with @lala/appraisal #52

Merged
merged 1 commit into from
Mar 4, 2024
Merged

Conversation

retraigo
Copy link
Collaborator

@retraigo retraigo commented Mar 3, 2024

This PR adds two features:

  • Better type for Shape.
  • An overload for tensor() to accept a TensorLike as a parameter.

This provides smooth interop with @lala/appraisal's ML utilities (class to categorical, softmax to class, text vectorizers, etc).

Using appraisal with netsaur before this PR:

const y_pre = [1, 1, 3, 1, 2, 2, 2, 1, 1, 3, 3, 3, 2, 1];
const encoder = new CategoricalEncoder();
const y = encoder.fit(y_pre).transform(y_pre, "f32");

tensor(y.data, y.shape)

Usage after this PR:

const y_pre = [1, 1, 3, 1, 2, 2, 2, 1, 1, 3, 3, 3, 2, 1];
const encoder = new CategoricalEncoder();
const y = encoder.fit(y_pre).transform(y_pre, "f32");

tensor(y)

Copy link
Member

@load1n9 load1n9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@load1n9 load1n9 merged commit 93d72e5 into denosaurs:main Mar 4, 2024
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants