Skip to content

How to add time dependence to candidate function library. #637

@sdal750-sudo

Description

@sdal750-sudo

I am trying to add a y and yM2 to the polynomial library. y is equal to y0 + epsilont, where epsilon and y0 are fixed and defined. However when i do this, it fits two seperate y's to the model. How do I fix this to have only one y in the candidate function library.

M = np.stack((m1, m2), axis=-1)

poly_library = ps.PolynomialLibrary(degree=3)

y_functions = [
lambda t: y0 + epsilon * t,
lambda x, t: x[1] * (y0 + epsilon * t),

]

y_function_names = [
lambda t: 'y',
lambda x, t: 'y M2',

]

y_library = ps.CustomLibrary(
library_functions=y_functions,
function_names=y_function_names
)

combined_library = y_library

differentiation_method = ps.FiniteDifference(order=2)
optimizer = ps.STLSQ(threshold=0.01)
model = ps.SINDy(
differentiation_method=differentiation_method,
feature_library=combined_library,
optimizer=optimizer,
feature_names=["M1", "M2"],
)

model.fit(M, t=t)
model.print()

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