Skip to content

Commit

Permalink
fix training time bug
Browse files Browse the repository at this point in the history
  • Loading branch information
simplymathematics committed Feb 7, 2024
1 parent a14df2d commit fe04a45
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions examples/gzip/gzip_classifier.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
python -m gzip_classifier --compressor gzip --k 3 --m 100 --method random --distance_matrix None --dataset 20newsgroups
"""
# These lines will be used to setup a virtual environment inside the current working directory in a folder called env
# You might need to install venv with:
# sudo apt-get install python3-venv
# python3 -m pip install venv
# python3 -m venv env
# source env/bin/activate
# run `deactivate` to exit the virtual environment
# These lines will be used to install the dependencies needed for this file
# You might need to install pip with:
# sudo apt-get install python3-pip
# python -m pip install numpy scikit-learn tqdm scikit-learn-extra pandas

import numpy as np
Expand Down Expand Up @@ -338,7 +342,7 @@ def test_model(X, y, train_size = 100, test_size =100, **kwargs) -> dict:
end = time.time()
pred_time = end - start
score = round(accuracy_score(y_test, predictions), 3)
print(f"Training time: {end - start}")
print(f"Training time: {train_time}")
print(f"Prediction time: {pred_time}")
print(f"Accuracy score is: {score}")
return {
Expand Down Expand Up @@ -391,4 +395,4 @@ def main(args:argparse.Namespace):
parser.add_argument("--test_size", type=int, default=100)
args = parser.parse_args()
logging.basicConfig(level=logging.INFO)
main(args)
main(args)

0 comments on commit fe04a45

Please sign in to comment.