public class MlModel
extends java.lang.Object
By default, parameters are case insensitive and may not be null or empty unless otherwise specified.
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object arg0) |
java.lang.String |
getName()
Returns the name of this ML model.
|
java.lang.String |
getPath()
Returns the path of this ML model from the root.
|
int |
hashCode() |
MlPredictionStatus[] |
predict(java.lang.Object... input)
Returns the predicted values for the set of inputs.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
public java.lang.String getName()
public java.lang.String getPath()
public MlPredictionStatus[] predict(java.lang.Object... input)
input
- a list of input value arrays
Example call from Groovy to predict one value:
The predicted output value will be printed to the job console as follows: 512.4775380929867if (operation.application.hasMlModel("/Library", "Model 1")) { MlModel model = operation.application.getMlModel("/Library", "Model 1") println model.predict("1","2","3","4","5")[0].PredictedValue }
Example call from Groovy to predict multiple values:
The prediction output values or error messages will be printed to the job console as follows: 512.4775380929867 The number of inputs provided do not match the expected inputs by the ML model.def inputs = [["1","2","3","4","5"] as String[], ["6","8","9","10"] as String[]] if (operation.application.hasMlModel("/Library", "Model 1")) { MlModel model = operation.application.getMlModel("/Library", "Model 1") MlPredictionStatus[] predictedValue = model.predict(inputs) predictedValue.each() { MlPredictionStatus status -> println status.success ? status.predictedValue : status.errorMessage } }
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object arg0)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Copyright © 2017, 2024, Oracle and/or its affiliates. All rights reserved.