(Optional) Unit 3. Prepare Code


You can skip this unit if 2.3 Cumulative Update 1 has been applied to your environment.

Download Code Files


You can download the code files used in this tutorial. Extract the package, you can find the following code files.


Number Code File Description
1 check_hive_config.py Checks if EnOS Hive is available to save the prediction results.
2 generate_model_list.py Generates a simulation instance list. A ParallelFor operator would perform parallel training or prediction tasks for each item in the list.
3 generate_random_int.py Generates a random number from 1-10. In this tutorial, the raw data is ready for feature engineering and model training when the random number generated is smaller than 5.
4 generate_variables.py Generates paths used in operators.
5 get_latest_model_version.py Gets the latest model version information for a specific model.
6 prepare_data.py Gets the raw data and split the training set and prediction set based on the sample_split_ratio defined in the pipeline.
7 prepare_predict_data.py Simulates the prediction data processing.
8 prepare_train_data.py Simulates the training data pre-processing and processing.
9 train_model.py Trains a model with the training data and a specified algorithm Model training file. It also generates Mlflow model files.
10 write_results.py Saves the prediction results as csv files.
11 requirements1.txt Python package requirement file.
12 requirements2.txt Python package requirement file.


Upload the Code Files


Since PythonEx operators are used in this tutorial, you need to upload the code files to the internal storage as follows:

  1. From Data Analytics > AI Studio > AI Lab, select New Instance and enter the following values:
    • Instance Name: winddemoinstance
    • Workspace Storage: wind-demo-instance
  2. Select the winddemo instance name to enter the JupyterLab environment.
  3. Select New Folder icon to create a new folder named as wind_demo and select Upload File icon to upload code files to the notebook folder.
  4. Open a new terminal and run the command pip install eap-notebook to install the eap-notebook package.
  5. Run the command eap-notebook push -p wind_demo to upload the code files.