alteryx / alteryxpredictive Goto Github PK
View Code? Open in Web Editor NEWThis is an R package containing utility functions used by the predictive tools in Alteryx.
License: GNU General Public License v3.0
This is an R package containing utility functions used by the predictive tools in Alteryx.
License: GNU General Public License v3.0
Naive Bayes
the.model$x <- the.data[the.preds]
the.model$y <- the.data[the.target]
the.model$xlevels <- xlevels
the.model$xvars <- the.preds
the.model$yvars <- the.target
It should be possible to automate creation of XDF test cases from a test case (list of inputs
and config
) created for open source R. The basic logic will be to:
inputs$XDFInfo
to list(is_XDF = TRUE, xdf_path = "Extras/Data/admissions.xdf")
inputs
and config
as a test.Here is some code abstracted from getXVars
, that is repeated in multiple places. It depends heavily on the fact that the final call has the full formula object as opposed to an intermediate variable.
xvars_from_call <- function(x){
the.call <- x$call
the.formula <- as.character(the.call)[2]
form.split <- unlist(strsplit(the.formula, " ~ "))
unlist(strsplit(form.split[2], " \\+ "))
}
To better see this, consider the following two calls
Call 1
x1 <- lm(mpg ~ wt + vs, data = mtcars)
xvars_from_call(x1)
# [1] "wt" "vs"
Call 2
f <- mpg ~ wt + vs
x2 <- lm(f, data = mtcars)
xvars_from_call(x2)
# [1] NA
A more robust function that will handle both cases correctly is
xvars_from_call2 <- function(x){
strsplit(as.character(formula(x))[3], "\\s*\\+\\s*")[[1]]
}
xvars_from_call2(x1) # [1] "wt" "vs"
xvars_from_call2(x2) # [1] "wt" "vs"
Here are some proposed steps to make this change systematically throughout the code base:
Finally, all tools refactored need to ensure that they work with the scoring tools. We can take advantage of the fact that the CrossValidation
tool makes heavy use of scoreModel
and so can write tests using those.
Users should have easy access (from the macro level) to the location of internal AlteryxPredictive code
Some workarounds are present in the code that should be refactored:
createTreePlotDT.C5.0
assigns the.data to the global namespace to allow plotting functions accessI'd like to use these functions in Cross-Validation. However, in order to use them within R, I currently need to copy and paste them.
Currently, this is the NOTE returned by R CMD Check
. Namespacing these functions with the appropriate package name and adding it to Suggests
will resolve the issue.
checking R code for possible problems ... NOTE
mrsDataObj: no visible global function definition for ‘RxTeradata’
mrsDataObj: no visible global function definition for ‘RxSqlServerData’
mrsLevels: no visible global function definition for ‘RxInTeradata’
mrsLevels: no visible global function definition for ‘RxInSqlServer’
mrsLevels: no visible global function definition for
‘rxSetComputeContext’
mrsLevels: no visible global function definition for ‘rxGetVarInfo’
@dputler can you let me know what package these functions come from? ScaleR
maybe?
"replacing previous import by ‘magrittr::%>%’ when loading ‘AlteryxPredictive’"
got this error and can't use serialize func. after that
This function fetches list of packages to load while dealing with a list of models specified.
#' Load packages based on a set of model classes.
#'
#' @param models list of model objects
#' @export
getPkgListForModels <- function(models){
modelClasses <- unlist(lapply(models, class))
pkgMap <- list(gbm = "gbm", rpart = "rpart", svm.formula = "e1071",
svm = "e1071", naiveBayes = "e1071", svyglm = "survey",
nnet.formula = "nnet", randomForest.formula = "randomForest", earth = "earth"
)
unique(unlist(pkgMap[modelClasses]))
}
Most functions have detailed comments and/or Rd files for documentation. Moving over to roxygen
will make it more easily maintainable for us in the long run. I am creating a checklist here so that we can keep track of the task's progress:
Thanks @tmmorley
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.