Getting started with MLAir¶
How to start with MLAir¶
In this section, we show three examples how to work with MLAir. Note, that for these examples MLAir was installed using the distribution file. In case you are using the git clone it is required to adjust the import path if not directly executed inside the source directory of MLAir.
We start MLAir in a dry run without any modification. Just import mlair and run it.
import mlair # just give it a dry run without any modification mlair.run()
The logging output will show you many informations. Additional information (including debug messages) are collected inside the experiment path in the logging folder.
INFO: DefaultWorkflow started INFO: ExperimentSetup started INFO: Experiment path is: /home/<usr>/mlair/testrun_network ... INFO: load data for DEBW001 from JOIN ... INFO: Training started ... INFO: DefaultWorkflow finished after 00:00:12 (hh:mm:ss)
Now we update the stations and customise the window history size parameter.
import mlair # our new stations to use stations = ['DEBW030', 'DEBW037', 'DEBW031', 'DEBW015', 'DEBW107'] # expanded temporal context to 14 (days, because of default sampling="daily") window_history_size = 14 # restart the experiment with little customisation mlair.run(stations=stations, window_history_size=window_history_size)
The output looks similar, but we can see, that the new stations are loaded.
INFO: DefaultWorkflow started INFO: ExperimentSetup started ... INFO: load data for DEBW030 from JOIN INFO: load data for DEBW037 from JOIN ... INFO: Training started ... INFO: DefaultWorkflow finished after 00:00:24 (hh:mm:ss)
Let’s just apply our trained model to new data. Therefore we keep the window history size parameter but change the stations. In the run method, we need to disable the trainable and create new model parameters. MLAir will use the model we have trained before. Note, this only works if the experiment path has not changed or a suitable trained model is placed inside the experiment path.
import mlair # our new stations to use stations = ['DEBY002', 'DEBY079'] # same setting for window_history_size window_history_size = 14 # run experiment without training mlair.run(stations=stations, window_history_size=window_history_size, create_new_model=False, trainable=False)
We can see from the terminal that no training was performed. Analysis is now made on the new stations.
INFO: DefaultWorkflow started ... INFO: No training has started, because trainable parameter was false. ... INFO: DefaultWorkflow finished after 00:00:06 (hh:mm:ss)