I am a user of Keras with Python, if I know some mathematics I am not very good at algebraic transformation.

The context is the following.
I am trying to reproduce the performances from a paper. In this paper, each individual has his own model: a neural network with the pattern 8-5-7-1. All these models reached a MSE of 100.
In my work, I do not use the same variables, so I found a different pattern. I considered 3 individuals (3 models). I have remarked models (of the same pattern) learn better when the skewness of the target is lower. /!\ The target is not transformed at all at this moment.
In concrete terms:

  1. Model 1: skewness 0.41 manage to learn until 100 MSE (reached the goal)
  2. Model 2: skewness 0.66 manage to learn until 200 MSE not less (do not reach the goal)
  3. Model 3: skewness 0.31 manage to learn until 80 MSE (beyond the reached goal)

So this is why I am thinking about making a target engineering by using the logarithm of any base (while it reduces the skewness it is ok). Nevertheless, it transforms the reached metric: 100 MSE as the maximum threshold. And I am pretty sure I cannot just compute log(MSE).
I searched the formula, of course: $ MSE = \frac{1}{n}\sum_{i=1}^{n}(y_{i}-\bar{y}_i)^{2} $

But I am not able with my limited skills to reconsider it correctly. I need help.
So MSE is dependent on the n observations of the dataset, more the logarithm transformation on y. How can I implement a function that will allow transforming the new form of MSE obtained through a logarithmic transformation in order to compare it with the previous goal: 100 MSE on a non-transformed target?


You have a $Y_{true}$
Then you calculated $Y^{log}_{true}$

So, your predictions are $Y^{log}_{pred}$
Then you can calculate the $MSE^{log}$ but it can't be compared with 100 MSE.
So, you can do a - $base^{MSE^{log}}$
to make it comparabale to 100 MSE.

A better intuitive approach will be to convert back your $Y^{log}_{pred}$
i.e. $base^{Y^{log}_{pred}}$
Then calculate the MSE

The inverse of log is just about using power to the base

import numpy as np
input = np.array([100, 1000])
log_out = np.log10(input)

input_re = 10**(log_out)
  • $\begingroup$ Your notation is confusing. To rise the value to a log power where the log has no input let me puzzled. Anyway, considering it is log(y_true) or not, I doubt we can just use the inverse using the base: base ^ log(MSE) is correct, because considering the formula "n" is not concerned by the logarithm. So, the MSE obtained isn't log(MSE) but MSE = Sum[log(y_true)-log(y_pred)]/n. As far I know discussing with mathematician, to claim it's equivalent (not equal) to use base^MSE, it must be demonstrated if the function is bijective. A field that I don't master at all. $\endgroup$
    – AvyWam
    Aug 23 '20 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.