useDynLib(MachineShop, .registration = TRUE, .fixes = "C_")

import(methods)

importClassesFrom(kernlab, ksvm)
importClassesFrom(party, RandomForest)

importFrom(abind, abind, adrop)
importFrom(cli, ansi_nchar, ansi_strtrim, ansi_strwrap, make_ansi_style,
           console_width, pluralize, qty, style_bold, style_reset)
importFrom(dials, parameters)
importFrom(foreach, "%dopar%", foreach, getDoParName, getDoParRegistered,
           getDoParWorkers, registerDoSEQ)
importFrom(ggplot2, aes, after_stat, coord_fixed, coord_flip, facet_wrap,
           geom_abline, geom_bar, geom_boxplot, geom_crossbar, geom_density,
           geom_errorbar, geom_line, geom_path, geom_point, geom_raster,
           geom_ribbon, geom_segment, geom_violin, ggplot, labs, mean_se,
           position_dodge, scale_fill_gradient, stat_summary)
importFrom(graphics, plot)
importFrom(magrittr, "%>%")
importFrom(polspline, hare, phare)
importFrom(progress, progress_bar)
importFrom(recipes, bake, prep, recipe, tidy, tunable)
importFrom(rsample, bootstraps, group_bootstraps, group_initial_split,
           group_vfold_cv, initial_split, vfold_cv)
importFrom(stats, aggregate, approx, coef, complete.cases, contr.helmert, cor,
           cov.wt, delete.response, drop1, formula, get_all_vars, loess, lm,
           median, model.frame, model.matrix, model.matrix.default,
           model.response, model.weights, na.fail, na.omit, na.pass, offset,
           p.adjust, pchisq, pnorm, predict, pt, quantile, reformulate,
           reshape, runif, sd, t.test, terms, time, update, var, vcov, xtabs)
importFrom(survival, concordance, is.Surv, Surv, survfit, survreg,
           survreg.distributions)
importFrom(tibble, as_tibble, as_tibble_col, is_tibble, tibble)
importFrom(utils, capture.output, combn, head, methods, packageVersion, relist,
           stack, str, tail)


export(BinomialVariate,
       DiscreteVariate,
       NegBinomialVariate,
       PoissonVariate,
       role_binom,
       role_case,
       role_pred,
       role_surv,
       SurvEvents,
       SurvProbs)

export(expand_model,
       expand_modelgrid,
       expand_params,
       expand_steps,
       ParameterGrid,
       TuningGrid)

export(MLModel,
       MLModelFunction,
       AdaBagModel,
       AdaBoostModel,
       BARTModel,
       BARTMachineModel,
       BlackBoostModel,
       C50Model,
       CForestModel,
       CoxModel,
       CoxStepAICModel,
       EarthModel,
       FDAModel,
       GAMBoostModel,
       GBMModel,
       GLMBoostModel,
       GLMModel,
       GLMStepAICModel,
       GLMNetModel,
       KNNModel,
       LARSModel,
       LDAModel,
       LMModel,
       MDAModel,
       NaiveBayesModel,
       NNetModel,
       ParsnipModel,
       PDAModel,
       PLSModel,
       POLRModel,
       QDAModel,
       RandomForestModel,
       RangerModel,
       RFSRCModel,
       RFSRCFastModel,
       RPartModel,
       SelectedModel,
       StackedModel,
       SuperModel,
       SurvRegModel,
       SurvRegStepAICModel,
       SVMModel,
       SVMANOVAModel,
       SVMBesselModel,
       SVMLaplaceModel,
       SVMLinearModel,
       SVMPolyModel,
       SVMRadialModel,
       SVMSplineModel,
       SVMTanhModel,
       TreeModel,
       TunedModel,
       XGBModel,
       XGBDARTModel,
       XGBLinearModel,
       XGBTreeModel)

export(ModelFrame,
       ModelSpecification,
       SelectedInput,
       TunedInput)

export(BootControl,
       BootOptimismControl,
       CVControl,
       CVOptimismControl,
       OOBControl,
       SplitControl,
       TrainControl,
       set_monitor,
       set_optim_bayes,
       set_optim_bfgs,
       set_optim_grid,
       set_optim_method,
       set_optim_pso,
       set_optim_sann,
       set_predict,
       set_strata)

export(MLMetric,
       "MLMetric<-",
       accuracy,
       auc,
       brier,
       cindex,
       cross_entropy,
       f_score,
       fnr,
       fpr,
       gini,
       kappa2,
       mae,
       mse,
       msle,
       npv,
       ppr,
       ppv,
       pr_auc,
       precision,
       r2,
       recall,
       rmse,
       rmsle,
       roc_auc,
       roc_index,
       sensitivity,
       specificity,
       tnr,
       tpr,
       weighted_kappa2)

export(.,
       "%>%",
       as.MLInput,
       as.MLModel,
       calibration,
       case_weights,
       confusion,
       ConfusionMatrix,
       dependence,
       fit,
       lift,
       metricinfo,
       modelinfo,
       performance,
       performance_curve,
       resample,
       response,
       rfe,
       settings,
       step_kmeans,
       step_kmedoids,
       step_lincomp,
       step_sbf,
       step_spca,
       tunable.step_kmeans,
       tunable.step_kmedoids,
       tunable.step_lincomp,
       tunable.step_spca,
       unMLModelFit,
       varimp)

exportMethods(predict)

S3method(as.data.frame, BinomialVariate)
S3method(as.data.frame, ModelFrame)
S3method(as.data.frame, PerformanceDiffTest)
S3method(as.data.frame, Resample)
S3method(as.data.frame, SurvMatrix)
S3method(as.data.frame, TabularArray)
S3method(as.double, BinomialVariate)
S3method(as.MLControl, character)
S3method(as.MLControl, default)
S3method(as.MLControl, "function")
S3method(as.MLControl, MLControl)
S3method(as.MLControl, "NULL")
S3method(as.MLMetric, character)
S3method(as.MLMetric, default)
S3method(as.MLMetric, MLMetric)
S3method(as.MLInput, default)
S3method(as.MLInput, formula)
S3method(as.MLInput, matrix)
S3method(as.MLInput, MLInput)
S3method(as.MLInput, MLModelFit)
S3method(as.MLInput, ModelSpecification)
S3method(as.MLInput, recipe)
S3method(as.MLModel, character)
S3method(as.MLModel, default)
S3method(as.MLModel, MLModel)
S3method(as.MLModel, MLModelFit)
S3method(as.MLModel, MLModelFunction)
S3method(as.MLModel, model_spec)
S3method(as.MLModel, ModelSpecification)
S3method(as.MLModel, "NULL")
S3method(as_string, default)
S3method(as_string, character)
S3method(bake, step_lincomp)
S3method(bake, step_sbf)
S3method(bake, ModelRecipe)
S3method(bake, SelectedInput)
S3method(bake, TunedInput)
S3method(c, BinomialVariate)
S3method(c, Calibration)
S3method(c, ConfusionList)
S3method(c, ConfusionMatrix)
S3method(c, DiscreteVariate)
S3method(c, LiftCurve)
S3method(c, ListOf)
S3method(c, PerformanceCurve)
S3method(c, Resample)
S3method(c, SurvMatrix)
S3method(diff, MLModel)
S3method(diff, Performance)
S3method(diff, Resample)
S3method(expand_modelgrid, formula)
S3method(expand_modelgrid, matrix)
S3method(expand_modelgrid, MLModel)
S3method(expand_modelgrid, MLModelFunction)
S3method(expand_modelgrid, ModelFrame)
S3method(expand_modelgrid, ModelSpecification)
S3method(expand_modelgrid, recipe)
S3method(fit, formula)
S3method(fit, matrix)
S3method(fit, MLModel)
S3method(fit, MLModelFunction)
S3method(fit, ModelFrame)
S3method(fit, ModelSpecification)
S3method(fit, recipe)
S3method(format, SurvMatrix)
S3method(formula, ModelFrame)
S3method(map, character)
S3method(map, "function")
S3method(model.matrix, ModelDesignTerms)
S3method(model.matrix, ModelFormulaTerms)
S3method(model.matrix, ModelFrame)
S3method(ModelFrame, data.frame)
S3method(ModelFrame, formula)
S3method(ModelFrame, matrix)
S3method(ModelFrame, ModelFrame)
S3method(ModelFrame, ModelTerms)
S3method(ModelFrame, recipe)
S3method(ModelSpecification, default)
S3method(ModelSpecification, formula)
S3method(ModelSpecification, matrix)
S3method(ModelSpecification, ModelFrame)
S3method(ModelSpecification, recipe)
S3method(ParameterGrid, list)
S3method(ParameterGrid, param)
S3method(ParameterGrid, parameters)
S3method(performance, BinomialVariate)
S3method(performance, BootOptimismControl)
S3method(performance, ConfusionList)
S3method(performance, ConfusionMatrix)
S3method(performance, CVOptimismControl)
S3method(performance, factor)
S3method(performance, matrix)
S3method(performance, MLControl)
S3method(performance, MLModel)
S3method(performance, numeric)
S3method(performance, Resample)
S3method(performance, Surv)
S3method(performance, TrainingStep)
S3method(performance_curve, default)
S3method(performance_curve, Resample)
S3method(plot, Calibration)
S3method(plot, ConfusionList)
S3method(plot, ConfusionMatrix)
S3method(plot, LiftCurve)
S3method(plot, MLModel)
S3method(plot, PartialDependence)
S3method(plot, Performance)
S3method(plot, PerformanceCurve)
S3method(plot, Resample)
S3method(plot, TrainingStep)
S3method(plot, VariableImportance)
S3method(predict, MLModelFit)
S3method(prep, ModelRecipe)
S3method(prep, SelectedInput)
S3method(prep, step_lincomp)
S3method(prep, step_sbf)
S3method(prep, TunedInput)
S3method(print, BinomialVariate)
S3method(print, BootControl)
S3method(print, Calibration)
S3method(print, ConfusionList)
S3method(print, ConfusionMatrix)
S3method(print, ConfusionSummary)
S3method(print, CVControl)
S3method(print, DiscreteVariate)
S3method(print, EnsembleModel)
S3method(print, ListOf)
S3method(print, MLControl)
S3method(print, MLMetric)
S3method(print, MLModel)
S3method(print, MLModelFit)
S3method(print, MLModelFunction)
S3method(print, MLOptimization)
S3method(print, ModelFrame)
S3method(print, ModelRecipe)
S3method(print, ModelSpecification)
S3method(print, ModelTerms)
S3method(print, NullControl)
S3method(print, OOBControl)
S3method(print, ParameterGrid)
S3method(print, ParsnipModel)
S3method(print, Performance)
S3method(print, PerformanceCurve)
S3method(print, PerformanceDiffTest)
S3method(print, RandomGridSearch)
S3method(print, RecipeGrid)
S3method(print, Resample)
S3method(print, SelectedInput)
S3method(print, SequentialOptimization)
S3method(print, SplitControl)
S3method(print, step_lincomp)
S3method(print, step_sbf)
S3method(print, SurvMatrix)
S3method(print, SurvTimes)
S3method(print, TrainingParams)
S3method(print, TrainingStep)
S3method(print, TunedInput)
S3method(print, TunedModel)
S3method(print, TuningGrid)
S3method(print, VariableImportance)
S3method(resample, formula)
S3method(resample, matrix)
S3method(resample, MLModel)
S3method(resample, MLModelFunction)
S3method(resample, ModelFrame)
S3method(resample, ModelSpecification)
S3method(resample, recipe)
S3method(response, formula)
S3method(response, MLModelFit)
S3method(response, ModelFrame)
S3method(response, ModelSpecification)
S3method(response, recipe)
S3method(rfe, formula)
S3method(rfe, matrix)
S3method(rfe, MLModel)
S3method(rfe, MLModelFunction)
S3method(rfe, ModelFrame)
S3method(rfe, ModelSpecification)
S3method(rfe, recipe)
S3method(SelectedInput, formula)
S3method(SelectedInput, list)
S3method(SelectedInput, matrix)
S3method(SelectedInput, ModelFrame)
S3method(SelectedInput, ModelSpecification)
S3method(SelectedInput, recipe)
S3method(SelectedModel, default)
S3method(SelectedModel, list)
S3method(SelectedModel, ModelSpecification)
S3method(set_monitor, list)
S3method(set_monitor, MLControl)
S3method(set_monitor, MLOptimization)
S3method(set_monitor, ModelSpecification)
S3method(set_monitor, TrainingParams)
S3method(set_optim_bayes, ModelSpecification)
S3method(set_optim_bfgs, ModelSpecification)
S3method(set_optim_grid, TrainingParams)
S3method(set_optim_grid, ModelSpecification)
S3method(set_optim_grid, TunedInput)
S3method(set_optim_grid, TunedModel)
S3method(set_optim_method, ModelSpecification)
S3method(set_optim_pso, ModelSpecification)
S3method(set_optim_sann, ModelSpecification)
S3method(summary, ConfusionList)
S3method(summary, ConfusionMatrix)
S3method(summary, MLModel)
S3method(summary, MLModelFit)
S3method(summary, Performance)
S3method(summary, PerformanceCurve)
S3method(summary, Resample)
S3method(summary, SurvRegModelFit)
S3method(summary, TrainingStep)
S3method(t.test, PerformanceDiff)
S3method(terms, ModelFrame)
S3method(tidy, step_kmeans)
S3method(tidy, step_lincomp)
S3method(tidy, step_sbf)
S3method(tunable, step_kmeans)
S3method(tunable, step_kmedoids)
S3method(tunable, step_lincomp)
S3method(tunable, step_spca)
S3method(TunedInput, recipe)
S3method(update, MLModelFit)
S3method(update, ModelFrame)
S3method(update, ModelRecipe)
S3method(update, ModelSpecification)
S3method(update, TunedModelRecipe)
S3method(update, SelectedInput)
S3method("[", BinomialVariate)
