hyperactive.process   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 24
dl 0
loc 38
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A _process_() 0 27 3
1
"""Process handling for hyperparameter optimization.
2
3
Author: Simon Blanke
4
Email: [email protected]
5
License: MIT License
6
"""
7
8
from tqdm import tqdm
9
10
11
def _process_(nth_process, optimizer):
12
    if "progress_bar" in optimizer.verbosity:
13
        p_bar = tqdm(
14
            position=nth_process,
15
            total=optimizer.n_iter,
16
            ascii=" ─",
17
            colour="Yellow",
18
        )
19
    else:
20
        p_bar = None
21
22
    optimizer.search(nth_process, p_bar)
23
24
    if p_bar:
25
        p_bar.colour = "GREEN"
26
        p_bar.refresh()
27
        p_bar.close()
28
29
    return {
30
        "nth_process": nth_process,
31
        "best_para": optimizer.best_para,
32
        "best_score": optimizer.best_score,
33
        "best_iter": optimizer.best_since_iter,
34
        "eval_times": optimizer.eval_times,
35
        "iter_times": optimizer.iter_times,
36
        "search_data": optimizer.search_data,
37
        "random_seed": optimizer.random_seed,
38
    }
39