Skip to content

Add MLEngine interface #33

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

Merged
merged 2 commits into from
May 14, 2021
Merged

Add MLEngine interface #33

merged 2 commits into from
May 14, 2021

Conversation

jngz-es
Copy link
Collaborator

@jngz-es jngz-es commented May 11, 2021

Description

Add MLEngine interface

Issues Resolved

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

*
*/

package org.opensearch.ml.engine;
Copy link
Contributor

Choose a reason for hiding this comment

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

Curiously, should the ML engine under the ml-algorithms project? Probably it's better to put the algorithms under the ML engine?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I got your point. Actually This MLEngine class is a public interface of all ml algorithms, so I put it in ml-algorithms project.

if (parameters == null) {
parameters = new ArrayList<>();
}
switch (algoName.toLowerCase()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably we need to validate the parameters here? for example, if the algoName is null, then we will get a NullPointerException.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am not so sure about it. I think throwing a NullPointerException is OK, isn't it?

Model model = trainKMeansModel();
Assert.assertEquals("KMeans", model.getName());
Assert.assertEquals(1, model.getVersion());
Assert.assertNotNull(model.getContent());
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we verify the model is the expected one instead of only verify it's not null?

Copy link
Contributor

@weicongs-amazon weicongs-amazon left a comment

Choose a reason for hiding this comment

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

to get the high level picture, we need have a sync-up first about this engine and algorithm interfaces.
basically I think only train and prediction interfaces aren't enough to support all use cases

switch (algoName.toLowerCase()) {
case MLAlgoNames.KMEANS:
KMeans kMeans = new KMeans(parameters);
return kMeans.train(dataFrame);
Copy link
Contributor

Choose a reason for hiding this comment

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

how to handle the case when the train isn't supported by some algorithms?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

enter default branch and throw exception

Copy link

@zhanghg08 zhanghg08 left a comment

Choose a reason for hiding this comment

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

Approved, thanks for all the changes!

@jngz-es jngz-es merged commit 6c38e04 into opensearch-project:develop May 14, 2021
@jngz-es jngz-es deleted the dev branch May 14, 2021 05:15
jackiehanyang pushed a commit that referenced this pull request Nov 16, 2021
* add MLEngine interface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants