local-transformations-generator's People
local-transformations-generator's Issues
Figure out the NOT operator
TODO
Features
- Mutation inside if blocks
- z-scoring inside functions
- If a source function call throws an error that it can't find the file, we should throw the error to the user
Refactors
- Remove duplicate code for generating PMML for is expressions inside the define-function and derived-field functions
- Remove duplicate code for generating inner function names within the define-function module
Figure out a way to include user custom functions
Parsing inner functions
An inner function is a function declared inside of another one, for example,
function_one <- function() {
function_two <- function() {
}
}
In the above R code, function_two
is an inner function.
Things to consider when parsing an inner function:
- The name of the inner function: The name should make it clear that this is a function inside of another function and should have the name of the parent function in it. Proposing that we use the dot notation to represent that the inner function is a property of the parent function. For example, in the above example the name of the inner function would be
function_one.function_two
. - Handling closure variables: The inner function is able to use variables that are in the parent function's environment. For example,
In the above example,
function_one <- function(a) { function_two <- function(b) { return(a + b) } }
function_two
is able to use the variablea
even though its not declared anywhere in its scope. In PMML however each function has only one scope, its own. To accommodate this R feature when the inner function is parsed into PMML:- Any accessed variables that are not in its scope will need to be added as extra parameters to the inner function's signature
- The names of these new parameters should use the same dot notation as in the inner function's name.
- Keeping the above points into account, the PMML for
function_two
would look like,
<Apply function="function_one.function_two"> <ParameterField name="b" dataType="double" /> <ParameterField name="function_one.a" dataType="double" /> <Apply function="+"> <FieldRef field="function_one.a"/>> <FieldRef field="b"/> </Apply> </Apply>
- Closure variables as well as variables within the inner function can be mutated which should be taken into account
- Before parsing the function body we need to apply the mutation algorithm which changes all the mutated variables names in the tokens
- The inner function can mutate the closured variables using
<<-
- The inner function can have parameters with the same name as the parent function
- When the parent function calls the inner function
- Keep in mind that inner functions can have functions themselves and so on, need to make sure all the above points apply to them as well.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.