Least-squares regularization matrix is not positive definite?












1












$begingroup$


I am fitting data $(x_i,y_i)$ to the following model:
$$
f(x) = sum_j a_j g_j(x) = a^T g(x)
$$

where $g_j(x)$ are well-conditioned basis functions (in my application they are B-splines, but I don't think that matters for this question).



I want to regularize the result by smoothing (damping) the function by minimizing the second derivative. This means my solution $a$ is given by
$$
a = textrm{argmin } ||y - X a||^2 + lambda^2 int_{-infty}^{infty} left| frac{d^2 f(x)}{dx^2} right|^2 dx
$$

where $X_{ij} = g_j(x_i)$ is the least-squares matrix, and the regularization term can be expressed as:
begin{align*}
int_{-infty}^{infty} left| frac{d^2 f(x)}{dx^2} right|^2 dx &= int_{-infty}^{infty} left( a^T g'' right)^2 dx \
&= int_{-infty}^{infty} a^T g'' g''^T a dx \
&= a^T left( int_{-infty}^{infty} g'' g''^T dx right) a \
&= a^T G a
end{align*}

where
$$
G_{ij} = int_{-infty}^{infty} frac{d^2 g_i(x)}{dx^2} frac{d^2 g_j(x)}{dx^2} dx
$$

So, now my solution is given by the standard form:
$$
a = textrm{argmin } ||y - X a||^2 + lambda^2 a^T G a
$$

I was trying to compute the Cholesky factor of $G = L L^T$ so that I could express this as
$$
a = textrm{argmin } ||y - X a||^2 + lambda^2 ||L a||^2
$$

so that I can use a generalized SVD or QR approach to solve the system. However, to my surprise, I found that $G$ was not positive definite - it had one zero eigenvalue.



My question is: shouldn't the matrix $G$ be positive definite as defined above, since the basis function $g_j(x)$ are positive and well-conditioned? Again, in my application the $g_j(x)$ are B-splines.



I am trying to determine if I made a mistake when computing the $G$ matrix.



Alternatively, does anyone see another way to compute the regularization matrix $L$, aside from a Cholesky factorization of $G$?










share|cite|improve this question









$endgroup$

















    1












    $begingroup$


    I am fitting data $(x_i,y_i)$ to the following model:
    $$
    f(x) = sum_j a_j g_j(x) = a^T g(x)
    $$

    where $g_j(x)$ are well-conditioned basis functions (in my application they are B-splines, but I don't think that matters for this question).



    I want to regularize the result by smoothing (damping) the function by minimizing the second derivative. This means my solution $a$ is given by
    $$
    a = textrm{argmin } ||y - X a||^2 + lambda^2 int_{-infty}^{infty} left| frac{d^2 f(x)}{dx^2} right|^2 dx
    $$

    where $X_{ij} = g_j(x_i)$ is the least-squares matrix, and the regularization term can be expressed as:
    begin{align*}
    int_{-infty}^{infty} left| frac{d^2 f(x)}{dx^2} right|^2 dx &= int_{-infty}^{infty} left( a^T g'' right)^2 dx \
    &= int_{-infty}^{infty} a^T g'' g''^T a dx \
    &= a^T left( int_{-infty}^{infty} g'' g''^T dx right) a \
    &= a^T G a
    end{align*}

    where
    $$
    G_{ij} = int_{-infty}^{infty} frac{d^2 g_i(x)}{dx^2} frac{d^2 g_j(x)}{dx^2} dx
    $$

    So, now my solution is given by the standard form:
    $$
    a = textrm{argmin } ||y - X a||^2 + lambda^2 a^T G a
    $$

    I was trying to compute the Cholesky factor of $G = L L^T$ so that I could express this as
    $$
    a = textrm{argmin } ||y - X a||^2 + lambda^2 ||L a||^2
    $$

    so that I can use a generalized SVD or QR approach to solve the system. However, to my surprise, I found that $G$ was not positive definite - it had one zero eigenvalue.



    My question is: shouldn't the matrix $G$ be positive definite as defined above, since the basis function $g_j(x)$ are positive and well-conditioned? Again, in my application the $g_j(x)$ are B-splines.



    I am trying to determine if I made a mistake when computing the $G$ matrix.



    Alternatively, does anyone see another way to compute the regularization matrix $L$, aside from a Cholesky factorization of $G$?










    share|cite|improve this question









    $endgroup$















      1












      1








      1





      $begingroup$


      I am fitting data $(x_i,y_i)$ to the following model:
      $$
      f(x) = sum_j a_j g_j(x) = a^T g(x)
      $$

      where $g_j(x)$ are well-conditioned basis functions (in my application they are B-splines, but I don't think that matters for this question).



      I want to regularize the result by smoothing (damping) the function by minimizing the second derivative. This means my solution $a$ is given by
      $$
      a = textrm{argmin } ||y - X a||^2 + lambda^2 int_{-infty}^{infty} left| frac{d^2 f(x)}{dx^2} right|^2 dx
      $$

      where $X_{ij} = g_j(x_i)$ is the least-squares matrix, and the regularization term can be expressed as:
      begin{align*}
      int_{-infty}^{infty} left| frac{d^2 f(x)}{dx^2} right|^2 dx &= int_{-infty}^{infty} left( a^T g'' right)^2 dx \
      &= int_{-infty}^{infty} a^T g'' g''^T a dx \
      &= a^T left( int_{-infty}^{infty} g'' g''^T dx right) a \
      &= a^T G a
      end{align*}

      where
      $$
      G_{ij} = int_{-infty}^{infty} frac{d^2 g_i(x)}{dx^2} frac{d^2 g_j(x)}{dx^2} dx
      $$

      So, now my solution is given by the standard form:
      $$
      a = textrm{argmin } ||y - X a||^2 + lambda^2 a^T G a
      $$

      I was trying to compute the Cholesky factor of $G = L L^T$ so that I could express this as
      $$
      a = textrm{argmin } ||y - X a||^2 + lambda^2 ||L a||^2
      $$

      so that I can use a generalized SVD or QR approach to solve the system. However, to my surprise, I found that $G$ was not positive definite - it had one zero eigenvalue.



      My question is: shouldn't the matrix $G$ be positive definite as defined above, since the basis function $g_j(x)$ are positive and well-conditioned? Again, in my application the $g_j(x)$ are B-splines.



      I am trying to determine if I made a mistake when computing the $G$ matrix.



      Alternatively, does anyone see another way to compute the regularization matrix $L$, aside from a Cholesky factorization of $G$?










      share|cite|improve this question









      $endgroup$




      I am fitting data $(x_i,y_i)$ to the following model:
      $$
      f(x) = sum_j a_j g_j(x) = a^T g(x)
      $$

      where $g_j(x)$ are well-conditioned basis functions (in my application they are B-splines, but I don't think that matters for this question).



      I want to regularize the result by smoothing (damping) the function by minimizing the second derivative. This means my solution $a$ is given by
      $$
      a = textrm{argmin } ||y - X a||^2 + lambda^2 int_{-infty}^{infty} left| frac{d^2 f(x)}{dx^2} right|^2 dx
      $$

      where $X_{ij} = g_j(x_i)$ is the least-squares matrix, and the regularization term can be expressed as:
      begin{align*}
      int_{-infty}^{infty} left| frac{d^2 f(x)}{dx^2} right|^2 dx &= int_{-infty}^{infty} left( a^T g'' right)^2 dx \
      &= int_{-infty}^{infty} a^T g'' g''^T a dx \
      &= a^T left( int_{-infty}^{infty} g'' g''^T dx right) a \
      &= a^T G a
      end{align*}

      where
      $$
      G_{ij} = int_{-infty}^{infty} frac{d^2 g_i(x)}{dx^2} frac{d^2 g_j(x)}{dx^2} dx
      $$

      So, now my solution is given by the standard form:
      $$
      a = textrm{argmin } ||y - X a||^2 + lambda^2 a^T G a
      $$

      I was trying to compute the Cholesky factor of $G = L L^T$ so that I could express this as
      $$
      a = textrm{argmin } ||y - X a||^2 + lambda^2 ||L a||^2
      $$

      so that I can use a generalized SVD or QR approach to solve the system. However, to my surprise, I found that $G$ was not positive definite - it had one zero eigenvalue.



      My question is: shouldn't the matrix $G$ be positive definite as defined above, since the basis function $g_j(x)$ are positive and well-conditioned? Again, in my application the $g_j(x)$ are B-splines.



      I am trying to determine if I made a mistake when computing the $G$ matrix.



      Alternatively, does anyone see another way to compute the regularization matrix $L$, aside from a Cholesky factorization of $G$?







      matrices least-squares regularization






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Dec 11 '18 at 23:54









      vibevibe

      1648




      1648






















          0






          active

          oldest

          votes











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "69"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3036030%2fleast-squares-regularization-matrix-is-not-positive-definite%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Mathematics Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3036030%2fleast-squares-regularization-matrix-is-not-positive-definite%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Probability when a professor distributes a quiz and homework assignment to a class of n students.

          Aardman Animations

          Are they similar matrix