MDL-65639 analytics: From time-splitting method to analysis interval

This change only affects the Moodle UI.
This commit is contained in:
David Monllaó 2019-05-22 17:20:20 +02:00
parent f3507273e9
commit 21cf3ec8d4
7 changed files with 48 additions and 48 deletions

View File

@ -156,7 +156,7 @@ class models_list implements \renderable, \templatable {
$modeldata->timesplittinghelp = $helpicon->export_for_template($output);
} else {
// We really want to encourage developers to add help to their time splitting methods.
debugging("The time splitting method '{$modeldata->timesplitting}' should include a '{$identifier}_help'
debugging("The analysis interval '{$modeldata->timesplitting}' should include a '{$identifier}_help'
string to describe its purpose.", DEBUG_DEVELOPER);
}
} else {

View File

@ -32,20 +32,20 @@ $help = "Enables the provided model.
Options:
--modelid Model id
--list List models
--timesplitting Time splitting method full class name
--analysisinterval Time splitting method full class name
-h, --help Print out this help
Example:
\$ php admin/tool/analytics/cli/enable_model.php --modelid=1 --timesplitting=\"\\core\\analytics\\time_splitting\\quarters\"
\$ php admin/tool/analytics/cli/enable_model.php --modelid=1 --analysisinterval=\"\\core\\analytics\\time_splitting\\quarters\"
";
// Now get cli options.
list($options, $unrecognized) = cli_get_params(
array(
'help' => false,
'list' => false,
'modelid' => false,
'timesplitting' => false
'help' => false,
'list' => false,
'modelid' => false,
'analysisinterval' => false
),
array(
'h' => 'help',
@ -62,7 +62,7 @@ if ($options['list'] || $options['modelid'] === false) {
exit(0);
}
if ($options['timesplitting'] === false) {
if ($options['analysisinterval'] === false) {
echo $help;
exit(0);
}
@ -73,7 +73,7 @@ if ($options['timesplitting'] === false) {
$model = new \core_analytics\model($options['modelid']);
// Evaluate its suitability to predict accurately.
$model->enable($options['timesplitting']);
$model->enable($options['analysisinterval']);
cli_heading(get_string('success'));
exit(0);

View File

@ -33,7 +33,7 @@ Options:
--modelid Model id
--list List models
--non-interactive Not interactive questions
--timesplitting Restrict the evaluation to 1 single time splitting method (Optional)
--analysisinterval Restrict the evaluation to 1 single analysis interval (Optional)
--filter Analyser dependant. e.g. A courseid would evaluate the model using a single course (Optional)
--mode 'configuration' or 'trainedmodel'. You can only use mode=trainedmodel when the trained" .
" model was imported" . "
@ -42,7 +42,7 @@ Options:
-h, --help Print out this help
Example:
\$ php admin/tool/analytics/cli/evaluate_model.php --modelid=1 --timesplitting='\\core\\analytics\\time_splitting\\quarters' --filter=123,321
\$ php admin/tool/analytics/cli/evaluate_model.php --modelid=1 --analysisinterval='\\core\\analytics\\time_splitting\\quarters' --filter=123,321
";
// Now get cli options.
@ -51,7 +51,7 @@ list($options, $unrecognized) = cli_get_params(
'help' => false,
'modelid' => false,
'list' => false,
'timesplitting' => false,
'analysisinterval' => false,
'mode' => 'configuration',
'reuse-prev-analysed' => true,
'non-interactive' => false,
@ -87,8 +87,8 @@ if ($options['mode'] !== 'configuration' && $options['mode'] !== 'trainedmodel')
cli_error('Error: The provided mode is not supported');
}
if ($options['mode'] == 'trainedmodel' && $options['timesplitting']) {
cli_error('Sorry, no time splitting method can be specified when using \'trainedmodel\' mode.');
if ($options['mode'] == 'trainedmodel' && $options['analysisinterval']) {
cli_error('Sorry, no analysis interval can be specified when using \'trainedmodel\' mode.');
}
// We need admin permissions.
@ -104,7 +104,7 @@ if ($options['reuse-prev-analysed']) {
$analyseroptions = array(
'filter' => $options['filter'],
'timesplitting' => $options['timesplitting'],
'timesplitting' => $options['analysisinterval'],
'reuseprevanalysed' => $options['reuse-prev-analysed'],
'mode' => $options['mode'],
);

View File

@ -24,7 +24,7 @@
$string['accuracy'] = 'Accuracy';
$string['allpredictions'] = 'All predictions';
$string['alltimesplittingmethods'] = 'All time-splitting methods';
$string['alltimesplittingmethods'] = 'All analysis intervals';
$string['analysingsitedata'] = 'Analysing the site';
$string['analyticmodels'] = 'Analytics models';
$string['bettercli'] = 'Evaluating models and generating predictions may involve heavy processing. It is recommended to run these actions from the command line.';
@ -33,7 +33,7 @@ $string['cantguessenddate'] = 'Can\'t guess the end date';
$string['classdoesnotexist'] = 'Class {$a} does not exist';
$string['clearpredictions'] = 'Clear predictions';
$string['clearmodelpredictions'] = 'Are you sure you want to clear all "{$a}" predictions?';
$string['clienablemodel'] = 'You can enable the model by selecting a time-splitting method by its ID. Note that you can also enable it later using the web interface (\'none\' to exit).';
$string['clienablemodel'] = 'You can enable the model by selecting an analysis interval by its ID. Note that you can also enable it later using the web interface (\'none\' to exit).';
$string['clievaluationandpredictions'] = 'A scheduled task iterates through enabled models and gets predictions. Models evaluation via the web interface is disabled. You can allow these processes to be executed manually via the web interface by disabling the <a href="{$a}">\'onlycli\'</a> analytics setting.';
$string['clievaluationandpredictionsnoadmin'] = 'A scheduled task iterates through enabled models and gets predictions. Models evaluation via the web interface is disabled. It may be enabled by a site administrator.';
$string['component'] = 'Component';
@ -41,14 +41,14 @@ $string['componentcore'] = 'Core';
$string['componentselect'] = 'Select all models provided by the component \'{$a}\'';
$string['componentselectnone'] = 'Unselect all';
$string['createmodel'] = 'Create model';
$string['currenttimesplitting'] = 'Current time-splitting method';
$string['currenttimesplitting'] = 'Current analysis interval';
$string['delete'] = 'Delete';
$string['deletemodelconfirmation'] = 'Are you sure you want to delete "{$a}"? These changes cannot be reverted.';
$string['disabled'] = 'Disabled';
$string['editmodel'] = 'Edit "{$a}" model';
$string['edittrainedwarning'] = 'This model has already been trained. Note that changing its indicators or its time-splitting method will delete its previous predictions and start generating new predictions.';
$string['edittrainedwarning'] = 'This model has already been trained. Note that changing its indicators or its analysis interval will delete its previous predictions and start generating new predictions.';
$string['enabled'] = 'Enabled';
$string['errorcantenablenotimesplitting'] = 'You need to select a time-splitting method before enabling the model';
$string['errorcantenablenotimesplitting'] = 'You need to select an analysis interval before enabling the model';
$string['errornoenabledandtrainedmodels'] = 'There are no enabled and trained models to predict.';
$string['errornoenabledmodels'] = 'There are no enabled models to train.';
$string['errornoexport'] = 'Only trained models can be exported';
@ -75,8 +75,8 @@ $string['export'] = 'Export';
$string['exportincludeweights'] = 'Include the weights of the trained model';
$string['exportmodel'] = 'Export configuration';
$string['exporttrainingdata'] = 'Export training data';
$string['getpredictionsresultscli'] = 'Results using {$a->name} (id: {$a->id}) time-splitting method';
$string['getpredictionsresults'] = 'Results using {$a->name} time-splitting method';
$string['getpredictionsresultscli'] = 'Results using {$a->name} (id: {$a->id}) analysis interval';
$string['getpredictionsresults'] = 'Results using {$a->name} analysis interval';
$string['extrainfo'] = 'Info';
$string['generalerror'] = 'Evaluation error. Status code {$a}';
$string['getpredictions'] = 'Get predictions';
@ -103,7 +103,7 @@ $string['modelid'] = 'Model ID';
$string['modelinvalidanalysables'] = 'Invalid analysable elements for "{$a}" model';
$string['modelname'] = 'Model name';
$string['modelresults'] = '{$a} results';
$string['modeltimesplitting'] = 'Time splitting';
$string['modeltimesplitting'] = 'Analysis interval';
$string['newmodel'] = 'New model';
$string['nextpage'] = 'Next page';
$string['nodatatoevaluate'] = 'There is no data to evaluate the model';
@ -125,12 +125,12 @@ $string['restoredefaultsome'] = 'Succesfully re-created {$a->count} new model(s)
$string['restoredefaultsubmit'] = 'Restore selected';
$string['samestartdate'] = 'Current start date is good';
$string['sameenddate'] = 'Current end date is good';
$string['selecttimesplittingforevaluation'] = 'Select the time-splitting method you want to use to evaluate the model configuration.';
$string['selecttimesplittingforevaluation'] = 'Select the analysis interval you want to use to evaluate the model configuration.';
$string['target'] = 'Target';
$string['target_help'] = 'The target is what the model will predict.';
$string['target_link'] = 'Targets';
$string['timesplittingnotdefined'] = 'Time splitting is not defined.';
$string['timesplittingnotdefined_help'] = 'You need to select a time-splitting method before enabling the model.';
$string['timesplittingnotdefined'] = 'No analysis interval is defined.';
$string['timesplittingnotdefined_help'] = 'You need to select an analysis interval before enabling the model.';
$string['trainandpredictmodel'] = 'Training model and calculating predictions';
$string['trainingprocessfinished'] = 'Training process finished';
$string['trainingresults'] = 'Training results';

View File

@ -30,8 +30,8 @@ $string['analyticslogstore'] = 'Log store used for analytics';
$string['analyticslogstore_help'] = 'The log store that will be used by the analytics API to read users\' activity.';
$string['analyticssettings'] = 'Analytics settings';
$string['analyticssiteinfo'] = 'Site information';
$string['defaulttimesplittingmethods'] = 'Default time-splitting methods for model\'s evaluation';
$string['defaulttimesplittingmethods_help'] = 'The time-splitting method divides the course duration into parts; the predictions engine will run at the end of these parts. The model evaluation process will iterate through these time-splitting methods unless a specific time-splitting method is specified. (The ability to specify a time-splitting method is only available when evaluating models using the command line script.)';
$string['defaulttimesplittingmethods'] = 'Default analysis intervals for model\'s evaluation';
$string['defaulttimesplittingmethods_help'] = 'The analysis interval defines when the system will calculate predictions and the portion of activity logs that will be considered for those predictions.The model evaluation process will iterate through these analysis intervals unless a specific analysis interval is specified.';
$string['defaultpredictionsprocessor'] = 'Default predictions processor';
$string['defaultpredictoroption'] = 'Default processor ({$a})';
$string['disabledmodel'] = 'Disabled model';
@ -45,12 +45,12 @@ $string['errorimportversionmismatches'] = 'The version of the following componen
$string['errorimportmissingclasses'] = 'The following analytics components are not available on this site: {$a->missingclasses}.';
$string['errorinvalidindicator'] = 'Invalid {$a} indicator';
$string['errorinvalidtarget'] = 'Invalid {$a} target';
$string['errorinvalidtimesplitting'] = 'Invalid time splitting; please ensure you add the fully qualified class name.';
$string['errorinvalidtimesplitting'] = 'Invalid analysis interval; please ensure you add the fully qualified class name.';
$string['errornoexportconfig'] = 'There was a problem exporting the model configuration.';
$string['errornoexportconfigrequirements'] = 'Only non-static models with time-splitting methods can be exported.';
$string['errornoexportconfigrequirements'] = 'Only non-static models with an analysis interval can be exported.';
$string['errornoindicators'] = 'This model does not have any indicators.';
$string['errornopredictresults'] = 'No results returned from the predictions processor. Check the output directory contents for more information.';
$string['errornotimesplittings'] = 'This model does not have any time-splitting method.';
$string['errornotimesplittings'] = 'This model does not have an analysis interval.';
$string['errornoroles'] = 'Student or teacher roles have not been defined. Define them in the analytics settings page.';
$string['errornotarget'] = 'This model does not have any target.';
$string['errorpredictioncontextnotavailable'] = 'This prediction context is no longer available.';
@ -60,7 +60,7 @@ $string['errorpredictionsprocessor'] = 'Predictions processor error: {$a}';
$string['errorpredictwrongformat'] = 'The predictions processor return cannot be decoded: "{$a}"';
$string['errorprocessornotready'] = 'The selected predictions processor is not ready: {$a}';
$string['errorsamplenotavailable'] = 'The predicted sample is no longer available.';
$string['errorunexistingtimesplitting'] = 'The selected time-splitting method is not available.';
$string['errorunexistingtimesplitting'] = 'The selected analysis interval is not available.';
$string['errorunexistingmodel'] = 'Non-existing model {$a}';
$string['errorunknownaction'] = 'Unknown action';
$string['eventpredictionactionstarted'] = 'Prediction process started';
@ -70,8 +70,8 @@ $string['insightmessagesubject'] = 'New insight for "{$a}"';
$string['insightinfomessage'] = 'The system generated an insight for you: {$a}';
$string['insightinfomessagehtml'] = 'The system generated an insight for you.';
$string['insightinfomessageaction'] = '{$a->text}: {$a->url}';
$string['invalidtimesplitting'] = 'Model with ID {$a} needs a time-splitting method before it can be used for training.';
$string['invalidanalysablefortimesplitting'] = 'It cannot be analysed using {$a} time-splitting method.';
$string['invalidtimesplitting'] = 'Model with ID {$a} needs an analysis interval before it can be used for training.';
$string['invalidanalysablefortimesplitting'] = 'It cannot be analysed using {$a} analysis interval.';
$string['levelinstitution'] = 'Level of education';
$string['levelinstitutionisced0'] = 'Early childhood education (less than primary for educational attainment)';
$string['levelinstitutionisced1'] = 'Primary education';
@ -123,7 +123,7 @@ $string['privacy:metadata:analytics:predictions'] = 'Predictions';
$string['privacy:metadata:analytics:predictions:modelid'] = 'The model ID';
$string['privacy:metadata:analytics:predictions:contextid'] = 'The context';
$string['privacy:metadata:analytics:predictions:sampleid'] = 'The sample ID';
$string['privacy:metadata:analytics:predictions:rangeindex'] = 'The index of the time-splitting method';
$string['privacy:metadata:analytics:predictions:rangeindex'] = 'The index of the analysis interval';
$string['privacy:metadata:analytics:predictions:prediction'] = 'The prediction';
$string['privacy:metadata:analytics:predictions:predictionscore'] = 'The prediction score';
$string['privacy:metadata:analytics:predictions:calculations'] = 'Indicator calculations';
@ -137,8 +137,8 @@ $string['privacy:metadata:analytics:predictionactions:actionname'] = 'The action
$string['privacy:metadata:analytics:predictionactions:timecreated'] = 'When the prediction action was performed';
$string['processingsitecontents'] = 'Processing site contents';
$string['successfullyanalysed'] = 'Successfully analysed';
$string['timesplittingmethod'] = 'Time-splitting method';
$string['timesplittingmethod_help'] = 'The time-splitting method defines when the system will calculate predictions and the portion of activity logs that will be considered for those predictions. For example, the course duration may be divided into parts, with a prediction generated at the end of each part.';
$string['timesplittingmethod'] = 'Analysis interval';
$string['timesplittingmethod_help'] = 'The analysis interval defines when the system will calculate predictions and the portion of activity logs that will be considered for those predictions. For example, the course duration may be divided into parts, with a prediction generated at the end of each part.';
$string['timesplittingmethod_link'] = 'Time_splitting_methods';
$string['typeinstitution'] = 'Type of institution';
$string['typeinstitutionacademic'] = 'Academic';

View File

@ -1984,23 +1984,23 @@ The list of available text editors is determined by the site administrator.';
$string['texteditor'] = 'Use standard web forms';
$string['textformat'] = 'Plain text format';
$string['timesplitting:deciles'] = 'Tenths';
$string['timesplitting:deciles_help'] = 'This time-splitting method divides the course into tenths (10 equal parts), with each prediction being based on the data of only the most recent previous tenth.';
$string['timesplitting:deciles_help'] = 'This analysis interval divides the course into tenths (10 equal parts), with each prediction being based on the data of only the most recent previous tenth.';
$string['timesplitting:decilesaccum'] = 'Tenths accumulative';
$string['timesplitting:decilesaccum_help'] = 'This time-splitting method divides the course into tenths (10 equal parts), with each prediction being based on the data of all previous tenths.';
$string['timesplitting:nosplitting'] = 'No time splitting';
$string['timesplitting:nosplitting_help'] = 'No time-splitting method is defined for this model.';
$string['timesplitting:decilesaccum_help'] = 'This analysis interval divides the course into tenths (10 equal parts), with each prediction being based on the data of all previous tenths.';
$string['timesplitting:nosplitting'] = 'No time limits';
$string['timesplitting:nosplitting_help'] = 'No analysis interval is defined for this model.';
$string['timesplitting:quarters'] = 'Quarters';
$string['timesplitting:quarters_help'] = 'This time-splitting method divides the course into quarters (4 equal parts), with each prediction being based on the data of only the most recent previous quarter.';
$string['timesplitting:quarters_help'] = 'This analysis interval divides the course into quarters (4 equal parts), with each prediction being based on the data of only the most recent previous quarter.';
$string['timesplitting:quartersaccum'] = 'Quarters accumulative';
$string['timesplitting:quartersaccum_help'] = 'This time-splitting method divides the course into quarters (4 equal parts), with each prediction being based on the data of all previous quarters.';
$string['timesplitting:quartersaccum_help'] = 'This analysis interval divides the course into quarters (4 equal parts), with each prediction being based on the data of all previous quarters.';
$string['timesplitting:singlerange'] = 'Single range';
$string['timesplitting:singlerange_help'] = 'This time-splitting method considers the entire course as a single span.';
$string['timesplitting:singlerange_help'] = 'This analysis interval considers the entire course as a single span.';
$string['timesplitting:upcoming3days'] = 'Upcoming 3 days';
$string['timesplitting:upcoming3days_help'] = 'This time-splitting method generates predictions every 3 days. The indicators calculations will be based on the upcoming 3 days.';
$string['timesplitting:upcoming3days_help'] = 'This analysis interval generates predictions every 3 days. The indicators calculations will be based on the upcoming 3 days.';
$string['timesplitting:upcomingfortnight'] = 'Upcoming fortnight';
$string['timesplitting:upcomingfortnight_help'] = 'This time-splitting method generates predictions every fortnight. The indicators calculations will be based on the upcoming fortnight.';
$string['timesplitting:upcomingfortnight_help'] = 'This analysis interval generates predictions every fortnight. The indicators calculations will be based on the upcoming fortnight.';
$string['timesplitting:upcomingweek'] = 'Upcoming week';
$string['timesplitting:upcomingweek_help'] = 'This time-splitting method generates predictions every week. The indicators calculations will be based on the upcoming week.';
$string['timesplitting:upcomingweek_help'] = 'This analysis interval generates predictions every week. The indicators calculations will be based on the upcoming week.';
$string['thanks'] = 'Thanks';
$string['theme'] = 'Theme';
$string['themes'] = 'Themes';

View File

@ -25,7 +25,7 @@
$string['datasetsizelimited'] = 'Only part of the dataset has been evaluated due to its size. Set $CFG->mlbackend_php_no_memory_limit if you are confident that your system can cope with a {$a} dataset.';
$string['errorcantloadmodel'] = 'Model file {$a} does not exist. The model should been trained before using it to predict.';
$string['errorlowscore'] = 'The evaluated model prediction accuracy is not very high, so some predictions may not be accurate. Model score = {$a->score}, minimum score = {$a->minscore}';
$string['errornotenoughdata'] = 'There is not enough data to evaluate this model using the time-splitting method.';
$string['errornotenoughdata'] = 'There is not enough data to evaluate this model using the provided analysis interval.';
$string['errornotenoughdatadev'] = 'The evaluation results varied too much. It is recommended that more data is gathered to ensure the model is valid. Evaluation results standard deviation = {$a->deviation}, maximum recommended standard deviation = {$a->accepteddeviation}';
$string['errorphp7required'] = 'The PHP machine learning backend requires PHP 7';
$string['pluginname'] = 'PHP machine learning backend';