// SPDX-License-Identifier: GPL-3.0-or-later#include<dlib/clustering.h>#include"ml-private.h"#include<random>#include"ad_charts.h"typedefstruct{calculated_number_t*training_cns;calculated_number_t*scratch_training_cns;std::vector<DSample>training_samples;}ml_tls_data_t;staticthread_localml_tls_data_ttls_data;/* * Functions to convert enums to strings*/__attribute__((unused))staticconstchar*ml_machine_learning_status_to_string(enumml_machine_learning_statusmls){switch(mls){caseMACHINE_LEARNING_STATUS_ENABLED:return"enabled";caseMACHINE_LEARNING_STATUS_DISABLED_DUE_TO_EXCLUDED_CHART:return"disabled-sp";default:return"unknown";}}__attribute__((unused))staticconstchar*ml_metric_type_to_string(enumml_metric_typemt){switch(mt){caseMETRIC_TYPE_CONSTANT:return"constant";caseMETRIC_TYPE_VARIABLE:return"variable";default:return"unknown";}}__attribute__((unused))staticconstchar*ml_training_status_to_string(enumml_training_statusts){switch(ts){caseTRAINING_STATUS_PENDING_WITH_MODEL:return"pending-with-model";caseTRAINING_STATUS_PENDING_WITHOUT_MODEL:return"pending-without-model";caseTRAINING_STATUS_TRAINED:return"trained";caseTRAINING_STATUS_UNTRAINED:return"untrained";default:return"unknown";}}__attribute__((unused))staticconstchar*ml_training_result_to_string(enumml_training_resulttr){switch(tr){caseTRAINING_RESULT_OK:return"ok";caseTRAINING_RESULT_INVALID_QUERY_TIME_RANGE:return"invalid-query";caseTRAINING_RESULT_NOT_ENOUGH_COLLECTED_VALUES:return"missing-values";caseTRAINING_RESULT_NULL_ACQUIRED_DIMENSION:return"null-acquired-dim";caseTRAINING_RESULT_CHART_UNDER_REPLICATION:return"chart-under-replication";default