跳到内容

平均路径长度

此文件是 TPOT 库的一部分。

TPOT 的当前版本由以下人员在 Cedars-Sinai 计算生物医学系开发: - Pedro Henrique Ribeiro (https://github.com/perib, https://www.linkedin.com/in/pedro-ribeiro/) - Anil Saini (anil.saini@cshs.org) - Jose Hernandez (jgh9094@gmail.com) - Jay Moran (jay.moran@cshs.org) - Nicholas Matsumoto (nicholas.matsumoto@cshs.org) - Hyunjun Choi (hyunjun.choi@cshs.org) - Gabriel Ketron (gabriel.ketron@cshs.org) - Miguel E. Hernandez (miguel.e.hernandez@cshs.org) - Jason Moore (moorejh28@gmail.com)

TPOT 的原始版本主要由以下人员在宾夕法尼亚大学开发: - Randal S. Olson (rso@randalolson.com) - Weixuan Fu (weixuanf@upenn.edu) - Daniel Angell (dpa34@drexel.edu) - Jason Moore (moorejh28@gmail.com) - 以及许多其他慷慨的开源贡献者

TPOT 是自由软件:您可以根据自由软件基金会发布的 GNU 宽通用公共许可证的条款,重新分发和/或修改它,无论是许可证的第 3 版,还是(由您选择)任何后续版本。

分发 TPOT 是希望它有用,但没有任何担保;甚至不包括适销性或特定用途适用性的默示担保。有关更多详情,请参阅 GNU 宽通用公共许可证。

您应该已经随 TPOT 收到一份 GNU 宽通用公共许可证的副本。如果没有,请访问 https://gnu.ac.cn/licenses/

average_path_length_objective(graph_pipeline)

计算从所有节点到根/最终估计器的平均最短路径(仅支持 GraphPipeline)

参数

名称 类型 描述 默认值
graph_pipeline

用于计算平均路径长度的管道

必需
源代码位于 tpot/objectives/average_path_length.py
def average_path_length_objective(graph_pipeline):
    """
    Computes the average shortest path from all nodes to the root/final estimator (only supported for GraphPipeline)

    Parameters
    ----------
    graph_pipeline: GraphPipeline
        The pipeline to compute the average path length for

    """

    path_lengths =  nx.shortest_path_length(graph_pipeline.graph, source=graph_pipeline.root)
    return np.mean(np.array(list(path_lengths.values())))+1