<commit_before># Copyright 2017-2019 TensorHub, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import
from __future__ import division

import click

from guild import click_util

from . import runs_support

@click.command()
@runs_support.runs_arg
@runs_support.all_filters
@click.option(
    "-c", "--cols", metavar="COLUMNS",
    help=(
        "Additional columns to compare. "
        "Cannot be used with --strict-columns."))
@click.option(
    "-cc", "--strict-cols", metavar="COLUMNS",
    help="Columns to compare. Cannot be used with --columns.")
@click.option(
    "-n", "--skip-op-cols", is_flag=True,
    help="Don't show operation columns.")
@click.option(
    "-r", "--skip-core", is_flag=True,
    help="Don't show core columns.")
@click.option(
    "-t", "--top", metavar="N", type=click.IntRange(min=1),
    help="Only show the top N runs.")
@click.option(
    "-m", "--min", "min_col", metavar="COLUMN",
    help="Show the lowest values for COLUMN first.")
@click.option(
    "-x", "--max", "max_col", metavar="COLUMN",
    help="Show the highest values for COLUMN first.")
@click.option(
    "--table", "format", flag_value="table",
    help="Generate comparison data as a table.",
    is_flag=True)
@click.option(
    "--csv", "format", flag_value="csv",
    help="Generate comparison data as a CSV file.",
    is_flag=True)
@click.option(
    "--include-batch", is_flag=True,
    help="Include batch runs.")
@click.option(
    "--print-scalars", is_flag=True,
    help="Show available scalars and exit.")

@click_util.use_args
@click_util.render_doc

def compare(args):
    """Compare run results.

    Guild Compare is a console based application that displays a table
    of runs with their current accuracy and loss. The application will
    continue to run until you exit it by pressing ``q`` (for quit).

    Guild Compare supports a number of commands. Commands are
    activated by pressing a letter. To view the list of commands,
    press ``?``.

    Guild Compare does not automatically update to display the latest
    available data. If you want to update the list of runs and their
    status, press ``r`` (for refresh).
<commit_msg>-tb short option for compare --table<commit_after># Copyright 2017-2019 TensorHub, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import absolute_import
from __future__ import division

import click

from guild import click_util

from . import runs_support

@click.command()
@runs_support.runs_arg
@runs_support.all_filters
@click.option(
    "-c", "--cols", metavar="COLUMNS",
    help=(
        "Additional columns to compare. "
        "Cannot be used with --strict-columns."))
@click.option(
    "-cc", "--strict-cols", metavar="COLUMNS",
    help="Columns to compare. Cannot be used with --columns.")
@click.option(
    "-n", "--skip-op-cols", is_flag=True,
    help="Don't show operation columns.")
@click.option(
    "-r", "--skip-core", is_flag=True,
    help="Don't show core columns.")
@click.option(
    "-t", "--top", metavar="N", type=click.IntRange(min=1),
    help="Only show the top N runs.")
@click.option(
    "-m", "--min", "min_col", metavar="COLUMN",
    help="Show the lowest values for COLUMN first.")
@click.option(
    "-x", "--max", "max_col", metavar="COLUMN",
    help="Show the highest values for COLUMN first.")
@click.option(
    "-tb", "--table", "format", flag_value="table",
    help="Generate comparison data as a table.",
    is_flag=True)
@click.option(
    "--csv", "format", flag_value="csv",
    help="Generate comparison data as a CSV file.",
    is_flag=True)
@click.option(
    "--include-batch", is_flag=True,
    help="Include batch runs.")
@click.option(
    "--print-scalars", is_flag=True,
    help="Show available scalars and exit.")

@click_util.use_args
@click_util.render_doc

def compare(args):
    """Compare run results.

    Guild Compare is a console based application that displays a table
    of runs with their current accuracy and loss. The application will
    continue to run until you exit it by pressing ``q`` (for quit).

    Guild Compare supports a number of commands. Commands are
    activated by pressing a letter. To view the list of commands,
    press ``?``.

    Guild Compare does not automatically update to display the latest
    available data. If you want to update the list of runs and their
    status, press ``r`` (for refresh).

{'fraction_non_alphanumeric': 0.1254605747973471, 'fraction_numerical': 0.004789977892409728, 'mean_word_length': 3.660085836909871, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2818304', 'n_tokens_mistral': 1611, 'n_tokens_neox': 1577, 'n_words': 624}