Something missing in log transformation,Interview question.

58 Views Asked by At

Question asked: Fit a linear model on $y,x$ where $y=\exp x$.

I replied: Take $\log$ on both sides then fit $\log y$ vs $x$. Get $y_{pred}$ then take exponential of $y_{pred}$ to get corresponding $y$ value. Interviewer said something is missing in conversion of $y_{pred}$ to $y$. I am not able to find it.

Can somebody help me in understanding that?

1

There are 1 best solutions below

4
On

I suppose that this is just a question of terminology.

You have $n$ data points $(x_i,y_i)$ and you want to fit the exponential model $$y=e^{a+bx}$$ You make the problem linear taking logarithms $$\log(y)=a+bx$$ Defining $z_i=\log(y_i)$, the model is then $$z_i=a+b x$$ The linear regression gives $a$ and $b$. Now, for a given value of $x=x_*$, you want to predict $y_{pred}$ from the model. So, the steps are $$z_{pred}=a+bx_*\implies y_{pred}=e^{z_{pred}}$$