Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
92 views

I need to compute the Hessian of a function involving cross products in Python. As an experiment, I consider the simple function def func(x): return np.sum(np.cross(x[0:3], x[3:6])) and compute the ...
CW279's user avatar
  • 153
6 votes
3 answers
259 views

I have been trying to use the scikit-learn library to solve this problem. Roughly: from sklearn.preprocessing import PolynomialFeatures from sklearn.linear_model import LinearRegression # Make or ...
SapereAude's user avatar
0 votes
1 answer
223 views

I'm using scipy.optimize.minimize, method = 'trust-constr'. Does anyone know how to retrieve the Hessian at the minimum when using method = ‘trust-constr’? I would like to use the Hessian to compute ...
JoeP's user avatar
  • 11
1 vote
0 answers
148 views

I'm currently training a two-layer neural network and want to compute the hessian w.r.t. the second-layer weights of the network. However, the output of the code is quite different from the theory. ...
Simon's user avatar
  • 11
0 votes
1 answer
113 views

I am doing optimization using maximum likelihood estimation, and when I am trying to get the standard errors of estimates using hessian matrix, I get non-invertible/singular hessian warning. After I ...
jasmine's user avatar
  • 263
0 votes
1 answer
643 views

I am using TF2.11. In order to have a deeper understanding of PINNs, I want to compute the Hessian matrix of the loss wrt to my PINN parameters. My toy case is a 2D Poisson equation $\Delta u = f$ I ...
L Maxime's user avatar
  • 124
2 votes
1 answer
597 views

I am currently working with ridge detection filters such as frangi(), sato() and hessian() within the python skimage package. In my project, I am using the hessian() filter to detect river-like ...
sourdough95's user avatar
4 votes
2 answers
746 views

Currently, I am trying to use Hessian matrix to detect wrinkles on the forehead. How could I remove out noises around these wrinkles? Below are my current code and result. from skimage.feature import ...
Richard Tran's user avatar
1 vote
0 answers
171 views

I am using from scipy.optimize import minimize to minimize a function subject to two constraints. I have been using the trust-constr method, which takes the value, gradient and the Hessian of the ...
S R Maiti's user avatar
  • 327
0 votes
3 answers
235 views

I am trying to create a function for theoretical hessian matrix that I can then evaluate at different locations. First I tried setting expressions as values in a matrix or array, but although I could ...
Casey Jayne's user avatar
2 votes
1 answer
730 views

Say that, for some reason, I want to fit a linear regression using PyTorch, as illustrated below. How could I compute the Hessian matrix of the model to, ultimately, compute the standard error for my ...
Álvaro A. Gutiérrez-Vargas's user avatar
2 votes
1 answer
234 views

I am calculating the hessian of a ( 2,2) linear model using functorch.hessian as follows model = torch.nn.Linear(2,2).to(device) inputs = torch.rand(1,2).to(device) criterion = torch.nn....
MMM's user avatar
  • 93
5 votes
1 answer
1k views

It appears that for larger nnet::multinom multinomial regression models (with a few thousand coefficients), calculating the Hessian (the matrix of second derivatives of the negative log likelihood, ...
Tom Wenseleers's user avatar
0 votes
0 answers
725 views

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. ...
JejeBelfort's user avatar
  • 1,693
0 votes
1 answer
203 views

Hessian Matrix helps determine the saddle points, and the local extremum of a function (source) Hessian Matrix is used in Newton methods to optimize functions. Of what use is a Hessian Matrix in ...
user avatar
1 vote
2 answers
870 views

I am reading about his paper [1] and I have an implementation taken from here. At some point of the code the diagonal of the Hessian matrix is approximated by a function set_hessian you can find below....
Darkmoor's user avatar
  • 922
2 votes
1 answer
708 views

I have a PyTree params (in my case a nested dictionary) containing my parameters of a neural network. My goal is to compute the diagonal entries of the Hessian of a loss function with respect to the ...
Philipp D.'s user avatar
0 votes
1 answer
260 views

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 = [-...
Image Check's user avatar
0 votes
0 answers
254 views

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, ...
Roopali Singh's user avatar
0 votes
1 answer
1k views

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....
user19095's user avatar
  • 105
1 vote
0 answers
147 views

I tried to calculate the Hessian matrix w.r.t. model parameters However, each tensor shape in the Hessian matrix was not symmetric. import tensorflow as tf x_train = tf.constant(tf.random.uniform(...
MyPrunus's user avatar
1 vote
0 answers
405 views

I’m trying to use the Optim package in Julia to optimize an objective function with 19 variables, and the following inequality constraints: 0 <= x[1]/3 - x[2] <= 1/3 5 <= 1/x[3] + 1/x[4] <...
Leonidas's user avatar
  • 783
0 votes
1 answer
97 views

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 ...
Luigi D'Amato's user avatar
2 votes
0 answers
2k views

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 ...
Titouan's user avatar
  • 41
1 vote
1 answer
655 views

I try to fit a graded response model with the R package ltm. The issue is that the Hessian matrix does not converge, and I don't understand why. Here is the code I use: dset %>% select(...
Marco Meyer's user avatar
5 votes
1 answer
2k views

I have a machine learning problem that I believe the negative binomial loss function would fit well, but the light gbm package doesn't have it as a standard, I'm trying to implement it, but I'm don't ...
Adauto.Almeida's user avatar
2 votes
2 answers
2k views

I'm relatively new to PyTorch and am trying to reproduce an algorithm from an academic paper that approximates a term using the Hessian matrix. I've set up a toy problem so that I can compare the ...
jalane's user avatar
  • 23
0 votes
0 answers
1k views

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 ...
kwnNa's user avatar
  • 1
-1 votes
1 answer
589 views

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 ...
Aim's user avatar
  • 537
3 votes
1 answer
14k views

So I am relatively new to the ML/AI game in python, and I'm currently working on a problem surrounding the implementation of a custom objective function for XGBoost. My differential equation ...
jpb's user avatar
  • 31
4 votes
0 answers
384 views

I would like to compute the second derivatives (diagonal hessian) for all the components of all my variables in TensorFlow 2.0. I would like to autograph such a function as well. I have it working ...
Nicholas Vadivelu's user avatar
0 votes
0 answers
113 views

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[][] ...
Efraim Kurniawan's user avatar
0 votes
0 answers
1k views

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 ...
J.Doe's user avatar
  • 534
0 votes
1 answer
723 views

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*...
J.Doe's user avatar
  • 534
6 votes
1 answer
6k views

While using scipy.optimize.minimize with the trust-constr method I got this UserWarning: scipy\optimize\_hessian_update_strategy.py:187: UserWarning: delta_grad == 0.0. Check if the approximated ...
theother's user avatar
  • 327
2 votes
0 answers
794 views

I am fitting a model to experimental data in Matlab. For this model I wanted to find the parameters by minimising the sum of square residues between the experimental and model data set. The model is ...
Vinotharan Annarasa's user avatar
3 votes
1 answer
790 views

"Before extracting the lines, you need to detect potential points on them. Apply a Gaussian filter first and use the Sobel filters as derivative operators. Threshold the determinant of the Hessian and ...
Taylor's user avatar
  • 31
2 votes
0 answers
815 views

I am creating a basic auto-encoder for the MNIST dataset using TensorFlow eager mode. I would like to observe the second-order partial derivatives of my loss function with respect to the parameters of ...
Devon Jarvis's user avatar
1 vote
1 answer
472 views

I'm using the solnp() function in the R package Rsolnp to solve a nonlinear regression with constraints. It works well, converges with no problem. I want to use the Hessian matrix to calculate ...
Jean V. Adams's user avatar
3 votes
1 answer
1k views

Computing Hessian in tensorflow is quite easy: x = tf.Variable([1., 1., 1.], dtype=tf.float32, name="x") f = (x[0] + x[1] ** 2 + x[0] * x[1] + x[2]) ** 2 hessian = tf.hessians(f, x) This correctly ...
Ruggero Turra's user avatar
1 vote
1 answer
329 views

I am trying to help fmincon to converge faster by supplying gradient vector and Hessian matrix. I am using interior-point algorithm and I realize that in such case, I have to supply Hessian using a ...
ِdidi's user avatar
  • 19
3 votes
1 answer
273 views

What I am trying to do is take a numpy array representing 3D image data and calculate the hessian matrix for every voxel. My input is a matrix of shape (Z,X,Y) and I can easily take a slice along z ...
dadrake's user avatar
  • 154
1 vote
1 answer
436 views

I minimized a function and need it's (inverse) Hessian for the standard errors. the function gives me this for the (inverse) Hessian: hess_inv: <5x5 LbfgsInvHessProduct with dtype=float64> I ...
Rens's user avatar
  • 187
4 votes
1 answer
2k views

Let's say I want to compute the Hessian of a scalar-valued function with respect to some parameters W (e.g the weights and biases of a feed-forward neural network). If you consider the following code, ...
lfaury's user avatar
  • 98
3 votes
1 answer
3k views

According to documentation, http://xgboost.readthedocs.io/en/latest/python/python_api.html if we want to define custom objective function, it should have signature objective(y_true, y_pred) -> ...
Evgeniy1089's user avatar
2 votes
1 answer
531 views

Second partial derivative test is a simple way to tell whether a critical point is a minimum, a maximum, or a saddle. I am currently toying with the idea of implementing such test for a simple neural ...
anna-earwen's user avatar
0 votes
1 answer
92 views

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 ...
Sergii Dudkin's user avatar
3 votes
1 answer
842 views

I am trying to estimate different distributions' parameters via scipy.stats."some_dist".fit(), and I'm having extreme difficulty retrieving any information on the optimization process being used. ...
Coolio2654's user avatar
  • 1,769
2 votes
1 answer
1k views

I'm currently working through some exercises on multivariable function calculus and thought I would have a go at making my own function to determine gradient and hessian at a defined point for any ...
Josmoor98's user avatar
  • 1,841
3 votes
0 answers
793 views

I do maximum likelihood estimation for a loglikelihood function of a poisson distribution. After the estimation i want to compute the standard errors of the coeffients. For that i need the hessian ...
Dima Ku's user avatar
  • 243