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

Fixed #966 Add Named Attributes to Matrix Profile #972

Merged
merged 17 commits into from
Jun 8, 2024
Merged

Fixed #966 Add Named Attributes to Matrix Profile #972

merged 17 commits into from
Jun 8, 2024

Conversation

seanlaw
Copy link
Contributor

@seanlaw seanlaw commented May 16, 2024

See #966

  • Update docstrings (to add attributes)
  • Add unit tests
  • Update tutorials

Pull Request Checklist

Below is a simple checklist but please do not hesitate to ask for assistance!

  • Fork, clone, and checkout the newest version of the code
  • Create a new branch
  • Make necessary code changes
  • Install black (i.e., python -m pip install black or conda install -c conda-forge black)
  • Install flake8 (i.e., python -m pip install flake8 or conda install -c conda-forge flake8)
  • Install pytest-cov (i.e., python -m pip install pytest-cov or conda install -c conda-forge pytest-cov)
  • Run black . in the root stumpy directory
  • Run flake8 . in the root stumpy directory
  • Run ./setup.sh && ./test.sh in the root stumpy directory
  • Reference a Github issue (and create one if one doesn't already exist)

@seanlaw seanlaw requested a review from NimaSarajpoor May 16, 2024 02:23
@seanlaw seanlaw added this to the Python 1.12.1/1.13.0 Release milestone May 16, 2024
@seanlaw
Copy link
Contributor Author

seanlaw commented May 16, 2024

@NimaSarajpoor Would you mind reviewing this first draft?

@NimaSarajpoor
Copy link
Collaborator

@seanlaw
Of course. Will do within next few days.

Copy link

codecov bot commented May 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.02%. Comparing base (f8f245c) to head (0c96429).
Report is 28 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #972      +/-   ##
==========================================
+ Coverage   98.93%   99.02%   +0.09%     
==========================================
  Files          84       85       +1     
  Lines       14293    14413     +120     
==========================================
+ Hits        14141    14273     +132     
+ Misses        152      140      -12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@NimaSarajpoor NimaSarajpoor left a comment

Choose a reason for hiding this comment

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

@seanlaw
I provided a few comments.

stumpy/mparray.py Outdated Show resolved Hide resolved
tests/test_mparray.py Outdated Show resolved Hide resolved
stumpy/gpu_stump.py Outdated Show resolved Hide resolved
stumpy/mparray.py Outdated Show resolved Hide resolved
tests/test_mparray.py Show resolved Hide resolved
tests/test_mparray.py Show resolved Hide resolved
stumpy/mparray.py Show resolved Hide resolved
stumpy/mparray.py Outdated Show resolved Hide resolved
@seanlaw
Copy link
Contributor Author

seanlaw commented May 26, 2024

@NimaSarajpoor Thanks for reviewing. I have made some changes and added some comments

stumpy/mparray.py Outdated Show resolved Hide resolved
stumpy/aamp.py Show resolved Hide resolved
@seanlaw
Copy link
Contributor Author

seanlaw commented May 28, 2024

@NimaSarajpoor Do you think this is ready to be merged?

Copy link
Collaborator

@NimaSarajpoor NimaSarajpoor left a comment

Choose a reason for hiding this comment

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

@seanlaw
Sorry for the late response. It is all good. I just added a few minor comments.

stumpy/mparray.py Outdated Show resolved Hide resolved
stumpy/mparray.py Outdated Show resolved Hide resolved
stumpy/mparray.py Outdated Show resolved Hide resolved
stumpy/mparray.py Outdated Show resolved Hide resolved
stumpy/stump.py Show resolved Hide resolved
@seanlaw
Copy link
Contributor Author

seanlaw commented Jun 2, 2024

@NimaSarajpoor Thanks for catching those. I've fixed them now

@NimaSarajpoor
Copy link
Collaborator

NimaSarajpoor commented Jun 2, 2024

@seanlaw
I am able to merge the changes, but I want to ensure I don't appear to be overstepping my permissions 😅 Let me know if I should merge it myself (of course, after passing all tests)

@seanlaw
Copy link
Contributor Author

seanlaw commented Jun 2, 2024

Please go ahead and merge when you are satisfied with the changes 😊

Copy link
Collaborator

@NimaSarajpoor NimaSarajpoor left a comment

Choose a reason for hiding this comment

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

@seanlaw
I missed this one (my bad!) I am going to take care of it.

stumpy/mparray.py Show resolved Hide resolved
@NimaSarajpoor
Copy link
Collaborator

@seanlaw
I am about to merge. In the very first comment in this PR, I can see the checkbox Update tutorials is left unmarked. Did you initially have a plan to update tutorials in this PR?

@seanlaw
Copy link
Contributor Author

seanlaw commented Jun 3, 2024

Ooh, yes! Let me think about that and what to do

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@seanlaw
Copy link
Contributor Author

seanlaw commented Jun 3, 2024

Ooh, yes! Let me think about that and what to do

Alright, @NimaSarajpoor what do you think of the tip/note that I've added as a colored box to the tutorials?

@seanlaw
Copy link
Contributor Author

seanlaw commented Jun 3, 2024

Frankly, I don't love how they look. I will try something else later today. Please stay tuned

@seanlaw
Copy link
Contributor Author

seanlaw commented Jun 3, 2024

Okay, adding the jupyterlab-myst extension allows us to render much nicer boxes using admonitions:

[comment]: <> (Myst)
:::{admonition} **Some title**
:class: note
Some body text

Add markdown code block here too
:::

@NimaSarajpoor
Copy link
Collaborator

NimaSarajpoor commented Jun 3, 2024

@seanlaw

Okay, adding the jupyterlab-myst extension allows us to render much nicer boxes using admonitions:

[comment]: <> (Myst)
:::{admonition} **Some title**
:class: note
Some body text

Add markdown code block here too
:::

The box is indeed nicer. However, I initially saw the box in its un-rendered form, and I realized that I had to upgrade my notebook from 6 to 7 so that I can see the box.

Are you okay with this?
(Even when I click on the notebook link from the repo, the box doesn't seems to be rendered: https://github.com/seanlaw/stumpy/tree/Add_Named_Attributes/docs)

@seanlaw
Copy link
Contributor Author

seanlaw commented Jun 3, 2024

Are you okay with this?

I am seeing the same thing as you on Github and I am only able to render in Jupyterlab using the Myst extension. However, I am unable to get it to render for readthedocs (building the docs locally) so I am troubleshooting. There is little to no information on why it is failing to render the boxes

@seanlaw
Copy link
Contributor Author

seanlaw commented Jun 4, 2024

I think I figured it out. The key was adding myst_enable_extensions = ["colon_fence",] to conf.py since the admonition syntax required using a "colon_fence". Additionally, we had to replace nbsphinx with myst-nb in the extensions of conf.py. After this, I was able to build everything locally, which suggests that things should work for readthedocs

After switching to myst-nb, I also noticed that the code cells look stylized too!

@seanlaw
Copy link
Contributor Author

seanlaw commented Jun 4, 2024

@NimaSarajpoor I think it is ready for review again

@NimaSarajpoor
Copy link
Collaborator

I think I figured it out. The key was adding myst_enable_extensions = ["colon_fence",] to conf.py since the admonition syntax required using a "colon_fence". Additionally, we had to replace nbsphinx with myst-nb in the extensions of conf.py. After this, I was able to build everything locally, which suggests that things should work for readthedocs

After switching to myst-nb, I also noticed that the code cells look stylized too!

That was fast! You should share how you do it 😅

@NimaSarajpoor I think it is ready for review again

I will check the changes.

@NimaSarajpoor
Copy link
Collaborator

@seanlaw
I was wondering if there is a way to fix the updated notebooks (see link below) so that they can show the rendered box properly. https://github.com/seanlaw/stumpy/tree/Add_Named_Attributes/docs

If most of the users go and check the tutorials available in the readthedocs, then we should be okay. What do you think?

@seanlaw
Copy link
Contributor Author

seanlaw commented Jun 4, 2024

That was fast! You should share how you do it 😅

Nothing special except eventually honing in on the problem:

  1. Search for jupyterlab-myst readthedocs
  2. Realize that this isn't a jupyterlab problem anymore and search for myst-parser readthedocs
  3. Realize that it's really about rendering .ipynb files in sphinx (this was key!) and then search for myst-nb sphinx
  4. Realize that myst-nb should replace nbsphinx in the conf.py so continue searching results
  5. Eventually, after quite a bit of time, poked around in the myst-nb Github repo and documentation and realize the notebooks are rendering using myst-nb but somehow the admonition boxes were the only thing NOT rendering so I looked at the docs a little bit more carefully and, in particular, blindly focus on the conf.py file (though I still didn't know if this was the problem!)
  6. I tried blindly adding/removing various things from the conf.py until it worked and, boy, was it a frustrating process!
  7. Ultimately, the colon_fence thing was the culprit and I have no idea how I figured it out as the docs were not actually direct/helpful to get there but I went to the myst-nb docs and stumbled from

myst-nb docs > authoring > Jupyter notebooks > Syntax exntensions > Colon Fencing

I'm sure there was a lot of branching along the way and it was very, very frustrating that I considered giving up numerous times!

@seanlaw
Copy link
Contributor Author

seanlaw commented Jun 4, 2024

@NimaSarajpoor Thanks for catching those copy/paste typos! I am doing too much at the same time and multitasking is killing me 😄. It's actually really, really nice to have somebody else reviewing with an eye for detail so thank you!

@seanlaw
Copy link
Contributor Author

seanlaw commented Jun 4, 2024

I was wondering if there is a way to fix the updated notebooks (see link below) so that they can show the rendered box properly. https://github.com/seanlaw/stumpy/tree/Add_Named_Attributes/docs

I had the same feeling but this is basically asking, "how do we force Github to render the .ipynb files using the myst-parser" and I am not sure. One may post a question on the myst-parser or myst-nb Github issues to ask? I don't know if it's worth it.

I think we are at the "early adopter" problem where it will take some time before anybody can get Github to change and add myst support. I just hope that readthedocs doesn't break this and we have to revert the changes to our tutorial

I posted a myst-parder discussion question here.

If most of the users go and check the tutorials available in the readthedocs, then we should be okay. What do you think?

Yes, I agree.

@NimaSarajpoor
Copy link
Collaborator

Nothing special except eventually honing in on the problem
I'm sure there was a lot of branching along the way and it was very, very frustrating that I considered giving up numerous times!

Thanks for sharing!! Great problem-solving skill! I think we all consider giving up from time to time.... but, eventually, we just keep going :)

I was wondering if there is a way to fix the updated notebooks (see link below) so that they can show the rendered box properly. https://github.com/seanlaw/stumpy/tree/Add_Named_Attributes/docs

I had the same feeling but this is basically asking, "how do we force Github to render the .ipynb files using the myst-parser" and I am not sure. One may post a question on the myst-parser or myst-nb Github issues to ask? I don't know if it's worth it.

I think we are at the "early adopter" problem where it will take some time before anybody can get Github to change and add myst support. I just hope that readthedocs doesn't break this and we have to revert the changes to our tutorial

I posted a myst-parder discussion question here.

Got it! Thanks for posting the question.

@NimaSarajpoor
Copy link
Collaborator

NimaSarajpoor commented Jun 5, 2024

@seanlaw
I need to learn to slow down and review my own review (before submitting it) so that I make sure I am not missing anything! (I missed the typo in the notebook Tutorial_Semantic_Segmentation.ipynb. The latest commit should fix it. )

@seanlaw
Copy link
Contributor Author

seanlaw commented Jun 5, 2024

Thanks, @NimaSarajpoor. It looks like all of the tests are passing except that the codecov/patch is getting stuck on In progress for over 5 hours. I've never encountered that before

@NimaSarajpoor
Copy link
Collaborator

NimaSarajpoor commented Jun 5, 2024

@seanlaw

except that the codecov/patch is getting stuck on In progress for over 5 hours

Can you let me know where I can find that? I took a look at the previous runs here: https://github.com/TDAmeritrade/stumpy/actions

And, I took a look at my first attempt:
https://github.com/TDAmeritrade/stumpy/actions/runs/9378123078/attempts/1

But couldn't locate the 5-hour delay (maybe it was not counted when it was in progress??).


As a side note:
I do however see some annotations errors. I can see it in previous runs as well even when the tests were passing. According to the provided message, we can add python3.8 -m pip install --upgrade pip to the Github Actions (or, maybe we just ignore it? But better to be addressed if possible)


As another side note:
I can see an error in the unit testing of snippet. The test for test_mpdist_snippets_s_with_isconstant[3-3-8-T0] failed. If you do not mind, I can take a look at this as I worked on snippet before.

@seanlaw
Copy link
Contributor Author

seanlaw commented Jun 5, 2024

Can you let me know where I can find that? I took a look at the previous runs here:

It's resolved now:

image

It was showing "In Progress" previously but the new commit seems to have fixed it

I do however see some annotations errors. I can see it in previous runs as well even when the tests were passing. According to the provided message, we can add python3.8 -m pip install --upgrade pip to the Github Actions (or, maybe we just ignore it? But better to be addressed if possible)

Please create a new issue for this so that it can be tracked separately

I can see an error in the unit testing of snippet. The test for test_mpdist_snippets_s_with_isconstant[3-3-8-T0] failed. If you do not mind, I can take a look at this as I worked on snippet before.

Let's handle this in a new issue as well please. Once you can confirm that you are able to reproduce the error and add it to the new issue then I will re-run the tests above so that we can close out this current issue/PR

@NimaSarajpoor
Copy link
Collaborator

@seanlaw

Once you can confirm that you are able to reproduce the error and add it to the new issue then I will re-run the tests above so that we can close out this current issue/PR

Please allow me some time to work on reproducing the error. I will get back to you

@NimaSarajpoor
Copy link
Collaborator

@seanlaw

Once you can confirm that you are able to reproduce the error and add it to the new issue then I will re-run the tests above so that we can close out this current issue/PR

Please allow me some time to work on reproducing the error. I will get back to you

I reported a similar failure in #984

@seanlaw
Copy link
Contributor Author

seanlaw commented Jun 8, 2024

I reported a similar failure in #984

Thank you. I am re-running the tests now. If they pass and there are no more changes, please feel free to squash and merge at your earliest convenience.

@NimaSarajpoor
Copy link
Collaborator

@seanlaw
Thanks for including me in this review! Going to merge it now.

@NimaSarajpoor NimaSarajpoor merged commit 31111f8 into TDAmeritrade:main Jun 8, 2024
35 checks passed
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.

2 participants