tdplyr: Model Predictions
Description
Generic predict function for performing predictions using results of model fitting functions, such as
-
td_adaboost_mle()
-
td_arima_mle()
-
td_decision_forest_mle()
-
td_decision_tree_mle()
-
td_decision_tree_valib()
-
td_glm_mle()
-
td_glml1l2_mle()
-
td_knn_recommender_mle()
-
td_lin_reg_mle()
-
td_lin_reg_valib()
-
td_log_reg_valib()
-
td_naivebayes_mle()
-
td_naivebayes_textclassifier_mle()
-
td_pca_valib()
-
td_svm_sparse_mle()
-
td_xgboost_mle()
-
td_svm_dense_mle()
-
td_decision_forest()
-
td_glm()
-
td_glm_per_segment()
-
td_kmeans()
-
td_naivebayes_textclassifier_trainer()
-
td_one_class_svm()
-
td_xgboost()
-
td_svm()
This function invokes respective predict methods, based on the class of the the model (first argument).
Usage
predict(object, ...)
Arguments
object |
Required Argument.
It is usually created using the following methods:
|
... |
Additional arguments useful for predictions. |
Value
Return value from predict depends on the class of the object.
Examples
# Please visit individual predict in-line documentation for more examples.
# help(predict.td_adaboost_mle)
# help(predict.td_glm_mle)
# help(predict.td_glml1l2_mle)
# help(predict.td_decision_forest_mle)
# help(predict.td_decision_tree_mle)
# help(predict.td_decision_tree_valib)
# help(predict.td_lin_reg_valib)
# help(predict.td_log_reg_valib)
# help(predict.td_naivebayes_mle)
# help(predict.td_naivebayes_textclassifier_mle)
# help(predict.td_pca_valib)
# help(predict.td_svm_sparse_mle)
# help(predict.td_svm_dense_mle)
# help(predict.td_arima_mle)
#### GLM Predict Example ####
# Get the current context/connection.
con <- td_get_context()$connection
# Load example data.
loadExampleData("glm_example", "admissions_train")
loadExampleData("glmpredict_example", "admissions_test")
# Create remote tibble objects.
admissions_test <- tbl(con, "admissions_test")
admissions_train <- tbl(con, "admissions_train")
# Example 1 -
# First train the data, i.e., create a GLM Model
td_glm_out <- td_glm_mle(formula = (admitted ~ stats + masters + gpa + programming),
family = "LOGISTIC",
linkfunction = "LOGIT",
data = admissions_train,
weights = "1",
threshold = 0.01,
maxit = 25,
step = FALSE,
intercept = TRUE
)
# Run predict on the output of GLM.
glm_predict_out <- predict(td_glm_out,
newdata = admissions_test,
terms = c("id","masters","gpa","stats","programming","admitted"),
family = "LOGISTIC",
linkfunction = "LOGIT"
)