Body: <p>For logistic regression, the <em><strong>Cost</strong></em> function is defined as:
  <span class="math-container">\begin{equation}
  Cost(h_{\theta}(x)-y) = -ylog(h_{\theta}(x))-(1-y)log(1-h_{\theta}(x))
  \end{equation}</span></p>
  
  <p>I now have a nonlinear function
  <span class="math-container">\begin{equation}
   h_{\theta}^{(i)}(x)=xe^{-j\theta_i|x|^2}
  \end{equation}</span>
  where <span class="math-container">$i$</span> denotes the <span class="math-container">$i$</span>th training sample. How should I define cost function for this particular nonlinear function? </p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-29T23:13:43.607Z
Comments.Text: Hi Yifan. I might be able to answer this question later. Meanwhile, if you need immediate help, you might want to ask the question also on https://stats.stackexchange.com/.
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-30T08:37:09.247Z
Comments.Text: Hi nbro, thank you very much for the suggestion~~ However I'll wait for your response~~ I'll ask there next time : )
Comments.UserDisplayName: yfliuuu
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-06-07T09:57:34.157Z
Comments.Text: Hi again~~ I would really like to ask if you could give me a hint on this problem~ Thank you so much
Comments.UserDisplayName: yfliuuu
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-06-07T10:44:12.153Z
Comments.Text: Hi Yifan! I am sorry I only answer now. It had been a while since I had worked with logistic regression, so I needed some time to review it. Have a look at [generalised linear models](https://en.wikipedia.org/wiki/Generalized_linear_model) (link function and prediction/mean function). In the usual case of logistic regression, the link function is the logarithm of the odds ratio, that is, it is $\ln \left( \frac{p}{1 - p} \right)$, because the mean function is $\frac{1}{1 + e^{-x^T \beta}}$. In your case, you have a different mean function, which will correspond to some link function.
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-06-07T21:39:18.917Z
Comments.Text: Hi~~~ thank you so much for this. I'll have a deeper look into it and let you know~ Thank you so much for all the help!
Comments.UserDisplayName: yfliuuu
Tags: <deep-learning><deep-neural-networks><logistic-regression>
Title: How to define cost function for custom nonlinear functions?
UserDisplayName: yfliuuu
ThreadText: # How to define cost function for custom nonlinear functions?
  
  (Asked by: username_0 on 2019-05-28)
  
  For logistic regression, the ***Cost*** function is defined as:
  \begin{equation}
  Cost(h\_{\theta}(x)-y) = -ylog(h\_{\theta}(x))-(1-y)log(1-h\_{\theta}(x))
  \end{equation}
  
  I now have a nonlinear function
  \begin{equation}
  h\_{\theta}^{(i)}(x)=xe^{-j\theta\_i|x|^2}
  \end{equation}
  where $i$ denotes the $i$th training sample. How should I define cost function for this particular nonlinear function?
  
  **Tags:** deep-learning, deep-neural-networks, logistic-regression
  
  > **Comments:**
  > **username_1**: Hi Yifan. I might be able to answer this question later. Meanwhile, if you need immediate help, you might want to ask the question also on https://stats.stackexchange.com/.  
  > **username_0**: Hi username_1, thank you very much for the suggestion~~ However I'll wait for your response~~ I'll ask there next time : )  
  > **username_0**: Hi again~~ I would really like to ask if you could give me a hint on this problem~ Thank you so much  
  > **username_1**: Hi Yifan! I am sorry I only answer now. It had been a while since I had worked with logistic regression, so I needed some time to review it. Have a look at [generalised linear models](https://en.wikipedia.org/wiki/Generalized_linear_model) (link function and prediction/mean function). In the usual case of logistic regression, the link function is the logarithm of the odds ratio, that is, it is $\ln \left( \frac{p}{1 - p} \right)$, because the mean function is $\frac{1}{1 + e^{-x^T \beta}}$. In your case, you have a different mean function, which will correspond to some link function.  
  > **username_0**: Hi~~~ thank you so much for this. I'll have a deeper look into it and let you know~ Thank you so much for all the help!  
  
  ---
  
  ## 0 answers
  
  