本文整理匯總了Python中plot.Plot.plot_true_mentions方法的典型用法代碼示例。如果您正苦於以下問題:Python Plot.plot_true_mentions方法的具體用法?Python Plot.plot_true_mentions怎麽用?Python Plot.plot_true_mentions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類plot.Plot
的用法示例。
在下文中一共展示了Plot.plot_true_mentions方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: plot_before
# 需要導入模塊: from plot import Plot [as 別名]
# 或者: from plot.Plot import plot_true_mentions [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