AnswerDotAI / AnswerDotAI/fastkmeans

total_time is strange

Open
#6 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
104
Forks
8
PR merge metrics
No merged PRs in 30d

Description

From the code, we can see the `total_time` is always double of the `iteration_time`, is this correct?

https://github.com/AnswerDotAI/fastkmeans/blob/b5173ffad0d37423b282cd60cfcf14c1588235d4/fastkmeans/kmeans.py#L160

From this code, we have these equations:
```
iteration_time = now - iteration_start_time
total_time = now - iteration_start_time + iteration_time = 2 * iteration_time
```

Here is the log of experiment we runned:
```
Iteration 2/100 took 18.6287s, total time: 37.2574s, shift: 49088.000000
Iteration 3/100 took 18.8487s, total time: 37.6975s, shift: 30736.000000
Iteration 4/100 took 18.9899s, total time: 37.9798s, shift: 23024.000000
Iteration 5/100 took 19.1189s, total time: 38.2379s, shift: 19040.000000
Iteration 6/100 took 19.2889s, total time: 38.5779s, shift: 16864.000000
Iteration 7/100 took 19.5249s, total time: 39.0499s, shift: 15688.000000
Iteration 8/100 took 19.8129s, total time: 39.6259s, shift: 14592.000000
Iteration 9/100 took 19.9709s, total time: 39.9419s, shift: 13800.000000
Iteration 10/100 took 19.9869s, total time: 39.9739s, shift: 13280.000000
Iteration 11/100 took 19.9949s, total time: 39.9899s, shift: 13080.000000
Iteration 12/100 took 20.0860s, total time: 40.1719s, shift: 12600.000000
Iteration 13/100 took 20.2500s, total time: 40.4999s, shift: 12280.000000
Iteration 14/100 took 20.1469s, total time: 40.2939s, shift: 12192.000000
Iteration 15/100 took 20.0179s, total time: 40.0359s, shift: 12048.000000
Iteration 16/100 took 19.9909s, total time: 39.9819s, shift: 11784.000000
Iteration 17/100 took 20.0150s, total time: 40.0299s, shift: 11872.000000
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in fastkmeans/kmeans.py around line 160 and inspect how iteration_start_time and total-time values are calculated for the log message. Reproduce or review the reported iteration output, then verify that total time represents the intended elapsed duration rather than twice the iteration time.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.