Skip to content

initial commit of matrix normal base API , regression, and MN-RSA#341

Merged
mihaic merged 90 commits into
brainiak:masterfrom
mshvartsman:matnormal-regression-rsa
Oct 13, 2020
Merged

initial commit of matrix normal base API , regression, and MN-RSA#341
mihaic merged 90 commits into
brainiak:masterfrom
mshvartsman:matnormal-regression-rsa

Conversation

@mshvartsman

Copy link
Copy Markdown
Contributor

Massive squashed commit of matrix-normal functionality. Includes the base API, matrix-normal RSA, matrix-normal regression, and an example. Have a separate commit ready to go for matrix-normal SRM but this is already huge so let's do this first.

Paging @narayanan2004 for double checking I didn't mess up with what I picked out of the private repo, @lcnature for reviewing RSA.

@mihaic

mihaic commented Mar 26, 2018

Copy link
Copy Markdown
Member

@narayanan2004, @lcnature, are you in touch with @mshvartsman about this PR?

@lcnature

Copy link
Copy Markdown
Contributor

@mihaic Sorry, not yet. I will have a look at it after Friday. @mshvartsman I just had a quick glance a the console output of the automatic testing system, it seems that there are quite a few formatting complaint in brainiak/utils/utils.py and a few in your brainiak/matnormal module. You can probably see them if you just run the run-checks.sh

@lcnature

lcnature commented Apr 6, 2018

Copy link
Copy Markdown
Contributor

Hi @mshvartsman
Here are some minor comments regarding MN-RSA.ipynb:
Somehow on github (https://github.com/mshvartsman/brainiak/blob/3dcf915ad942b843b3abf6787cf473f8a094d4a6/examples/matnormal/MN-RSA.ipynb), the font of the first line of equation appear extremely small.
The equation after "Now we add a matrix-normal prior on $\beta$, allowing us to marginalize. We parameterize the covariance in terms of its cholesky factor $\L$." seems to be two distribution, one for beta, one for Y conditioning on other variables. So it seems good to separate them to two lines. The same applies for the next two lines of equations.
Is it possible to write transpose as either ' or ^T?

Will continue to read other codes :)

@mshvartsman

Copy link
Copy Markdown
Contributor Author

Github rendering of math in notebooks seems pretty bad unfortunately -- it looks fine locally.

@mshvartsman

Copy link
Copy Markdown
Contributor Author

Sorry for so many vacuous commits as I get this ship-shape: for some reason run-checks.sh gives different results on my machine vs on the CI box.

@mshvartsman

Copy link
Copy Markdown
Contributor Author

Current linux failures look to be due to tensorflow being incompatible with old libc (e.g. tensorflow/tensorflow#177), I'm guessing because the test server runs Centos/Springdale 6. There are various hackarounds possible (easiest might be installing TF from conda) but I don't know how to make any of them work with the CI setup. Any advice?

@mihaic

mihaic commented Apr 9, 2018

Copy link
Copy Markdown
Member

@mshvartsman, you are right. TensorFlow does appear to require glibc >= 2.17 (tensorflow/tensorflow#53), although this requirement is not explicitly documented, as far as I can tell.

We do want to be able to depend on TensorFlow, so I am looking into a workaround for our Jenkins server.

@mihaic

mihaic commented Apr 9, 2018

Copy link
Copy Markdown
Member

I added PR #357 as a workaround for the TensorFlow issue.

@mshvartsman

Copy link
Copy Markdown
Contributor Author

Great -- so what are next steps? Review / merge #357 and then I need to modify the build script somewhere also to pass --conda-override into the build script? Or does the latter happen on the Travis CI side?

@mshvartsman

Copy link
Copy Markdown
Contributor Author

@lcnature As mentioned on slack, the garbled math rendering is an issue with github's jupyter notebook renderer -- it looks fine locally. I don't know of a workaround -- @mihaic do you?

@mihaic

mihaic commented Apr 10, 2018

Copy link
Copy Markdown
Member

After PR #357 is merged, I will modify the Jenkins configuration to pass the flag. The Jenkins configuration is not part of this repo. Travis is not affected.

As for the GitHub Latex rendering, I am not aware of a workaround, but I don't think it matters. Users can see the rendering locally, as you mentioned; additionally, we should use our HTML docs for displaying examples (see issue #268).

@mihaic

mihaic commented Apr 16, 2018

Copy link
Copy Markdown
Member

@mshvartsman, please add the commit from PR #357 to your branch, so we can use the Jenkins workaround.

@mihaic

mihaic commented Apr 16, 2018

Copy link
Copy Markdown
Member

I didn't mean to be obscure. Merging master will add the commit.

@lcnature

Copy link
Copy Markdown
Contributor

@mshvartsman @mihaic Other than the last comment above, I think the PR is good to go!

@mihaic mihaic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still looking great. Just one overlooked whitespace diff. I am willing to merge and as soon as @lcnature approves and leave the Conda build fix for later (hint: we could change tensorflow-probability to PyPI like pymanopt).

Comment thread brainiak/utils/utils.py
r : float or 1D ndarray
Pearson correlation values for input variables
"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this one whitespace difference as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's done.

@mshvartsman

Copy link
Copy Markdown
Contributor Author

The conda build fix doesn't look too onerous, we might as well do it. I think I got all the spots where pymanopt is special-cased and did the same for TFP? The one place I'm not sure about is jenkins-server-customization: does that still need to be there, or does that go away with the hackaround I've got in SSSRM?

Latest TF in conda is 2.2 though and TFP requires 2.3 so we can either do the pypi workaround or just wait until TF2.3 makes it into the conda repo, up to you.

@lcnature

lcnature commented Sep 1, 2020

Copy link
Copy Markdown
Contributor

@mihaic @mshvartsman Looks good to me too! I am happy to approve! Thank you both for contributing and managing!

@lcnature lcnature left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just hit the approve button here

@mihaic

mihaic commented Sep 1, 2020

Copy link
Copy Markdown
Member

@lcnature, thanks a lot for helping with this monumental PR!

@mshvartsman, since you are up fixing the Conda build, could you please try TensorFlow from PyPI as well? Please ignore jenkins-server-customization; we decided to stop testing on Jenkins recently.

@mshvartsman

Copy link
Copy Markdown
Contributor Author

Tried it, not sure what happened with the build there. Looks like TFP successfully installed without complaining about missing TF2.3 but then it couldn't find all the TF libs and froze. Any ideas?

Comment thread .conda/build.sh Outdated
# Install pymanopt and tensorflow_probability via pip because there isn't a conda
# package, and install tensorflow 2.3 from pip because tensorflow_probability
# requires it and latest in conda is 2.2.
PIP_NO_INDEX=False $PYTHON -m pip install tensorflow>=2.3

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to quote or escape the >, otherwise Bash interprets it as a redirect, e.g., tensorflow\>=2.3. We cannot see in the Travis logs what happened to the installation because of this redirect.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks. I blame my fancy programming font ligature.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that was it though? Still fails.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for trying. Not sure what is happening. I'll experiment with building the Conda package manually to understand. If I don't figure it out in the next few days, I plan to merge the PR nevertheless and solve the build issue later.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! I'll get rolling on the next piece (MN-SRM) and PR that when it's ready.

Thanks to @bdsinger for finding the proper TensorFlow Conda package.
@mihaic

mihaic commented Sep 25, 2020

Copy link
Copy Markdown
Member

The good news is that there is a TensorFlow 2.3 package in Conda (tensorflow-base). The bad news is that it is not compiled for macOS, only Linux.

@mshvartsman

Copy link
Copy Markdown
Contributor Author

Does that change our plans for merging?

@mihaic

mihaic commented Oct 1, 2020

Copy link
Copy Markdown
Member

My comment was a sort of explanation for the failure of commit 5e472a1. Still planning to merge for the upcoming release and still looking for the best way to build the Conda package.

@mihaic

mihaic commented Oct 6, 2020

Copy link
Copy Markdown
Member

@mshvartsman, I have a new proposal in light of the difficulty in packaging TensorFlow 2.3 for macOS with Conda. What if I make a new brainiak-matnormal package? It would be a pure Python package, so we will be able to publish a binary wheel for it on PyPI. That would be easily installable using either Pip or Conda, with no prerequirement from the operating system.

I also thought about using Setuptools extras_require to make matnormal an optional part of the BrainIAK package, but that does not work in Conda as far as I can tell.

@mihaic

mihaic commented Oct 7, 2020

Copy link
Copy Markdown
Member

@mshvartsman, another solution I see is to use extras_require and do nothing in Conda. Instead, we would instruct Conda users to install the TensorFlow 2.3 separately. The instructions would be:

No TensorFlow, matnormal cannot be used:

pip install brainiak
or
conda install brainiak

TensorFlow installed, matnormal can be used:

pip install brainiak[matnormal]
or
conda install brainiak && pip install -r requirements-matnormal.txt

What do you think?

@mihaic

mihaic commented Oct 8, 2020

Copy link
Copy Markdown
Member

@mshvartsman, to make some progress, I will implement the extras_require proposal. We can change it later.

@mihaic mihaic merged commit 740ec16 into brainiak:master Oct 13, 2020
@mihaic

mihaic commented Oct 13, 2020

Copy link
Copy Markdown
Member

@mshvartsman, thank you very much for your patience! I hope the optional dependencies approach will work well.

Thank you for your help, @narayanan2004, @lcnature, and @szorowi1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants