Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced subdomain integration for the weak form library #153

Merged
merged 28 commits into from
Apr 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5038797
eliminated interpolation in the weak form in favor of analytic weight…
znicolaou Jan 20, 2022
03199cf
added binomial factor for higher mixed derivative orders
znicolaou Jan 20, 2022
05c7e87
added acknowledgement for ZGN to paper
znicolaou Jan 20, 2022
fe82e95
cleaned up code and added some comments
znicolaou Jan 20, 2022
899468d
removed old unused code
znicolaou Jan 20, 2022
b20099f
recycled function evaluation
znicolaou Jan 21, 2022
e25dac2
improved weight calculation and vectorized a bit
znicolaou Jan 25, 2022
0be5400
more vectorization
znicolaou Jan 26, 2022
d0803a2
organized a bit
znicolaou Jan 27, 2022
44fdedb
added small fix to generalized library for the weak case
znicolaou Jan 28, 2022
de2e190
fixed linting issue
znicolaou Jan 28, 2022
3673517
fixed typo...
znicolaou Jan 28, 2022
2f63caf
Added some minor polishing changes to the notebook and library. Chopp…
Apr 24, 2022
45435b8
Fixed the simple linting errors.
Apr 24, 2022
8d7fe0a
Added newest version of black python package in order to avoid lintin…
Apr 24, 2022
75a7b2b
Updated to newest version of black python package last commit, but it…
Apr 24, 2022
1fb7850
documented the new weak library
znicolaou Apr 25, 2022
f445942
merged weak_pde_library
znicolaou Apr 25, 2022
6fe1299
merged weak_pde_library, but saved this time
znicolaou Apr 25, 2022
a87932f
fixed linting
znicolaou Apr 25, 2022
a292ba6
Believe I fixed issues using control inputs with PDE/weakPDE and issu…
Apr 25, 2022
f8530de
Merge branch 'weak_optimization' of https://github.com/dynamicslab/py…
Apr 25, 2022
d8fe104
Merged with Zacks changes. Nice progress today.
Apr 25, 2022
264b3d0
added weak form score and predict
znicolaou Apr 25, 2022
509da85
Merge branch 'weak_optimization' of https://github.com/dynamicslab/py…
znicolaou Apr 25, 2022
98617f2
fixed linting
znicolaou Apr 25, 2022
9927c42
debugged score and predict for discrete_time, multiple_trajectories, …
znicolaou Apr 25, 2022
0748ec5
added more weak documentation
znicolaou Apr 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
hooks:
- id: reorder-python-imports
- repo: https://github.com/ambv/black
rev: 21.5b1
rev: 22.3.0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
Expand Down
2 changes: 1 addition & 1 deletion docs/JOSS2/paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ The goal of the `PySINDy` package is to enable anyone with access to measurement

# Acknowledgments
`PySINDy` is a fork of [`sparsereg`](https://github.com/Ohjeah/sparsereg) [@markus_quade_sparsereg].
SLB, AAK, KK, and UF acknowledge support from the Army Research Office (ARO W911NF-19-1-0045). JLC acknowledges support from funding support from the Department of Defense (DoD) through the National Defense Science \& Engineering Graduate (NDSEG) Fellowship Program.
SLB, AAK, KK, and UF acknowledge support from the Army Research Office (ARO W911NF-19-1-0045). JLC acknowledges support from funding support from the Department of Defense (DoD) through the National Defense Science \& Engineering Graduate (NDSEG) Fellowship Program. ZGN is a Washington Research Foundation Postdoctoral Fellow.

![Summary of SINDy features organized by (a) `PySINDy` structure and (b) functionality. (a) Hierarchy from the sparse regression problem solved by SINDy, to the submodules of `PySINDy`, to the individual optimizers, libraries, and differentiation methods implemented in the code.
(b) Flow chart for organizing the SINDy variants and functionality in the literature. Bright color boxes indicate the features that have been implemented through this work, roughly organized by functionality. Semi-transparent boxes indicate features that have not yet been implemented.\label{fig:package-structure}](Fig1.png)
Expand Down
441 changes: 296 additions & 145 deletions examples/12_weakform_SINDy_examples.ipynb

Large diffs are not rendered by default.

46 changes: 27 additions & 19 deletions examples/1_feature_overview.ipynb

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion pysindy/feature_library/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,11 @@ def __init__(
)
self.libraries_ = libraries
self.inputs_per_library_ = inputs_per_library
for lib in self.libraries_:
if hasattr(lib, "spatiotemporal_grid"):
if lib.spatiotemporal_grid is not None:
self.n_samples = lib.K
self.spatiotemporal_grid = lib.spatiotemporal_grid

def _combinations(self, lib_i, lib_j):
"""
Expand Down Expand Up @@ -422,9 +427,12 @@ def transform(self, x):
generated from applying the custom functions to the inputs.

"""
n_samples = x.shape[0]
for lib in self.libraries_:
check_is_fitted(lib)
n_samples = x.shape[0]
if hasattr(lib, "spatiotemporal_grid"):
if lib.spatiotemporal_grid is not None: # check if weak form
n_samples = self.n_samples

# preallocate matrix
xp = np.zeros((n_samples, self.n_output_features_))
Expand Down
3 changes: 3 additions & 0 deletions pysindy/feature_library/generalized_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ def transform(self, x):

n_samples, n_features = x.shape

if isinstance(self.libraries_[0], WeakPDELibrary):
n_samples = self.libraries_[0].K * self.libraries_[0].num_trajectories

if float(__version__[:3]) >= 1.0:
n_input_features = self.n_features_in_
else:
Expand Down
Loading