-
Notifications
You must be signed in to change notification settings - Fork 162
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
Add data labeler tf loader for any cnn softmax model #532
Conversation
@@ -17,237 +16,7 @@ | |||
_file_dir = os.path.dirname(os.path.abspath(__file__)) | |||
|
|||
logger = dp_logging.get_child_logger(__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.
moved
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.
moved to labeler_utils.py
@@ -0,0 +1,148 @@ | |||
import json |
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.
new test for new labeler
@@ -0,0 +1,373 @@ | |||
import json |
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.
new test for new model
@@ -22,7 +22,7 @@ | |||
import numpy as np | |||
import tensorflow as tf | |||
|
|||
from dataprofiler.labelers.character_level_cnn_model import F1Score, FBetaScore | |||
from dataprofiler.labelers.labeler_utils import F1Score, FBetaScore |
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.
updated for movement
@@ -267,3 +269,33 @@ def test_save_conf_mat(self, mock_dataframe): | |||
self.assertDictEqual(expected_row_col_names, mock_dataframe.call_args[1]) | |||
|
|||
mock_instance_df.to_csv.assert_called() | |||
|
|||
|
|||
class TestTFFunctions(unittest.TestCase): |
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.
test new get layer name func
ind = labeler_utils.get_tf_layer_index_from_name(model, 'dense0') | ||
self.assertEqual(0, ind) | ||
|
||
def test_hide_tf_logger_warnings(self): |
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.
test ability for func to hide logs
@@ -0,0 +1,511 @@ | |||
import json |
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.
new code
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... only recommendation is run both isort
and black
on these files to ensure we are in alignment with what we are merging into.
|
||
# Make sure the necessary parameters are present and valid. | ||
for param in parameters: | ||
if param in ["default_label", "model_path", "pad_label"]: |
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 param in ["default_label", "model_path", "pad_label"]: | |
if param in list_of_necessary_params: |
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.
ah great catch!
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.
fair, not usually the case, but works for this one since they are all strings
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 have slight concerns this makes it less clear as it doesn't list the values at the point of callout, but I'm fine switching it.
Allows the DL to load any TF model which has a softmax output