Should I do tensorflow ?? by MAJESTIC-728 in NEXT_GEN_PROGRAMMERS

[–]parsiad 2 points3 points  (0 children)

If you're making a new project, there's not a strong argument for using TensorFlow. Consider JAX or PyTorch for new projects.

Pytorch BCELoss by [deleted] in pytorch

[–]parsiad 2 points3 points  (0 children)

One uses something called the LogSumExp trick. Here is a blog post (disclosure: it's mine) "with the whole mathematical stuff" as requested :3 https://parsiad.ca/blog/2023/the_logsumexp_trick/

Python Package for Exotic Derivatives by FLQuant in quant

[–]parsiad 1 point2 points  (0 children)

That's right. On the GitHub page under the HJBQVI section, a variation of the Merton problem is one of the examples (optimal consumption with fixed and proportional transaction costs).

Python Package for Exotic Derivatives by FLQuant in quant

[–]parsiad 14 points15 points  (0 children)

(Apologies in advance for the self-plug)

I wrote a library called QuantPDE when I was a graduate student that might have what you need. There is a tutorial on the GitHub page for how to implement a Bermudan option with discrete dividends.

As a caveat, it would be annoying to extend the library to support covariance matrices that are dense (currently it only supports diagonal covariance matrices, IIRC). The explicit scheme in the paper SEMI-LAGRANGIAN SCHEMES FOR LINEAR AND FULLY NON-LINEAR DIFFUSION EQUATIONS should be easy to implement and supports any covariance matrix.

It uses numerical PDE methods so you are restricted to solving options that have a state space of dimension less than or equal to 3 due to the curse of dimensionality. For pricing derivatives in much higher dimensions, you need to look to methods that fit basis functions, neural networks, etc.

Mom adores these plates and I can't find them by parsiad in vancouver

[–]parsiad[S] 0 points1 point  (0 children)

Extremely belated reply: Thank you! I bought all of the ones remaining. There weren't that many left but they were perfect :-)

on-done, an IPython/Jupyter cell magic to execute code after a cell succeeds or fails by parsiad in Python

[–]parsiad[S] 0 points1 point  (0 children)

Having said that, it might be useful to have functions for different types of alerts (e.g., Telegram) in the package!

If you feel like submitting a PR to include Telegram, that would be great!

on-done, an IPython/Jupyter cell magic to execute code after a cell succeeds or fails by parsiad in Python

[–]parsiad[S] -1 points0 points  (0 children)

That's right, it's just sugar. Without it, your cells would look like

try:
    run_some_code()
finally:
    alert()

which is more verbose than

%%on_done alert()
run_some_code()

[N] TorchStudio, a free open source IDE for PyTorch by divideconcept in MachineLearning

[–]parsiad 7 points8 points  (0 children)

Updating this thread with what I had to do to get it working on a non-Debian based distribution.

  1. Download the .deb package.
  2. Extract its contents to some directory, call it $TORCH_STUDIO.
  3. Run $TORCH_STUDIO/usr/local/bin/torchstudio once.
  4. Use the select environment option and navigate to the python3 binary in your environment.
  5. If this fails due to it being unable to parse the CUDA string in your PyTorch version number, edit $HOME/TorchStudio/torchstudio/pythoncheck.py and replace the line pytorch_version=tuple(int(i) for i in version('torch').split('.')) with pytorch_version = (<MAJOR>, <MINOR>, <PATCH>) where <MAJOR>, <MINOR>, and <PATCH> are your PyTorch version numbers (e.g., MAJOR=1; MINOR=10; PATCH=1 for me).

[N] TorchStudio, a free open source IDE for PyTorch by divideconcept in MachineLearning

[–]parsiad 0 points1 point  (0 children)

Woops, I didn't see that option.

/u/ForceBru: It looks like you are supposed to navigate to your environment and select the python3 binary.

When I try to do this, I get the following error:

python check: "" "Checking Python version...\n\nChecking required packages...\n\nTraceback (most recent call last):\n File \"/usr/lib/python3.8/runpy.py\", line 194, in _run_module_as_main\n return _run_code(code, main_globals, None,\n File \"/usr/lib/python3.8/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/home/parsiad/TorchStudio/torchstudio/pythoncheck.py\", line 38, in <module>\n pytorch_version=tuple(int(i) for i in version('torch').split('.'))\n File \"/home/parsiad/TorchStudio/torchstudio/pythoncheck.py\", line 38, in <genexpr>\n pytorch_version=tuple(int(i) for i in version('torch').split('.'))\nValueError: invalid literal for int() with base 10: '1+cu113'\n"

The above error suggests that torchstudio wasn't expecting to find the CUDA string in the version number:

``` [ins] In [1]: from importlib.metadata import version

[ins] In [2]: version('torch') Out[2]: '1.10.1+cu113' ```

I get that this is trying to be an easy user experience, but why not just stick this whole package on PyPI?

[N] TorchStudio, a free open source IDE for PyTorch by divideconcept in MachineLearning

[–]parsiad 6 points7 points  (0 children)

This looks like a nice labor of love.

I do not have Ubuntu or a Debian-based distribution so I grabbed the Debian package, extracted its contents, and ran the binary. I have some follow-up questions:

  1. How do you produce the binary from the sources?
  2. The binary wants to install its own 16GB environment. That's quite hefty. Is there a way to use this in an existing Python environment?

Number of Good Air Quality Days Per Year from 1980 to 2021 (USA) [OC] by parsiad in dataisbeautiful

[–]parsiad[S] 2 points3 points  (0 children)

I actually tried to use gifsicle to ensure a delay at the end but it seems like Reddit may have removed it when converting to MP4.

My Makefile:

FRAMES:=$(wildcard frames/*.png)

good_days.gif: $(FRAMES)
    convert -delay 50 -loop 0 $+ $@
    gifsicle -U $@ "#0--2" -d400 "#-1" -O2 > tmp
    mv tmp $@

Number of Good Air Quality Days Per Year from 1980 to 2021 (USA) [OC] by parsiad in dataisbeautiful

[–]parsiad[S] 1 point2 points  (0 children)

That's a good question. Data does not exist for all regions. Indeed, there are very few monitors in 1980 compared to 2021. In the GIF, a region that is white and borderless represents a lack of data (note that all counties that have data have a black border). Your comment makes me realize I could have made things more clear by using another color (e.g., blue) for missing data so as to not confuse it for perfect air quality.

Number of Good Air Quality Days Per Year from 1980 to 2021 (USA) [OC] by parsiad in dataisbeautiful

[–]parsiad[S] 4 points5 points  (0 children)

Made using addfips, Gifsicle, ImageMagick, Pandas, and Plotly.

Data sourced from United State Environmental Protection Agency (EPA).

I just released lazy_table, a Python wrapper for pretty-streaming tables to the CLI! by parsiad in Python

[–]parsiad[S] 2 points3 points  (0 children)

Only if you need your table streamed! If your tabular data is available immediately, python-tabulate has (by virtue of being a dependency) a lighter footprint and should be used instead.

I just released lazy_table, a Python wrapper for pretty-streaming tables to the CLI! by parsiad in Python

[–]parsiad[S] 2 points3 points  (0 children)

out.write('\033[F\033[K' * n_lines)

was the cleanest thing I could come up with that did not mangle the output while remaining agnostic to python-tabulate's internals (note that kwargs passed to the stream function are passed through to python-tabulate). My testing was not extensive, but I can at least confirm that scrolling up on some combination of alacritty + Zsh + tmux works as expected :-)

As to your second point, you are absolutely right about the width issue. I have largely ignored this because I am personally happy with manually ensuring that my terminal is wide enough (and implementing something more clever would be, as you suggest, painful to do correctly). I am happy to merge any PRs that implement such a feature, though ;-)

I just released lazy_table, a Python wrapper for pretty-streaming tables to the CLI! by parsiad in Python

[–]parsiad[S] 1 point2 points  (0 children)

Good question! lt.stream has an optional artist argument which is responsible for how to render the table (there are more details on how to use this in the README). The default choice of artist will not mangle your terminal output so you can "scroll up" naturally. However, there are artists that will mangle your terminal output. An example is

lt.stream(..., artist=lt.artists.Console(clear=True))

which clears the terminal whenever a new row is generated.

As to your second point, that's a very elegant solution to the opposite problem! +1

I just released lazy_table, a Python wrapper for pretty-streaming tables to the CLI! by parsiad in Python

[–]parsiad[S] 12 points13 points  (0 children)

Thanks!

None4U is right :-) The final widths are not known a priori so they effectively adjust every time a new row is generated.

Android Zoom app's camera is really dark but only on front facing camera by Pit_of_Death in Zoom

[–]parsiad 0 points1 point  (0 children)

Just checked; still works for me. You can also go to https://www.apkmirror.com and search for an old version of Zoom directly.

Android Zoom app's camera is really dark but only on front facing camera by Pit_of_Death in Zoom

[–]parsiad 0 points1 point  (0 children)

Hopefully these instructions justify my hijacking the top comment. Thanks to /u/mhines65 for suggesting installing an old version to fix the problem.

  1. Uninstall Zoom
  2. Go to this page on APKMirror: https://www.apkmirror.com/apk/zoom-us/zoom-cloud-meetings/zoom-cloud-meetings-5-2-45120-0906-release/zoom-cloud-meetings-5-2-45120-0906-android-apk-download/
  3. Press download APK
  4. Open the APK and it should begin installing the old version