-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix classifier models when exploration is reverted and add test case for auto migrations #5888
Fix classifier models when exploration is reverted and add test case for auto migrations #5888
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @prasanna08! Took a pass and left a few comments, PTAL.
feconf.py
Outdated
@@ -761,14 +761,14 @@ def get_empty_ratings(): | |||
MAX_PLAYTHROUGHS_FOR_ISSUE = 5 | |||
|
|||
# Unfinished features. | |||
SHOW_TRAINABLE_UNRESOLVED_ANSWERS = False | |||
SHOW_TRAINABLE_UNRESOLVED_ANSWERS = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert all changes to this file, we aren't ready to launch ML in production yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, my mistake. Will revert these in next commit.
core/domain/exp_jobs_one_off_test.py
Outdated
# Start migration job on sample exploration. | ||
job_id = exp_jobs_one_off.ExplorationMigrationJobManager.create_new() | ||
exp_jobs_one_off.ExplorationMigrationJobManager.enqueue(job_id) | ||
with self.swap(feconf, 'MIN_TOTAL_TRAINING_EXAMPLES', 0): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think you should swap these constants to nonzero numbers and add a bit of training data. Otherwise you run the risk of this test passing simply because there is nothing ML-related to migrate. Ideally the training job model gets created organically as a result of making appropriate changes to the lesson and saving them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I thought about that but in schema 0 we didn't really have a notion of state or training data. To be frank, I am unable to figure out what goes where when that schema is updated to the latest version and hence I refrained from putting training data there. Maybe I will have to create a similar function which creates an exploration of a more recent schema version, where we do have a notion of training data. Also, training data is not part of such default explorations, so what it needs is a highly specific function (that creates an exploration with training data and also creates appropriate classifier data and mapping models) which is useful only in this particular test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need to start at schema 0. You can start at the schema where the ML fields are introduced (as I think you're suggesting).
Also, I think creating such setup functions in test_utils.py would probably be useful, since we're likely to have more backend tests for the ML stuff down the road. So it probably will have usefulness beyond this particular case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified test case.
Hi, my end semester exams are upcoming in next couple of weeks and so I might not be able to work on this PR for a while. After my exams I'll pick this up from here. EDIT: I will pick this up after 12 December. |
Hi @prasanna08, I'm going to mark this PR as stale because it hasn't had any updates for 10 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue. |
…_classifier_training_job
Codecov Report
@@ Coverage Diff @@
## develop #5888 +/- ##
===========================================
+ Coverage 45.3% 45.66% +0.36%
===========================================
Files 520 516 -4
Lines 30667 30147 -520
Branches 4597 4535 -62
===========================================
- Hits 13893 13766 -127
+ Misses 16774 16381 -393
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## develop #5888 +/- ##
===========================================
- Coverage 45.3% 45.21% -0.09%
===========================================
Files 520 523 +3
Lines 30667 30722 +55
Branches 4597 4605 +8
===========================================
- Hits 13893 13892 -1
- Misses 16774 16830 +56
Continue to review full report at Codecov.
|
Hi @prasanna08, I'm going to mark this PR as stale because it hasn't had any updates for 10 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue. |
Sorry, this needed to be reviewed by me. Reopening, and will review shortly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @prasanna08, sorry for the delay in reviewing this. Just two docstring fixes but otherwise LGTM and feel free to merge. Thanks!
@@ -930,6 +999,71 @@ def save_new_exp_with_states_schema_v0(self, exp_id, user_id, title): | |||
exploration = exp_services.get_exploration_from_model(exp_model) | |||
exp_services.create_and_save_state_id_mapping_model(exploration, []) | |||
|
|||
def save_new_exp_with_states_schema_v21(self, exp_id, user_id, title): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain in the docstring the significance of version 21? Just a note at the end of the first paragraph saying "Version 21 is where XXX is implemented." will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
core/domain/classifier_services.py
Outdated
|
||
Args: | ||
exploration: Exploration. Exploration domain object. | ||
exploration_to_revert_to: Exploration. Exploration to which revert to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra "which": Exploration to revert to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
This PR adds code to generate classifier models when exploration is reverted and a test case to ensure that auto migrations (done by Exploration Migration One Off job) generates appropriate classifier models.