跳到内容

Amltk 解析器

此文件是 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 宽通用公共许可证(GNU Lesser General Public License)条款重新分发和/或修改它,可以选择该许可证的第 3 版或任何后续版本。

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

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

tpot_parser(node)

将 amltk 流水线搜索空间转换为 tpot 流水线搜索空间。

参数

名称 类型 描述 默认值
node 节点

要转换的节点。

必需

返回值

类型 描述
搜索空间

可由 TPOT 优化的等效 TPOT 搜索空间。

源代码位于 tpot/utils/amltk_parser.py
def tpot_parser(
    node: Node,
    ):
    """
    Convert amltk pipeline search space into a tpot pipeline search space.

    Parameters
    ----------
    node: amltk.pipeline.Node
        The node to convert.

    Returns
    -------
    tpot.search_spaces.base.SearchSpace
        The equivalent TPOT search space which can be optimized by TPOT.
    """

    if isinstance(node, Component):
        return component_to_estimatornode(node)
    elif isinstance(node, Sequential):
        return sequential_to_sequentialpipeline(node)
    elif isinstance(node, Choice):
        return choice_to_choicepipeline(node)
    elif isinstance(node, Fixed):
        return fixed_to_estimatornode(node)
    elif isinstance(node, Split):
        return split_to_unionpipeline(node)
    else:
        raise ValueError(f"Node type {type(node)} not supported")