antoinecarme / pyaf

PyAF is an Open Source Python library for Automatic Time Series Forecasting built on top of popular pydata modules.
BSD 3-Clause "New" or "Revised" License
459 stars 72 forks source link

Add some messages to reflect the progress of the trainining process #185

Closed antoinecarme closed 2 years ago

antoinecarme commented 2 years ago

For the slow mode (all models and options activated), PyAF may have to analyze hundreds of models in parallel, This may take some time on non-parallel hardware.

Add some messages to a t least display the model names that are processed and reflect their training time.

Target Release : 2022-07-14

antoinecarme commented 2 years ago

Add a generic timer class to measure the time spent in most time-consuming operations.

antoinecarme commented 2 years ago

Added pyaf.timing logger.

antoinecarme commented 2 years ago

New log timing operations :

xxxxx@z600:~/dev/python/packages/timeseries/pyaf$ python3 tests/func/test_ozone.py 
     Month  Ozone       Time
0  1955-01    2.7 1955-01-01
1  1955-02    2.0 1955-02-01
2  1955-03    3.6 1955-03-01
3  1955-04    5.0 1955-04-01
4  1955-05    6.5 1955-05-01
INFO:pyaf.timing:('OPERATION_START', ('SIGNAL_TRAINING', {'Signals': ['Ozone'], 'Cores': 4}))
INFO:pyaf.timing:('OPERATION_START', ('TRAINING', {'Signal': 'Ozone', 'Transformation': 'Diff_Ozone'}))
INFO:pyaf.timing:('OPERATION_START', ('TRAINING', {'Signal': 'Ozone', 'Transformation': '_Ozone'}))
INFO:pyaf.timing:('OPERATION_START', ('TRAINING', {'Signal': 'Ozone', 'Transformation': 'RelDiff_Ozone'}))
INFO:pyaf.timing:('OPERATION_START', ('TRAINING', {'Signal': 'Ozone', 'Transformation': 'CumSum_Ozone'}))
INFO:pyaf.timing:('OPERATION_END_ELAPSED', 1.144, ('TRAINING', {'Signal': 'Ozone', 'Transformation': '_Ozone'}))
INFO:pyaf.timing:('OPERATION_END_ELAPSED', 1.376, ('SIGNAL_TRAINING', {'Signals': ['Ozone'], 'Cores': 4}))
INFO:pyaf.timing:('OPERATION_START', ('FINALIZE_TRAINING', {'Signals': ['Ozone'], 'Cores': 1}))
INFO:pyaf.timing:('OPERATION_START', ('COMPUTE_PREDICTION_INTERVALS', {'Signal': 'Ozone'}))
INFO:pyaf.timing:('OPERATION_END_ELAPSED', 0.345, ('COMPUTE_PREDICTION_INTERVALS', {'Signal': 'Ozone'}))
INFO:pyaf.timing:('OPERATION_END_ELAPSED', 0.424, ('FINALIZE_TRAINING', {'Signals': ['Ozone'], 'Cores': 1}))
INFO:pyaf.std:TIME_DETAIL TimeVariable='Time' TimeMin=1955-01-01T00:00:00.000000 TimeMax=1967-09-01T00:00:00.000000 TimeDelta=<DateOffset: months=1> Horizon=12
INFO:pyaf.std:SIGNAL_DETAIL_ORIG SignalVariable='Ozone' Length=204  Min=1.2 Max=8.7  Mean=3.8357843137254894 StdDev=1.491559215940118
INFO:pyaf.std:SIGNAL_DETAIL_TRANSFORMED TransformedSignalVariable='_Ozone' Min=0.0 Max=1.0  Mean=0.35143790849673195 StdDev=0.19887456212534912
INFO:pyaf.std:DECOMPOSITION_TYPE 'T+S+R'
INFO:pyaf.std:BEST_TRANSOFORMATION_TYPE '_'
INFO:pyaf.std:BEST_DECOMPOSITION  '_Ozone_LinearTrend_residue_bestCycle_byMAPE_residue_AR(51)' [LinearTrend + Cycle_None + AR]
INFO:pyaf.std:TREND_DETAIL '_Ozone_LinearTrend' [LinearTrend]
INFO:pyaf.std:CYCLE_DETAIL '_Ozone_LinearTrend_residue_bestCycle_byMAPE' [Cycle_None]
INFO:pyaf.std:AUTOREG_DETAIL '_Ozone_LinearTrend_residue_bestCycle_byMAPE_residue_AR(51)' [AR]
INFO:pyaf.std:MODEL_MAPE MAPE_Fit=0.1668 MAPE_Forecast=0.1479 MAPE_Test=0.1426
INFO:pyaf.std:MODEL_SMAPE SMAPE_Fit=0.1565 SMAPE_Forecast=0.1637 SMAPE_Test=0.1527
INFO:pyaf.std:MODEL_MASE MASE_Fit=0.7155 MASE_Forecast=0.6304 MASE_Test=0.7351
INFO:pyaf.std:MODEL_CRPS CRPS_Fit=0.3393520318874522 CRPS_Forecast=0.26586525836868236 CRPS_Test=0.28274618156625175
INFO:pyaf.std:MODEL_L1 L1_Fit=0.6289210242456797 L1_Forecast=0.4893586521049049 L1_Test=0.3475195870267343
INFO:pyaf.std:MODEL_L2 L2_Fit=0.83001742194125 L2_Forecast=0.6681008123392113 L2_Test=0.430119338678025
INFO:pyaf.std:MODEL_LnQ LnQ_Fit=6.4891787083547765 LnQ_Forecast=1.7465131682383166 LnQ_Test=0.5857060588437405
INFO:pyaf.std:MODEL_MEDIAN_AE MedAE_Fit=0.5336042100469847 MedAE_Forecast=0.40725700645438323 MedAE_Test=0.254203897678674
INFO:pyaf.std:MODEL_COMPLEXITY 39.0
INFO:pyaf.std:SIGNAL_TRANSFORMATION_DETAIL_START
INFO:pyaf.std:SIGNAL_TRANSFORMATION_MODEL_VALUES NoTransf None
INFO:pyaf.std:SIGNAL_TRANSFORMATION_DETAIL_END
INFO:pyaf.std:TREND_DETAIL_START
INFO:pyaf.std:LINEAR_RIDGE_TREND LinearTrend (0.5096770848334515, array([-0.24361723]))
INFO:pyaf.std:TREND_DETAIL_END
INFO:pyaf.std:CYCLE_MODEL_DETAIL_START
INFO:pyaf.std:BEST_CYCLE_LENGTH_VALUES _Ozone_LinearTrend_residue_bestCycle_byMAPE None 0.0017292167436161465 {}
INFO:pyaf.std:CYCLE_MODEL_DETAIL_END
INFO:pyaf.std:AR_MODEL_DETAIL_START
antoinecarme commented 2 years ago

Fixed