Exemple #1
0
            "The linkage distance threshold above which, clusters will not be merged.",
            default=None,
        ),
        n_clusters=AnyOf(
            types=[
                Int(minForOptimizer=2,
                    maxForOptimizer=8,
                    laleMaximum="X/maxItems"),
                Null(forOptimizer=False),
            ],
            default=2,
            forOptimizer=False,
            desc="The number of clusters to find.",
        ),
        constraint=AnyOf(
            [Object(n_clusters=Null()),
             Object(distance_threshold=Null())],
            desc="n_clusters must be None if distance_threshold is not None.",
        ),
    )
    FeatureAgglomeration = FeatureAgglomeration.customize_schema(
        constraint=AnyOf(
            [
                Object(compute_full_tree=Enum(["True"])),
                Object(distance_threshold=Null()),
            ],
            desc=
            "compute_full_tree must be True if distance_threshold is not None.",
        ))

if sklearn.__version__ >= "0.24":
Exemple #2
0
    from packaging import version

    from lale.schemas import AnyOf, Array, Enum, Float, Not, Null, Object, String

    autoai_libs_version = version.parse(autoai_libs_version_str)

    if autoai_libs_version >= version.Version("1.12.18"):
        NumImputer = typing.cast(
            lale.operators.PlannedIndividualOp,
            NumImputer.customize_schema(
                set_as_available=True,
                constraint=[
                    AnyOf(
                        desc="fill_value and fill_values cannot both be specified",
                        forOptimizer=False,
                        types=[Object(fill_value=Null()), Object(fill_values=Null())],
                    ),
                    AnyOf(
                        desc="if strategy=constants, the fill_values cannot be None",
                        forOptimizer=False,
                        types=[
                            Object(strategy=Not(Enum(["constants"]))),
                            Not(Object(fill_values=Null())),
                        ],
                    ),
                ],
                fill_value=AnyOf(
                    types=[Float(), String(), Enum(values=[np.nan]), Null()],
                    desc="The placeholder for fill value used in constant strategy",
                    default=None,
                ),