当前位置: 首页>>代码示例>>Python>>正文


Python display.Markdown方法代码示例

本文整理汇总了Python中IPython.display.Markdown方法的典型用法代码示例。如果您正苦于以下问题:Python display.Markdown方法的具体用法?Python display.Markdown怎么用?Python display.Markdown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPython.display的用法示例。


在下文中一共展示了display.Markdown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: scatter_plot_intent_dist

# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def scatter_plot_intent_dist(workspace_pd):
    """
    takes the workspace_pd and generate a scatter distribution of the intents
    :param workspace_pd:
    :return:
    """

    label_frequency = Counter(workspace_pd["intent"]).most_common()
    frequencies = list(reversed(label_frequency))
    counter_list = list(range(1, len(frequencies) + 1))
    df = pd.DataFrame(data=frequencies, columns=["Intent", "Number of User Examples"])
    df["Intent"] = counter_list

    sns.set(rc={"figure.figsize": (15, 10)})
    display(
        Markdown(
            '## <p style="text-align: center;">Sorted Distribution of User Examples \
                     per Intent</p>'
        )
    )

    plt.ylabel("Number of User Examples", fontdict=LABEL_FONT)
    plt.xlabel("Intent", fontdict=LABEL_FONT)
    ax = sns.scatterplot(x="Intent", y="Number of User Examples", data=df, s=100) 
开发者ID:watson-developer-cloud,项目名称:assistant-dialog-skill-analysis,代码行数:26,代码来源:summary_generator.py

示例2: print_markdown_table

# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def print_markdown_table(headers, data):
    '''
    Renders table given headers and data
    '''
    md = ''

    for h in headers:
        md += '|' + h

    md += '|\n'

    for r in range(len(headers)):
        md += '|---'

    md += '|\n'

    for row in data:
        for element in row:
            md += '|' + str(element)
        md += '|\n'

    display(Markdown(md)) 
开发者ID:Nurtch,项目名称:rubix,代码行数:24,代码来源:utils.py

示例3: display_observations

# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def display_observations(self):
        """Display the current observations using IPython.display."""
        for observation in self.observation_list.values():
            display(Markdown(f"### {observation.caption}"))
            display(Markdown(observation.description))
            display(Markdown(f"Score: {observation.score}"))
            if observation.link:
                display(Markdown(f"[Go to details](#{observation.link})"))
            if observation.tags:
                display(Markdown(f'tags: {", ".join(observation.tags)}'))
            display(observation.data)
            if observation.additional_properties:
                display(Markdown("### Additional Properties"))
                for key, val in observation.additional_properties.items():
                    display(Markdown(f"**{key}**: {val}")) 
开发者ID:microsoft,项目名称:msticpy,代码行数:17,代码来源:observationlist.py

示例4: generate_summary_statistics

# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def generate_summary_statistics(data, entities_list=None):
    """
    Take the workspace dictionary and display summary statistics regarding the workspace
    :param data:
    :param entities_list:
    :return:
    """

    total_examples = len(data["utterance"])
    label_frequency = Counter(data["intent"]).most_common()
    number_of_labels = len(label_frequency)
    average_example_per_intent = np.average(list(dict(label_frequency).values()))
    standard_deviation_of_intent = np.std(list(dict(label_frequency).values()))

    characteristics = list()
    characteristics.append(["Total User Examples", total_examples])
    characteristics.append(["Unique Intents", number_of_labels])
    characteristics.append(
        ["Average User Examples per Intent", int(np.around(average_example_per_intent))]
    )
    characteristics.append(
        [
            "Standard Deviation from Average",
            int(np.around(standard_deviation_of_intent)),
        ]
    )
    if entities_list:
        characteristics.append(["Total Number of Entities", len(entities_list)])
    else:
        characteristics.append(["Total Number of Entities", 0])

    df = pd.DataFrame(data=characteristics, columns=["Data Characteristic", "Value"])
    df.index = np.arange(1, len(df) + 1)
    display(Markdown("### Summary Statistics"))
    display(df) 
开发者ID:watson-developer-cloud,项目名称:assistant-dialog-skill-analysis,代码行数:37,代码来源:summary_generator.py

示例5: show_user_examples_per_intent

# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def show_user_examples_per_intent(data):
    """
    Take the workspace dictionary and display summary statistics regarding the workspace
    :param data:
    :return:
    """

    label_frequency = Counter(data["intent"]).most_common()
    frequencies = list(reversed(label_frequency))
    df = pd.DataFrame(data=frequencies, columns=["Intent", "Number of User Examples"])
    df.index = np.arange(1, len(df) + 1)
    display(Markdown("### Sorted Distribution of User Examples per Intent"))
    display(df) 
开发者ID:watson-developer-cloud,项目名称:assistant-dialog-skill-analysis,代码行数:15,代码来源:summary_generator.py

示例6: h1

# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def h1(text):
        display(Markdown('# %s' % text)) 
开发者ID:miklevin,项目名称:Pipulate,代码行数:4,代码来源:__init__.py

示例7: h2

# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def h2(text):
        display(Markdown('## %s' % text)) 
开发者ID:miklevin,项目名称:Pipulate,代码行数:4,代码来源:__init__.py

示例8: h3

# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def h3(text):
        display(Markdown('### %s' % text)) 
开发者ID:miklevin,项目名称:Pipulate,代码行数:4,代码来源:__init__.py

示例9: h4

# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def h4(text):
        display(Markdown('#### %s' % text)) 
开发者ID:miklevin,项目名称:Pipulate,代码行数:4,代码来源:__init__.py

示例10: print_md

# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def print_md(string):
    display(Markdown(string))


#@DeprecationWarning 
开发者ID:mitdbg,项目名称:aurum-datadiscovery,代码行数:7,代码来源:main.py

示例11: help

# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def help(self):
        """
        Prints general help information, or specific usage information of a function if provided
        :param function: an optional function
        """
        from IPython.display import Markdown, display

        def print_md(string):
            display(Markdown(string))

        # Check whether the request is for some specific function
        #if function is not None:
        #    print_md(self.function.__doc__)
        # If not then offer the general help menu
        #else:
        print_md("### Help Menu")
        print_md("You can use the system through an **API** object. API objects are returned"
                 "by the *init_system* function, so you can get one by doing:")
        print_md("***your_api_object = init_system('path_to_stored_model')***")
        print_md("Once you have access to an API object there are a few concepts that are useful "
                 "to use the API. **content** refers to actual values of a given field. For "
                 "example, if you have a table with an attribute called __Name__ and values *Olu, Mike, Sam*, content "
                 "refers to the actual values, e.g. Mike, Sam, Olu.")
        print_md("**schema** refers to the name of a given field. In the previous example, schema refers to the word"
                 "__Name__ as that's how the field is called.")
        print_md("Finally, **entity** refers to the *semantic type* of the content. This is in experimental state. For "
                 "the previous example it would return *'person'* as that's what those names refer to.")
        print_md("Certain functions require a *field* as input. In general a field is specified by the source name ("
                 "e.g. table name) and the field name (e.g. attribute name). For example, if we are interested in "
                 "finding content similar to the one of the attribute *year* in the table *Employee* we can provide "
                 "the field in the following way:")
        print(
            "field = ('Employee', 'year') # field = [<source_name>, <field_name>)") 
开发者ID:mitdbg,项目名称:aurum-datadiscovery,代码行数:35,代码来源:ddapi.py

示例12: test_append_display_data

# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def test_append_display_data():
    widget = widget_output.Output()

    # Try appending a Markdown object.
    widget.append_display_data(Markdown("# snakes!"))
    expected = (
        {
            'output_type': 'display_data',
            'data': {
                'text/plain': '<IPython.core.display.Markdown object>',
                'text/markdown': '# snakes!'
            },
            'metadata': {}
        },
    )
    assert widget.outputs == expected, repr(widget.outputs)

    # Now try appending an Image.
    image_data = b"foobar"
    image_data_b64 = image_data if sys.version_info[0] < 3 else 'Zm9vYmFy\n'

    widget.append_display_data(Image(image_data, width=123, height=456))
    expected += (
        {
            'output_type': 'display_data',
            'data': {
                'image/png': image_data_b64,
                'text/plain': '<IPython.core.display.Image object>'
            },
            'metadata': {
                'image/png': {
                    'width': 123,
                    'height': 456
                }
            }
        },
    )
    assert widget.outputs == expected, repr(widget.outputs) 
开发者ID:luckystarufo,项目名称:pySINDy,代码行数:40,代码来源:test_widget_output.py

示例13: printmd

# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def printmd(*args):  # fixme: make it work without jupyter notebook
    display(Markdown(" ".join(map(str, args)))) 
开发者ID:paperswithcode,项目名称:axcell,代码行数:4,代码来源:elastic.py

示例14: printmd

# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def printmd(string):
    '''
    Renders markdown in notebook output of codecell
    '''
    display(Markdown(string)) 
开发者ID:Nurtch,项目名称:rubix,代码行数:7,代码来源:utils.py

示例15: display_source_code

# 需要导入模块: from IPython import display [as 别名]
# 或者: from IPython.display import Markdown [as 别名]
def display_source_code(source_code, language='python'):
    display(Markdown("```%s\n%s\n```" % (language, source_code))) 
开发者ID:feihoo87,项目名称:QuLab,代码行数:4,代码来源:utils.py


注:本文中的IPython.display.Markdown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。