ndrean

ndrean

Calculate a division with Nx?

I want to calculate the ratio COV(X,Y) / VAR(X) of two vectors. Each function returns a Tensor of singleton type. There is no Nx.div and I didn’t find how to cast a (1,1) tensor into a float.
Any clue?

Most Liked

polvalente

polvalente

Nx Core Team

There are Nx.divide and Nx.quotient. You also probably don’t need to explicitly cast to float, although you can with Nx.as_type.

Finally, Scholar has a covariance function (https://github.com/elixir-nx/scholar/blob/main/lib/scholar/covariance.ex) which might be useful. You have to install from github, though.

Nx.variance is there already, though.

Last Post!

ndrean

ndrean

Thanks for your prompt response. I didn’t search in the `functions: element-wise!

Where Next?

Popular in Questions Top

New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

Other popular topics Top

JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54921 245
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49084 226
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44139 214
New

We're in Beta

About us Mission Statement