Description
Generic predict function for performing predictions using results of model fitting functions, such as td_glm_mle(), td_glml1l2_mle(), td_decision_forest_mle(), td_decision_tree_mle(), td_naivebayes_mle(), td_naivebayes_textclassifier_mle(), td_svm_sparse_mle(), td_arima_mle(), td_xgboost_mle(), td_knn_recommender_mle(), td_lin_reg_mle(). 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 indivdual predict in line documentation for more examples. # 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_naivebayes_mle) # help(predict.td_naivebayes_textclassifier_mle) # 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" )