idaes.surrogate.alamopy package¶
Submodules¶
idaes.surrogate.alamopy.allcard module¶
idaes.surrogate.alamopy.almconfidence module¶
idaes.surrogate.alamopy.almerror module¶
Errors
-
exception
idaes.surrogate.alamopy.almerror.
AlamoError
[source]
-
exception
idaes.surrogate.alamopy.almerror.
AlamoInputError
(msg)[source]
idaes.surrogate.alamopy.almpickle module¶
idaes.surrogate.alamopy.almplot module¶
Plot doalamo output including confidence intervals if they are calculated.
idaes.surrogate.alamopy.almpywriter module¶
idaes.surrogate.alamopy.almwriter module¶
idaes.surrogate.alamopy.doalamo module¶
Run ALAMO.
-
idaes.surrogate.alamopy.doalamo.
addBasisConstraints
(groups_constraints)[source] NMT (no more than), ATL (at least), REQ (required if main group), XCL (exclude) format: group-id output_id constraint_type integer_parameter
-
idaes.surrogate.alamopy.doalamo.
addBasisGroup
(type_of_function, input_indices='', powers='')[source] Include the checks
-
idaes.surrogate.alamopy.doalamo.
addBasisGroups
(groups)[source] format: index_num Type_of_function Member_indices(indice of the input) <pow> types: LIN, LOG, EXP, SIN, COS, MONO, MULTI2, MULTI3, RATIO, RBf, CUST, CONST Only one CONST One input: MONO, EXP, LOG, SIN, COS - integer from 1- NINPUTs, (-1) - all inputs multiple input: Multi2, Multi3, ratio Need <pow> for MONO, Multi2, Multi3, Ratio, (-1111) - all powers
-
idaes.surrogate.alamopy.doalamo.
addCustomConstraints
(constraint_list, **kwargs)[source] constraint args = CRTOL, CRNINITIAL, CRMAXITER, CRNVIOL, CRNTRIALS
-
idaes.surrogate.alamopy.doalamo.
alamo
(xdata, zdata, **kwargs)[source] [almmodel] = doalamo(xdata,zdata, xvaldata, zvaldata,addopt=vals)
Parameters: - xdata (numpy.array or list[real]) –
- zdata (numpy.array or list[real) –
- kwargs –
- Additional options may be specified and will be applied
- to the .alm
- example - monomialpower=(1,2,3,4)
- xlabels : labels given to input variables
- zlabels : labels given to outputs
- xval : validaiton data for alamo
- zval : response validation data for alamo
- modeler : modeler value used in alamo
- solvemip : force alamo to solve mip if gams is availible
- linfcns : 0-1 option to include linear transformations
- expfcns : 0-1 option to include exponential transformations
- logfcns : 0-1 option to include logarithmic transformations
- sinfcns : 0-1 option to include sine transformations
- cosfcns : 0-1 option to include cosine transformations
- monomialpower : list of monomial powers
- multi2power : list of binomial powers
- multi3power : list of trinomials
- ratiopower : list of ratio powers
- screener : screening method
- almname : specify a name for the .alm file
- savescratch : saves .alm and .lst
- savetrace : saves trace file
- expandoutput : add a key to the output dictionary for the output
- (must be on for inputs(outputs?#Engle)>1)
- almopt : direct text appending
- the option almopt=<file> will append a file to the end of the .alm and can be used to facilitate direct access to the .alm (no current checks)
- loo : leave one out evaluation
- lmo : leave many out evaluation
Returns: - An ALAMO model with the following keys
- ’model’ : algebraic form of model
- ’f(model)’ : a callable lambda function
- Syntac is depended on expandout
- syntax => almmodel[‘f(model)’][‘out’](inputs,sep,by,comma)
- almmodel[‘f(model)’](inputs,sep,by,comma)
- ’ssr’ : SSE on training set provided
- ’R2’ : R2 on training set provided
- ’ssrval’ : SSE on testing set if provided
- ’R2val’ : R2 on testing set if provided
Return type:
-
idaes.surrogate.alamopy.doalamo.
buildSimWrapper
(data, debug)[source] Builds an executable simulator to sample for data
Parameters: - data – shared alamo data options
- debug – Additional options may be specified and will be applied to the .alm
-
idaes.surrogate.alamopy.doalamo.
checkForSampledData
(data, debug)[source] Check to see if data has been sampled and update ndata
Parameters: - data – shared alamo data options
- debug – Additional options may be specified and will be applied to the .alm
-
idaes.surrogate.alamopy.doalamo.
checkinput
(data, debug, xdata, zdata, vargs, kwargs)[source] Check the input data into doalamo for errors.
Parameters:
-
idaes.surrogate.alamopy.doalamo.
cleanFiles
(data, debug, pywrite=False, **kwargs)[source] Removes intermediate files
Parameters: - data/debug – shared default options for .alm file
- vargs – Validation data
-
idaes.surrogate.alamopy.doalamo.
constructXBounds
(xdata, zdata, data, debug)[source] Construct xmin,xmax and zmin, zmax for alamo if none are given
Parameters:
-
idaes.surrogate.alamopy.doalamo.
doalamo
(xdata, zdata, **kwargs)[source] Warning: doalamo is deprecated. please use alamopy.doalamo.alamo(xdata, zdata, **kwargs)
-
idaes.surrogate.alamopy.doalamo.
expandOutput
(xdata, zdata, vargs, data, debug)[source] Expand output to validation metrics and labels
Parameters:
-
idaes.surrogate.alamopy.doalamo.
getTrainingData
(xdata, zdata, data, debug)[source] Structure data for training the model. Modifies data[‘opts’]
Args: xdata (numpy.array or list[real]) zdata (numpy.array or list[real) data: shared alamo data options debug: Additional options may be specified and will be applied
to the .alm
-
idaes.surrogate.alamopy.doalamo.
getValidationData
(vargs, data, debug)[source] Structure data for validating the model. Modifies data[‘opts’]
Args: vargs: validation data valxdata, valzdata data: shared alamo data options debug: Additional options may be specified and will be applied
to the .alm
-
idaes.surrogate.alamopy.doalamo.
getlabels
(data, debug, kwargs)[source] Creates labels for data and output. Modifies data[‘labs’]. Makes labels if no labels are given.
Parameters: - data – shared alamo data options
- debug – Additional options may be specified and will be applied to the .alm
- vargs – validation data valxdata, valzdata
-
idaes.surrogate.alamopy.doalamo.
makelabs
(data, debug, param)[source] Constructs labels for alamo
- Args:
data: shared alamo data options debug: Additional options may be specified and will be applied
to the .almparam = ‘ninputs’ or ‘noutputs
-
idaes.surrogate.alamopy.doalamo.
manageArguments
(xdata, zdata, data, debug, kwargs)[source] Parse additional input options The ‘pargs’ library is used to keep track of options a user has availible descriptions of the dictionaries data, and debug are given in shared.py Multiple keys used to make writing the .alm file easier
Parameters:
-
idaes.surrogate.alamopy.doalamo.
parseKwargs
(data, debug, kwargs)[source] Parse keyword arguments
Parameters: - data – shared alamo data options
- debug – Additional options may be specified and will be applied to the .alm
- kwargs – keyword arguments
-
idaes.surrogate.alamopy.doalamo.
readTraceFile
(vargs, data, debug)[source] Read the alamo trace file to read in the model and metrics
Parameters: - data/debug – shared default options for .alm file
- vargs – Validation data
-
idaes.surrogate.alamopy.doalamo.
setupData
(data, debug, xdata, zdata, vargs, kwargs)[source] - [xdata, zdata, xvaldata, zvaldata] =
- setupData(data, debug, xdata,zdata, vargs, kwargs)
Checks inputted data and resturctures the data for the .alm file
Parameters:
idaes.surrogate.alamopy.examples module¶
idaes.surrogate.alamopy.mapminmax module¶
idaes.surrogate.alamopy.multos module¶
-
idaes.surrogate.alamopy.multos.
catfile
(outf, *fname)[source] Concatenates files
-
idaes.surrogate.alamopy.multos.
copyfile
(outf, inf)[source] Copies files
-
idaes.surrogate.alamopy.multos.
deletefile
(*fname)[source] Deletes files
-
idaes.surrogate.alamopy.multos.
has_alamo
()[source] Checks for ALAMO
-
idaes.surrogate.alamopy.multos.
movefile
(*fname)[source] Moves files