public function trained_locally() : bool {
        global $DB;

        if (!$this->is_trained() || $this->is_static()) {
            // Early exit.
            return false;
        }

        if ($DB->record_exists('analytics_train_samples', ['modelid' => $this->model->id])) {
            return true;
        }

        return false;
    }