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

Migrates DistanceType to a Distance interface #285

Merged
merged 2 commits into from
Oct 3, 2022
Merged

Conversation

Craigacp
Copy link
Member

@Craigacp Craigacp commented Sep 30, 2022

Description

Adds a Distance interface in org.tribuo.math.distance, along with implementations for Cosine, L1 and L2. Users can supply their own distance computation function by implementing the interface. All models which were previously migrated to use DistanceType now store a Distance instance, and the enum holds a singleton of each of the built in types for easy use in CLI programs and as default arguments.

cc @geoffreydstewart

Motivation

The set of available distances was too limiting, fixes #284.

@Craigacp Craigacp added the squash-commits Squash the commits when merging this PR label Sep 30, 2022
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Sep 30, 2022
@geoffreydstewart
Copy link
Member

@Craigacp This is a great improvement without breaking compatibility. Nice.

Copy link
Member

@jhalexand jhalexand left a comment

Choose a reason for hiding this comment

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

LGTM!

@jhalexand jhalexand merged commit 715d36b into main Oct 3, 2022
@jhalexand jhalexand deleted the distance-interface branch October 3, 2022 18:13
@brainbytes42
Copy link

Well done, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement. squash-commits Squash the commits when merging this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Limitid extendability by using Enums
4 participants