1 The files in this directory are Matlab scripts that are used to help train a neural network
2 to replace the the fuel_cell_left_x subroutines in module_fr_sfire_core.F
4 Requires Deep Learning Toolbox, tested with Matlab R2022a
8 Running the script full_train.m will generate data, train a network, and compare network performance with a second set of data. Creating 10000
9 samples will require less than a minute to complete the task.
12 1) Generate some data to simulate the fire arrival time at four corners of a grid cell and
13 the fuel constant that determines the burn rate. Run the function
15 s = gauss_samps(n,0.8)
17 to generate n samples with 80% of the fire arrival times drawn from a Gaussian distribution with a smaller variance, simulating
18 fires newly arrived at grid cells.
21 1a) Process the data so that maximum value is always in the lower left corner and max of diagonal is in the upper left.
25 2) Compute the fuel left associated with the samples from step 1.
27 r = fuel_int(s) % uses matlab integral2 function, slow
31 r = fuel_quad(s,n) % uses midpoint quadrature on an nxn grid, faster and nearly same result as above.
33 3) Train the network using s for the predictors and r as the responses. Training can be done using the GUI in the apps tab for Neural Net Fittin and then selecting Import with s as predictors and r as responses, using radial button to indicate that observations are arranged in rows of the matrices. When data is imported, the green triangle train button will divide the data into training, validation and testing sets and optimize the network.
35 Optionally, scripts have been generated by Matlab to do the training of the network. Either of the two following scripts will train the network if s and r from the steps above are in the workspace.
40 The training of a CNN with two hidden layers may be also accomplished with s and r from above by the function train_2_layers.m, with usage
42 net = train_2_layers(s,r)