Deprecated: Return type of ResultWrapper::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/db/DatabaseUtility.php on line 174

Deprecated: Return type of ResultWrapper::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/db/DatabaseUtility.php on line 192

Deprecated: Return type of ResultWrapper::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/db/DatabaseUtility.php on line 185

Deprecated: Return type of ResultWrapper::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/db/DatabaseUtility.php on line 202

Deprecated: Return type of ResultWrapper::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/db/DatabaseUtility.php on line 163

Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/vhosts/rave.gatech.edu/httpdocs/help/languages/Language.php on line 2104

Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/vhosts/rave.gatech.edu/httpdocs/help/languages/Language.php on line 2104

Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/vhosts/rave.gatech.edu/httpdocs/help/languages/Language.php on line 2104

Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/vhosts/rave.gatech.edu/httpdocs/help/languages/Language.php on line 2104

Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/vhosts/rave.gatech.edu/httpdocs/help/languages/Language.php on line 2104

Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/vhosts/rave.gatech.edu/httpdocs/help/languages/Language.php on line 2104

Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/vhosts/rave.gatech.edu/httpdocs/help/languages/Language.php on line 2104

Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/vhosts/rave.gatech.edu/httpdocs/help/languages/Language.php on line 2104

Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/vhosts/rave.gatech.edu/httpdocs/help/languages/Language.php on line 2104

Warning: Trying to access array offset on value of type null in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/profiler/SectionProfiler.php on line 104

Warning: Trying to access array offset on value of type null in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/profiler/SectionProfiler.php on line 104

Warning: Trying to access array offset on value of type null in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/profiler/SectionProfiler.php on line 105

Warning: Trying to access array offset on value of type null in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/profiler/SectionProfiler.php on line 105

Warning: Trying to access array offset on value of type null in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/profiler/SectionProfiler.php on line 106

Warning: Trying to access array offset on value of type null in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/profiler/SectionProfiler.php on line 106

Deprecated: header(): Passing null to parameter #3 ($response_code) of type int is deprecated in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/WebResponse.php on line 37

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/profiler/SectionProfiler.php:105) in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/WebResponse.php on line 37

Deprecated: header(): Passing null to parameter #3 ($response_code) of type int is deprecated in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/WebResponse.php on line 37

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/profiler/SectionProfiler.php:105) in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/WebResponse.php on line 37

Deprecated: header(): Passing null to parameter #3 ($response_code) of type int is deprecated in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/WebResponse.php on line 37

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/profiler/SectionProfiler.php:105) in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/WebResponse.php on line 37

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/skins/SkinTemplate.php on line 313
Difference between revisions of "Working with functions" - Rave Documentation

Difference between revisions of "Working with functions"

From Rave Documentation
Jump to: navigation, search
(Modeled Variables)
Line 1: Line 1:
 
==Introduction==
 
==Introduction==
 +
One of the great things about Rave is that it can work not only with static data sets, but with functions of variables that appear in data sets. For example, if you load a data set that contains a variable called "Weight (lbs)", you can easily create a new variable called "Weight (kg)" whose values are equal to Weight (lbs) / 2.2046. If later the values for the variable Weight (lbs) change, the values for Weight (kg) will automatically update to reflect that change, because the two are functionally related.
 +
 +
The above example is an extremely simple function. In general there is no limit to how complicated your function can be, although if the function takes a long time to run it may be impractical for some applications. Functions can have multiple variables as inputs, and may have other functional variables as inputs as well (for example, y = f(x), z = g(y)).
 +
 +
An important limitation, however, is that the relations between your variables must form a "directed acyclic graph". Put simply, this means that each functional variable must be able to be represented as a function of only independent variables in the data set (although as described above, your actual implementation may involve other functional variables). Functions that form a "circular logic" loop are not allowed (for example y=f(z), z=g(y) ).
 +
 +
==Functions vs. Functional Variables==
 +
A '''functional variable''' is a variable in Rave whose value is calculated by a function. A "function" in this context is a MATLAB .m function file, in particular it is a MATLAB file that calculates the functional variable as one of its outputs. You create functional variables in Rave by loading functions into Rave or by creating functions using Rave. Note that if you create the function using Rave, the actual MATLAB function file will get created "behind the scenes" and you will typically never directly view or edit the function file.
 +
 +
 +
 +
 +
 +
  
 
When you import a function, a new variable is created for each of the function's outputs, and each output becomes a new column in your data set. You can use these new variables just like you use any other variable in your data set. However, variables that were calculated by functions also have some special properties that let you customize how Rave handles them.  
 
When you import a function, a new variable is created for each of the function's outputs, and each output becomes a new column in your data set. You can use these new variables just like you use any other variable in your data set. However, variables that were calculated by functions also have some special properties that let you customize how Rave handles them.  

Revision as of 12:42, 22 August 2013

Introduction

One of the great things about Rave is that it can work not only with static data sets, but with functions of variables that appear in data sets. For example, if you load a data set that contains a variable called "Weight (lbs)", you can easily create a new variable called "Weight (kg)" whose values are equal to Weight (lbs) / 2.2046. If later the values for the variable Weight (lbs) change, the values for Weight (kg) will automatically update to reflect that change, because the two are functionally related.

The above example is an extremely simple function. In general there is no limit to how complicated your function can be, although if the function takes a long time to run it may be impractical for some applications. Functions can have multiple variables as inputs, and may have other functional variables as inputs as well (for example, y = f(x), z = g(y)).

An important limitation, however, is that the relations between your variables must form a "directed acyclic graph". Put simply, this means that each functional variable must be able to be represented as a function of only independent variables in the data set (although as described above, your actual implementation may involve other functional variables). Functions that form a "circular logic" loop are not allowed (for example y=f(z), z=g(y) ).

Functions vs. Functional Variables

A functional variable is a variable in Rave whose value is calculated by a function. A "function" in this context is a MATLAB .m function file, in particular it is a MATLAB file that calculates the functional variable as one of its outputs. You create functional variables in Rave by loading functions into Rave or by creating functions using Rave. Note that if you create the function using Rave, the actual MATLAB function file will get created "behind the scenes" and you will typically never directly view or edit the function file.




When you import a function, a new variable is created for each of the function's outputs, and each output becomes a new column in your data set. You can use these new variables just like you use any other variable in your data set. However, variables that were calculated by functions also have some special properties that let you customize how Rave handles them.


Modeled Variables

When you import a function, you are given the option to define its output variable to be a new model of an existing variable in your data set. Regardless of what you choose, the output of the function will be added to your data set as a new variable. If you select a variable from the list, Rave will note that the selected variable and the new variable that you are creating are linked in the sense that they both represent the same physical quantity, though they may have different numerical values since they come from different sources.

Currently this linking does not affect Rave in any way.

In the future, you will be able to perform some special tasks with variables that are linked in this way.

Note: Whenever you create a surrogate model, it is automatically linked as a model of the variable it is based on.

Objective Functions

Objective functions can be created by clicking the "Create New Objective Fcn" button on the Model Tab. Objective functions are similar to general user-supplied functions, with the following exceptions:

  • Objective functions get recalculated whenever the user changes the Data Set, the Preferences or the Targets. General user-supplied functions only get recalculated when the user changes the Data Set. Consequently, any function that uses Preferences or Targets should be set as an Objective function.

Objective functions can be created by using the "Create New Objective Fcn" gui, which comes with built-in templates that help you automatically generate code for these functions.

Function files created by Rave

Whenever you load a function into Rave that is not a .m MATLAB file, Rave creates a .m "wrapper" function that it calls in place of the function you specified. This function in turn calls the original file you specified in a way that is compatible with Rave.

  • When you load a .txt function, the .m file that is created contains all the information that was in your .txt file. Rave does not use the .txt file, only the .m file. You can delete or move the original .txt file and it won't break Rave.
  • When you load any type of function other than a .txt file or a .m file, Rave creates a new .m file to run the function, but it also uses the original file you specified and any other files that depend on this file. Make sure to keep all such dependent files in a place where Rave can find them.

See also: MATLAB search path


Deprecated: header(): Passing null to parameter #3 ($response_code) of type int is deprecated in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/WebResponse.php on line 37

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/profiler/SectionProfiler.php:105) in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/WebResponse.php on line 37

Deprecated: header(): Passing null to parameter #3 ($response_code) of type int is deprecated in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/WebResponse.php on line 37

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/profiler/SectionProfiler.php:105) in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/WebResponse.php on line 37

Deprecated: header(): Passing null to parameter #3 ($response_code) of type int is deprecated in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/WebResponse.php on line 37

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/profiler/SectionProfiler.php:105) in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/WebResponse.php on line 37

Deprecated: header(): Passing null to parameter #3 ($response_code) of type int is deprecated in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/WebResponse.php on line 37

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/profiler/SectionProfiler.php:105) in /var/www/vhosts/rave.gatech.edu/httpdocs/help/includes/WebResponse.php on line 37