Module org.elasticsearch.xcore
Class LangIdentNeuralNetwork
java.lang.Object
org.elasticsearch.xpack.core.ml.inference.trainedmodel.langident.LangIdentNeuralNetwork
- All Implemented Interfaces:
org.apache.lucene.util.Accountable,NamedWriteable,Writeable,org.elasticsearch.xcontent.ToXContent,org.elasticsearch.xcontent.ToXContentObject,InferenceModel,LenientlyParsedTrainedModel,StrictlyParsedTrainedModel,TrainedModel,NamedXContentObject
public class LangIdentNeuralNetwork
extends Object
implements StrictlyParsedTrainedModel, LenientlyParsedTrainedModel, InferenceModel
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.elasticsearch.xcontent.ParseFieldstatic final org.elasticsearch.xcontent.ParseFieldstatic final org.elasticsearch.xcontent.ConstructingObjectParser<LangIdentNeuralNetwork, Void> static final org.elasticsearch.xcontent.ParseFieldstatic final org.elasticsearch.xcontent.ParseFieldstatic final org.elasticsearch.xcontent.ConstructingObjectParser<LangIdentNeuralNetwork, Void> Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLEFields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionLangIdentNeuralNetwork(String embeddedVectorFeatureName, LangNetLayer hiddenLayer, LangNetLayer softmaxLayer) -
Method Summary
Modifier and TypeMethodDescriptionbooleanlongstatic LangIdentNeuralNetworkfromXContentLenient(org.elasticsearch.xcontent.XContentParser parser) static LangIdentNeuralNetworkfromXContentStrict(org.elasticsearch.xcontent.XContentParser parser) String[]getName()inthashCode()infer(double[] embeddedVector, InferenceConfig config) Same asInferenceModel.infer(Map, InferenceConfig, Map)but the features are already extracted.Infer against the provided fieldslongvoidrewriteFeatureIndices(Map<String, Integer> newFeatureIndexMapping) Rewrites underlying feature index mappings.booleanorg.elasticsearch.xcontent.XContentBuildertoXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) voidvalidate()Runs validations against the model.voidwriteTo(StreamOutput out) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.util.Accountable
getChildResourcesMethods inherited from interface org.elasticsearch.xcontent.ToXContentObject
isFragmentMethods inherited from interface org.elasticsearch.xpack.core.ml.inference.trainedmodel.TrainedModel
getMinimalCompatibilityVersion
-
Field Details
-
NAME
public static final org.elasticsearch.xcontent.ParseField NAME -
EMBEDDED_VECTOR_FEATURE_NAME
public static final org.elasticsearch.xcontent.ParseField EMBEDDED_VECTOR_FEATURE_NAME -
HIDDEN_LAYER
public static final org.elasticsearch.xcontent.ParseField HIDDEN_LAYER -
SOFTMAX_LAYER
public static final org.elasticsearch.xcontent.ParseField SOFTMAX_LAYER -
STRICT_PARSER
public static final org.elasticsearch.xcontent.ConstructingObjectParser<LangIdentNeuralNetwork,Void> STRICT_PARSER -
LENIENT_PARSER
public static final org.elasticsearch.xcontent.ConstructingObjectParser<LangIdentNeuralNetwork,Void> LENIENT_PARSER
-
-
Constructor Details
-
LangIdentNeuralNetwork
public LangIdentNeuralNetwork(String embeddedVectorFeatureName, LangNetLayer hiddenLayer, LangNetLayer softmaxLayer) -
LangIdentNeuralNetwork
- Throws:
IOException
-
-
Method Details
-
fromXContentStrict
public static LangIdentNeuralNetwork fromXContentStrict(org.elasticsearch.xcontent.XContentParser parser) -
fromXContentLenient
public static LangIdentNeuralNetwork fromXContentLenient(org.elasticsearch.xcontent.XContentParser parser) -
infer
public InferenceResults infer(Map<String, Object> fields, InferenceConfig config, Map<String, String> featureDecoderMap) Description copied from interface:InferenceModelInfer against the provided fields- Specified by:
inferin interfaceInferenceModel- Parameters:
fields- The fields and their values to infer againstconfig- The configuration options for inferencefeatureDecoderMap- A map for decoding feature value names to their originating feature. Necessary for feature influence.- Returns:
- The predicted value. For classification this will be discrete values (e.g. 0.0, or 1.0). For regression this is continuous.
-
infer
Description copied from interface:InferenceModelSame asInferenceModel.infer(Map, InferenceConfig, Map)but the features are already extracted.- Specified by:
inferin interfaceInferenceModel
-
rewriteFeatureIndices
Description copied from interface:InferenceModelRewrites underlying feature index mappings. This is to allow optimization of the underlying models.- Specified by:
rewriteFeatureIndicesin interfaceInferenceModel
-
getFeatureNames
- Specified by:
getFeatureNamesin interfaceInferenceModel- Returns:
- The feature names in their desired order
-
targetType
- Specified by:
targetTypein interfaceInferenceModel- Specified by:
targetTypein interfaceTrainedModel- Returns:
TargetTypefor the model.
-
validate
public void validate()Description copied from interface:TrainedModelRuns validations against the model. Example:Treeshould check if there are any loops- Specified by:
validatein interfaceTrainedModel
-
estimatedNumOperations
public long estimatedNumOperations()- Specified by:
estimatedNumOperationsin interfaceTrainedModel- Returns:
- The estimated number of operations required at inference time
-
supportsFeatureImportance
public boolean supportsFeatureImportance()- Specified by:
supportsFeatureImportancein interfaceInferenceModel- Returns:
- Does the model support feature importance
-
ramBytesUsed
public long ramBytesUsed()- Specified by:
ramBytesUsedin interfaceorg.apache.lucene.util.Accountable
-
getWriteableName
- Specified by:
getWriteableNamein interfaceNamedWriteable
-
writeTo
- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
getName
- Specified by:
getNamein interfaceInferenceModel- Specified by:
getNamein interfaceNamedXContentObject- Returns:
- The name of the XContentObject that is to be serialized
-
toXContent
public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceorg.elasticsearch.xcontent.ToXContent- Throws:
IOException
-
equals
-
hashCode
public int hashCode()
-