Show
Prepare the environment for this test:
Download the attached test-mdl-57791.php file and place it in moodle root
Execute php test-mdl-57791.php createcourses , this will create 3 courses, 1 for no teachers model, and 2 more for students at risk of dropping out: a course for training the machine learning algorithm and another one to get predictions. These courses start and end dates are set accordingly to what is needed:
no teachers course starts in less than 1 week
students at risk of dropping out training course is already finished
students at risk of dropping out prediction course just passed 50% of the course duration
In predictyeah and trainingyeah courses create a page activity and a resource activity in topic 2
Enrol 5 new users as students into predictyeah and trainingyeah new courses, in predictyeah course log in as 2 of these users and access the page and the resource refresh page like 10 times as we need some activity logs; in trainingyeah course log in as 2 of these users and access the page and the resource, also refresh page like 10 times as we need some activity logs
Enrol a user as a teacher to predictyeah course, login as this teacher and go to "Notification preferences" to enable "Insights generated by prediction models" web notifications if it is not already enabled
Execute php test-mdl-57791.php movelogsback this will update the logs timecreated attribute to some time ago so they make sense according to start and end course dates
Researcher role
Log in as admin
Create a researcher role with the following capabilities:
moodle/site:configview
moodle/analytics:managemodels
moodle/analytics:listinsights
Assign a user to that role (system level) and log in as that user
Go to 'site admin' > reports > analytics models
No teaching model:
Execute "Get predictions" action for "No teaching" model
Back in admin/tool/analytics/index.php, select "All predictions" from "No teaching"'s "Insights" column
You should see a list of courses without teacher
Expand "Actions" menu, you should only see 1 link to view the course, click on it, researcher user may not have permissions to access the course, but you should at least be redirected to course/view.php?id=XXX
Students at risk of dropping out model:
Execute "Evaluate" action for "Students at risk of dropping out" model
Do not worry about the results as long as at least 1 course is used for training (most of your site courses will be skipped because they are not finished yet, do not have enough student's activity...) and it successfully finishes
Do the same using php admin/tool/analytics/cli/evaluate_model.php --modelid=X where X is the mdl_analytics_model record with target ending in "*course_dropout", at the end it will ask you to select a time splitting method, just type none.
Return to the web interface (site admin > reports > analytic models) and view "Students at risk of dropping out" log (in actions drop down menu)
You should see 1 record for each time you evaluated the model + for each time splitting method (by default 3 time splitting methods are enabled and if you followed this instructions strictly you run it twice, web and cli, so total 6 logs)
Check that you see the list of indicators, a time splitting method and a accuracy percentage
Edit "Students at risk of dropping out" model, remove all assign, book and workshop indicators, tick "Enabled" and select "Quarters accumulative" time splitting method. Save changes and check that the updated information appears in admin/tool/models/index.php
Select "Get predictions" action from "Students at risk of dropping out" model in admin/tool/models/index.php
You should not see the id of trainingyeah course under "Training results" and you should see it under "Prediction results"
You should see the id of predictyeah course under "Training results" and you should not see it under "Prediction results"
Click "Continue" to return to admin/tool/models/index.php, you should see a dropdown menu in "Insights" column -> "Students at risk of dropping out" row. Select "predictyeah"
You should see 3 student at risk and 2 not at risk.
Go to CLI and run php admin/tool/task/cli/schedule_task.php --execute= tool_analytics
task
train_models and php admin/tool/task/cli/schedule_task.php --execute= tool_analytics
task
predict_models
They should finish ok although you will see info about skipped courses if you have debugging mode enabled. No new courses will be trained nor you will get more predictions as there is no new stuff to calculate.
Insights:
In the web interface, log out as researcher, log in as admin go to admin/tool/models/index.php and select "Students at risk of dropping out" "predictyeah" course insights again
Verify that you can click on the students pic and go to their course profile
Select "Actions" menu's "View prediction details" link for both students
You should see a list of notifications with some percents, the ones belonging to the student that is at risk should be 0% or close, the ones belonging to the user that is not at risk will be 100% or close
Insights notifications:
Log out and log in as predictyeah course teacher
You should have a notification about new insights, click on it
You should see the list of insights in that context
Click all links in "Actions" menu and verify that they work correctly
New site:
Install a new site (integration master)
Check that mdl_analytics_models table have 2 records, one of them with enabled and train = 1 and timesplitting = \core\analytics\time_splitting\single_range