Aqee
Aqee

Reputation: 163

How to measure the execution time for a classification algorithm in Python's scikit-learn?

How do I measure the time taken to train and test a classifier like SVM, KNN and Decision Treen in scikit-learn?

Upvotes: 2

Views: 2929

Answers (1)

Eeshaan
Eeshaan

Reputation: 1635

You can use the time module like so

import time
start = time.time()

# enter your code here

end = time.time()
print(end - start, "seconds")

Upvotes: 1

Related Questions