-
Notifications
You must be signed in to change notification settings - Fork 40
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
if column.model not provided in visual app then set default model name #235
base: main
Are you sure you want to change the base?
if column.model not provided in visual app then set default model name #235
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.
Hi! Thank you so much for you contribution. I have suggested just a few tiny things to improve.
tests/visuals/test_visual_app.py
Outdated
is_u2i=True, | ||
selected_requests=SELECTED_REQUESTS_U2I, | ||
) | ||
incorrect_reco = pd.DataFrame( |
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 move this to a separate test with test_happy_path_with_missing_model
.
And please add assertion on expected_grouped_reco
data.
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, there is my suggestion, how to name this test - test_successful_path_with_missing_model
. Added assertion on expected_grouped_reco
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.
Great! Could you please name it happy
? It's just our common naming everywhere in the tests. This way it'a a bit easier to navigate in the code.
I also added a few more comments. And we will be ready to merge.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #235 +/- ##
===========================================
Coverage 100.00% 100.00%
===========================================
Files 45 59 +14
Lines 2242 3877 +1635
===========================================
+ Hits 2242 3877 +1635 ☔ View full report in Codecov by Sentry. |
@@ -71,7 +72,8 @@ def from_raw( | |||
---------- | |||
reco : tp.Union[pd.DataFrame, TablesDict] | |||
Recommendations from different models in a form of a pd.DataFrame or a dict. | |||
In DataFrame form model names must be specified in `Columns.Model` column. In dict form | |||
In DataFrame form model names must be specified in `Columns.Model` column. | |||
If not, `Columns.Model` column will be created with default value ``model1``. In dict form |
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.
If not, `Columns.Model` column will be created with default value ``model1``. In dict form | |
If not, `Columns.Model` column will be created with default value ``model``. In dict form |
tests/visuals/test_visual_app.py
Outdated
@@ -21,7 +21,12 @@ | |||
import pytest | |||
|
|||
from rectools import Columns, ExternalId | |||
from rectools.visuals.visual_app import AppDataStorage, ItemToItemVisualApp, StorageFiles, TablesDict, VisualApp | |||
from rectools.visuals.visual_app import (AppDataStorage, |
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 run make format
command in your terminal before pushing your changes. It will run isort
and black
to fix code style.
Also it is useful to run make lint
command to check that all linters are passing locally. Right now they are failing because of unusual formatting.
) | ||
} | ||
} | ||
assert expected_grouped_reco.keys() == ads.grouped_reco.keys() |
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.
Great to see this added to the test!
Could you please move this block of code (lines 256-26) to a separate method of the class? You can call it assert_equal_data_in_grouped_reco_and_ads
.
Right now we are copy-pasting this line 3 times in the file and it's too much.
tests/visuals/test_visual_app.py
Outdated
is_u2i=True, | ||
selected_requests=SELECTED_REQUESTS_U2I, | ||
) | ||
incorrect_reco = pd.DataFrame( |
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.
Great! Could you please name it happy
? It's just our common naming everywhere in the tests. This way it'a a bit easier to navigate in the code.
I also added a few more comments. And we will be ready to merge.
@@ -100,7 +102,7 @@ def from_raw( | |||
|
|||
if isinstance(reco, pd.DataFrame): | |||
if Columns.Model not in reco.columns: | |||
raise KeyError("Missing `{Columns.Model}` column in `reco` DataFrame") | |||
reco[Columns.Model] = DEFAULT_MODEL_NAME |
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, please add a warning here
warnings.warn("`{Columns.Model}` column in `reco` DataFrame is missing. All recommendations will be related to a single model")
Description
Set default model name in
Column.Model
column, when usingVisualApp
#118Closes #118
Type of change
How Has This Been Tested?
Before submitting a PR, please check yourself against the following list. It would save us quite a lot of time.