al-folio icon indicating copy to clipboard operation
al-folio copied to clipboard

Error on adding Hashnode RSS: Liquid Exception: Numerical argument is out of domain - "sqrt" (Math::DomainError)

Open SwayamInSync opened this issue 1 year ago • 7 comments

One can make these changes to re-create the error

# External sources.
# If you have blog posts published on medium.com or other external sources,
# you can display them in your blog by adding a link to the RSS feed.
external_sources:
  - name: Hashnode.com
    rss_url: https://swayam-blog.hashnode.dev/rss.xml

Error in the Installing workflow

Liquid Exception: Numerical argument is out of domain - sqrt in /SwayamInSync.github.io/_layouts/post.html

SwayamInSync avatar Oct 13 '23 12:10 SwayamInSync

when this template is used for the first time, we are getting similar error directing to _layouts/post.html, due to this webpage is not being deployted. can some one please tackle this bug.

pskadasi avatar Oct 14 '23 01:10 pskadasi

Hi, Hope it's the right place to report, I am also facing a similar issue.

external_sources:
  - name: medium.com
    rss_url: https://medium.com/@rahulkumar.aws/feed

error:

Liquid Exception: Numerical argument is out of domain - "sqrt" in /Users/rahulkumar/Documents/GitHub/rahulkumar-aws.io/_layouts/post.html
/Users/rahulkumar/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/classifier-reborn-2.3.0/lib/classifier-reborn/extensions/vector.rb:64:in `sqrt': Numerical argument is out of domain - "sqrt" (Math::DomainError)

This error stops the server from running.

rahulkumar-aws avatar Oct 14 '23 15:10 rahulkumar-aws

Same Issue! I'm trying it with Medium.com RSS Feed, still the same.

rudresh-v avatar Oct 15 '23 20:10 rudresh-v

I find this issue is caused by the related_blog_post with the usage of --lsi (latent semantic indexing) option. If there is no need for related posts, one can simply fix the issue by setting enable as false in _config.yml.

Otherwise, it is rather tricky to fix this issue. After tracing back the out of domain error, I find it is due to the accumulated numerical error of SVD used in classfier-reborn. In short, they self-crafted a pure Ruby SVD algorithm and it is not very robust. The orthonormal matrices they introduced might not be exact due to floating-point error and this could lead to a negative value inside the square root of line 64 here. One can fix the issue locally by changing line 64 to s << Math.sqrt(qrot[r, r].abs) See jekyll/classifier-reborn#153 for more discussion.

On the other hand, the official classifier-reborn does recommend to use other linear algebra solvers like LAPACK or GSL. These methods can be run locally and significantly increase the running speed, but I am not sure if it is possible to deploy them on GitHub page as well.

YifanJiang233 avatar Oct 21 '23 20:10 YifanJiang233

Same issue here when redirecting to a pdf in the blog post.

pinshuai avatar Nov 07 '23 16:11 pinshuai

@YifanJiang233 have you made a PR with this change in the classfier-reborn plugin repo?

Meanwhile the best solution for someone with this problem is indeed disabling LSI. As for using other solvers, currently jekyll only support the LSI, as can be seen in jekyll options.

george-gca avatar Dec 14 '23 19:12 george-gca

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Feb 13 '24 05:02 stale[bot]