Add predicate-based MLP implementation using mat_vec predicates#3
Open
DLaneAtElekta wants to merge 2 commits intomasterfrom
Open
Add predicate-based MLP implementation using mat_vec predicates#3DLaneAtElekta wants to merge 2 commits intomasterfrom
DLaneAtElekta wants to merge 2 commits intomasterfrom
Conversation
Implements neural network operations using relational predicates: - mat_vec(M, V_in, V_out): Matrix-vector multiplication - vec_add(A, B, C): Vector addition - activation(V_in, V_out): Activation function application This declarative approach enables: - Compositional reasoning about network structure - Potential for bidirectional inference - Natural integration with logic programming systems - Prolog-style rule export for interpretability Includes: - Python implementation (PredicateMLP.py) with PyTorch backend - F# implementation (PredicateMLP.fs) for inference engine - Comprehensive test suite (test_predicate_mlp.py)
Implements MLP inference using relational predicates: - mat_vec(M, V_in, V_out): Matrix-vector multiplication - vec_add(A, B, C): Vector addition - activation(Type, V_in, V_out): Activation functions New files: - sro_decoder_mlp.pl: Core MLP predicates for inference - tensor_autodiff.pl: Computation graph with automatic differentiation - dense(W, B, In, Out): Dense layer building graph node - relu/swish/sigmoid(In, Out): Activations with grad functions - mse(Exp, Act, Loss): Loss function - backward(Loss, Gradients): Backpropagation via chain rule - export_weights_to_prolog.py: Convert PyTorch weights to Prolog facts - example_weights.pl: Sample weights for testing The autodiff module builds execution graphs suitable for automatic differentiation by recording operations and their gradient functions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements neural network operations using relational predicates:
This declarative approach enables:
Includes: