-
Notifications
You must be signed in to change notification settings - Fork 25
Adding supporting code for blog post #9
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
base: main
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,97 @@ | |||
classdef spectralConvolution1dLayer < nnet.layer.Layer ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect we could use the same version here and in the 1d FNO example - maybe we should consider a directory of shared tools for the examples.
That's something we'll have to look into in future I think, not something to try deal with in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome Mae!
I still need to review the other MLX files, but I wanted to post my initial comments first.
phiml-blog-supporting-code/physics-informed-ml-blog-supporting-code.prj
Outdated
Show resolved
Hide resolved
…g m files and md files for each subdirectory
… add startup script
…xample so that motion remained bounded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great Mae!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there might be some open conversations still, but this is looking good to me.
I forget if I said elsewhere, but just in case, we should "Squash and merge" when merging this. That seems to be the default when I look, probably because we've used that elsewhere. My understanding is that will prevent those large data files, hidden in the historic commits, won't end up in the main branch since a later commit deletes them, and squashing those together will remove the files from the git history.
phiml-blog-supporting-code/README.md
Outdated
2. **Fourier Neural Operator**: learns the solution operator that maps input functions (e.g. forcing function) to the solution of a differential equation, utilizing Fourier transforms to parameterize the integral kernel and efficiently capture global dependencies. | ||
|
||
## Setup | ||
Open the project file physics-informed-ml-blog-supporting-code.prj to correctly set the path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like using a project. I think the path management is simple enough, when I opened the project the only path I noticed added was the /data
, which we can probably reference with relative paths in most examples load(fullfile("..","data","datafile.mat"))
The project adds a bunch of .xml
files without human readable names, and it's not obvious what their purpose is. That makes it harder to understand the state of local copies of the repo and harder to review changes.
I think we shouldn't use a project and should remove all the resources and metadata that it adds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't add binary files to the repo where possible, particularly data files that are "large" - MB is large for git, e.g. this page says 50MB will give you warnings.
These files add a noticeable impact on the speed of pulling the repo, and it's not possible to review changes to these files as a diff (arguably the same is true of .mlx
. At least visdiff
locally could let me see a human readable diff).
I can message on Teams about how I'm planning to add some data separately.
@@ -1,13 +1,13 @@ | |||
# Physics Informed Machine Learning Methods and Implementation supporting code | |||
This repository provides examples demonstrating a variety of Physics-Informed Machine Learning (PhiML) techniques, applied to a simple pendulum system. The examples provided here are discussed in detail in the accompanying blog post "Physics-Informed Machine Learning: Methods and Implementation". | |||
This collection provides examples demonstrating a variety of Physics-Informed Machine Learning (PhiML) techniques, applied to a simple pendulum system. The examples provided here are discussed in detail in the accompanying blog post "Physics-Informed Machine Learning: Methods and Implementation". | |||
|
|||
 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like I'm missnig something, why's the alt text "hippo" 😅?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to above, it'd be nice if we can change the code so that this blank plot isn't needed.
**Physics\-Informed Loss** | ||
|
||
|
||
The physics loss enforces the differential equation by penalizing deviations from the governing pendulum ODE. Functions like [`dllaplacian`](https://www.mathworks.com/help/releases/R2025a/deeplearning/ref/dlarray.dllaplacian.html?searchPort=60735) and [`dljacobian`](https://www.mathworks.com/help/deeplearning/ref/dlarray.dljacobian.html) make it simple to define derivative terms appearing in ordinary and partial differential equations for use in a PINN. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need that "?searchPort" part in the dllaplacian
link.
phiml-blog-supporting-code/README.md
Outdated
Created and tested with MATLAB® R2025a | ||
- [Deep Learning Toolbox™](https://www.mathworks.com/products/deep-learning.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The generatePendulumData
function uses sgolayfilt
which needs Signal Processing Toolbox. I guess we won't need that when we get the data on supportfiles.
@@ -76,6 +66,8 @@ for i = 1:numPlots | |||
ylabel("$\theta(t)$",Interpreter='latex') | |||
end | |||
``` | |||
|
|||
 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's nice if the alt text here is descriptive, like "Solution Plots" or something. Not sure if we have any control over that for MLX to MD export.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could these plots be made such that the y axis labels don't overlap, and the legend isn't blocking the plot?
Supporting code for the blog post Physics-Informed Machine Learning: Methods and Implementation