Questions tagged [hyperbolic-function]

36 questions
23
votes
7 answers

Why use tanh for activation function of MLP?

Im personally studying theories of neural network and got some questions. In many books and references, for activation function of hidden layer, hyper-tangent functions were used. Books came up with really simple reason that linear combinations of…
forsythia
  • 265
  • 1
  • 2
  • 5
8
votes
1 answer

Avoiding overflow in log(cosh(x))

My simulation needs to implement np.log(np.cosh(x)) This overflows for large x, i. e. I'm getting the RuntimeWarning: overflow encountered in cosh warning. In principle, as logarithm decreases the number in question, in some range of x, cosh should…
WojciechR
  • 323
  • 1
  • 6
6
votes
1 answer

Quaternion division and hyperbolic tangent tanh

Quaternion multiplication is well-defined, and is known to me as "Hamilton product": // hamilton product vec4 qmul(in vec4 q1, in vec4 q2) { return vec4( q1.w * q2.xyz + q2.w * q1.xyz - cross(q1.xyz, q2.xyz), q1.w*q2.w -…
xakepp35
  • 2,878
  • 7
  • 26
  • 54
6
votes
2 answers

Floating point problems in asymptotic functions approaching zero - Python

New to python coming from MATLAB. I am using a hyperbolic tangent truncation of a magnitude-scale function. I encounter my problem when applying the 0.5 * math.tanh(r/rE-r0) + 0.5 function onto an array of range values r =…
4
votes
1 answer

How do I implement Poincaré Embeddings using tfa.layers.PoincareNormalize?

I am trying to implement Poincaré embeddings as discussed in a paper by Facebook (Link) for my hierarchical data. You may find a more accessible explanation of Poincaré embeddings here. Based on the paper I have found some implementations for…
lhjohn
  • 123
  • 8
3
votes
2 answers

Where did I go wrong in my attempt to graph a hyperbola using R?

The Task Use R to plot the hyperbola x2 - y2/3 = 1, as in Figure 4.3: My Attempt x <- seq(-5, 5, by = 0.01) x <- x[(3*(x^2 - 1)) >= 0] y.upper <- sqrt(3*(x^2 - 1)) y.lower <- -sqrt(3*(x^2 - 1)) y.max <- max(y.upper) y.min <- min(y.lower) d1 <-…
air_nomad
  • 33
  • 4
3
votes
1 answer

Hyperbolic Tangent in R throws NAN in Windows but not in Mac?

When estimating the hyperbolic tangent in Windows using the R base function tanh for large (real, with 0 imaginary part) values the function returns 'NaN': tanh(356 + 0i) > NaN + 0i However, in Mac the same value returns 1 (coinciding with the…
Rodrigo Zepeda
  • 1,935
  • 2
  • 15
  • 25
2
votes
1 answer

How can Matplotlib axes be scaled hyperbolically?

I have a plot a bit like this: The differences between the two lines (red and blue) are most important in my actual data (a ROC curve) at say the grid cell 0.2
BlandCorporation
  • 1,324
  • 1
  • 15
  • 33
2
votes
0 answers

extanded kalman filter for tdoa 3D positioning

I am trying to use the Extended Kalman filter to locate my mobile device in the spice using the TDoA method. The problem I get that is my cone doesn't converge to the ground truth position. Sometimes the matrix P, Xh, and X have complex values is…
2
votes
2 answers

Optimize matlab for loop for big data

I want to calculate the Euclidean distance between two images using the Hyperbolic Tangent (Sigmoid) kernel. Please follow this link where I have discussed the same problem using Gaussian Kernel in detail. If x=(i,j) & y=(i1,j1) are any two pixels…
nagarwal
  • 87
  • 1
  • 1
  • 7
1
vote
0 answers

How to draw a line in the Poincaré disk using geoopt for Python?

I am trying to learn the API to geoopt and Python at once, but have this example so far: import geoopt import torch import matplotlib.pyplot as plt # Create the Poincare ball model poincare = geoopt.PoincareBall() # Define two points in the…
Lance
  • 75,200
  • 93
  • 289
  • 503
1
vote
1 answer

Problem to solve sympy symbolic equation with tanh

I write the following equation my_Eq. a and b are reals. a,b=sp.symbols('a,b',real=True) my_Eq=sp.Eq(sp.tanh(a),b) When I tried to solve it : sp.solve(my_Eq,a), two solutions are found : [log(-sqrt(-(b + 1)/(b - 1))), log(sqrt(-(b + 1)/(b -…
Stef1611
  • 1,978
  • 2
  • 11
  • 30
1
vote
0 answers

How to plot hyperbolic grid in Matlab

I am trying to create a hyperbolic mesh grid in Matlab, similar to What somehow works is to project a hyperboloid onto a plane (x-z in this case): t = -5:.1:5; [X,Y,Z] = meshgrid(t, t, t); V = X.^2 + Y.^2 - Z.^2; contour(squeeze(V(:, 1, :))) which…
pisoir
  • 192
  • 3
  • 13
1
vote
2 answers

How to initialise the Bresenham algorithm to display an hyperbole

I have an exam in graphics informatic and I am trying to understand the Bresenham algorithm. I understand displaying a line and a circle (I think) but when I do an exercise where I have to display a hyperbolic function I can't make it right. The…
Adrien
  • 439
  • 4
  • 15
1
vote
1 answer

How to fit rotated hyperbola accurately?

My experimental data points looks like pieces of hyperbola. Below I provide a code (Matlab), which generates "dummy" data, which is very similar to original one: function [x_out,y_out,alpha1,alpha2,ecK,offsetX,offsetY,branchDirection] =…
zlon
  • 812
  • 8
  • 24
1
2 3