processor.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:ClassifyHub 作者: Top-Ranger 项目源码 文件源码
def _batch_worker(queue_input, queue_output):
    classifiers = classifier.get_all_classifiers()
    try:
        while True:
            data = queue_input.get(True, 1)
            sum_results = utility.get_zero_class_dict()
            classifier_results = dict()
            for c in classifiers:
                result = c.classify(data)
                classifier_results[c.name()] = result
                for key in sum_results.keys():
                    if key in result:
                        sum_results[key] += result[key] / len(classifiers)
            queue_output.put((data, utility.get_best_class(sum_results), sum_results, classifier_results))
    except queue.Empty:
        sys.exit(0)


##
# \brief Learning worker for parallel processing.
#
# \param input List containing Tupel (GITHUB, CLASS), where GITHUB is the repository as a github.Github class and
#              CLASS is the class label of the repository as a string.
# \param queue_classifier multiprocessing.Queue containing classifier objects for learning.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号