In regression analysis, how does one know which transformation to apply to either the response variables or features? In regression analysis, how does one know which transformation to apply to either the response variables or features?
I'm guessing looking at a plot of the data would give one an idea but I'm not entirely sure
 A: Consider the case of OLS regression:
$$ Y_i = a + b_1X_{i1} + \cdots +b_kX_{ik} + \epsilon_{i}$$
where $Y$ is your response variable, $a$ is the intercept, the $X$s are your independent variables (i.e. predictors), $b_1$ to $b_k$ are the slope coefficients associated with each independent variable, $\epsilon$ represents your residuals, and $i$ is the index denoting each row of observations.
Usually, after fitting your OLS model, residual plots are produced to visually inspect the spread of residuals. This is typically accomplished by plotting residuals vs fitted values. Visually, residuals should show constant variance (this is called homoskedasticity), rather than forming patterns (called heteroskedasticity). Heteroskedasticity is problematic as it means that parts of the model are predicted with different levels of error. The negative consequences of this are related to the wrong estimation of parameters' standard errors, p-values and confidence intervals. Therefore, your ability to correctly state whether each variable is statistically significant is compromised. Please note that under heteroskedasticity, your $b$ slopes may still be unbiased: it is just you will not be able to say with confidence if they are statistically significant.
Now there are a number of ways of dealing with this issue, including, for example, the use of heteroskedasticity robust standard errors, or transformations. Let us comment on the latter to stay on track. Transforming $Y$ and/or $X$ variables can be a remedy for making the residual plot (more) homoskedastic.
One flexible approach to identifying transformations falls under the theme of the Box-Cox (Box & Cox, 1964) and Box-Tidwell (Box & Tidwell, 1962) techniques. You can easily compute those in R (Fox, 2002; Faraway, 2005). In case you are very interested, manual calculation of both is covered in Hutcheson and Sofroniou (1999). The Box-Cox method suggests transformations to the response variable (DV), and the Box-Tidwell procedure suggests transformations for the predictor variables (IVs).
One strategy is to start with a single type of transformation. For example, transformation to the response variable (DV). This can be accomplished with the MASS package in R by using boxcox function. This will produce a plot of log-likelihoods versus $\lambda$ (power transformations). Then, for example, the graph can suggest a power transformation of 3 with 95% confidence intervals between 2.5 and 3.75. As such, we transform the response variable from $Y$ into $Y^3$.
Next, assess the residual plot and check if this resulted in an improvement. For example, your residual plot became less heteroskedastic but there may still be room for improvement. In that case, we may proceed further and try to additionally apply transformation(s) to the independent predictor variable(s). This can be accomplished with the aforementioned Box-Tidwell transformation, by using the boxTidwell function in  car package in R. Here, we may get a suggestion that your IV should be raised to the power of, for example, $.6968$. So then you would add this transformation and end up with some model such as
$Y^3 = a + \beta_{1}X^{.7}$. So then you assess the fit and hopefully, the issue of heteroskedasticity is resolved or significantly improved upon.

Caution: from real-life experience, I can assure you that transformations do not always work. So they are not always a magical cure, and if time is of the essence for you, you may consider resorting to using heteroskedasticity-robust standard errors. However, this, in itself, is a different topic

Edit
Courtesy to @IsabellaGhement who correctly noted that in addition to improving on model heteroskedasticity (non-constant variance), power transformations may also represent a useful solution to violations of linearity and normality.
References
Box, G. E. P., & Cox, D. R. (1964). An analysis of transformations. Journal of the Royal Statistical Society: Series B (Methodological), 26(2), 211-243.
Box, G. E. P., & Tidwell, P. W. (1962). Transformation of the independent variables. Technometrics, 4(4), 531-550.
Fox, J. (2002). An R and S-PLUS Companion to Applied Regression. Sage Publications,
Thousand Oaks, CA.
Faraway, J. J. (2005). Extending the linear model with r (texts in statistical science).
Hutcheson, G. D., & Sofroniou, N. (1999). The multivariate social scientist: Introductory statistics using generalized linear models. London: Sage.
A: If your only tool is OLS regression, then you can use methods such as Box-Cox. In the old days, this was true in practice because computers were (first) unavailable and (later) not that powerful or fast.
Nowadays, though, we have very powerful computers and methods that can implement many methods other than OLS, in particular quantile regression and various kinds of robust regression. These do not make assumptions about the distribution of errors/residuals, which is the problem that most transformations are trying to solve.
Therefore, I'd say that you ought transform variables when it suits your substantive purpose. E.g. for variables related to money (income, expenses, sales, etc) it often makes sense to take the log. 
A: Mosteller and Tukey (1977) offered their bulging rule, suggesting transformations (of X or Y) based on eyeballing the shape of the untransformed relationship.

Mosteller and Tukey suggested looking at the plot of untransformed X and Y, matching the curve that you see to one of the four quadrant curves in the diagram, and applying an indicated transformations, taking either X or Y (or both) to either a higher power or to lower power. Here, "higher power" means square or cube, while "lower power" includes log, inverse, inverse square and so forth.
You also can think of this as adjusting the axis for either X or Y, and in so doing making the curved relationship more straight. Higher power transformations stretch the axis, while lower power transformations compress the axis.
As Cohen et al. (2003) pointed out, transforming Y may resolve multiple problems, including heterogeneity in residuals, so that may be preferred. But also think about how you are going to explain the result to your client. A transformation applied to one predictor in a model may take less explaining than a transformation applied to the outcome variable. And then there is convention--if you can resolve the problem either by applying the same transformation that everyone else has used or by doing something different, life may be easier if you follow convention.
References:
Cohen, J., Cohen, P., West, S. G., & Aiken, L. S. (2003). Applied multiple correlation/regression analysis for the social sciences.
Mosteller, F., & Tukey, J. W. (1977). Data analysis and regression: a second course in statistics. Addison-Wesley Series in Behavioral Science: Quantitative Methods.
