17zuoye / pyirt

A python library of IRT algorithm
MIT License
99 stars 54 forks source link

avoid duplicate logging #24

Open hiromakimaki opened 3 years ago

hiromakimaki commented 3 years ago

@junchenfeng Hello. I tried to solve the issue https://github.com/17zuoye/pyirt/issues/23.

I confirmed this issue was solved by this code:

from pyirt import irt

input = [
    ('user_0', 'item_0', 0),
    ('user_1', 'item_0', 1)
]

item_param, user_param = irt(input)

The logs in console of the above code are as follows. You can see duplicated logging problem is solved.

I'm glad if you review this pull request.

before

2021-07-08 04:07:32 INFO: start loading data
start loading data
2021-07-08 04:07:32 INFO: data loaded
data loaded
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 571.55it/s]
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 441.97it/s]
2021-07-08 04:07:32 DEBUG: E step runs for 291.61 sec
E step runs for 291.61 sec
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 120.35it/s]
2021-07-08 04:07:32 DEBUG: M step runs for 126.464 sec
M step runs for 126.464 sec
2021-07-08 04:07:32 DEBUG: score calculating
score calculating
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 7145.32it/s]
2021-07-08 04:07:32 DEBUG: score calculated.
score calculated.
2021-07-08 04:07:32 DEBUG: 0.6018582902998789
0.6018582902998789
2021-07-08 04:07:32 DEBUG: stop condition runs for 110.94 sec
stop condition runs for 110.94 sec
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 497.72it/s]
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 312.80it/s]
2021-07-08 04:07:33 DEBUG: E step runs for 248.485 sec
E step runs for 248.485 sec
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 290.42it/s]
2021-07-08 04:07:33 DEBUG: M step runs for 124.469 sec
M step runs for 124.469 sec
2021-07-08 04:07:33 DEBUG: score calculating
score calculating
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 4848.91it/s]
2021-07-08 04:07:33 DEBUG: score calculated.
score calculated.
2021-07-08 04:07:33 DEBUG: 0.6018582902998789
0.6018582902998789
2021-07-08 04:07:33 INFO: EM converged at iteration 2.
EM converged at iteration 2.
2021-07-08 04:07:33 DEBUG: stop condition runs for 105.169 sec
stop condition runs for 105.169 sec
2021-07-08 04:07:33 INFO: parameter estimated
parameter estimated
2021-07-08 04:07:33 INFO: parameter retrieved
parameter retrieved

after

2021-07-08 04:08:15 INFO: start loading data
2021-07-08 04:08:15 INFO: data loaded
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 737.46it/s]
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 199.68it/s]
2021-07-08 04:08:15 DEBUG: E step runs for 282.773 sec
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 221.76it/s]
2021-07-08 04:08:15 DEBUG: M step runs for 139.378 sec
2021-07-08 04:08:15 DEBUG: score calculating
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 7660.83it/s]
2021-07-08 04:08:15 DEBUG: score calculated.
2021-07-08 04:08:15 DEBUG: 0.6018582902998789
2021-07-08 04:08:15 DEBUG: stop condition runs for 113.277 sec
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 818.08it/s]
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 483.27it/s]
2021-07-08 04:08:16 DEBUG: E step runs for 238.975 sec
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 200.30it/s]
2021-07-08 04:08:16 DEBUG: M step runs for 121.835 sec
2021-07-08 04:08:16 DEBUG: score calculating
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 11184.81it/s]
2021-07-08 04:08:16 DEBUG: score calculated.
2021-07-08 04:08:16 DEBUG: 0.6018582902998789
2021-07-08 04:08:16 INFO: EM converged at iteration 2.
2021-07-08 04:08:16 DEBUG: stop condition runs for 104.464 sec
2021-07-08 04:08:16 INFO: parameter estimated
2021-07-08 04:08:16 INFO: parameter retrieved