Skip to content

Instantly share code, notes, and snippets.

@chilang
Created May 25, 2020 16:59
Show Gist options
  • Save chilang/beab86d32593478ad1f833532f7ede88 to your computer and use it in GitHub Desktop.
Save chilang/beab86d32593478ad1f833532f7ede88 to your computer and use it in GitHub Desktop.
def _collect_models(self, runners, N):
r_intercepts, r_coefs, r_weights = [], [], []
self.models = []
for runner in random.sample(runners, k=self.sample_size):
r_model = runner.optimise(self.intercept_, self.coef_, self.runner_hyperparams)
self.models.append(r_model)
r_intercepts.append(r_model.intercept_)
r_coefs.append(r_model.coef_)
r_weights.append(runner.dataset_size()/N if self.combine == 'weighted' else 1/self.sample_size)
return r_intercepts, r_coefs, r_weights
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment