A general framework for frequentist model averaging