0

I want to measure time and space complexity foreach algorithm LR and NB using python scikit learn.

models = []
models.append(('LR', LogisticRegression()))
models.append(('NB', GaussianNB()))
seed = 7
kfold = KFold(n_splits=10, random_state=seed)
for name, m in models:
    start_time = time.time()
    results = cross_val_score(m, X, Y, cv=kfold)
    elapsed_time = time.time() - start_time
    print(name)
    print("Accuracy:", results.mean()*100.0,'% Time:', elapsed_time)
    results = 0
    start_time=0
   elapsed_time=0
Basma Elshoky
  • 151
  • 1
  • 10

0 Answers0