Skip to content

[BUG] PDE Library usage with function_library #597

Closed
@Al-Ofek

Description

@Al-Ofek

Recently started experimenting with SINDy for PDE identification. Even while using the example code, I ran into an issue where PDELibrary does not accept the useage of function_library. Is it related to some recent changes? Defining the library functions explicitly seems to work.
Any input will be appriciated. Thanks!

Reproducing code example:

(Taken directly from the docs )

import pysindy

# basic data to illustrate the PDE Library
t = np.linspace(0, 10)
x = np.linspace(0, 10)
u = ps.AxesArray(np.ones((len(x) * len(t), 2)),{"ax_coord":1})

# Define PDE library that is quadratic in u,
# and second-order in spatial derivatives of u.
# library_functions = [lambda x: x, lambda x: x * x]
# library_function_names = [lambda x: x, lambda x: x + x]
pde_lib = ps.PDELibrary(
#     library_functions=library_functions,
    function_library=ps.PolynomialLibrary(degree=2,include_bias=False),
    derivative_order=2,
    spatial_grid=x,
).fit([u])
print("2nd order derivative library: ")
print(pde_lib.get_feature_names())

Error message:

Traceback (most recent call last):

File ~\miniconda3\envs\PhysML\Lib\site-packages\spyder_kernels\customize\utils.py:209 in exec_encapsulate_locals
exec_fun(compile(code_ast, filename, "exec"), globals)

File \sindy_test.py:143
pde_lib = ps.PDELibrary(

TypeError: PDELibrary.init() got an unexpected keyword argument 'function_library'

PySINDy/Python version information:

pysindy - 1.7.5
Python - '3.12.8 | packaged by conda-forge | (main, Dec 5 2024, 14:06:27) [MSC v.1942 64 bit (AMD64)]'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions