See Release Notes
Long Term Support Release
Differences Between: [Versions 39 and 401]
Abstract base target.
Copyright: | 2016 David Monllao {@link http://www.davidmonllao.com} |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 459 lines (17 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
base:: (20 methods):
uses_insights()
link_insights_report()
based_on_assumptions()
always_update_analysis_time()
prediction_actions()
bulk_actions()
add_bulk_actions_js()
get_view_details_text()
prediction_callback()
generate_insight_notifications()
get_insights_users()
get_insight_context_url()
get_insight_subject()
get_insight_body()
get_insight_body_for_prediction()
instance()
min_prediction_score()
triggers_callback()
calculate()
filter_out_invalid_samples()
uses_insights() X-Ref |
Is this target generating insights? Defaults to true. return: bool |
link_insights_report() X-Ref |
Should the insights of this model be linked from reports? return: bool |
based_on_assumptions() X-Ref |
Based on facts (processed by machine learning backends) by default. return: bool |
always_update_analysis_time() X-Ref |
Update the last analysis time on analysable processed or always. If you overwrite this method to return false the last analysis time will only be recorded in DB when the element successfully analysed. You can safely return false for lightweight targets. return: bool |
prediction_actions(\core_analytics\prediction $prediction, $includedetailsaction = false,$isinsightuser = false) X-Ref |
Suggested actions for a user. param: \core_analytics\prediction $prediction param: bool $includedetailsaction param: bool $isinsightuser Force all the available actions to be returned as it the user who return: \core_analytics\prediction_action[] |
bulk_actions(array $predictions) X-Ref |
Suggested bulk actions for a user. param: \core_analytics\prediction[] $predictions List of predictions suitable for the bulk actions to use. return: \core_analytics\bulk_action[] The list of bulk actions. |
add_bulk_actions_js() X-Ref |
Adds the JS required to run the bulk actions. |
get_view_details_text() X-Ref |
Returns the view details link text. return: string |
prediction_callback($modelid, $sampleid, $rangeindex, \context $samplecontext, $prediction, $predictionscore) X-Ref |
Callback to execute once a prediction has been returned from the predictions processor. Note that the analytics_predictions db record is not yet inserted. param: int $modelid param: int $sampleid param: int $rangeindex param: \context $samplecontext param: float|int $prediction param: float $predictionscore return: void |
generate_insight_notifications($modelid, $samplecontexts, array $predictions = []) X-Ref |
Generates insights notifications param: int $modelid param: \context[] $samplecontexts param: \core_analytics\prediction[] $predictions return: void |
get_insights_users(\context $context) X-Ref |
Returns the list of users that will receive insights notifications. Feel free to overwrite if you need to but keep in mind that moodle/analytics:listinsights or moodle/analytics:listowninsights capability is required to access the list of insights. param: \context $context return: array |
get_insight_context_url($modelid, $context) X-Ref |
URL to the insight. param: int $modelid param: \context $context return: \moodle_url |
get_insight_subject(int $modelid, \context $context) X-Ref |
The insight notification subject. This is just a default message, you should overwrite it for a custom insight message. param: int $modelid param: \context $context return: string |
get_insight_body(\context $context, string $contextname, \stdClass $user, \moodle_url $insighturl) X-Ref |
Returns the body message for an insight with multiple predictions. This default method is executed when the analysable used by the model generates multiple insight for each analysable (one_sample_per_analysable === false) param: \context $context param: string $contextname param: \stdClass $user param: \moodle_url $insighturl return: string[] The plain text message and the HTML message |
get_insight_body_for_prediction(\context $context, \stdClass $user, \core_analytics\prediction $prediction,array &$actions) X-Ref |
Returns the body message for an insight for a single prediction. This default method is executed when the analysable used by the model generates one insight for each analysable (one_sample_per_analysable === true) param: \context $context param: \stdClass $user param: \core_analytics\prediction $prediction param: \core_analytics\action[] $actions Passed by reference to remove duplicate links to actions. return: array Plain text msg, HTML message and the main URL for this |
instance() X-Ref |
Returns an instance of the child class. Useful to reset cached data. return: \core_analytics\base\target |
min_prediction_score() X-Ref |
Defines a boundary to ignore predictions below the specified prediction score. Value should go from 0 to 1. return: float |
triggers_callback($predictedvalue, $predictionscore) X-Ref |
This method determines if a prediction is interesing for the model or not. param: mixed $predictedvalue param: float $predictionscore return: bool |
calculate($sampleids, \core_analytics\analysable $analysable, $starttime = false, $endtime = false) X-Ref |
Calculates the target. Returns an array of values which size matches $sampleids size. Rows with null values will be skipped as invalid by time splitting methods. param: array $sampleids param: \core_analytics\analysable $analysable param: int $starttime param: int $endtime return: array The format to follow is [userid] = scalar|null |
filter_out_invalid_samples(&$sampleids, \core_analytics\analysable $analysable, $fortraining = true) X-Ref |
Filters out invalid samples for training. param: int[] $sampleids param: \core_analytics\analysable $analysable param: bool $fortraining return: void |