Commit 0215434d authored by Janis Jatnieks's avatar Janis Jatnieks
Browse files

Add new file for general purpose model fitting experiment demo

parent 28fbcad6
# Surrogate experiments controller
# Author: Janis Jatnieks, janis.jatnieks@gfz-potsdam.de, +49(0)157 3245 1188
require(stringr)
require(data.table)
# This calls all the other dependencies
source("Surrogate_playground.R")
# read the data tables
IN_training_data_path = "train/100_IN.csv"
OUT_training_data_path ="train/100_OUT.csv"
INtable = fread(IN_training_data_path)
OUTtable = fread(OUT_training_data_path)
# subset columns
INselection =c("C","Ca","Cl","Mg","N","Na","S","Si","H*","O*","Charge","Pressure","MatUnsatPorosity","UD_p4f","UD_pH","UD_pe","UD_mass_H2O","UD_charge(eq)","UD_O(0)(mol/kgw)","UD_Ca(mol/kgw)","UD_Calcite","UD_Kaolinite","UD_si_Calcite","UD_si_Gypsum","UD_si_K-Feldspar", "UD_si_Kaolinite","Time")
OUTselection=c("C","Ca","Cl","Mg","N","Na","S","Si","H*","O*","Charge","Pressure","MatUnsatPorosity","UD_p4f","UD_pH","UD_pe","UD_mass_H2O","UD_charge(eq)","UD_O(0)(mol/kgw)","UD_Ca(mol/kgw)","UD_Calcite","UD_Kaolinite","UD_si_Calcite","UD_si_Gypsum","UD_si_K-Feldspar", "UD_si_Kaolinite","Time")
INtable = subset(INtable, select=INselection )
OUTtable = subset(OUTtable,select=OUTselection)
# run the model fitting, validation and selection work-flow with given methods
Main(c("MARS","MARS3","PolyMARS","PolyMARS3","mda_p01","polymars_p01","brnn","qrnn","lars2","lasso","lars")
,preprocessing_ind = c(17) # no pre-processing
,input_data = INtable
,output_data = OUTtable
,seed = 105
# use of parallelization for training, validation and preprocessing steps
,preproc_para = T, train_para = T, run_para = F
,selection_criteria = "MASE"
# drops any such named column from input as well as output
,exclude_columns = c("Head")
# makes sure concentration values are positive
,allow_neg_cols= c("Pressure","H*","O*")
# assumes this will be passed in from the model coupling to the Surrogate at run-time
,external = c("Time","Pressure","MatUnsatPorosity","Saturation","Temp","MatHeatPorosity","MatFlowStorativity","UD_p4f")
# dump error tables
,write_full_residuals = F
# run caret tuning routines
,tuner = T
# use this much for training
,training_samples = 0.7
)
# do a quick check the resulting surrogate model actually runs
qtestin <- as.matrix( head(INtable,1000)
qres <-data.table( SelectedSurrogate(qtestin) )
cat ("\n\n")
print (head( qres )
print (head( OUTtable )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment