Skip to content

Commit

Permalink
Add input configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkyle committed Oct 2, 2023
1 parent d721d6f commit d8803b5
Show file tree
Hide file tree
Showing 8 changed files with 570 additions and 70 deletions.
13 changes: 13 additions & 0 deletions docs/reference/ingest/processors/inference.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,23 @@ ingested in the pipeline.
| `model_id` . | yes | - | (String) The ID or alias for the trained model, or the ID of the deployment.
| `target_field` | no | `ml.inference.<processor_tag>` | (String) Field added to incoming documents to contain results objects.
| `field_map` | no | If defined the model's default field map | (Object) Maps the document field names to the known field names of the model. This mapping takes precedence over any default mappings provided in the model configuration.
| `input_field` | no |
| `inference_config` | no | The default settings defined in the model | (Object) Contains the inference type and its options.
include::common-options.asciidoc[]
|======

[source,js]
--------------------------------------------------
{
"inference": {
"model_id": "model_deployment_for_inference",
"target_field": "FlightDelayMin_prediction_infer",
"input_field": ""
"inference_config": { "regression": {} }
}
}
--------------------------------------------------
// NOTCONSOLE

[source,js]
--------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class ClassificationConfig implements LenientlyParsedInferenceConfig, Str

public static final ParseField NAME = new ParseField("classification");

public static final ParseField RESULTS_FIELD = new ParseField("results_field");
public static final ParseField NUM_TOP_CLASSES = new ParseField("num_top_classes");
public static final ParseField TOP_CLASSES_RESULTS_FIELD = new ParseField("top_classes_results_field");
public static final ParseField NUM_TOP_FEATURE_IMPORTANCE_VALUES = new ParseField("num_top_feature_importance_values");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@

import org.elasticsearch.TransportVersion;
import org.elasticsearch.common.io.stream.VersionedNamedWriteable;
import org.elasticsearch.xcontent.ParseField;
import org.elasticsearch.xpack.core.ml.MlConfigVersion;
import org.elasticsearch.xpack.core.ml.utils.NamedXContentObject;

public interface InferenceConfig extends NamedXContentObject, VersionedNamedWriteable {

String DEFAULT_TOP_CLASSES_RESULTS_FIELD = "top_classes";
String DEFAULT_RESULTS_FIELD = "predicted_value";
ParseField RESULTS_FIELD = new ParseField("results_field");

boolean isTargetTypeSupported(TargetType targetType);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public interface NlpConfig extends LenientlyParsedInferenceConfig, StrictlyParse
ParseField VOCABULARY = new ParseField("vocabulary");
ParseField TOKENIZATION = new ParseField("tokenization");
ParseField CLASSIFICATION_LABELS = new ParseField("classification_labels");
ParseField RESULTS_FIELD = new ParseField("results_field");
ParseField NUM_TOP_CLASSES = new ParseField("num_top_classes");

MlConfigVersion MINIMUM_NLP_SUPPORTED_VERSION = MlConfigVersion.V_8_0_0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class RegressionConfig implements LenientlyParsedInferenceConfig, Strictl
public static final ParseField NAME = new ParseField("regression");
private static final MlConfigVersion MIN_SUPPORTED_VERSION = MlConfigVersion.V_7_6_0;
private static final TransportVersion MIN_SUPPORTED_TRANSPORT_VERSION = TransportVersions.V_7_6_0;
public static final ParseField RESULTS_FIELD = new ParseField("results_field");
public static final ParseField NUM_TOP_FEATURE_IMPORTANCE_VALUES = new ParseField("num_top_feature_importance_values");

public static RegressionConfig EMPTY_PARAMS = new RegressionConfig(DEFAULT_RESULTS_FIELD, null);
Expand Down
Loading

0 comments on commit d8803b5

Please sign in to comment.