Default stepAIC in R I am facing the following piece of legacy code, and there is no chance to speak with its author unfortunately. 
Model1_LM <- lm(result ~ ., data = data)
fit1_LM <- stepAIC(Model1_LM, direction = 'backward')

Here data is a dataframe which contains features and the target to be predicted, the latter is the "result" column of the data. I have not used R, but I do know say Python and have some experience with learning, linear and non-linear. I am trying to understand what does stepAIC do here. 
In my understanding, and judging from the documentation, stepAIC chooses the best model from the class according to the Akaike information criterion (AIC). As far as I understood, the class of models in my case are linear models that try to predict the result column based on all other ones. Now, is this class parametrized in R: in case that were say neural nets, I would think that the class would be parametrized by number of hidden nodes, but in case of a linear model in R I am no sure how the selection is done. Also, I am surprised that for this selection no separation in training and validation is needed: a single dataframe is provided. Perhaps, the split is done under the hood using some default method, but I have not found information about this in the docs.
Bottom line: I would be happy if someone told me what exactly is happening under the hood of stepAIC in the code above. Thanks.
 A: It is doing model selection based on Akaike's Information Criterion, which is calculated as AIC = 2k - 2lnL, where k is the number of parameters estimated by the model and lnL is the log likelihood of the data given the model. Basically, model selection with AIC attempts to select the model that best explains the data (highest likelihood), while still not fitting too many parameters. 
As a metric, AIC only makes sense relative to other values; its absolute value has no meaning. So in the procedure in your code stepAIC() is starting at the most complex model (because direction = "backward"), and sequentially removing terms in an effort to lower the AIC. You can think of this as building a group of models from the possible combinations of predictors in your dataset, and determining which has the lowest AIC (FYI, you can also choose direction = "forward" which starts simple and adds terms, or direction = "both" which trials both adding and removing terms). 
When the stepAIC() finds a model where it cannot lower the AIC any further by removing terms (if direction = "backward"), then it selects this model as the best model. 
There are arguments as to the relative merits of this approach, and of using different selection metrics (AICc, BIC, etc.). If you search Cross Validated for 'model selection' there will be an abundance of results. 
EDIT: Oh yeah, AFAIK, there is no separation of training or validation etc. This basic approach is agnostic to Cross Validation.
