-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
[GSoC] Added symbolic Expectation, Variance and CrossCovariance matrix #19529
Conversation
✅ Hi, I am the SymPy bot (v160). I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.7. Note: This comment will be updated with the latest check if you edit the pull request. You need to reload the page to see it. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
🟠Hi, I am the SymPy bot (v160). I've noticed that some of your commits add or delete files. Since this is sometimes done unintentionally, I wanted to alert you about it. This is an experimental feature of SymPy Bot. If you have any feedback on it, please comment at sympy/sympy-bot#75. The following commits add new files:
If these files were added/deleted on purpose, you can ignore this message. |
There are various name possibilities to choose, from wikipedia:
In principle, 1 and 2 are the generalizations of variance and covariance to vector random variables. There are problems with the terminology though, as the covariance matrix is the generalization of the variance (not the covariance), while the cross-covariance matrix is the generalization of the covariance. |
Tests? |
I am writing them currently, and push by tonight. |
I have added docs and tests for VarianceMatrix and CrossCovarianceMatrix. I am currently trying to resolve the following error with ExpectationMatrix. >>> A = MatrixSymbol("A", k, k)
>>> X = RandomMatrixSymbol("X", k, 1)
>>> Expectation((Mul.fromiter([A*X]))) # correct
ExpectationMatrix(A*X)
>>> Expectation((Mul.fromiter([X])))
ExpectationMatrix(X)
>>> A*Expectation((Mul.fromiter([X]))) # this looks incorrect
A*X # Expected as: A*ExpectationMatrix(X) @oscarbenjamin @sylee957 Can you please have a look at this? |
a7edaac
to
e28d084
Compare
The problem is with >>> r = Expectation((Mul.fromiter([X])))
>>> r
ExpectationMatrix(X)
>>> r.doit()
X |
Codecov Report
@@ Coverage Diff @@
## master #19529 +/- ##
=============================================
+ Coverage 75.621% 75.667% +0.046%
=============================================
Files 652 655 +3
Lines 169813 170092 +279
Branches 40061 40110 +49
=============================================
+ Hits 128415 128705 +290
+ Misses 35789 35770 -19
- Partials 5609 5617 +8 |
Opps, got it, MatMul will call |
5bc5d82
to
28d62c4
Compare
ping @Upabjojr |
def test_multivariate_variance(): | ||
raises(ShapeError, lambda: Variance(A)) | ||
|
||
expr = Variance(a) # type: VarianceMatrix |
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.
maybe also an assert isinstance(expr, VarianceMatrix)
?
This looks good to me. |
Added symbolic Expectation, Variance and Covariance matrix
References to other Issues or PRs
References from #19299
Brief description of what is fixed or changed
Other comments
Release Notes
ping @czgdp1807 @Upabjojr