<jupyter_start><jupyter_text>Runtime of bolasso under sklearn built-in parallel scheme    *  In this file we set the DGP identical to the one in simulation 1.   1: import all modules*  "pickle" is used to save all computation results into ".p" files, which can be loaded later. *  For simplicity and elegancy, all relevant functions and classes are coded in "simul_built_in_parallel.py".<jupyter_code>%reset -f

from simul_built_in_parallel import simul_func

import numpy             as np
import matplotlib.pyplot as plt
import pickle
import os
import errno
n_info    = 5
step_size = -0.01
num_rep   = 200
rnd_seed  = 0

n_dim_0 = 400 ; sample_size_0 = 200
n_dim_1 = 800 ; sample_size_1 = 400
n_dim_2 = 1200; sample_size_2 = 600<jupyter_output><empty_output><jupyter_text>--- Result summary On i9-9900K, my result is summarized in this table. The unit of this table is *seconds per iteration*. |                     | SR | p/n = 100/100  |  p/n = 100/150  |  p/n = 100/200  |  p/n = 150/100  |  p/n = 200/150  |  p/n = 250/200  |  p/n = 400/200  |  p/n = 800/400  |  p/n = 1200/600  || ------------------: | :----------------------------: | :----------: | :-----------: | :-----------: | :----------: | :-----------: | :-----------: | :-----------: | :-----------: | :------------: || bsolar-3            | 3                              | 0\.13        | 0\.17         | 0\.24         | 0\.13        | 0\.18         | 0\.25         | 0\.40         | 1\.07         | 2\.05          || bolasso  (joblib parallel)             | 256                            | 1\.84        | 3\.41         | 7\.68         | 2\.01        | 3\.93         | 6\.46         | 15\.48        | 231\.25       | 820\.84        || bolasso  (built-in parallel)                   | 256                                        | 5\.30              | 8\.71               | 19\.98              | 7\.46              | 14\.88              | 20\.62              | 29\.36              | 229\.26             | 779\.01              | the runtime of "solar + hold out" can be found at the progress bars in "Simul_1d.html" ---  More possibly, *  you might run Anaconda3 on *Windows and openBLAS by default*; *  your PC would be similar to a *Dell Inspiron 24 5000 All-in-One* with *i7-10700 CPU*.     *  the CPU cooler is inefficient     *  the CPU base frequency is below 3.6GHz  Thus, we also include the runtime on the all-in-one mentioned above with *30 repetitions*|                     | SR | p/n = 100/100  |  p/n = 100/150  |  p/n = 100/200  |  p/n = 150/100  |  p/n = 200/150  |  p/n = 250/200  |  p/n = 400/200  |  p/n = 800/400  |  p/n = 1200/600  || ------------------: | :----------------------------: | :----------: | :-----------: | :-----------: | :----------: | :-----------: | :-----------: | :-----------: | :-----------: | :------------: || bsolar-3            | 3                              | 0\.33        | 0\.22         | 0\.24         | 0\.19        | 0\.27         | 0\.35         | 0\.46         | 1\.07         | 2\.40          || bolasso  (joblib parallel)             | 256                            | 6\.71        | 11\.88         | 9\.37         | 7\.22        | 13\.05         | 24\.39         | 38\.44        | 608\.94       | 1819\.51        || bolasso  (built-in parallel)                   | 256                                        | 6\.78              | 11\.94               | 18\.67              | 7\.50              | 16\.25              | 25\.75              | 46\.41              | 636\.29             | 1731\.38              | --- **Read this before replication** 1. the ["tqdm progress bar"](https://github.com/tqdm/tqdm) After runing all the codes, you should see a progress bar below each simulation function. The progress bars are made by Python package *"tqdm"* with negligible overheads (80ns for the graphical output). As a result, it does not affect the accuracy of measuring runtime.  2. the graphical interface of progress bar The progress bar looks as follows (such as the one below *trial.simul_bsolar()* ). ![the tqdm progress bar](./progress_bar.png) From left to right, it displays*  percentage of finished repetitions *  the progress bar *  number of finished repetitions &nbsp; $/$ &nbsp; number of total repetitions *  $[$ time spent &nbsp;  $*  Note that the average time in either **iteration per second (it/s)** or **second per iteration (s/it)**; take the reciprical of **it/s** to make a clear comparison  3. the runtime length issue of bolasso Beware that bolasso computation could take very long time. On a Thinkpad T480 laptop with i5-8500u CPU and 8G Ram, sometimes bolasso takes around 60 mins for each repetition at $p/n=1200/600$, implying that 200 hours for all 200 repetitions. we highly recommend set **num_rep = 30** if your CPU frequency is lower than 3.6GHz.---  4 : $\log(p)/n \rightarrow 0$<jupyter_code>num_rep = 30<jupyter_output><empty_output><jupyter_text>4(a): $p/n=400/200$<jupyter_code>trial = simul_func(sample_size_0, n_dim_0, n_info, num_rep, step_size, rnd_seed)<jupyter_output><empty_output><jupyter_text>run 200 repetitions for bolasso<jupyter_code>trial.simul_bolasso()<jupyter_output>100%|██████████| 200/200 [1:37:51<00:00, 29.36s/it]<jupyter_text>4(b): $p/n=800/400$<jupyter_code>trial = simul_func(sample_size_1, n_dim_1, n_info, num_rep, step_size, rnd_seed)<jupyter_output><empty_output><jupyter_text>run 200 repetitions for bolasso<jupyter_code>trial.simul_bolasso()<jupyter_output>100%|██████████| 200/200 [12:44:12<00:00, 229.26s/it]<jupyter_text>4(c): $p/n=1200/600$<jupyter_code>trial = simul_func(sample_size_2, n_dim_2, n_info, num_rep, step_size, rnd_seed)<jupyter_output><empty_output><jupyter_text>run 200 repetitions for bolasso<jupyter_code>trial.simul_bolasso()<jupyter_output>100%|██████████| 200/200 [43:16:41<00:00, 779.01s/it]<jupyter_text>--- 4 : $p/n \rightarrow 0$<jupyter_code>n_dim_3 = 100 ; sample_size_3 = 100
n_dim_4 = 100 ; sample_size_4 = 150
n_dim_5 = 100 ; sample_size_5 = 200<jupyter_output><empty_output><jupyter_text>4(d) : $p/n = 100/100$<jupyter_code>trial = simul_func(sample_size_3, n_dim_3, n_info, num_rep, step_size, rnd_seed)<jupyter_output><empty_output><jupyter_text>run 200 repetitions for bolasso<jupyter_code>trial.simul_bolasso()<jupyter_output>100%|██████████| 200/200 [17:39<00:00,  5.30s/it]<jupyter_text>4(d): $p/n = 100/150$<jupyter_code>trial = simul_func(sample_size_4, n_dim_4, n_info, num_rep, step_size, rnd_seed)<jupyter_output><empty_output><jupyter_text>run 200 repetitions for bolasso<jupyter_code>trial.simul_bolasso()<jupyter_output>100%|██████████| 200/200 [29:02<00:00,  8.71s/it]<jupyter_text>4(e): $p/n=100/200$<jupyter_code>trial = simul_func(sample_size_5, n_dim_5, n_info, num_rep, step_size, rnd_seed)<jupyter_output><empty_output><jupyter_text>run 200 repetitions for bolasso<jupyter_code>trial.simul_bolasso()<jupyter_output>100%|██████████| 200/200 [1:06:35<00:00, 19.98s/it]<jupyter_text>--- 4 : $p/n \rightarrow 1$<jupyter_code>n_dim_6 = 150 ; sample_size_6 = 100
n_dim_7 = 200 ; sample_size_7 = 150
n_dim_8 = 250 ; sample_size_8 = 200<jupyter_output><empty_output><jupyter_text>4(f): $p/n=150/100$<jupyter_code>trial = simul_func(sample_size_6, n_dim_6, n_info, num_rep, step_size, rnd_seed)<jupyter_output><empty_output><jupyter_text>run 200 repetitions for bolasso<jupyter_code>trial.simul_bolasso()<jupyter_output>100%|██████████| 200/200 [24:51<00:00,  7.46s/it]<jupyter_text>4(g): $p/n=200/150$<jupyter_code>trial = simul_func(sample_size_7, n_dim_7, n_info, num_rep, step_size, rnd_seed)<jupyter_output><empty_output><jupyter_text>run 200 repetitions for bolasso<jupyter_code>trial.simul_bolasso()<jupyter_output>100%|██████████| 200/200 [49:35<00:00, 14.88s/it]<jupyter_text>4(h): $p/n=250/200$<jupyter_code>trial = simul_func(sample_size_8, n_dim_8, n_info, num_rep, step_size, rnd_seed)<jupyter_output><empty_output><jupyter_text>run 200 repetitions for bolasso<jupyter_code>trial.simul_bolasso()<jupyter_output>100%|██████████| 200/200 [1:08:43<00:00, 20.62s/it]<jupyter_text>--- 5. output the raw results into HTML<jupyter_code>!rm -rf Simul_3_runtime_built_in_parallel.html
!jupyter nbconvert --to html Simul_3_runtime_built_in_parallel.ipynb<jupyter_output>[NbConvertApp] Converting notebook Simul_3_runtime_built_in_parallel.ipynb to html
[NbConvertApp] Writing 609148 bytes to Simul_3_runtime_built_in_parallel.html
{'fraction_non_alphanumeric': 0.16819973718791065, 'fraction_numerical': 0.0934177517620356, 'mean_word_length': 2.5309995782370307, 'pattern_counts': {'":': 0, '<': 92, '<?xml version=': 0, '>': 83, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '23', 'dir': 'jupyter-structured-clean-dedup', 'id': '253588', 'license': 'Intel', 'n_tokens_mistral': 3679, 'n_tokens_neox': 2956, 'n_words': 670, 'path': 'Section_3.3_simul_3/2_Runtime/Simul_3_runtime_built_in_parallel.ipynb', 'repo_name': 'isaac2math/solar', 'size': '8371'}