File size: 3,317 Bytes
90994b0
75c23d4
0b9e421
 
8f60615
 
0b9e421
d16abb4
 
 
 
8f60615
 
d16abb4
 
 
 
 
 
 
8f60615
 
d16abb4
8f60615
d16abb4
 
0b9e421
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90994b0
042b27f
d16abb4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
"""Various functions to deprecate features."""

import warnings

from .julia_import import jl


def install(*args, **kwargs):
    del args, kwargs
    warnings.warn(
        "The `install` function has been removed. "
        "PySR now uses the `juliacall` package to install its dependencies automatically at import time. ",
        FutureWarning,
    )


def init_julia(*args, **kwargs):
    del args, kwargs
    warnings.warn(
        "The `init_julia` function has been removed. "
        "Julia is now initialized automatically at import time.",
        FutureWarning,
    )
    return jl


def pysr(X, y, weights=None, **kwargs):  # pragma: no cover
    from .sr import PySRRegressor

    warnings.warn(
        "Calling `pysr` is deprecated. "
        "Please use `model = PySRRegressor(**params); "
        "model.fit(X, y)` going forward.",
        FutureWarning,
    )
    model = PySRRegressor(**kwargs)
    model.fit(X, y, weights=weights)
    return model.equations_


def best(*args, **kwargs):  # pragma: no cover
    raise NotImplementedError(
        "`best` has been deprecated. "
        "Please use the `PySRRegressor` interface. "
        "After fitting, you can return `.sympy()` "
        "to get the sympy representation "
        "of the best equation."
    )


def best_row(*args, **kwargs):  # pragma: no cover
    raise NotImplementedError(
        "`best_row` has been deprecated. "
        "Please use the `PySRRegressor` interface. "
        "After fitting, you can run `print(model)` to view the best equation, "
        "or "
        "`model.get_best()` to return the best equation's "
        "row in `model.equations_`."
    )


def best_tex(*args, **kwargs):  # pragma: no cover
    raise NotImplementedError(
        "`best_tex` has been deprecated. "
        "Please use the `PySRRegressor` interface. "
        "After fitting, you can return `.latex()` to "
        "get the sympy representation "
        "of the best equation."
    )


def best_callable(*args, **kwargs):  # pragma: no cover
    raise NotImplementedError(
        "`best_callable` has been deprecated. Please use the `PySRRegressor` "
        "interface. After fitting, you can use "
        "`.predict(X)` to use the best callable."
    )


DEPRECATED_KWARGS = {
    "fractionReplaced": "fraction_replaced",
    "fractionReplacedHof": "fraction_replaced_hof",
    "npop": "population_size",
    "hofMigration": "hof_migration",
    "shouldOptimizeConstants": "should_optimize_constants",
    "weightAddNode": "weight_add_node",
    "weightDeleteNode": "weight_delete_node",
    "weightDoNothing": "weight_do_nothing",
    "weightInsertNode": "weight_insert_node",
    "weightMutateConstant": "weight_mutate_constant",
    "weightMutateOperator": "weight_mutate_operator",
    "weightSwapOperands": "weight_swap_operands",
    "weightRandomize": "weight_randomize",
    "weightSimplify": "weight_simplify",
    "crossoverProbability": "crossover_probability",
    "perturbationFactor": "perturbation_factor",
    "batchSize": "batch_size",
    "warmupMaxsizeBy": "warmup_maxsize_by",
    "useFrequency": "use_frequency",
    "useFrequencyInTournament": "use_frequency_in_tournament",
    "ncyclesperiteration": "ncycles_per_iteration",
    "loss": "elementwise_loss",
    "full_objective": "loss_function",
}