Skip to content

Commit

Permalink
Merge pull request #57 from outbrain/silencio
Browse files Browse the repository at this point in the history
Verbosity levels
  • Loading branch information
SkBlaz authored Jan 5, 2024
2 parents ac44d16 + 1a1d7b6 commit 289bb9c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
15 changes: 8 additions & 7 deletions outrank/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,6 @@ def main():
help="Which ';'-separated features should be one-hot encoded into n new features (coverage analysis)",
)

parser.add_argument(
'--silent',
type=str,
default='False',
help='Suppress the logo and tips.',
)

parser.add_argument(
'--subfeature_mapping',
type=str,
Expand Down Expand Up @@ -225,6 +218,14 @@ def main():
help='Relevant for task data_generator -- name of the folder that contains generated data.',
)

parser.add_argument(
'--disable_tqdm',
default='False',
choices=['False', 'True'],
help='Either True or False.',
)


args = parser.parse_args()

if args.task == 'selftest':
Expand Down
4 changes: 3 additions & 1 deletion outrank/core_ranking.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ def compute_cardinalities(input_dataframe: pd.DataFrame, pbar: Any) -> None:
GLOBAL_CARDINALITY_STORAGE[column].add(
internal_hash(unique_value),
)

pbar.set_description(
f'Computing cardinality (Hyperloglog update) {enx}/{input_dataframe.shape[1]}',
)
Expand Down Expand Up @@ -498,6 +499,7 @@ def compute_batch_ranking(
input_dataframe = input_dataframe[list(focus_set)]

if args.transformers != 'none':

pbar.set_description('Adding transformations')
input_dataframe = enrich_with_transformations(
input_dataframe, numeric_column_types, logger, args,
Expand Down Expand Up @@ -628,7 +630,7 @@ def estimate_importances_minibatches(

local_coverage_object = defaultdict(list)
local_pbar = tqdm.tqdm(
total=get_num_of_instances(input_file) - 1, position=0,
total=get_num_of_instances(input_file) - 1, position=0, disable=args.disable_tqdm == 'True',
)

file_name, file_extension = os.path.splitext(input_file)
Expand Down
6 changes: 2 additions & 4 deletions outrank/task_ranking.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@
)


def outrank_task_conduct_ranking(args: Any):
def outrank_task_conduct_ranking(args: Any) -> None:
# Data source = folder structure + relevant file specifications

# No need for full-blown ranking in this case
if args.task in ['identify_rare_values', 'feature_summary_transformers']:
args.heuristic = 'Constant'

if args.silent != 'True':
if args.disable_tqdm == 'False':
display_tool_name()
display_random_tip()

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def _read_description():
packages = [x for x in setuptools.find_packages() if x != 'test']
setuptools.setup(
name='outrank',
version='0.95.3',
version='0.95.4',
description='OutRank: Feature ranking for massive sparse data sets.',
long_description=_read_description(),
long_description_content_type='text/markdown',
Expand Down
1 change: 1 addition & 0 deletions tests/ranking_module_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class args:
target_ranking_only: str = 'True'
interaction_order: int = 3
combination_number_upper_bound: int = 1024
disable_tqdm: bool = False


class CompareStrategiesTest(unittest.TestCase):
Expand Down

0 comments on commit 289bb9c

Please sign in to comment.