-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 #3797: Deprecate old classification framework #4653
Fix #3797: Deprecate old classification framework #4653
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #4653 +/- ##
===========================================
- Coverage 44.92% 44.86% -0.06%
===========================================
Files 383 384 +1
Lines 23266 23303 +37
Branches 3750 3757 +7
===========================================
+ Hits 10452 10455 +3
- Misses 12814 12848 +34
Continue to review full report at Codecov.
|
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.
@GanitGenius you have removed few parts of the new framework here. I have added relevant comments.
I guess the confusion arose because we are using LDAStringClassifier in unit tests of the new framework, as well. Actually, it should have been replaced by TextClassifier when that was implemented but now I realize that there are still some loose ends regarding the transition from LDA to TextClassifier.
|
||
(classifier_models,) = models.Registry.import_models( | ||
[models.NAMES.classifier]) | ||
|
||
|
||
class ClassifierTrainingJobModelUnitTests(test_utils.GenericTestBase): |
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.
Keep this. It is part of new framework.
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.
@@ -78,7 +78,7 @@ | |||
# A mapping of interaction ids to classifier properties. | |||
INTERACTION_CLASSIFIER_MAPPING = { | |||
'TextInput': { | |||
'algorithm_id': 'LDAStringClassifier', | |||
'algorithm_id': 'TextClassifier', |
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.
Why wasn't this modified before @anmolshkl? (when you implemented TextClassifier on Oppia side)
Also have you done the end to end tests (manually) of running TextClassifier i.e. start Oppia-ml and Oppia, change all the constants and enable classification framework, create or load any exploration that uses text classifier, and then check logs of Oppia-ml to see if classifier is trained, check logs of Oppia and see if trained model has been stored, also playtest exploration once the trained model has been stored and see if it predicts correct values?
def test_create_and_get_new_training_job_runs_successfully(self): | ||
next_scheduled_check_time = datetime.datetime.utcnow() | ||
job_id = classifier_models.ClassifierTrainingJobModel.create( | ||
'LDAStringClassifier', 'TextInput', 'exp_id1', 1, |
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.
You will have to change LDAStringClassifier to TextClassifier as you did in feconf.
from core.domain import classifier_domain | ||
from core.tests import test_utils | ||
import utils | ||
|
||
|
||
class ClassifierTrainingJobDomainTests(test_utils.GenericTestBase): |
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.
Keep this. It is part of the new framework.
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/controllers/reader_test.py
Outdated
@@ -199,55 +148,6 @@ def test_give_feedback_handler(self): | |||
self.logout() | |||
|
|||
|
|||
class ExplorationStateClassifierMappingTests(test_utils.GenericTestBase): |
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.
Keep this. It is part of the new framework.
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.
@prasanna08 i have added them now. please review. |
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.
LGTM @GanitGenius . Just this one small nit.
Thanks!
@@ -24,6 +24,7 @@ | |||
class ActivityListModelTest(test_utils.GenericTestBase): | |||
"""Tests the ActivityListModel class.""" | |||
|
|||
|
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.
Remove this new line
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 @pranavsid98 it tried to add and it gives lint error for one line gap.
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.
Thats weird. @seanlip Do you have any idea?
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.
@apb7 should be able to advice. @GanitGenius it would be helpful if you could provide the exact text of the lint error here. (In general, always do that whenever you are reporting an error, otherwise it's pretty much impossible to debug.)
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.
ok, will do.
ckd@PC:~/Desktop/dev/oppia/oppia$ git push origin deprecate_old_classification_framework
ref_list:
[GitRef(local_ref='refs/heads/deprecate_old_classification_framework', local_sha1='fe09b03b3a5cb90c5f729f79e363ec7b8a067580', remote_ref='refs/heads/deprecate_old_classification_framework', remote_sha1='783961291ecc1b26bbcc71f1fc0692624774bec1')]
Modified files in deprecate_old_classification_framework:
[FileDiff(status='M', name='core/storage/classifier/gae_models_test.py')]
Files to lint in deprecate_old_classification_framework:
['core/storage/classifier/gae_models_test.py']
Starting def-spacing checks
----------------------------------------
core/storage/classifier/gae_models_test.py:27:1: E302 expected 2 blank lines, found 1
1 E302 expected 2 blank lines, found 1
----------------------------------------
FAILED Def spacing checks failed
i think this might be due to this where tox.ini contains E302 check. waiting for apurv to confirm.
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.
@seanlip I tried this locally (with a single line gap) but did not get any lint error here. Also, initially there was a single line gap only between the class and the method and no linting error was encountered back then.
@GanitGenius: I'm not exactly sure at the moment how this error springs up.
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.
posting the full log:
ckd@PC:~/Desktop/dev/oppia/oppia$ git push origin deprecate_old_classification_framework
ref_list:
[GitRef(local_ref='refs/heads/deprecate_old_classification_framework', local_sha1='fe09b03b3a5cb90c5f729f79e363ec7b8a067580', remote_ref='refs/heads/deprecate_old_classification_framework', remote_sha1='783961291ecc1b26bbcc71f1fc0692624774bec1')]
Modified files in deprecate_old_classification_framework:
[FileDiff(status='M', name='core/storage/classifier/gae_models_test.py')]
Files to lint in deprecate_old_classification_framework:
['core/storage/classifier/gae_models_test.py']
Starting def-spacing checks
----------------------------------------
core/storage/classifier/gae_models_test.py:27:1: E302 expected 2 blank lines, found 1
1 E302 expected 2 blank lines, found 1
----------------------------------------
FAILED Def spacing checks failed
Starting import-order checks
----------------------------------------
----------------------------------------
Starting newline-at-EOF checks
----------------------------------------
----------------------------------------
(1 files checked, 0 errors found)
SUCCESS Newline character checks passed
Starting linter...
Starting Javascript and Python Linting
----------------------------------------
Linting 1 Python files
Linting Python files 1 to 1...
There are no JavaScript files to lint.
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
Python linting finished.
----------------------------------------
SUCCESS 1 Python files linted (1.3 secs)
Starting Pattern Checks
----------------------------------------
----------------------------------------
(1 files checked, 0 errors found)
SUCCESS Pattern checks passed
Push failed, please correct the linting issues above
error: failed to push some refs to 'git@github.com:GanitGenius/oppia.git'
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.
Commit changes:
ckd@PC:~/Desktop/dev/oppia/oppia$ git show fe09b03b3
commit fe09b03b3a5cb90c5f729f79e363ec7b8a067580 (HEAD -> deprecate_old_classification_framework)
Author: GanitGenius <anonims.ak@gmail.com>
Date: Wed Feb 7 12:55:01 2018 +0530
addressed review comment
diff --git a/core/storage/classifier/gae_models_test.py b/core/storage/classifier/gae_models_test.py
index e57267fa2..e50921f8b 100644
--- a/core/storage/classifier/gae_models_test.py
+++ b/core/storage/classifier/gae_models_test.py
@@ -24,7 +24,6 @@ import feconf
(classifier_models,) = models.Registry.import_models(
[models.NAMES.classifier])
-
class ClassifierTrainingJobModelUnitTests(test_utils.GenericTestBase):
"""Test the ClassifierTrainingJobModel class."""
so earlier there was 2 line gap and after removing one line it gave that error.
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.
got it. i was modifing the wrong file '/activity/gae_models_test.py' instead of '/classifier/gae_models_test.py'.
sorry for the trouble.
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.
@GanitGenius: Re E302, it checks for two lines above top-level functions and class definitions. E301 checks for single line gap between methods (https://github.com/PyCQA/pycodestyle/blob/master/pycodestyle.py#L306:L308).
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 @GanitGenius LGTM
Hi @seanlip, good to go for merge? Thanks! |
I defer entirely to @prasanna08 on this one -- if he's happy, then so am I. I noticed one unresolved comment in feconf.py? |
Yes, that comment was meant for @anmolshkl. I wanted to make sure that we have tested the text input classifier from end to end. I will talk about this with him on hangouts. Thanks. Other than that this PR LGTM. Edit: So I talked about this to @anmolshkl and he did not do manual end to end testing. So I created a new issue to do that test. |
* partial work * removed classifiers from backend and frontend Specs * fix lint * added back new framework tests * addressed review comment * address review comments
* partial work * removed classifiers from backend and frontend Specs * fix lint * added back new framework tests * addressed review comment * address review comments
[Explain what your PR does here]
Checklist
python scripts/pre_commit_linter.py
andbash scripts/run_frontend_tests.sh
.i have removed LDAStringClassifier, domain/base_classifier.py, domain/classifier_registry.py.
and updated some frontend specs.