fix(model): create model file if non-existent

This commit is contained in:
Hao He 2022-06-14 16:12:18 +08:00
parent 20b17526c4
commit b8ee4f07b2
2 changed files with 11 additions and 4 deletions

View File

@ -46,8 +46,6 @@ def get_update_set(
issues_test=[],
n_resolved_issues=0,
n_newcomer_resolved=0,
accuracy=0,
auc=0,
last_updated=datetime.now(),
)
repo.save()
@ -118,10 +116,18 @@ def update_models(
update_set: list, train_90_add: list, batch_size: int, threshold: int
) -> xgb.core.Booster:
model_90 = utils.update_model(
model_90_path(threshold), threshold, train_90_add, batch_size
model_90_path(threshold) if os.path.exists(model_90_path(threshold)) else None,
threshold,
train_90_add,
batch_size,
)
model_full = utils.update_model(
model_full_path(threshold), threshold, update_set, batch_size
model_full_path(threshold)
if os.path.exists(model_full_path(threshold))
else None,
threshold,
update_set,
batch_size,
)
model_90.save_model(model_90_path(threshold))
model_full.save_model(model_full_path(threshold))

View File

@ -54,4 +54,5 @@ def test_all(real_mongodb):
assert data.count() == 2
assert data.first().resolver_commit_num >= 0
predictor.update(cleanup=True)
predictor.update()