26
Getting started with GEM-SA Marc Kennedy

Getting started with GEM-SA Marc Kennedy. This talk Starting GEM-SA program Creating input and output files Explanation of the menus, toolbars,

Embed Size (px)

Citation preview

Page 1: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

Getting started with GEM-SA

Marc Kennedy

Page 2: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

This talk

Starting GEM-SA program Creating input and output files Explanation of the menus, toolbars, etc. Description of the project window

Page 3: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

Starting GEM-SA

Double-click the GEM-SA icon to start The main window appears, with

– Menu– Toolbar– Sensitivity analysis output grid– Log window

Page 4: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

menumenu

Log windowLog window

toolbartoolbar

Sensitivity analysis Sensitivity analysis output gridoutput grid

Page 5: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

Toolbar icons

New project

Open project

Save project

Print output report

Edit project

Generate input design points

Rescale an input

Standardise design

Copy input design to clipboard

Convert input to integer

Run the analysis

Help

Page 6: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

Sensitivity analysis output grid

This will report the sensitivity results after the analysis is complete– One line for each input parameter– One line for each pair of inputs, if joint

effects are selected

Page 7: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

Log Window output

Tells us– Which training data are being loaded/saved– Transformations applied to the data– Fitted Gaussian process parameters– Summary of the uncertainty analysis

Page 8: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

Creating a GEM project

To build the emulator we first need 3 files:– Data file of code inputs– Data file of code outputs– GEM-SA project file

Page 9: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

Restrictions on input/output data

Single output– Multiple outputs must be treated individually

Max 30 input parameters Max 400 training points The data files are plain text files

– One line for each point– Input file can be space or tab delimited

Page 10: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

Generating a new input design

Designs can be generated using the toolbar icon or the menu: Input Generate…

The design dialog appears

Page 11: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

Generating a new input design

Click OK and fill in the required range for each input

Click OK again

Page 12: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

Editing input designs

If you select a column, you can rescale values of that input or round values to be integers

Designs can be loaded into or saved from this window using the Inputs menu. Use to copy the points to the clipboard for use in other programs

Page 13: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

Types of design

GEM-SA can generate 2 types of design– LP-– Maximin Latin Hypercube designs

Both have good space-filling properties– Ensure all regions of the input space are

well represented

Page 14: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

LP- design

Very quick to generate Deterministic set of uniform points Increasing the sample size just adds points to

the smaller design– Making it useful for sequential analysis– Only have to generate the extra runs

Page 15: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

Maximin Latin hypercube design

Maximin Latin Hypercube designs– Maximise the minimum distance amongst

all pairs of points– Can take a long time to generate

Univariate projections are equally spaced– Each input has all its range represented– Good when only a few inputs are active

Page 16: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

Creating output points from these inputs

This is the tricky part… Each row from the input design must be used

to generate a single output, e.g. using– Spreadsheet

Simple, but requires functional form

– Script Only need executable code Loop through inputs, modify code input file

– Modify code to loop through the points Messy, need source code

Page 17: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

Example: using a spreadsheet

Copy the input design to the clipboard using

Open Excel and paste inputs

Create formula in final column

Copy formula for all rows of the design

Cut and paste special (values) in a new sheet

Save as text file

Page 18: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

Example: using a script

Read base input file Read training inputs file Loop through training file lines

– Replace target inputs using training line– Write new base input file– Run code– Calculate single output and add to training

output file

Page 19: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

my $pftchangeline = 21; # change line 21 within the input file for each runmy @pftchangecols = (11,14,23,19); # columns within pftchangeline to modifymy @pftinlh = (0,1,2,3); # ordering of these parameters within training inputs

open(BASEINFILE, "input.dat"); # getinitial (fixed) input file used by sdgvmd my @lines = <BASEINFILE>; # and store the input lines in @linesclose BASEINFILE;

open(LHFILE, "training_inputs.txt");my $newpftline = $lines[$pftchangeline];my @newpftpoints = split(" ", $newpftline);while (<LHFILE>){

# assigns each line in turn to $_ chomp;split;my @lhpoints = @_;open(INFILE, "> inputfile.dat");@newpftpoints[@pftchangecols] = @lhpoints[@pftinlh] # modify lines $lines[$pftchangeline] = join(' ', @newpftpoints)."\n";print INFILE @lines;close INFILE;`sdgvm0 input.dat`; # run sdgvm0 with modified input # now do something with the output files.......

}

Page 20: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

The project window

Appears whenever you– Load a project– Edit a project– Create new project

This window has 3 tabs– Options– Files– Simulations

Page 21: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

How many How many inputs?inputs?

What are What are the input the input names?names?

Page 22: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

Which joint Which joint effects effects should be should be calculated?calculated?

What What should be should be calculated, calculated, and how?and how?

Page 23: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

Are the Are the inputs inputs uncertain?uncertain?

What prior What prior mean for mean for the output?the output?

Page 24: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

What kind of What kind of prediction?prediction?

What kind of cross What kind of cross validation?validation?

Page 25: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

Names for Names for the input the input filesfiles

Names for Names for the output the output filesfiles

Page 26: Getting started with GEM-SA Marc Kennedy. This talk  Starting GEM-SA program  Creating input and output files  Explanation of the menus, toolbars,

MCMC MCMC control control parametersparameters

How many points How many points used to calculate used to calculate main effects, joint main effects, joint effectseffects

How many realisations How many realisations of predictions, main of predictions, main and joint effects to and joint effects to generategenerate