Questions tagged [hessian-matrix]

Hessian matrix is an N x N matrix containing second partial derivatives of a function with respect to its input variables.

Hessian matrices are used extensively in second-order optimization methods such as Newton's method. They give information about the curvature around a point x0 on a function surface.

119 questions
0
votes
0 answers

Implement adaHessian as an optimizer in neural network model

I want to use second order optimizer instead of using SGD, Adam, Adagrad, AdaDelta etc in neural network model. So I found AdaHessian as an optimizer. I have the following code: # define model model = Sequential() model.add(Dense(132,…
0
votes
0 answers

This function takes a lot of time to run on Google Colab

Input : x_train, y_train. Output : Hessian matrix of loss function with respect to weights. def compute_hessian(x_train_array,y_train_array):##functio which calculates and returns the hessian matrix hessian_row_mat = np.empty(shape =…
0
votes
0 answers

UserWarning when using scipy.optimize.minimize with method 'trust-constr'

I am trying to minimize a function using scipy.optimize.minimize and I get the following errors: Singular Jacobian matrix. Using SVD decomposition to perform the factorizations. delta_grad == 0.0. Check if the approximated function is linear. If…
0
votes
1 answer

How do I find least square between two matrix in MATLAB?

What is the replacement in MATLAB for the following line of code snippet in python? From Python Implementation for SIFT Feature Extraction x = -lstsq(hessian, gradient, rcond=None)[0] if hessian = [-0.001 -9.042 -9.491;-9.042 -2.345…
Image Check
  • 91
  • 2
  • 14
0
votes
0 answers

How to calculate Godambe information matrix in R?

I have a likelihood function in R that I am optimizing using 'optim' and calculating the hessian matrix using hessian=T in the optim function. I want to calculate the Godambe Information matrix in R, which is defined as: G(theta)= H(theta)…
0
votes
1 answer

hessian matrix of a keras model with tf.hessians

I want to compute the Hessian matrix of a keras model w.r.t. its input in graph mode using tf.hessians. Here is a minimal example import tensorflow as tf from tensorflow import keras model = keras.Sequential([ keras.Input((10,)), …
user19095
  • 105
  • 3
0
votes
1 answer

Does anybody understand how to make this code work?

I am trying to estimate a multiple linear probit model (killer_apps is the limited dependent variable) using the maximum likelihood approach. Therefore, in this code, I am trying to estimate the regressors and the respective standard errors. Can…
0
votes
0 answers

Hessian of Gaussian eigenvalues for 3D image with Python

I have a 3D image and I want to calculate the Hessian of Gaussian eigenvalues for this image. I would like to have the three eigenvalues of the Hessian approximation for each voxel. This feature seems to be something very common in image…
0
votes
0 answers

Why do I get negative variance from hessian matrix in optim function

I try to estimate mle parameters of a generalised gamma distribution. I use optim function with a lower bound equal to one (since parameters must be positive) and BFGS method. Initially, I estimate the log likelihood function as…
kwnNa
  • 1
  • 1
0
votes
1 answer

What is a Hessian matrix?

I know that the Hessian matrix is a kind of second derivative test of functions involving more than one independent variable. How does one find the maximum or minimum of a function involving more than one variable? Is it found using the eigenvalues…
Aim
  • 389
  • 6
  • 20
0
votes
1 answer

Newton's method for multivariate optimization in matlab

How to compute the gradient and hessian matrix when the equation cannot be solved numerically? My minimization equation is: c=c[(x/y/(1-x)^2)^0.6 + (1-(x/y)/(1-y)^2)^0.6 + 6/y^0 I tried the MATLAB function "diff" to compute the gradient and…
0
votes
0 answers

system throw exception when trying to invert hessian matrix

I'm trying some code from jamesmccaffrey web about inverse matrix (link). I used for invert n x n hessian matrix and I got the exception: "Cannot use Doolittle's method" in "static double[][] MatrixDecompose()" method. Here is the code that I…
0
votes
0 answers

Sympy: Calculating eigenvalues takes very long for (9,9) matrix

I'm trying to calculate the eigenvalues of a matrix F, which contains 9 variables, which are the cartesian coordinates of three vectors. The execution time for F.eigenvals() takes at least 15 minutes and I haven't been patient enough to wait even…
J.Doe
  • 224
  • 1
  • 4
  • 19
0
votes
1 answer

Sympy: Solve entries in Hessian Matrix for better readability?

I'm very green when it comes to sympy and I don't know how to produce output in a well formatted fashion. Right now I've computed the Hessian matrix of my potential function: V = 1/2*kOH*(r1)**2 +1/2*kOH*(r2)**2 +1/2*kHH*(r3)**2 of three harmonic…
J.Doe
  • 224
  • 1
  • 4
  • 19
0
votes
1 answer

TensorFlow Hessian matrix is not updated after training session

I am trying to get Hessian matrix using tf.hessians function. Whereas the loss value and variables are updated after each training session, Hessian matrix values remain constant. Moreover, they does not depend on initial variable values that can be…