-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
[ML][Inference] Adding classification_weights to ensemble models #50874
[ML][Inference] Adding classification_weights to ensemble models #50874
Conversation
classification_weights are a way to allow models to prefer specific classification results over others this might be advantageous if classification value probabilities are a known quantity and can improve model error rates.
Pinging @elastic/ml-core (:ml) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I noted some minor things and would like to see the classification labels in LangIdentNeuralNetwork::toXContent
|
||
if (classificationLabels != null && probabilities.size() != classificationLabels.size()) { | ||
throw ExceptionsHelper | ||
.serverError( | ||
"model returned classification probabilities of size [{}] which is not equal to classification labels size [{}]", | ||
"model returned classification probabilities of size [{}] which is not equal to classification labels size {}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better how it was before [{}]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 possibly? I might want to switch this around a bit. It is writing out the classification labels array not the size. Woops!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha
@@ -156,11 +146,6 @@ public TargetType targetType() { | |||
return TargetType.CLASSIFICATION; | |||
} | |||
|
|||
@Override | |||
public List<String> classificationLabels() { | |||
return LANGUAGE_NAMES; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding LANGUAGE_NAMES
to toXContent
and the parser. Tree
includes the labels in its xcontent representation
...e/src/main/java/org/elasticsearch/xpack/core/ml/inference/trainedmodel/InferenceHelpers.java
Show resolved
Hide resolved
/** | ||
* @return List of featureNames expected by the model. In the order that they are expected | ||
*/ | ||
List<String> getFeatureNames(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both these methods are just not called anywhere? Is that why they are removed? If so 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I am cleaning up the interface. I added a bunch of stuff that I thought "all" models would need, and it turns out that that is not the case.
@elasticmachine update branch |
…stic#50874) * [ML][Inference] Adding classification_weights to ensemble models classification_weights are a way to allow models to prefer specific classification results over others this might be advantageous if classification value probabilities are a known quantity and can improve model error rates.
) (#50994) * [ML][Inference] Adding classification_weights to ensemble models classification_weights are a way to allow models to prefer specific classification results over others this might be advantageous if classification value probabilities are a known quantity and can improve model error rates.
…stic#50874) * [ML][Inference] Adding classification_weights to ensemble models classification_weights are a way to allow models to prefer specific classification results over others this might be advantageous if classification value probabilities are a known quantity and can improve model error rates.
classification_weights are a way to allow models to
prefer specific classification results over others
this might be advantageous if classification value
probabilities are a known quantity and can improve
model error rates.