本文整理汇总了Python中plot.Plot.false_mention_histogram方法的典型用法代码示例。如果您正苦于以下问题:Python Plot.false_mention_histogram方法的具体用法?Python Plot.false_mention_histogram怎么用?Python Plot.false_mention_histogram使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plot.Plot
的用法示例。
在下文中一共展示了Plot.false_mention_histogram方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plot_before
# 需要导入模块: from plot import Plot [as 别名]
# 或者: from plot.Plot import false_mention_histogram [as 别名]
def plot_before (before, output_dir):
from chemotext_util import LoggingUtil
logger = LoggingUtil.init_logging (__file__)
if before.count () <= 0:
return
'''
before = before.reduceByKey (lambda x, y : x + y). \
mapValues (lambda x : filter (lambda v : v is not None, x))
'''
true_plots_dir = os.path.join (output_dir, "chart")
print ("-------------> before 0")
true_mentions = before. \
mapValues (lambda x : Plot.plot_true_mentions (x, true_plots_dir)). \
filter (lambda x : len(x[1]) > 0)
logger.info ("Plotted {0} sets of true mentions.".format (true_mentions.count ()))
print ("-------------> before 1")
false_plots_dir = os.path.join (output_dir, "chart", "false")
false_mentions = before.subtractByKey (true_mentions)
false_frequency = false_mentions. \
mapValues (lambda x : Plot.false_mention_histogram (x, false_plots_dir))
false_mentions = false_mentions. \
mapValues (lambda x : Plot.plot_false_mentions (x, false_plots_dir))
logger.info ("false mentions: {0}".format (false_mentions.count ()))
true_mentions = None
false_mentions = None
false_frequency = None