Refactor linear ensemble.