原英文版地址: https://www.elastic.co/guide/en/elasticsearch/reference/7.7/get-dfanalytics-stats.html, 原文档版权归 www.elastic.co 所有
本地英文版地址: ../en/get-dfanalytics-stats.html

Get data frame analytics jobs statistics APIedit

Retrieves usage information for data frame analytics jobs.

This functionality is experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.

Requestedit

GET _ml/data_frame/analytics/<data_frame_analytics_id>/_stats

GET _ml/data_frame/analytics/<data_frame_analytics_id>,<data_frame_analytics_id>/_stats

GET _ml/data_frame/analytics/_stats

GET _ml/data_frame/analytics/_all/_stats

GET _ml/data_frame/analytics/*/_stats

Prerequisitesedit

If the Elasticsearch security features are enabled, you must have the following privileges:

  • cluster: monitor_ml

For more information, see Security privileges and Built-in roles.

Path parametersedit

<data_frame_analytics_id>
(Optional, string) Identifier for the data frame analytics job. If you do not specify this option, the API returns information for the first hundred data frame analytics jobs.

Query parametersedit

allow_no_match

(Optional, boolean) Specifies what to do when the request:

  • Contains wildcard expressions and there are no data frame analytics jobs that match.
  • Contains the _all string or no identifiers and there are no matches.
  • Contains wildcard expressions and there are only partial matches.

The default value is true, which returns an empty data_frame_analytics array when there are no matches and the subset of results when there are partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches.

from
(Optional, integer) Skips the specified number of data frame analytics jobs. The default value is 0.
size
(Optional, integer) Specifies the maximum number of data frame analytics jobs to obtain. The default value is 100.

Response bodyedit

data_frame_analytics

(array) An array of objects that contain usage information for data frame analytics jobs, which are sorted by the id value in ascending order.

Properties of data frame analytics job usage resources
analysis_stats

(object) An object containing information about the analysis job.

Properties of analysis_stats
classification_stats

(object) An object containing information about the classification analysis job.

Properties of classification_stats
hyperparameters

(object) An object containing the parameters of the classification analysis job.

Properties of hyperparameters
alpha
(double) Regularization factor to penalize deeper trees when training decision trees.
class_assignment_objective
(string) Defines the objective to optimize when assigning class labels: maximize_accuracy or maximize_minimum_recall. When maximizing accuracy, class labels are chosen to maximize the number of correct predictions. When maximizing minimum recall, labels are chosen to maximize the minimum recall for any class. Defaults to maximize_minimum_recall.
downsample_factor
(double) The value of the downsample factor.
eta
(double) Advanced configuration option. The shrinkage applied to the weights. Smaller values result in larger forests which have a better generalization error. However, the smaller the value the longer the training will take. For more information, about shrinkage, see this wiki article.
eta_growth_rate_per_tree
(double) Specifies the rate at which the eta increases for each new tree that is added to the forest. For example, a rate of 1.05 increases eta by 5%.
feature_bag_fraction
(double) Advanced configuration option. Defines the fraction of features that will be used when selecting a random bag for each candidate split. By default, this value is calculated during hyperparameter optimization.
gamma
(double) Advanced configuration option. Regularization parameter to prevent overfitting on the training data set. Multiplies a linear penalty associated with the size of individual trees in the forest. The higher the value the more training will prefer smaller trees. The smaller this parameter the larger individual trees will be and the longer training will take. By default, this value is calculated during hyperparameter optimization.
lambda
(double) Advanced configuration option. Regularization parameter to prevent overfitting on the training data set. Multiplies an L2 regularisation term which applies to leaf weights of the individual trees in the forest. The higher the value the more training will attempt to keep leaf weights small. This makes the prediction function smoother at the expense of potentially not being able to capture relevant relationships between the features and the dependent variable. The smaller this parameter the larger individual trees will be and the longer training will take. By default, this value is calculated during hyperparameter optimization.
max_attempts_to_add_tree
(integer) If the algorithm fails to determine a non-trivial tree (more than a single leaf), this parameter determines how many of such consecutive failures are tolerated. Once the number of attempts exceeds the threshold, the forest training stops.
max_optimization_rounds_per_hyperparameter
(integer) A multiplier responsible for determining the maximum number of hyperparameter optimization steps in the Bayesian optimization procedure. The maximum number of steps is determined based on the number of undefined hyperparameters times the maximum optimization rounds per hyperparameter.
max_trees
(integer) Advanced configuration option. Defines the maximum number of trees the forest is allowed to contain. The maximum value is 2000. By default, this value is calculated during hyperparameter optimization.
num_folds
(integer) The maximum number of folds for the cross-validation procedure.
num_splits_per_feature
(integer) Determines the maximum number of splits for every feature that can occur in a decision tree when the tree is trained.
soft_tree_depth_limit
(double) Tree depth limit is used for calculating the tree depth penalty. This is a soft limit, it can be exceeded.
soft_tree_depth_tolerance
(double) Tree depth tolerance is used for calculating the tree depth penalty. This is a soft limit, it can be exceeded.
iteration
(integer) The number of iterations on the analysis.
timestamp
(date) The timestamp when the statistics were reported in milliseconds since the epoch.
timing_stats

(object) An object containing time statistics about the data frame analytics job.

Properties of timing_stats
elapsed_time
(integer) Runtime of the analysis in milliseconds.
iteration_time
(integer) Runtime of the latest iteration of the analysis in milliseconds.
validation_loss

(object) An object containing information about validation loss.

Properties of validation_loss
fold_values
(array of strings) Validation loss values for every added decision tree during the forest growing procedure.
loss_type
(string) The type of the loss metric. For example, binomial_logistic.
outlier_detection_stats

(object) An object containing information about the outlier detection job.

Properties of outlier_detection_stats
parameters

(object) The list of job parameters specified by the user or determined by algorithmic heuristics.

Properties of parameters
compute_feature_influence
(boolean) Specifies whether the feature influence calculation is enabled. Defaults to true.
feature_influence_threshold
(double) The minimum outlier score that a document needs to have in order to calculate its feature influence score. Value range: 0-1 (0.1 by default).
method
(string) The method that outlier detection uses. Available methods are lof, ldof, distance_kth_nn, distance_knn, and ensemble. The default value is ensemble, which means that outlier detection uses an ensemble of different methods and normalises and combines their individual outlier scores to obtain the overall outlier score.
n_neighbors
(integer) Defines the value for how many nearest neighbors each method of outlier detection uses to calculate its outlier score. When the value is not set, different values are used for different ensemble members. This default behavior helps improve the diversity in the ensemble; only override it if you are confident that the value you choose is appropriate for the data set.
outlier_fraction
(double) The proportion of the data set that is assumed to be outlying prior to outlier detection. For example, 0.05 means it is assumed that 5% of values are real outliers and 95% are inliers.

The proportion of the data set that is assumed to be outlying prior to outlier detection.

standardization_enabled
(boolean) If true, the following operation is performed on the columns before computing outlier scores: (x_i - mean(x_i)) / sd(x_i). Defaults to true. For more information about this concept, see Wikipedia.
timestamp
(date) The timestamp when the statistics were reported in milliseconds since the epoch.
timing_stats

(object) An object containing time statistics about the data frame analytics job.

Property of timing_stats
elapsed_time
(integer) Runtime of the analysis in milliseconds.
regression_stats

(object) An object containing information about the regression analysis job.

Properties of regression_stats
hyperparameters

(object) An object containing the parameters of the regression analysis job.

Properties of hyperparameters
alpha
(double) Regularization factor to penalize deeper trees when training decision trees.
downsample_factor
(double) The value of the downsample factor.
eta
(double) Advanced configuration option. The shrinkage applied to the weights. Smaller values result in larger forests which have a better generalization error. However, the smaller the value the longer the training will take. For more information, about shrinkage, see this wiki article.
eta_growth_rate_per_tree
(double) Specifies the rate at which the eta increases for each new tree that is added to the forest. For example, a rate of 1.05 increases eta by 5%.
feature_bag_fraction
(double) Advanced configuration option. Defines the fraction of features that will be used when selecting a random bag for each candidate split. By default, this value is calculated during hyperparameter optimization.
gamma
(double) Advanced configuration option. Regularization parameter to prevent overfitting on the training data set. Multiplies a linear penalty associated with the size of individual trees in the forest. The higher the value the more training will prefer smaller trees. The smaller this parameter the larger individual trees will be and the longer training will take. By default, this value is calculated during hyperparameter optimization.
lambda
(double) Advanced configuration option. Regularization parameter to prevent overfitting on the training data set. Multiplies an L2 regularisation term which applies to leaf weights of the individual trees in the forest. The higher the value the more training will attempt to keep leaf weights small. This makes the prediction function smoother at the expense of potentially not being able to capture relevant relationships between the features and the dependent variable. The smaller this parameter the larger individual trees will be and the longer training will take. By default, this value is calculated during hyperparameter optimization.
max_attempts_to_add_tree
(integer) If the algorithm fails to determine a non-trivial tree (more than a single leaf), this parameter determines how many of such consecutive failures are tolerated. Once the number of attempts exceeds the threshold, the forest training stops.
max_optimization_rounds_per_hyperparameter
(integer) A multiplier responsible for determining the maximum number of hyperparameter optimization steps in the Bayesian optimization procedure. The maximum number of steps is determined based on the number of undefined hyperparameters times the maximum optimization rounds per hyperparameter.
max_trees
(integer) Advanced configuration option. Defines the maximum number of trees the forest is allowed to contain. The maximum value is 2000. By default, this value is calculated during hyperparameter optimization.
num_folds
(integer) The maximum number of folds for the cross-validation procedure.
num_splits_per_feature
(integer) Determines the maximum number of splits for every feature that can occur in a decision tree when the tree is trained.
soft_tree_depth_limit
(double) Tree depth limit is used for calculating the tree depth penalty. This is a soft limit, it can be exceeded.
soft_tree_depth_tolerance
(double) Tree depth tolerance is used for calculating the tree depth penalty. This is a soft limit, it can be exceeded.
iteration
(integer) The number of iterations on the analysis.
timestamp
(date) The timestamp when the statistics were reported in milliseconds since the epoch.
timing_stats

(object) An object containing time statistics about the data frame analytics job.

Propertis of timing_stats
elapsed_time
(integer) Runtime of the analysis in milliseconds.
iteration_time
(integer) Runtime of the latest iteration of the analysis in milliseconds.
validation_loss

(object) An object containing information about validation loss.

Properties of validation_loss
fold_values
(array of strings) Validation loss values for every added decision tree during the forest growing procedure.
loss_type
(string) The type of the loss metric. For example, binomial_logistic.
assignment_explanation
(string) For running jobs only, contains messages relating to the selection of a node to run the job.
data_counts

(object) An object that provides counts for the quantity of documents skipped, used in training, or available for testing.

Properties of data_counts
skipped_docs_count
(integer) The number of documents that are skipped during the analysis because they contained values that are not supported by the analysis. For example, outlier detection does not support missing fields so it skips documents with missing fields. Likewise, all types of analysis skip documents that contain arrays with more than one element.
test_docs_count
(integer) The number of documents that are not used for training the model and can be used for testing.
training_docs_count
(integer) The number of documents that are used for training the model.
id
(string) The unique identifier of the data frame analytics job.
memory_usage

(Optional, object) An object describing memory usage of the analytics. It is present only after the job is started and memory usage is reported.

Properties of memory_usage
peak_usage_bytes
(long) The number of bytes used at the highest peak of memory usage.
timestamp
(date) The timestamp when memory usage was calculated.
node

(object) Contains properties for the node that runs the job. This information is available only for running jobs.

Properties of node
attributes
(object) Lists node attributes such as ml.machine_memory or ml.max_open_jobs settings.
ephemeral_id
(string) The ephemeral ID of the node.
id
(string) The unique identifier of the node.
name
(string) The node name.
transport_address
(string) The host and port where transport HTTP connections are accepted.
progress

(array) The progress report of the data frame analytics job by phase.

Properties of phase objects
phase
(string) Defines the phase of the data frame analytics job. Possible phases: reindexing, loading_data, analyzing, and writing_results.
progress_percent
(integer) The progress that the data frame analytics job has made expressed in percentage.
state
(string) The status of the data frame analytics job, which can be one of the following values: analyzing, failed, reindexing, started, starting, stopped, stopping.

Response codesedit

404 (Missing resources)
If allow_no_match is false, this code indicates that there are no resources that match the request or only partial matches for the request.

Examplesedit

The following API retrieves usage information for the outlier detection data frame analytics job example:

GET _ml/data_frame/analytics/ecommerce/_stats

The API returns the following results:

{
  "count" : 1,
  "data_frame_analytics" : [
    {
      "id" : "ecommerce",
      "state" : "stopped",
      "progress" : [
        {
          "phase" : "reindexing",
          "progress_percent" : 100
        },
        {
          "phase" : "loading_data",
          "progress_percent" : 100
        },
        {
          "phase" : "analyzing",
          "progress_percent" : 100
        },
        {
          "phase" : "writing_results",
          "progress_percent" : 100
        }
      ],
      "data_counts" : {
        "training_docs_count" : 3321,
        "test_docs_count" : 0,
        "skipped_docs_count" : 0
      },
      "memory_usage" : {
        "timestamp" : 1586905058000,
        "peak_usage_bytes" : 279484
      },
      "analysis_stats" : {
        "outlier_detection_stats" : {
          "timestamp" : 1586905058000,
          "parameters" : {
            "n_neighbors" : 0,
            "method" : "ensemble",
            "compute_feature_influence" : true,
            "feature_influence_threshold" : 0.1,
            "outlier_fraction" : 0.05,
            "standardization_enabled" : true
          },
          "timing_stats" : {
            "elapsed_time" : 245
          }
        }
      }
    }
  ]
}