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:
if (operation.application.hasMlModel("/Library", "Model 1")) {
MlModel model = operation.application.getMlModel("/Library", "Model 1")
println model.predict("1","2","3","4","5")[0].PredictedValue
}
The predicted output value will be printed to the job console as follows:
512.4775380929867
Example call from Groovy to predict multiple values:
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
}
}
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.public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object arg0)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.ObjectCopyright © 2017, 2025, Oracle and/or its affiliates. All rights reserved.