Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve convergence system for MiniBatch algorithm #122

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PyDataBlog
Copy link
Owner

@PyDataBlog PyDataBlog commented Oct 21, 2024

Fixes #113

Improve the convergence system for the MiniBatch algorithm in src/mini_batch.jl and add corresponding tests in test/test90_minibatch.jl.

  • Adaptive Batch Size Mechanism

    • Implement an adaptive batch size mechanism that adjusts based on the convergence rate.
    • Modify the batch size dynamically during the iterations.
  • Early Stopping Criteria

    • Introduce early stopping criteria by monitoring the change in cluster assignments and the stability of centroids.
    • Add a check to stop the algorithm if the labels and centroids remain unchanged over iterations.
  • Tests for New Features

    • Add tests for the adaptive batch size mechanism to ensure it adjusts the batch size correctly based on the convergence rate.
    • Add tests for early stopping criteria to ensure the algorithm stops when the change in cluster assignments or the stability of centroids is detected.
    • Add tests for improved initialization of centroids to ensure the algorithm converges successfully.

For more details, open the Copilot Workspace session.

Fixes #113

Improve the convergence system for the MiniBatch algorithm in `src/mini_batch.jl` and add corresponding tests in `test/test90_minibatch.jl`.

* **Adaptive Batch Size Mechanism**
  - Implement an adaptive batch size mechanism that adjusts based on the convergence rate.
  - Modify the batch size dynamically during the iterations.

* **Early Stopping Criteria**
  - Introduce early stopping criteria by monitoring the change in cluster assignments and the stability of centroids.
  - Add a check to stop the algorithm if the labels and centroids remain unchanged over iterations.

* **Tests for New Features**
  - Add tests for the adaptive batch size mechanism to ensure it adjusts the batch size correctly based on the convergence rate.
  - Add tests for early stopping criteria to ensure the algorithm stops when the change in cluster assignments or the stability of centroids is detected.
  - Add tests for improved initialization of centroids to ensure the algorithm converges successfully.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/PyDataBlog/ParallelKMeans.jl/issues/113?shareId=XXXX-XXXX-XXXX-XXXX).
Copy link
Contributor

Benchmark result

Judge result

Benchmark Report for /home/runner/work/ParallelKMeans.jl/ParallelKMeans.jl

Job Properties

  • Time of benchmarks:
    • Target: 21 Oct 2024 - 18:21
    • Baseline: 21 Oct 2024 - 18:22
  • Package commits:
    • Target: 16881e
    • Baseline: 500f7a
  • Julia commits:
    • Target: 3b76b2
    • Baseline: 3b76b2
  • Julia command flags:
    • Target: None
    • Baseline: None
  • Environment variables:
    • Target: None
    • Baseline: None

Results

A ratio greater than 1.0 denotes a possible regression (marked with ❌), while a ratio less
than 1.0 denotes a possible improvement (marked with ✅). Only significant results - results
that indicate possible regressions or improvements - are shown below (thus, an empty table means that all
benchmark results remained invariant between builds).

ID time ratio memory ratio
["distance", "100kx10"] 1.65 (5%) ❌ 1.00 (1%)
["distance", "100kx3"] 1.51 (5%) ❌ 1.00 (1%)
["kmeans", "10x100_000x10x1 Hammerly"] 0.89 (5%) ✅ 1.00 (1%)
["kmeans", "10x100_000x3x1 Hammerly"] 0.94 (5%) ✅ 1.00 (1%)
["kmeans", "10x100_000x3x2 Hammerly"] 0.89 (5%) ✅ 1.00 (1%)

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["distance"]
  • ["kmeans"]

Julia versioninfo

Target

Julia Version 1.6.7
Commit 3b76b25b64 (2022-07-19 15:11 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 22.04.5 LTS
  uname: Linux 6.5.0-1025-azure #26~22.04.1-Ubuntu SMP Thu Jul 11 22:33:04 UTC 2024 x86_64 x86_64
  CPU: AMD EPYC 7763 64-Core Processor: 
              speed         user         nice          sys         idle          irq
       #1  2591 MHz        670 s          0 s         82 s       2700 s          0 s
       #2  2445 MHz        688 s          0 s         93 s       2666 s          0 s
       #3  3243 MHz        584 s          0 s         89 s       2780 s          0 s
       #4  2445 MHz        231 s          0 s         86 s       3130 s          0 s
       
  Memory: 15.606491088867188 GB (12445.23828125 MB free)
  Uptime: 347.47 sec
  Load Avg:  1.03  0.65  0.28
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, generic)

Baseline

Julia Version 1.6.7
Commit 3b76b25b64 (2022-07-19 15:11 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 22.04.5 LTS
  uname: Linux 6.5.0-1025-azure #26~22.04.1-Ubuntu SMP Thu Jul 11 22:33:04 UTC 2024 x86_64 x86_64
  CPU: AMD EPYC 7763 64-Core Processor: 
              speed         user         nice          sys         idle          irq
       #1  3243 MHz        823 s          0 s         87 s       3284 s          0 s
       #2  3248 MHz        787 s          0 s        102 s       3303 s          0 s
       #3  2680 MHz        755 s          0 s         95 s       3346 s          0 s
       #4  3241 MHz        555 s          0 s         92 s       3546 s          0 s
       
  Memory: 15.606491088867188 GB (12482.78515625 MB free)
  Uptime: 422.06 sec
  Load Avg:  1.01  0.73  0.34
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, generic)

Target result

Benchmark Report for /home/runner/work/ParallelKMeans.jl/ParallelKMeans.jl

Job Properties

  • Time of benchmark: 21 Oct 2024 - 18:21
  • Package commit: 16881e
  • Julia commit: 3b76b2
  • Julia command flags: None
  • Environment variables: None

Results

Below is a table of this job's results, obtained by running the benchmarks.
The values listed in the ID column have the structure [parent_group, child_group, ..., key], and can be used to
index into the BaseBenchmarks suite to retrieve the corresponding benchmarks.
The percentages accompanying time and memory values in the below table are noise tolerances. The "true"
time/memory value for a given benchmark is expected to fall within this percentage of the reported value.
An empty cell means that the value was zero.

ID time GC time memory allocations
["distance", "100kx10"] 682.004 μs (5%)
["distance", "100kx3"] 248.033 μs (5%)
["kmeans", "10x100_000x10x1 Lloyd"] 1.046 s (5%) 785.55 KiB (1%) 18
["kmeans", "10x100_000x10x1 Hammerly"] 472.588 ms (5%) 2.29 MiB (1%) 21
["kmeans", "10x100_000x10x2 Lloyd"] 1.047 s (5%) 929.20 KiB (1%) 1569
["kmeans", "10x100_000x10x2 Hammerly"] 557.046 ms (5%) 2.59 MiB (1%) 2904
["kmeans", "10x100_000x3x1 Lloyd"] 126.322 ms (5%) 783.72 KiB (1%) 18
["kmeans", "10x100_000x3x1 Hammerly"] 141.633 ms (5%) 2.29 MiB (1%) 21
["kmeans", "10x100_000x3x2 Lloyd"] 126.390 ms (5%) 819.08 KiB (1%) 399
["kmeans", "10x100_000x3x2 Hammerly"] 142.277 ms (5%) 2.41 MiB (1%) 1224

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["distance"]
  • ["kmeans"]

Julia versioninfo

Julia Version 1.6.7
Commit 3b76b25b64 (2022-07-19 15:11 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 22.04.5 LTS
  uname: Linux 6.5.0-1025-azure #26~22.04.1-Ubuntu SMP Thu Jul 11 22:33:04 UTC 2024 x86_64 x86_64
  CPU: AMD EPYC 7763 64-Core Processor: 
              speed         user         nice          sys         idle          irq
       #1  2591 MHz        670 s          0 s         82 s       2700 s          0 s
       #2  2445 MHz        688 s          0 s         93 s       2666 s          0 s
       #3  3243 MHz        584 s          0 s         89 s       2780 s          0 s
       #4  2445 MHz        231 s          0 s         86 s       3130 s          0 s
       
  Memory: 15.606491088867188 GB (12445.23828125 MB free)
  Uptime: 347.47 sec
  Load Avg:  1.03  0.65  0.28
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, generic)

Baseline result

Benchmark Report for /home/runner/work/ParallelKMeans.jl/ParallelKMeans.jl

Job Properties

  • Time of benchmark: 21 Oct 2024 - 18:22
  • Package commit: 500f7a
  • Julia commit: 3b76b2
  • Julia command flags: None
  • Environment variables: None

Results

Below is a table of this job's results, obtained by running the benchmarks.
The values listed in the ID column have the structure [parent_group, child_group, ..., key], and can be used to
index into the BaseBenchmarks suite to retrieve the corresponding benchmarks.
The percentages accompanying time and memory values in the below table are noise tolerances. The "true"
time/memory value for a given benchmark is expected to fall within this percentage of the reported value.
An empty cell means that the value was zero.

ID time GC time memory allocations
["distance", "100kx10"] 412.200 μs (5%)
["distance", "100kx3"] 164.378 μs (5%)
["kmeans", "10x100_000x10x1 Lloyd"] 1.050 s (5%) 785.55 KiB (1%) 18
["kmeans", "10x100_000x10x1 Hammerly"] 529.350 ms (5%) 2.29 MiB (1%) 21
["kmeans", "10x100_000x10x2 Lloyd"] 1.054 s (5%) 929.20 KiB (1%) 1569
["kmeans", "10x100_000x10x2 Hammerly"] 540.309 ms (5%) 2.59 MiB (1%) 2904
["kmeans", "10x100_000x3x1 Lloyd"] 126.180 ms (5%) 783.72 KiB (1%) 18
["kmeans", "10x100_000x3x1 Hammerly"] 149.985 ms (5%) 2.29 MiB (1%) 21
["kmeans", "10x100_000x3x2 Lloyd"] 126.461 ms (5%) 819.08 KiB (1%) 399
["kmeans", "10x100_000x3x2 Hammerly"] 159.252 ms (5%) 2.41 MiB (1%) 1224

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["distance"]
  • ["kmeans"]

Julia versioninfo

Julia Version 1.6.7
Commit 3b76b25b64 (2022-07-19 15:11 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
      Ubuntu 22.04.5 LTS
  uname: Linux 6.5.0-1025-azure #26~22.04.1-Ubuntu SMP Thu Jul 11 22:33:04 UTC 2024 x86_64 x86_64
  CPU: AMD EPYC 7763 64-Core Processor: 
              speed         user         nice          sys         idle          irq
       #1  3243 MHz        823 s          0 s         87 s       3284 s          0 s
       #2  3248 MHz        787 s          0 s        102 s       3303 s          0 s
       #3  2680 MHz        755 s          0 s         95 s       3346 s          0 s
       #4  3241 MHz        555 s          0 s         92 s       3546 s          0 s
       
  Memory: 15.606491088867188 GB (12482.78515625 MB free)
  Uptime: 422.06 sec
  Load Avg:  1.01  0.73  0.34
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, generic)

Runtime information

Runtime Info
BLAS #threads 4
BLAS.vendor() openblas64
Sys.CPU_THREADS 4

lscpu output:

Architecture:                       x86_64
CPU op-mode(s):                     32-bit, 64-bit
Address sizes:                      48 bits physical, 48 bits virtual
Byte Order:                         Little Endian
CPU(s):                             4
On-line CPU(s) list:                0-3
Vendor ID:                          AuthenticAMD
Model name:                         AMD EPYC 7763 64-Core Processor
CPU family:                         25
Model:                              1
Thread(s) per core:                 2
Core(s) per socket:                 2
Socket(s):                          1
Stepping:                           1
BogoMIPS:                           4890.85
Flags:                              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl tsc_reliable nonstop_tsc cpuid extd_apicid aperfmperf pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext invpcid_single vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves clzero xsaveerptr rdpru arat npt nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold v_vmsave_vmload umip vaes vpclmulqdq rdpid fsrm
Virtualization:                     AMD-V
Hypervisor vendor:                  Microsoft
Virtualization type:                full
L1d cache:                          64 KiB (2 instances)
L1i cache:                          64 KiB (2 instances)
L2 cache:                           1 MiB (2 instances)
L3 cache:                           32 MiB (1 instance)
NUMA node(s):                       1
NUMA node0 CPU(s):                  0-3
Vulnerability Gather data sampling: Not affected
Vulnerability Itlb multihit:        Not affected
Vulnerability L1tf:                 Not affected
Vulnerability Mds:                  Not affected
Vulnerability Meltdown:             Not affected
Vulnerability Mmio stale data:      Not affected
Vulnerability Retbleed:             Not affected
Vulnerability Spec rstack overflow: Vulnerable: Safe RET, no microcode
Vulnerability Spec store bypass:    Vulnerable
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Mitigation; Retpolines; STIBP disabled; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Not affected
Cpu Property Value
Brand AMD EPYC 7763 64-Core Processor
Vendor :AMD
Architecture :Unknown
Model Family: 0xaf, Model: 0x01, Stepping: 0x01, Type: 0x00
Cores 16 physical cores, 16 logical cores (on executing CPU)
No Hyperthreading hardware capability detected
Clock Frequencies Not supported by CPU
Data Cache Level 1:3 : (32, 512, 32768) kbytes
64 byte cache line size
Address Size 48 bits virtual, 48 bits physical
SIMD 256 bit = 32 byte max. SIMD vector size
Time Stamp Counter TSC is accessible via rdtsc
TSC runs at constant rate (invariant from clock frequency)
Perf. Monitoring Performance Monitoring Counters (PMC) are not supported
Hypervisor Yes, Microsoft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better convergence system for mini batch algorithm
1 participant