submissions.py 文件源码

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

项目:kaggle-seizure-prediction 作者: sics-lm 项目源码 文件源码
def write_scores(scores,
                 output=sys.stdout,
                 do_normalize=True,
                 default_score=0):
    """
    Writes the given segment scores to a submission file. If a expected segment is missing, it will be filled with
    a default value.

    :param scores: A list of score dictionaries. Each if the inner dictionaries should have two keys: 'clip' and
                   'preictal'. 'clip' is the name of the segment and 'preictal' is the class probability of that
                    segment being preictal.
    :param output: The file-like object which the scores should be written to.
    :param do_normalize: If True, scores will be normalized per subject.
    :param default_score: The value to use for missing segments in the *scores* list.
    :return: None. The scores are written to the output file-like object.
    """
    submissions = scores_to_submission(scores, do_normalize=do_normalize, default_score=default_score)
    csv_writer = csv.DictWriter(output, fieldnames=['clip', 'preictal'])
    csv_writer.writeheader()
    csv_writer.writerows(submissions)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号