protected function init_analyser($options = array()) {

        $target = $this->get_target();
        $indicators = $this->get_indicators();

        if (empty($target)) {
            throw new \moodle_exception('errornotarget', 'analytics');
        }

        $timesplittings = array();
        if (empty($options['notimesplitting'])) {
            if (!empty($options['evaluation'])) {
                // The evaluation process will run using all available time splitting methods unless one is specified.
                if (!empty($options['timesplitting'])) {
                    $timesplitting = \core_analytics\manager::get_time_splitting($options['timesplitting']);
                    $timesplittings = array($timesplitting->get_id() => $timesplitting);
                } else {
                    $timesplittings = \core_analytics\manager::get_time_splitting_methods_for_evaluation();
                }
            } else {

                if (empty($this->model->timesplitting)) {
                    throw new \moodle_exception('invalidtimesplitting', 'analytics', '', $this->model->id);
                }

                // Returned as an array as all actions (evaluation, training and prediction) go through the same process.
                $timesplittings = array($this->model->timesplitting => $this->get_time_splitting());
            }

            if (empty($timesplittings)) {
                throw new \moodle_exception('errornotimesplittings', 'analytics');
            }
        }

        $classname = $target->get_analyser_class();
        if (!class_exists($classname)) {
            throw new \coding_exception($classname . ' class does not exists');
        }

        // Returns a \core_analytics\local\analyser\base class.
        $this->analyser = new $classname($this->model->id, $target, $indicators, $timesplittings, $options);
    }