[OpenR8 solution] Data_Analysis(Date Analyzing)
  1. Data_Analysis

 

Data_analysis uses different methods to model learning and inference of data. The use method has the fully connection layer, the random forest, provides the example has the stock price forecast, the sin waveform prediction.

 

 

  1. Introduction

 

The contents of this solution folder are shown in Figure 1 below. The contents of Flow are described in the following table.

 

The source code path is shown in Fig. 2 below.

 

The path to the data and trained model files is shown in Fig. 3 below.

 

Fig. 1. Folder diagram..png

Fig. 1. Folder diagram.

 

Method

Application

Flow Files and instructions

Dense

Sin Function Waveform Prediction

sin_read.flow

Read Sin waveform data.

sin_dense_keras_1_training.flow

Sin waveform training, generating models.

sin_dense_keras_2_inference.flow

Use a trained model for inference data.

Stock price Analysis Forecast

stock_dense_keras_1_training.flow

Train stock price data to produce models.

stock_dense_keras_2_inference.flow

Use a trained model for inference data.

Regression forest

Sin Function Waveform Prediction

sin_regression_forest_1_training.flow

Sin waveform training, generating models.

sin_regression_forest_2_inference.flow

Use a trained model for inference data.

Stock price Analysis Forecast

stock_regression_forest_1_preparation.flow

Read stock price data.

stock_regression_forest_2_training.flow

Train stock price data to produce models.

stock_regression_forest_3_inference.flow

Use a trained model for inference data.

 
 
Fig. 2. Src - Folder Contents..png
Fig. 2. Src - Folder Contents.
 
 
Fig. 3. Data - Path to the data..png
Fig. 3. Data - Path to the data.
 
 
 
  1. Model training and prediction based on dense method applied to sin or stock

 

※ This solution needs to use Python. Please install the Python kit yourself.

 

  1. Preparing data :

Please to OpenR8 > solution > Data_Analysis > Sin.csv and Stock.csv are found in the Data folder. See Fig. 4 below.

 

(1) sin.csv : The sin.csv content is turned on as shown in Fig. 5 (left), with two fields (degree, sin). This data automatically outputs its corresponding Sin angle value for what you want the model to learn when the input angle is.

From this, we can find out the sin waveform diagram, and further infer the values of different angles.

(2) Stock.csv: The opening content is shown in Fig. 5 (right) below, with six fields, the first five to enter information about the daily stock, and the last is the closing price after five days of output.

 

Sin's waveform is an input, an output, the stock example is five inputs, an output, you can according to the requirements of the data you want to make inferences into CSV, and then follow the process to run the next steps, you can complete the training model and inference.

 

Fig. 4. The file path of Sin.csv and Stock.csv..png

Fig. 4. The file path of Sin.csv and Stock.csv.

 

Fig. 5. Schematic diagram of sin.csv left stock.csv right .png

Fig. 5. Schematic diagram of sin.csv left stock.csv right.

 

  1. Run flow files :

【Training Models】

(1) How to use it : Run R8.exe > Open and load process files > Perform training. First, introduce the example of sin, each step is shown in Fig. 6, Fig. 7, Fig. 8, Fig. 9.

Stock : Please select Stock_dense_keras_1_training.flow, follow in the way of sin and so on. 

 

Fig. 6. Run R8.png

Fig. 6. Run R8.exe.

 

Fig. 7. Open and load process files sin .png

Fig. 7. Open and load process files (sin).

 

Fig. 8. Training Models sin ..png

Fig. 8.  Training Models (sin).

 

Fig. 9. Training complete output model file . h5 ..png

Fig. 9. Training complete, output model file (. h5).

 

(2) Parameter description :There are two main parameters, one of which sets the content to be learned and the other is the model file name that is completed for training. See Fig. 10, Fig. 11 below.

 

Fig. 10. Set the data you want the model to learn..png

Fig. 10. Set the data you want the model to learn.

 

Fig. 11. File name of the output model..png

Fig. 11. File name of the output model.

 

【Model Inference】Test the model files that have been trained to complete. The inference steps for the Sin example are shown in Fig. 12, Fig. 13, Fig. 14, Fig. 15, Fig. 16. Stock is used in a way that selects Stock_dense_keras_2_inference.flow. For subsequent use, please refer to the use of sin.

 

Fig. 12. Open Inference flow file..png

Fig. 12. Open Inference flow file.

 

Fig. 13. Select the model to use for inference..png

Fig. 13. Select the model to use for inference.

 

Fig. 14. Select what you want to infer..png

Fig. 14. Select what you want to infer.

 

Fig. 15. Set the result file name of the output inference..png

Fig. 15. Set the result file name of the output inference.

 

Fig. 16. Inference Results..png

Fig. 16. Inference Results.

 

 

  1. Model training and prediction based on regression forest method applied to sin or stock 

 

  1. Run R8.exe > Load stock_regression_forest_1_preparation.flow > Click Run.

Running completes results in the stock-25to5-1-validation.csv of Data augmentation, whose path is in the OpenR8/solution/Data_Analysis/data folder.

  1. Load stock_regression_forest_2_training.flow file > Click Run.
  2. Load stock_regression_forest_3_inference.flow file > Click Run.
  3. Produce inference results placed in : OpenR8/solution/Data_Analysis/data/stock-25to5-1.csv.The last field of the CSV table content close after 5 days is the result of the inference.

 

If there is a need to replace the user's own data or modify parameters, please refer to the parameter setting instructions below.  Parameter setting Description :

The parameters of "Stock_regression_forest_1_preparation.flow" are shown in Fig. 17, Fig. 18, Fig. 19, Fig. 20, Fig. 21. 

 

Fig. 17. Data files that need to be pre-processed..png

Fig. 17. Data files that need to be pre-processed.

 

Fig. 18. Multiples of pre-processed data increments..png

Fig. 18. Multiples of pre-processed data increments.

 

Fig. 19. Set the output of the pre-processing..png

Fig. 19. Set the output of the pre-processing.

 

Fig. 20. Set test samples as a percentage of the dataset..png

Fig. 20. Set test samples as a percentage of the dataset.

 

Fig. 21. stock-25to5-1-validation..png

Fig. 21. stock-25to5-1-validation.

 

【stock_regression_forest_2_training.flow】The parameter settings are shown in Fig. 22, Fig. 23 below. 

 

Fig. 22. stock_regression_forest_2_training 1 ..png

Fig. 22. stock_regression_forest_2_training (1).

 

Fig. 23. stock_regression_forest_2_training 2 ..png

Fig. 23. stock_regression_forest_2_training (2).

 

The parameters of 【Stock_regression_forest_3_inference.flow】 are shown in Fig. 24, Fig. 25 below.

 

Fig. 24. stock_regression_forest_3_inference 1 ..png

Fig. 24. stock_regression_forest_3_inference (1).

 

Fig. 25. stock_regression_forest_3_inference 2 ..png

Fig. 25Fig. 25. stock_regression_forest_3_inference (2).


Recommended Article

1.
OpenR8 Community Edition - AI Software for Everyone (Free Download)