├── .Rbuildignore ├── .github ├── .gitignore ├── CODEOWNERS ├── ISSUE_TEMPLATE.md └── workflows │ ├── R-CMD-check.yaml │ ├── pr-commands.yaml │ └── test-coverage.yaml ├── .gitignore ├── README.md ├── RegressionTests ├── Code │ ├── ANFIS.R │ ├── AdaBag.R │ ├── AdaBoost.M1.R │ ├── Boruta.R │ ├── C5.0.R │ ├── C5.0Cost.R │ ├── C5.0Rules.R │ ├── C5.0Tree.R │ ├── CSimca.R │ ├── DENFIS.R │ ├── FH.GBML.R │ ├── FIR.DM.R │ ├── FRBCS.CHI.R │ ├── FRBCS.W.R │ ├── FS.HGD.R │ ├── GFS.FR.MOGUL.R │ ├── GFS.GCCL.R │ ├── GFS.LT.RS.R │ ├── GFS.Thrift.R │ ├── HYFIS.R │ ├── J48.R │ ├── JRip.R │ ├── LMT.R │ ├── Linda.R │ ├── LogitBoost.R │ ├── M5.R │ ├── M5Rules.R │ ├── Mlda.R │ ├── ORFlog.R │ ├── ORFpls.R │ ├── ORFridge.R │ ├── ORFsvm.R │ ├── OneR.R │ ├── PART.R │ ├── PRIM.R │ ├── PenalizedLDA.R │ ├── QdaCov.R │ ├── RFlda.R │ ├── RRFglobal.R │ ├── RSimca.R │ ├── Rborist.R │ ├── SBC.R │ ├── SLAVE.R │ ├── WM.R │ ├── ada.R │ ├── adaboost.R │ ├── amdai.R │ ├── avMxnet.R │ ├── avNNet.R │ ├── awnb.R │ ├── awtan.R │ ├── bag.R │ ├── bagEarth.R │ ├── bagEarthGCV.R │ ├── bagFDA.R │ ├── bagFDAGCV.R │ ├── bam.R │ ├── bartMachine.R │ ├── bayesglm.R │ ├── bdk.R │ ├── binda.R │ ├── blackboost.R │ ├── blasso.R │ ├── blassoAveraged.R │ ├── bridge.R │ ├── brnn.R │ ├── bstSm.R │ ├── bstTree.R │ ├── cforest.R │ ├── ctree.R │ ├── ctree2.R │ ├── cubist.R │ ├── dda.R │ ├── deepboost.R │ ├── dnn.R │ ├── dwdLinear.R │ ├── dwdPoly.R │ ├── dwdRadial.R │ ├── earth.R │ ├── elm.R │ ├── enet.R │ ├── enpls.R │ ├── enpls.fs.R │ ├── evtree.R │ ├── extraTrees.R │ ├── fda.R │ ├── foba.R │ ├── ga.R │ ├── gam.R │ ├── gamSpline.R │ ├── gamboost.R │ ├── gbm.R │ ├── gbm_h2o.R │ ├── gcvEarth.R │ ├── glm.R │ ├── glm.nb.R │ ├── glmStepAIC.R │ ├── glmboost.R │ ├── glmnet.R │ ├── glmnet_h2o.R │ ├── gpls.R │ ├── hda.R │ ├── hdda.R │ ├── hdrda.R │ ├── icr.R │ ├── kernelpls.R │ ├── kknn.R │ ├── knn.R │ ├── knnImpute.R │ ├── krlsPoly.R │ ├── krlsRadial.R │ ├── lars.R │ ├── lars2.R │ ├── lasso.R │ ├── lda.R │ ├── lda2.R │ ├── leapBackward.R │ ├── leapForward.R │ ├── leapSeq.R │ ├── lm.R │ ├── lmStepAIC.R │ ├── loclda.R │ ├── logicBag.R │ ├── logreg.R │ ├── lssvmRadial.R │ ├── lvq.R │ ├── manb.R │ ├── mda.R │ ├── mlp.R │ ├── mlpKerasDecay.R │ ├── mlpKerasDecayCost.R │ ├── mlpKerasDropout.R │ ├── mlpKerasDropoutCost.R │ ├── mlpML.R │ ├── mlpSGD.R │ ├── mlpWeightDecay.R │ ├── mlpWeightDecayML.R │ ├── monmlp.R │ ├── msaenet.R │ ├── multinom.R │ ├── mxnet.R │ ├── mxnetAdam.R │ ├── naive_bayes.R │ ├── nb.R │ ├── nbDiscrete.R │ ├── nbSearch.R │ ├── neuralnet.R │ ├── nnet.R │ ├── nnls.R │ ├── nodeHarvest.R │ ├── null.R │ ├── oblique.tree.R │ ├── ordinalNet.R │ ├── ordinalRF.R │ ├── ownn.R │ ├── pam.R │ ├── partDSA.R │ ├── pcaNNet.R │ ├── pcr.R │ ├── pda.R │ ├── pda2.R │ ├── penalized.R │ ├── plr.R │ ├── pls.R │ ├── plsRglm.R │ ├── polr.R │ ├── ppr.R │ ├── pre.R │ ├── preprocess_back.R │ ├── protoclass.R │ ├── pythonKnnReg.R │ ├── qda.R │ ├── qrf.R │ ├── qrnn.R │ ├── rFerns.R │ ├── randomGLM.R │ ├── ranger.R │ ├── rbf.R │ ├── rbfDDA.R │ ├── rda.R │ ├── regLogistic.R │ ├── relaxo.R │ ├── rf.R │ ├── rfRules.R │ ├── rfe_gam.R │ ├── rfe_issue485.R │ ├── rfe_lda.R │ ├── rfe_lm.R │ ├── rfe_lr.R │ ├── rfe_nb.R │ ├── rfe_rf.R │ ├── rfe_train.R │ ├── rfe_treebag.R │ ├── ridge.R │ ├── rknn.R │ ├── rknnBel.R │ ├── rlda.R │ ├── rlm.R │ ├── rmda.R │ ├── rocc.R │ ├── rotationForest.R │ ├── rotationForestCp.R │ ├── rpart.R │ ├── rpart1SE.R │ ├── rpart2.R │ ├── rpartCost.R │ ├── rpartScore.R │ ├── rqlasso.R │ ├── rqnc.R │ ├── rrlda.R │ ├── rvmLinear.R │ ├── rvmPoly.R │ ├── rvmRadial.R │ ├── sa.R │ ├── sbf_lda.R │ ├── sbf_lm.R │ ├── sbf_nb.R │ ├── sbf_rf.R │ ├── sbf_train.R │ ├── sbf_treebag.R │ ├── sda.R │ ├── sddaLDA.R │ ├── sddaQDA.R │ ├── sdwd.R │ ├── simpls.R │ ├── slda.R │ ├── smda.R │ ├── snn.R │ ├── sparseLDA.R │ ├── spikeslab.R │ ├── spls.R │ ├── stepLDA.R │ ├── stepQDA.R │ ├── subsampling.R │ ├── superpc.R │ ├── svmBoundrangeString.R │ ├── svmExpoString.R │ ├── svmLinear.R │ ├── svmLinear2.R │ ├── svmLinear3.R │ ├── svmLinearWeights.R │ ├── svmLinearWeights2.R │ ├── svmPoly.R │ ├── svmRadial.R │ ├── svmRadialCost.R │ ├── svmRadialSigma.R │ ├── svmRadialWeights.R │ ├── svmSpectrumString.R │ ├── tan.R │ ├── tanSearch.R │ ├── treebag.R │ ├── trimming.R │ ├── vglmAdjCat.R │ ├── vglmContRatio.R │ ├── vglmCumulative.R │ ├── widekernelpls.R │ ├── wsrf.R │ ├── xgbDART.R │ ├── xgbLinear.R │ ├── xgbTree.R │ └── xyf.R ├── compare.R ├── expected_preprocess.R ├── make_markdown_files.R ├── markdown_functions.R ├── move_files.R ├── preProcess.R └── test_results │ ├── ANFIS.md │ ├── AdaBag.md │ ├── AdaBoost.M1.md │ ├── C5.0.md │ ├── C5.0Cost.md │ ├── C5.0Rules.md │ ├── C5.0Tree.md │ ├── CSimca.md │ ├── DENFIS.md │ ├── FH.GBML.md │ ├── FIR.DM.md │ ├── FRBCS.CHI.md │ ├── FRBCS.W.md │ ├── FS.HGD.md │ ├── GFS.FR.MOGUL.md │ ├── GFS.LT.RS.md │ ├── GFS.THRIFT.md │ ├── HYFIS.md │ ├── J48.md │ ├── JRip.md │ ├── LMT.md │ ├── Linda.md │ ├── LogitBoost.md │ ├── M5.md │ ├── M5Rules.md │ ├── ORFlog.md │ ├── ORFpls.md │ ├── ORFridge.md │ ├── ORFsvm.md │ ├── OneR.md │ ├── PART.md │ ├── PenalizedLDA.md │ ├── QdaCov.md │ ├── RRFglobal.md │ ├── RSimca.md │ ├── Rborist.md │ ├── WM.md │ ├── ada.md │ ├── adaboost.md │ ├── amdai.md │ ├── avNNet.md │ ├── awnb.md │ ├── awtan.md │ ├── bag.md │ ├── bagEarthGCV.md │ ├── bagFDA.md │ ├── bagFDAGCV.md │ ├── bam.md │ ├── bartMachine.md │ ├── bayesglm.md │ ├── binda.md │ ├── blackboost.md │ ├── blasso.md │ ├── blassoAveraged.md │ ├── bridge.md │ ├── brnn.md │ ├── bstSm.md │ ├── bstTree.md │ ├── cforest.md │ ├── ctree.md │ ├── ctree2.md │ ├── cubist.md │ ├── dda.md │ ├── deepboost.md │ ├── dnn.md │ ├── dwdLinear.md │ ├── dwdPoly.md │ ├── dwdRadial.md │ ├── earth.md │ ├── elm.md │ ├── enet.md │ ├── evtree.md │ ├── extraTrees.md │ ├── fda.md │ ├── foba.md │ ├── gam.md │ ├── gamSpline.md │ ├── gamboost.md │ ├── gbm.md │ ├── gbm_h2o.md │ ├── gcvEarth.md │ ├── glm.md │ ├── glm.nb.md │ ├── glmStepAIC.md │ ├── glmboost.md │ ├── glmnet.md │ ├── gpls.md │ ├── hda.md │ ├── hdda.md │ ├── hdrda.md │ ├── icr.md │ ├── kernelpls.md │ ├── kknn.md │ ├── knn.md │ ├── krlsPoly.md │ ├── krlsRadial.md │ ├── lars.md │ ├── lars2.md │ ├── lasso.md │ ├── lda.md │ ├── lda2.md │ ├── leapBackward.md │ ├── leapForward.md │ ├── leapSeq.md │ ├── lm.md │ ├── lmStepAIC.md │ ├── loclda.md │ ├── logicBag.md │ ├── logreg.md │ ├── lssvmRadial.md │ ├── lvq.md │ ├── manb.md │ ├── mda.md │ ├── mlp.md │ ├── mlpML.md │ ├── mlpSGD.md │ ├── mlpWeightDecay.md │ ├── mlpWeightDecayML.md │ ├── multinom.md │ ├── nb.md │ ├── nbDiscrete.md │ ├── nbSearch.md │ ├── neuralnet.md │ ├── nnet.md │ ├── nnls.md │ ├── nodeHarvest.md │ ├── oblique.tree.md │ ├── ordinalNet.md │ ├── ownn.md │ ├── pam.md │ ├── partDSA.md │ ├── pcaNNet.md │ ├── pcr.md │ ├── pda.md │ ├── pda2.md │ ├── penalized.md │ ├── plr.md │ ├── pls.md │ ├── plsRglm.md │ ├── polr.md │ ├── ppr.md │ ├── protoclass.md │ ├── pythonKnnReg.md │ ├── qda.md │ ├── qrf.md │ ├── qrnn.md │ ├── rFerns.md │ ├── randomGLM.md │ ├── ranger.md │ ├── rda.md │ ├── relaxo.md │ ├── rf.md │ ├── rfRules.md │ ├── rfe_lda.md │ ├── rfe_lm.md │ ├── rfe_lr.md │ ├── rfe_nb.md │ ├── rfe_rf.md │ ├── rfe_train.md │ ├── rfe_treebag.md │ ├── ridge.md │ ├── rlda.md │ ├── rlm.md │ ├── rmda.md │ ├── rocc.md │ ├── rotationForest.md │ ├── rotationForestCp.md │ ├── rpart.md │ ├── rpart1SE.md │ ├── rpart2.md │ ├── rpartCost.md │ ├── rpartScore.md │ ├── rqlasso.md │ ├── rqnc.md │ ├── rrlda.md │ ├── rvmLinear.md │ ├── rvmPoly.md │ ├── rvmRadial.md │ ├── sbf_lda.md │ ├── sbf_lm.md │ ├── sbf_nb.md │ ├── sbf_rf.md │ ├── sbf_treebag.md │ ├── sda.md │ ├── sdwd.md │ ├── simpls.md │ ├── slda.md │ ├── smda.md │ ├── snn.md │ ├── sparseLDA.md │ ├── spikeslab.md │ ├── spls.md │ ├── stepLDA.md │ ├── stepQDA.md │ ├── superpc.md │ ├── svmExpoString.md │ ├── svmLinear.md │ ├── svmLinear2.md │ ├── svmLinear3.md │ ├── svmLinearWeights.md │ ├── svmLinearWeights22.md │ ├── svmPoly.md │ ├── svmRadial.md │ ├── svmRadialCost.md │ ├── svmRadialSigma.md │ ├── svmRadialWeights.md │ ├── svmSpectrumString.md │ ├── tan.md │ ├── treebag.md │ ├── trimming.md │ ├── vglmAdjCat.md │ ├── vglmContRatio.md │ ├── vglmCumulative.md │ ├── widekernelpls.md │ └── wsrf.md ├── bookdown ├── 01-Visualizations.Rmd ├── 02-PreProcessing.Rmd ├── 03-Splitting.Rmd ├── 04-Basic.Rmd ├── 05-Model-List.Rmd ├── 06-Tags.Rmd ├── 07-Similarity.Rmd ├── 08-Parallel.Rmd ├── 09-Random-Search.Rmd ├── 10-Sampling.Rmd ├── 11-Recipes.Rmd ├── 12-Custom-Models.Rmd ├── 13-Adaptive-Resampling.Rmd ├── 14-Importance.Rmd ├── 15-Misc-Functions.Rmd ├── 16-Performance.Rmd ├── 17-Feature-Selection.Rmd ├── 18-Filters.Rmd ├── 19-RFE.Rmd ├── 20-GA.Rmd ├── 21-SA.Rmd ├── 22-Datasets.Rmd ├── 23-Session-Info.Rmd ├── caret_doc.Rproj ├── index.Rmd ├── make_files.R ├── premade │ ├── Algo1.png │ ├── Algo2.png │ ├── FEq.png │ ├── MaxDissim.gif │ ├── TrainAlgo.png │ ├── cm.jpg │ ├── cm.pdf │ ├── parallel.png │ └── tol.png ├── redirects │ ├── Accepts_Case_Weights.html │ ├── Bagging.html │ ├── Bayesian_Model.html │ ├── Binary_Predictors_Only.html │ ├── Boosting.html │ ├── Categorical_Predictors_Only.html │ ├── Cost_Sensitive_Learning.html │ ├── Discriminant_Analysis.html │ ├── Distance_Weighted_Discrimination.html │ ├── Ensemble_Model.html │ ├── Feature_Extraction.html │ ├── Feature_Selection_Wrapper.html │ ├── GA.html │ ├── Gaussian_Process.html │ ├── Generalized_Additive_Model.html │ ├── Generalized_Linear_Model.html │ ├── Handle_Missing_Predictor_Data.html │ ├── Implicit_Feature_Selection.html │ ├── Kernel_Method.html │ ├── L1_Regularization.html │ ├── L2_Regularization.html │ ├── Linear_Classifier.html │ ├── Linear_Regression.html │ ├── Logic_Regression.html │ ├── Logistic_Regression.html │ ├── Mixture_Model.html │ ├── Model_Tree.html │ ├── Multivariate_Adaptive_Regression_Splines.html │ ├── Neural_Network.html │ ├── Oblique_Tree.html │ ├── Ordinal_Outcomes.html │ ├── Partial_Least_Squares.html │ ├── Polynomial_Model.html │ ├── Prototype_Models.html │ ├── Quantile_Regression.html │ ├── ROC_Curves.html │ ├── Radial_Basis_Function.html │ ├── Random_Forest.html │ ├── Regularization.html │ ├── Relevance_Vector_Machines.html │ ├── Ridge_Regression.html │ ├── Robust_Methods.html │ ├── Robust_Model.html │ ├── Rule_Based_Model.html │ ├── SA.html │ ├── Self_Organising_Maps.html │ ├── String_Kernel.html │ ├── Support_Vector_Machines.html │ ├── Text_Mining.html │ ├── Tree_Based_Model.html │ ├── Two_Class_Only.html │ ├── adaptive.html │ ├── bytag.html │ ├── custom_models.html │ ├── featureselection.html │ ├── filters.html │ ├── modelList.html │ ├── other.html │ ├── parallel.html │ ├── preprocess.html │ ├── random.html │ ├── rfe.html │ ├── sampling.html │ ├── splitting.html │ ├── training.html │ └── varimp.html ├── style.css └── toc.css ├── codecov.yml ├── deprecated ├── PLS.R ├── generateExprVal.method.trimMean.R ├── generateExprVal.method.trimMean.Rd ├── normalize.AffyBatch.normalize2Reference.R ├── normalize.AffyBatch.normalize2Reference.Rd └── normalize2Reference.R ├── docs ├── survival_thoughts.Rmd └── survival_thoughts.md ├── html ├── Algo1.png ├── Algo2.png ├── FEq.png ├── GA.Rhtml ├── README.md ├── SA.Rhtml ├── TrainAlgo.png ├── adaptive.Rhtml ├── bytag.Rhtml ├── cache │ ├── __packages │ ├── custom_lb_pred_c750307340bfbdbec19a6828e04f4667.RData │ ├── custom_lb_pred_c750307340bfbdbec19a6828e04f4667.rdb │ ├── custom_lb_pred_c750307340bfbdbec19a6828e04f4667.rdx │ ├── custom_sonar_70733b2ad211d556bf0e6ecd376c0b9a.RData │ ├── custom_sonar_70733b2ad211d556bf0e6ecd376c0b9a.rdb │ └── custom_sonar_70733b2ad211d556bf0e6ecd376c0b9a.rdx ├── carrot.png ├── cm.png ├── custom_models.Rhtml ├── custom_models.html ├── d3.v3.js ├── d3.v3.min.js ├── datasets.Rhtml ├── featureSelection.Rhtml ├── filters.Rhtml ├── images │ ├── img01.jpg │ ├── img02.jpg │ └── img03.png ├── index.Rhtml ├── makeHTML.R ├── misc.Rhtml ├── other.Rhtml ├── parallel.Rhtml ├── parallel.png ├── preprocess.Rhtml ├── random.Rhtml ├── rfe.Rhtml ├── sampling.Rhtml ├── similarity.Rhtml ├── splitting.Rhtml ├── style.css ├── table.png ├── table.tiff ├── template.html ├── tol.pdf ├── tol.png ├── tol.tiff ├── training.Rhtml ├── varImp.Rhtml └── visualizations.Rhtml ├── models ├── README.md ├── deprecated │ ├── Boruta.R │ ├── GFS.GCCL.R │ ├── avMxnet.R │ ├── bdk.R │ ├── enpls.R │ ├── enpls.fs.R │ ├── oblique.tree.R │ ├── pythonKnnReg.R │ ├── rknn.R │ ├── rknnBel.R │ ├── sddaLDA.R │ └── sddaQDA.R ├── files │ ├── ANFIS.R │ ├── AdaBag.R │ ├── AdaBoost.M1.R │ ├── BstLm.R │ ├── C5.0.R │ ├── C5.0Cost.R │ ├── C5.0Rules.R │ ├── C5.0Tree.R │ ├── CSimca.R │ ├── DENFIS.R │ ├── FH.GBML.R │ ├── FIR.DM.R │ ├── FRBCS.CHI.R │ ├── FRBCS.W.R │ ├── FS.HGD.R │ ├── GFS.FR.MOGUL.R │ ├── GFS.LT.RS.R │ ├── GFS.THRIFT.R │ ├── HYFIS.R │ ├── J48.R │ ├── JRip.R │ ├── LMT.R │ ├── Linda.R │ ├── LogitBoost.R │ ├── M5.R │ ├── M5Rules.R │ ├── Mlda.R │ ├── ORFlog.R │ ├── ORFpls.R │ ├── ORFridge.R │ ├── ORFsvm.R │ ├── OneR.R │ ├── PART.R │ ├── PRIM.R │ ├── PenalizedLDA.R │ ├── QdaCov.R │ ├── RFlda.R │ ├── RRF.R │ ├── RRFglobal.R │ ├── RSimca.R │ ├── Rborist.R │ ├── SBC.R │ ├── SLAVE.R │ ├── WM.R │ ├── ada.R │ ├── adaboost.R │ ├── amdai.R │ ├── avNNet.R │ ├── awnb.R │ ├── awtan.R │ ├── bag.R │ ├── bagEarth.R │ ├── bagEarthGCV.R │ ├── bagFDA.R │ ├── bagFDAGCV.R │ ├── bam.R │ ├── bartMachine.R │ ├── bayesglm.R │ ├── binda.R │ ├── blackboost.R │ ├── blasso.R │ ├── blassoAveraged.R │ ├── bridge.R │ ├── brnn.R │ ├── bstSm.R │ ├── bstTree.R │ ├── cforest.R │ ├── chaid.R │ ├── ctree.R │ ├── ctree2.R │ ├── cubist.R │ ├── dda.R │ ├── deepboost.R │ ├── dnn.R │ ├── dwdLinear.R │ ├── dwdPoly.R │ ├── dwdRadial.R │ ├── earth.R │ ├── elm.R │ ├── enet.R │ ├── evtree.R │ ├── extraTrees.R │ ├── fda.R │ ├── foba.R │ ├── gam.R │ ├── gamLoess.R │ ├── gamSpline.R │ ├── gamboost.R │ ├── gaussprLinear.R │ ├── gaussprPoly.R │ ├── gaussprRadial.R │ ├── gbm.R │ ├── gbm_h2o.R │ ├── gcvEarth.R │ ├── glm.R │ ├── glm.nb.R │ ├── glmStepAIC.R │ ├── glmboost.R │ ├── glmnet.R │ ├── glmnet_h2o.R │ ├── gpls.R │ ├── hda.R │ ├── hdda.R │ ├── hdrda.R │ ├── icr.R │ ├── kernelpls.R │ ├── kknn.R │ ├── knn.R │ ├── krlsPoly.R │ ├── krlsRadial.R │ ├── lars.R │ ├── lars2.R │ ├── lasso.R │ ├── lda.R │ ├── lda2.R │ ├── leapBackward.R │ ├── leapForward.R │ ├── leapSeq.R │ ├── lm.R │ ├── lmStepAIC.R │ ├── loclda.R │ ├── logicBag.R │ ├── logreg.R │ ├── lssvmLinear.R │ ├── lssvmPoly.R │ ├── lssvmRadial.R │ ├── lvq.R │ ├── manb.R │ ├── mda.R │ ├── mlp.R │ ├── mlpKerasDecay.R │ ├── mlpKerasDecayCost.R │ ├── mlpKerasDropout.R │ ├── mlpKerasDropoutCost.R │ ├── mlpML.R │ ├── mlpSGD.R │ ├── mlpWeightDecay.R │ ├── mlpWeightDecayML.R │ ├── monmlp.R │ ├── msaenet.R │ ├── multinom.R │ ├── mxnet.R │ ├── mxnetAdam.R │ ├── naive_bayes.R │ ├── nb.R │ ├── nbDiscrete.R │ ├── nbSearch.R │ ├── neuralnet.R │ ├── nnet.R │ ├── nnls.R │ ├── nodeHarvest.R │ ├── null.R │ ├── ordinalNet.R │ ├── ordinalRF.R │ ├── ownn.R │ ├── pam.R │ ├── parRF.R │ ├── partDSA.R │ ├── pcaNNet.R │ ├── pcr.R │ ├── pda.R │ ├── pda2.R │ ├── penalized.R │ ├── plr.R │ ├── pls.R │ ├── plsRglm.R │ ├── polr.R │ ├── ppr.R │ ├── pre.R │ ├── protoclass.R │ ├── qda.R │ ├── qrf.R │ ├── qrnn.R │ ├── rFerns.R │ ├── randomGLM.R │ ├── ranger.R │ ├── rbf.R │ ├── rbfDDA.R │ ├── rda.R │ ├── regLogistic.R │ ├── relaxo.R │ ├── rf.R │ ├── rfRules.R │ ├── ridge.R │ ├── rlda.R │ ├── rlm.R │ ├── rmda.R │ ├── rocc.R │ ├── rotationForest.R │ ├── rotationForestCp.R │ ├── rpart.R │ ├── rpart1SE.R │ ├── rpart2.R │ ├── rpartCost.R │ ├── rpartScore.R │ ├── rqlasso.R │ ├── rqnc.R │ ├── rrlda.R │ ├── rvmLinear.R │ ├── rvmPoly.R │ ├── rvmRadial.R │ ├── sda.R │ ├── sdwd.R │ ├── simpls.R │ ├── slda.R │ ├── smda.R │ ├── snn.R │ ├── sparseLDA.R │ ├── spikeslab.R │ ├── spls.R │ ├── stepLDA.R │ ├── stepQDA.R │ ├── superpc.R │ ├── svmBoundrangeString.R │ ├── svmExpoString.R │ ├── svmLinear.R │ ├── svmLinear2.R │ ├── svmLinear3.R │ ├── svmLinearWeights.R │ ├── svmLinearWeights2.R │ ├── svmPoly.R │ ├── svmRadial.R │ ├── svmRadialCost.R │ ├── svmRadialSigma.R │ ├── svmRadialWeights.R │ ├── svmSpectrumString.R │ ├── tan.R │ ├── tanSearch.R │ ├── treebag.R │ ├── vbmpRadial.R │ ├── vglmAdjCat.R │ ├── vglmContRatio.R │ ├── vglmCumulative.R │ ├── widekernelpls.R │ ├── wsrf.R │ ├── xgbDART.R │ ├── xgbLinear.R │ ├── xgbTree.R │ └── xyf.R ├── parseModels.R └── sampling_methods.R ├── pkg └── caret │ ├── .Rbuildignore │ ├── .Rinstignore │ ├── .github │ └── .gitignore │ ├── DESCRIPTION │ ├── NAMESPACE │ ├── R │ ├── BoxCoxTrans.R │ ├── aaa.R │ ├── adaptive.R │ ├── additive.R │ ├── avNNet.R │ ├── bag.R │ ├── bagEarth.R │ ├── bagFDA.R │ ├── basic2x2Stats.R │ ├── calibration.R │ ├── caret-package.R │ ├── caretTheme.R │ ├── classDist.R │ ├── classLevels.R │ ├── common_code.R │ ├── confusionMatrix.R │ ├── createDataPartition.R │ ├── createModel.R │ ├── createResample.R │ ├── diag.R │ ├── dotplot.varImp.train.R │ ├── dummyVar.R │ ├── expoTrans.R │ ├── extractPrediction.R │ ├── extractProb.R │ ├── featurePlot.R │ ├── filterVarImp.R │ ├── findCorrelation.R │ ├── findLinearCombos.R │ ├── format.bagEarth.R │ ├── gafs.R │ ├── getTrainPerf.R │ ├── ggplot.R │ ├── heldout.R │ ├── icr.R │ ├── knn3.R │ ├── knnreg.R │ ├── lattice.train.R │ ├── learning_curve.R │ ├── lift.R │ ├── maxDissim.R │ ├── misc.R │ ├── modelLookup.R │ ├── nearZeroVar.R │ ├── negPredValue.R │ ├── panel.needle.R │ ├── pcaNNet.R │ ├── plot.train.R │ ├── plot.varImp.train.R │ ├── plotClassProbs.R │ ├── plotObsVsPred.R │ ├── plsda.R │ ├── posPredValue.R │ ├── postResample.R │ ├── preProcess.R │ ├── prec_rec.R │ ├── predict.PLS.R │ ├── predict.train.R │ ├── predictionFunction.R │ ├── predictors.R │ ├── print.mars.R │ ├── print.train.R │ ├── print.varImp.train.R │ ├── probFunction.R │ ├── reg_sims.R │ ├── resampleHist.R │ ├── resampleSummary.R │ ├── resampleWrapper.R │ ├── resamples.R │ ├── rfe.R │ ├── safs.R │ ├── sampling.R │ ├── selectByFilter.R │ ├── selection.R │ ├── sensitivity.R │ ├── sortImp.R │ ├── spatialSign.R │ ├── specificity.R │ ├── splsda.R │ ├── suggestions.R │ ├── thresholder.R │ ├── train.default.R │ ├── trainControl.R │ ├── train_recipes.R │ ├── trim.R │ ├── twoClassSim.R │ ├── updates.R │ ├── varImp.R │ ├── varImp.train.R │ └── workflows.R │ ├── caret.Rproj │ ├── data │ ├── BloodBrain.RData │ ├── GermanCredit.RData │ ├── Sacramento.RData │ ├── cars.RData │ ├── cox2.RData │ ├── datalist │ ├── dhfr.RData │ ├── mdrr.RData │ ├── oil.RData │ ├── pottery.RData │ ├── scat.RData │ ├── segmentationData.RData │ └── tecator.RData │ ├── inst │ ├── CITATION │ ├── NEWS.Rd │ └── models │ │ ├── models.RData │ │ └── sampling.RData │ ├── man │ ├── BloodBrain.Rd │ ├── BoxCoxTrans.Rd │ ├── GermanCredit.Rd │ ├── Sacramento.Rd │ ├── as.matrix.confusionMatrix.Rd │ ├── avNNet.Rd │ ├── bag.Rd │ ├── bagEarth.Rd │ ├── bagFDA.Rd │ ├── calibration.Rd │ ├── caret-internal.Rd │ ├── caretFuncs.Rd │ ├── caretSBF.Rd │ ├── cars.Rd │ ├── classDist.Rd │ ├── confusionMatrix.Rd │ ├── confusionMatrix.train.Rd │ ├── cox2.Rd │ ├── createDataPartition.Rd │ ├── densityplot.rfe.Rd │ ├── dhfr.Rd │ ├── diff.resamples.Rd │ ├── dotPlot.Rd │ ├── dotplot.diff.resamples.Rd │ ├── downSample.Rd │ ├── dummyVars.Rd │ ├── featurePlot.Rd │ ├── filterVarImp.Rd │ ├── findCorrelation.Rd │ ├── findLinearCombos.Rd │ ├── format.bagEarth.Rd │ ├── gafs.default.Rd │ ├── gafs_initial.Rd │ ├── getSamplingInfo.Rd │ ├── histogram.train.Rd │ ├── icr.formula.Rd │ ├── index2vec.Rd │ ├── knn3.Rd │ ├── knnreg.Rd │ ├── learning_curve_dat.Rd │ ├── lift.Rd │ ├── maxDissim.Rd │ ├── mdrr.Rd │ ├── modelLookup.Rd │ ├── models.Rd │ ├── nearZeroVar.Rd │ ├── nullModel.Rd │ ├── oil.Rd │ ├── oneSE.Rd │ ├── panel.lift2.Rd │ ├── panel.needle.Rd │ ├── pcaNNet.Rd │ ├── plot.gafs.Rd │ ├── plot.rfe.Rd │ ├── plot.train.Rd │ ├── plot.varImp.train.Rd │ ├── plotClassProbs.Rd │ ├── plotObsVsPred.Rd │ ├── plsda.Rd │ ├── postResample.Rd │ ├── pottery.Rd │ ├── prcomp.resamples.Rd │ ├── preProcess.Rd │ ├── predict.bagEarth.Rd │ ├── predict.gafs.Rd │ ├── predict.knn3.Rd │ ├── predict.knnreg.Rd │ ├── predict.train.Rd │ ├── predictors.Rd │ ├── print.confusionMatrix.Rd │ ├── print.train.Rd │ ├── recall.Rd │ ├── resampleHist.Rd │ ├── resampleSummary.Rd │ ├── resamples.Rd │ ├── rfe.Rd │ ├── rfeControl.Rd │ ├── safs.Rd │ ├── safsControl.Rd │ ├── safs_initial.Rd │ ├── sbf.Rd │ ├── sbfControl.Rd │ ├── scat.Rd │ ├── segmentationData.Rd │ ├── sensitivity.Rd │ ├── spatialSign.Rd │ ├── summary.bagEarth.Rd │ ├── tecator.Rd │ ├── thresholder.Rd │ ├── train.Rd │ ├── trainControl.Rd │ ├── twoClassSim.Rd │ ├── update.safs.Rd │ ├── update.train.Rd │ ├── varImp.Rd │ ├── varImp.gafs.Rd │ ├── var_seq.Rd │ └── xyplot.resamples.Rd │ ├── src │ └── caret.c │ ├── tests │ ├── testthat.R │ └── testthat │ │ ├── test_BoxCox.R │ │ ├── test_Dummies.R │ │ ├── test_bad_class_options.R │ │ ├── test_classDist.R │ │ ├── test_confusionMatrix.R │ │ ├── test_data_spliting.R │ │ ├── test_gafs.R │ │ ├── test_ggplot.R │ │ ├── test_glmnet_varImp.R │ │ ├── test_minimal.R │ │ ├── test_misc.R │ │ ├── test_mnLogLoss.R │ │ ├── test_models_bagEarth.R │ │ ├── test_multiclassSummary.R │ │ ├── test_nearZeroVar.R │ │ ├── test_preProcess.R │ │ ├── test_preProcess_internals.R │ │ ├── test_preProcess_methods.R │ │ ├── test_ptypes.R │ │ ├── test_recipe_fs.R │ │ ├── test_recipe_upsample.R │ │ ├── test_resamples.R │ │ ├── test_safs.R │ │ ├── test_sampling_options.R │ │ ├── test_sparse_Matrix.R │ │ ├── test_spatialSign.R │ │ ├── test_tibble.R │ │ ├── test_twoClassSummary.R │ │ ├── test_updates.R │ │ ├── test_varImp.R │ │ ├── trim.R │ │ ├── trim_C5.R │ │ ├── trim_bayesglm.R │ │ ├── trim_glm.R │ │ ├── trim_glmnet.R │ │ ├── trim_rpart.R │ │ ├── trim_train.R │ │ └── trim_treebag.R │ └── vignettes │ └── caret.Rmd └── release_process ├── Open_Data_Science_Conference ├── caret.Rnw ├── caret.pdf ├── caret.tex ├── coverage_12.png ├── min_graph.pdf ├── new_graph.pdf ├── old_graph.pdf ├── outline.md └── test_coverage_report.png ├── README.md ├── make_model_Rd.R ├── reverse_depends.R ├── talk ├── caret.Rnw ├── caret.pdf └── outline.md ├── update_biocmanager.R ├── update_pak.R └── update_pak.Rout /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^\.github$ 2 | ^codecov\.yml$ 3 | -------------------------------------------------------------------------------- /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # CODEOWNERS for caret 2 | # https://www.tidyverse.org/development/understudies 3 | .github/CODEOWNERS @topepo @alexpghayes 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![R-CMD-check](https://github.com/topepo/caret/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/topepo/caret/actions/workflows/R-CMD-check.yaml) 2 | [![Codecov test coverage](https://codecov.io/gh/topepo/caret/graph/badge.svg)](https://app.codecov.io/gh/topepo/caret) 3 | [![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/caret)](http://cran.r-project.org/web/packages/caret) 4 | [![Downloads](http://cranlogs.r-pkg.org/badges/caret)](http://cran.rstudio.com/package=caret) 5 | 6 | # Classification and Regression Training 7 | 8 | Miscellaneous functions for training and plotting classification and regression models. Detailed documentation is at http://topepo.github.io/caret/index.html 9 | 10 | ## Install the current release from CRAN: 11 | 12 | ```r 13 | install.packages('caret') 14 | ``` 15 | 16 | ## Install the development version from GitHub: 17 | ```r 18 | pak::pak('topepo/caret/pkg/caret') 19 | ``` 20 | 21 | ## Status 22 | 23 | caret will be 20 years old in March of 2026. The package is currently in *maintenance mode*; the author will fix bugs and make CRAN releases as needed, but there will not be any major features in the package. **It will stay on CRAN long-term**; it's not going away. 24 | 25 | -------------------------------------------------------------------------------- /RegressionTests/Code/rfe_issue485.R: -------------------------------------------------------------------------------- 1 | timestamp <- Sys.time() 2 | library(caret) 3 | library(plyr) 4 | library(recipes) 5 | library(dplyr) 6 | 7 | model <- "rfe_issue485" 8 | 9 | ######################################################################### 10 | 11 | set.seed(31253) 12 | test_reg <- rfe(x = iris[,1:3], 13 | y = iris[,4]/max(iris[,4]), 14 | sizes = 1:2, 15 | method="nnet", 16 | trace = FALSE, 17 | rfeControl = rfeControl(functions = caretFuncs, number = 3)) 18 | 19 | set.seed(45563) 20 | test_class <- rfe(x = iris[,1:4], 21 | y = iris$Species, 22 | sizes = 1:2, 23 | method="nnet", 24 | trace = FALSE, 25 | rfeControl = rfeControl(functions = caretFuncs, number = 3), 26 | trControl = trainControl(classProbs = TRUE, summaryFunction = multiClassSummary)) 27 | 28 | ######################################################################### 29 | 30 | tests <- grep("test_", ls(), fixed = TRUE, value = TRUE) 31 | 32 | sInfo <- sessionInfo() 33 | timestamp_end <- Sys.time() 34 | 35 | save(list = c(tests, "sInfo", "timestamp", "timestamp_end"), 36 | file = file.path(getwd(), paste(model, ".RData", sep = ""))) 37 | 38 | if(!interactive()) 39 | q("no") 40 | -------------------------------------------------------------------------------- /bookdown/05-Model-List.Rmd: -------------------------------------------------------------------------------- 1 | ```{r list_setup, include=FALSE} 2 | library(DT) 3 | library(caret) 4 | mods <- getModelInfo() 5 | 6 | num_param <- unlist(lapply(mods, function(x) paste(as.character(x$param$parameter), sep = "", collapse = ", "))) 7 | num_param[num_param == "parameter"] <- "None" 8 | num_param <- data.frame(model = names(num_param), num_param = num_param) 9 | 10 | mod_type <- unlist(lapply(mods, function(x) paste(sort(x$type), sep = "", collapse = ", "))) 11 | mod_type <- data.frame(model = names(mod_type), type = mod_type) 12 | 13 | libs <- unlist(lapply(mods, function(x) paste(x$library, sep = "", collapse = ", "))) 14 | libs <- data.frame(model = names(libs), libraries = libs) 15 | 16 | mod_name <- unlist(lapply(mods, function(x) x$label)) 17 | mod_name <- data.frame(model = names(mod_name), name = mod_name) 18 | 19 | model_info <- merge(mod_name, mod_type, all = TRUE) 20 | model_info <- merge(model_info, libs, all = TRUE) 21 | model_info <- merge(model_info, num_param, all = TRUE) 22 | model_info <- model_info[, c('name', 'model', 'type', 'libraries', 'num_param')] 23 | model_info <- model_info[order(model_info$name),] 24 | ``` 25 | 26 | # Available Models 27 | 28 | The models below are available in `train`. The code behind these protocols can be obtained using the function `getModelInfo` or by going to the [github repository](https://github.com/topepo/caret/tree/master/models/files). 29 | 30 | 31 | ```{r list_table, echo = FALSE} 32 | datatable(model_info, rownames = FALSE, style = "bootstrap", 33 | colnames = c("Model", "`method` Value", "Type", "Libraries", "Tuning Parameters"), 34 | options = list(lengthMenu = c(nrow(model_info), 5, 10, 15, 20), 35 | scrollX = TRUE)) 36 | ``` 37 | -------------------------------------------------------------------------------- /bookdown/23-Session-Info.Rmd: -------------------------------------------------------------------------------- 1 | # Session Information 2 | 3 | This documentation was created on `r format(Sys.time(), "%a %b %d %Y")` with the following R packages 4 | ```{r session_info, echo = FALSE} 5 | library(sessioninfo) 6 | session_info() 7 | ``` 8 | -------------------------------------------------------------------------------- /bookdown/caret_doc.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: knitr 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Website 19 | -------------------------------------------------------------------------------- /bookdown/make_files.R: -------------------------------------------------------------------------------- 1 | library(bookdown) 2 | # library(parallel) 3 | # library(doParallel) 4 | # cl <- makeForkCluster(parallel::detectCores(logical = TRUE)) 5 | # registerDoParallel(cl) 6 | 7 | library(doMC) 8 | registerDoMC(cores = parallel::detectCores(logical = TRUE)) 9 | 10 | render_book("index.Rmd", "bookdown::gitbook") 11 | 12 | if (!interactive()) 13 | q("no") 14 | -------------------------------------------------------------------------------- /bookdown/premade/Algo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/bookdown/premade/Algo1.png -------------------------------------------------------------------------------- /bookdown/premade/Algo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/bookdown/premade/Algo2.png -------------------------------------------------------------------------------- /bookdown/premade/FEq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/bookdown/premade/FEq.png -------------------------------------------------------------------------------- /bookdown/premade/MaxDissim.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/bookdown/premade/MaxDissim.gif -------------------------------------------------------------------------------- /bookdown/premade/TrainAlgo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/bookdown/premade/TrainAlgo.png -------------------------------------------------------------------------------- /bookdown/premade/cm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/bookdown/premade/cm.jpg -------------------------------------------------------------------------------- /bookdown/premade/cm.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/bookdown/premade/cm.pdf -------------------------------------------------------------------------------- /bookdown/premade/parallel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/bookdown/premade/parallel.png -------------------------------------------------------------------------------- /bookdown/premade/tol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/bookdown/premade/tol.png -------------------------------------------------------------------------------- /bookdown/redirects/Accepts_Case_Weights.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Bagging.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Bayesian_Model.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Binary_Predictors_Only.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Boosting.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Categorical_Predictors_Only.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Cost_Sensitive_Learning.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Discriminant_Analysis.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Distance_Weighted_Discrimination.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Ensemble_Model.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Feature_Extraction.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Feature_Selection_Wrapper.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/GA.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | 13 | If you are not redirected automatically, follow the link 14 | 15 | -------------------------------------------------------------------------------- /bookdown/redirects/Gaussian_Process.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Generalized_Additive_Model.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Generalized_Linear_Model.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Handle_Missing_Predictor_Data.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Implicit_Feature_Selection.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Kernel_Method.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/L1_Regularization.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/L2_Regularization.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Linear_Classifier.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Linear_Regression.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Logic_Regression.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Logistic_Regression.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Mixture_Model.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Model_Tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Multivariate_Adaptive_Regression_Splines.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Neural_Network.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Oblique_Tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Ordinal_Outcomes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Partial_Least_Squares.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Polynomial_Model.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Prototype_Models.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Quantile_Regression.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/ROC_Curves.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Radial_Basis_Function.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Random_Forest.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Regularization.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Relevance_Vector_Machines.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Ridge_Regression.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Robust_Methods.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Robust_Model.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Rule_Based_Model.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/SA.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | 13 | If you are not redirected automatically, follow the link 14 | 15 | -------------------------------------------------------------------------------- /bookdown/redirects/Self_Organising_Maps.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/String_Kernel.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Support_Vector_Machines.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Text_Mining.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Tree_Based_Model.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/Two_Class_Only.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | If you are not redirected automatically, follow the link 13 | 14 | -------------------------------------------------------------------------------- /bookdown/redirects/adaptive.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | 13 | If you are not redirected automatically, follow the link 14 | 15 | -------------------------------------------------------------------------------- /bookdown/redirects/bytag.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | 13 | If you are not redirected automatically, follow the link 14 | 15 | 16 | -------------------------------------------------------------------------------- /bookdown/redirects/custom_models.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | 13 | If you are not redirected automatically, follow the link 14 | 15 | -------------------------------------------------------------------------------- /bookdown/redirects/featureselection.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | 13 | If you are not redirected automatically, follow the link 14 | 15 | -------------------------------------------------------------------------------- /bookdown/redirects/filters.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | 13 | If you are not redirected automatically, follow the link 14 | 15 | -------------------------------------------------------------------------------- /bookdown/redirects/modelList.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | 13 | If you are not redirected automatically, follow the link 14 | 15 | 16 | -------------------------------------------------------------------------------- /bookdown/redirects/other.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | 13 | If you are not redirected automatically, follow the link 14 | 15 | -------------------------------------------------------------------------------- /bookdown/redirects/parallel.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | 13 | If you are not redirected automatically, follow the link 14 | 15 | -------------------------------------------------------------------------------- /bookdown/redirects/preprocess.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | 13 | If you are not redirected automatically, follow the link 14 | 15 | -------------------------------------------------------------------------------- /bookdown/redirects/random.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | 13 | If you are not redirected automatically, follow the link 14 | 15 | -------------------------------------------------------------------------------- /bookdown/redirects/rfe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | 13 | If you are not redirected automatically, follow the link 14 | 15 | -------------------------------------------------------------------------------- /bookdown/redirects/sampling.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | 13 | If you are not redirected automatically, follow the link 14 | 15 | -------------------------------------------------------------------------------- /bookdown/redirects/splitting.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | 13 | If you are not redirected automatically, follow the link 14 | 15 | -------------------------------------------------------------------------------- /bookdown/redirects/training.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | 13 | If you are not redirected automatically, follow the link 14 | 15 | -------------------------------------------------------------------------------- /bookdown/redirects/varimp.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | Page Redirection 10 | 11 | 12 | 13 | If you are not redirected automatically, follow the link 14 | 15 | -------------------------------------------------------------------------------- /bookdown/style.css: -------------------------------------------------------------------------------- 1 | p.caption { 2 | color: #777; 3 | margin-top: 10px; 4 | } 5 | p code { 6 | white-space: inherit; 7 | } 8 | pre { 9 | word-break: normal; 10 | word-wrap: normal; 11 | } 12 | pre code { 13 | white-space: inherit; 14 | } 15 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | comment: false 2 | 3 | coverage: 4 | status: 5 | project: 6 | default: 7 | target: auto 8 | threshold: 1% 9 | informational: true 10 | patch: 11 | default: 12 | target: auto 13 | threshold: 1% 14 | informational: true 15 | -------------------------------------------------------------------------------- /deprecated/PLS.R: -------------------------------------------------------------------------------- 1 | PLS <- function (x, ...) 2 | UseMethod("PLS") 3 | 4 | PLS.default <- function (x, y, ncomp = min(dim(x)[2], 5), ...) 5 | { 6 | # much of this function is from the nnet package 7 | class.ind <- function(cl) 8 | { 9 | 10 | n <- length(cl) 11 | x <- matrix(0, n, length(levels(cl))) 12 | x[(1:n) + n * (as.vector(unclass(cl)) - 1)] <- 1 13 | dimnames(x) <- list(names(cl), levels(cl)) 14 | x 15 | } 16 | if(!is.matrix(x)) x <- as.matrix(x) 17 | if (any(is.na(x))) 18 | stop("missing values in 'x'") 19 | if (any(is.na(y))) 20 | stop("missing values in 'y'") 21 | if (dim(x)[1] != length(y)) 22 | stop("nrows of 'x' and 'y' must match") 23 | 24 | if (is.factor(y)) 25 | { 26 | isRegression <- FALSE 27 | lev <- levels(y) 28 | counts <- table(y) 29 | if (any(counts == 0)) 30 | { 31 | empty <- lev[counts == 0] 32 | warning(sprintf(ngettext(length(empty), "group %s is empty", 33 | "groups %s are empty"), paste(empty, collapse = " ")), 34 | domain = NA) 35 | y <- factor(y, levels = lev[counts > 0]) 36 | } 37 | yLevels <- lev[counts > 0] 38 | y <- class.ind(y) 39 | } else { 40 | isRegression <- TRUE 41 | yLevels <- NULL 42 | } 43 | 44 | library(pls) 45 | out <- simpls.fit(x, y, ncomp) 46 | out$ncomp <- ncomp 47 | out$isRegression <- isRegression 48 | out$x <- x 49 | out$y <- y 50 | out$yLevels <- yLevels 51 | 52 | structure(out, class = "PLS") 53 | } 54 | -------------------------------------------------------------------------------- /deprecated/generateExprVal.method.trimMean.R: -------------------------------------------------------------------------------- 1 | "generateExprVal.method.trimMean" <- 2 | function(probes, trim = 0.15) 3 | { 4 | mu <- apply(probes, 2, mean, trim = trim) 5 | s <- rep(NA, length(mu)) 6 | return(list(exprs = mu, se.exprs = s)) 7 | } 8 | -------------------------------------------------------------------------------- /deprecated/generateExprVal.method.trimMean.Rd: -------------------------------------------------------------------------------- 1 | \name{Alternate Affy Gene Expression Summary Methods.} 2 | \alias{generateExprVal.method.trimMean} 3 | \title{Generate Expression Values from Probes} 4 | \description{ 5 | Generate an expression from the probes 6 | } 7 | \usage{ 8 | generateExprVal.method.trimMean(probes, trim = 0.15) 9 | } 10 | \arguments{ 11 | \item{probes}{a matrix of probe intensities with rows representing 12 | probes and columns representing 13 | samples. Usually \code{pm(probeset)} where \code{probeset} is a 14 | of class \code{\link[affy:ProbeSet-class]{ProbeSet}}} 15 | \item{trim}{the fraction (0 to 0.5) of observations to be trimmed 16 | from each end of the data before the mean is computed.} 17 | } 18 | \value{ 19 | A list containing entries: 20 | \item{exprs}{The expression values.} 21 | \item{se.exprs}{The standard error estimate.} 22 | } 23 | \examples{ 24 | \dontrun{ 25 | # first, let affy/expresso know that the method exists 26 | express.summary.stat.methods <- c(express.summary.stat.methods, "trimMean") 27 | 28 | example not run, as it would take a while 29 | RawData <- ReadAffy(celfile.path=FilePath) 30 | 31 | expresso(RawData, 32 | bgcorrect.method="rma", 33 | normalize.method="quantiles", 34 | normalize.param = list(type= "pmonly"), 35 | pmcorrect.method="pmonly", 36 | summary.method="trimMean") 37 | 38 | step1 <- bg.correct(RawData, "rma") 39 | step2 <- normalize.AffyBatch.quantiles(step1) 40 | step3 <- computeExprSet(step2, "pmonly", "trimMean") 41 | } 42 | } 43 | \seealso{ 44 | \code{\link[affy]{generateExprSet-methods}} 45 | } 46 | \keyword{manip} 47 | -------------------------------------------------------------------------------- /deprecated/normalize.AffyBatch.normalize2Reference.R: -------------------------------------------------------------------------------- 1 | "normalize.AffyBatch.normalize2Reference" <- 2 | function (abatch, type = c("separate", "pmonly", "mmonly", "together"), ref = NULL) 3 | { 4 | type <- match.arg(type) 5 | if ((type == "pmonly") | (type == "separate")) { 6 | pms <- unlist(pmindex(abatch)) 7 | noNA <- rowSums(is.na(intensity(abatch)[pms, , drop = FALSE])) == 0 8 | pms <- pms[noNA] 9 | intensity(abatch)[pms, ] <- normalize2Reference( 10 | intensity(abatch)[pms, , drop = FALSE], 11 | refData = ref, ties = TRUE) 12 | } 13 | if ((type == "mmonly") | (type == "separate")) { 14 | mms <- unlist(mmindex(abatch)) 15 | noNA <- rowSums(is.na(intensity(abatch)[mms, , drop = FALSE])) == 0 16 | mms <- mms[noNA] 17 | intensity(abatch)[mms, ] <- normalize2Reference( 18 | intensity(abatch)[mms, , drop = FALSE], 19 | refData = ref, ties = TRUE) 20 | } 21 | if (type == "together") { 22 | pms <- unlist(indexProbes(abatch, "both")) 23 | intensity(abatch)[pms, ] <- normalize2Reference( 24 | intensity(abatch)[pms, , drop = FALSE], 25 | refData = ref, ties = TRUE) 26 | } 27 | return(abatch) 28 | } 29 | 30 | -------------------------------------------------------------------------------- /html/Algo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/Algo1.png -------------------------------------------------------------------------------- /html/Algo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/Algo2.png -------------------------------------------------------------------------------- /html/FEq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/FEq.png -------------------------------------------------------------------------------- /html/README.md: -------------------------------------------------------------------------------- 1 | `html` directory 2 | ========= 3 | 4 | 5 | These files are the substrate for the on-line `caret` help pages. The files are geared to work with `knitr` so these files include the templates and the final `html` files should not be stored here. 6 | 7 | The files `makeHTML.R` is used to create new documentation files. -------------------------------------------------------------------------------- /html/TrainAlgo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/TrainAlgo.png -------------------------------------------------------------------------------- /html/cache/__packages: -------------------------------------------------------------------------------- 1 | base 2 | knitr 3 | lattice 4 | ggplot2 5 | caret 6 | class 7 | caTools 8 | pROC 9 | DMwR 10 | reshape2 11 | plyr 12 | foreach 13 | iterators 14 | doMC 15 | -------------------------------------------------------------------------------- /html/cache/custom_lb_pred_c750307340bfbdbec19a6828e04f4667.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/cache/custom_lb_pred_c750307340bfbdbec19a6828e04f4667.RData -------------------------------------------------------------------------------- /html/cache/custom_lb_pred_c750307340bfbdbec19a6828e04f4667.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/cache/custom_lb_pred_c750307340bfbdbec19a6828e04f4667.rdb -------------------------------------------------------------------------------- /html/cache/custom_lb_pred_c750307340bfbdbec19a6828e04f4667.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/cache/custom_lb_pred_c750307340bfbdbec19a6828e04f4667.rdx -------------------------------------------------------------------------------- /html/cache/custom_sonar_70733b2ad211d556bf0e6ecd376c0b9a.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/cache/custom_sonar_70733b2ad211d556bf0e6ecd376c0b9a.RData -------------------------------------------------------------------------------- /html/cache/custom_sonar_70733b2ad211d556bf0e6ecd376c0b9a.rdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/cache/custom_sonar_70733b2ad211d556bf0e6ecd376c0b9a.rdb -------------------------------------------------------------------------------- /html/cache/custom_sonar_70733b2ad211d556bf0e6ecd376c0b9a.rdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/cache/custom_sonar_70733b2ad211d556bf0e6ecd376c0b9a.rdx -------------------------------------------------------------------------------- /html/carrot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/carrot.png -------------------------------------------------------------------------------- /html/cm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/cm.png -------------------------------------------------------------------------------- /html/images/img01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/images/img01.jpg -------------------------------------------------------------------------------- /html/images/img02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/images/img02.jpg -------------------------------------------------------------------------------- /html/images/img03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/images/img03.png -------------------------------------------------------------------------------- /html/parallel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/parallel.png -------------------------------------------------------------------------------- /html/table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/table.png -------------------------------------------------------------------------------- /html/table.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/table.tiff -------------------------------------------------------------------------------- /html/tol.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/tol.pdf -------------------------------------------------------------------------------- /html/tol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/tol.png -------------------------------------------------------------------------------- /html/tol.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/html/tol.tiff -------------------------------------------------------------------------------- /models/README.md: -------------------------------------------------------------------------------- 1 | `models` directory 2 | ========= 3 | 4 | 5 | These files define the code for the specific model. 6 | 7 | The `files` directory contains files for each model. In the package, this data is bundled into a list object. 8 | 9 | `parseModels.R` will source the models and create the list object that can be added to the package. 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /models/deprecated/enpls.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Ensemble Partial Least Squares Regression", 2 | library = "enpls", 3 | type = "Regression", 4 | parameters = data.frame(parameter = c('maxcomp'), 5 | class = "numeric", 6 | label = c('Max. #Components')), 7 | grid = function(x, y, len = NULL, search = "grid") { 8 | comps <- caret::var_seq(p = ncol(x), 9 | classification = is.factor(y), 10 | len = 1) 11 | if(search == "grid") { 12 | out <- data.frame(maxcomp = comps) 13 | } else { 14 | out <- data.frame(maxcomp = sample(1:comps, size = len, replace = TRUE)) 15 | } 16 | out 17 | }, 18 | loop = NULL, 19 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 20 | x <- if(is.matrix(x)) x else as.matrix(x) 21 | enpls::enpls.en(x = x, y = y, maxcomp = param$maxcomp, 22 | ...) 23 | }, 24 | predict = function(modelFit, newdata, submodels = NULL) { 25 | newdata <- if(is.matrix(newdata)) newdata else as.matrix(newdata) 26 | predict(modelFit, newdata) 27 | }, 28 | predictors = function(x, ...) rownames(x$projection), 29 | tags = c("Partial Least Squares", "Ensemble Model"), 30 | prob = NULL, 31 | sort = function(x) x[order(x[,1]),]) 32 | -------------------------------------------------------------------------------- /models/deprecated/sddaLDA.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Stepwise Diagonal Linear Discriminant Analysis", 2 | library = c("SDDA"), 3 | loop = NULL, 4 | type = c("Classification"), 5 | parameters = data.frame(parameter = c("parameter"), 6 | class = c("character"), 7 | label = c('parameter')), 8 | grid = function(x, y, len = NULL, search = "grid") 9 | data.frame(parameter = "none"), 10 | fit = function(x, y, wts, param, lev, last, classProbs, ...) 11 | SDDA::sdda(as.matrix(x), y, method = "lda", ...), 12 | predict = function(modelFit, newdata, submodels = NULL) 13 | predict(modelFit, as.matrix(newdata), type = "class"), 14 | prob = function(modelFit, newdata, submodels = NULL) 15 | predict(modelFit, as.matrix(newdata), type = "prob"), 16 | levels = function(x) x$obsLevels, 17 | tags = c("Discriminant Analysis", "Feature Selection Wrapper", "Linear Classifier"), 18 | sort = function(x) x) 19 | -------------------------------------------------------------------------------- /models/deprecated/sddaQDA.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Stepwise Diagonal Quadratic Discriminant Analysis", 2 | library = c("SDDA"), 3 | loop = NULL, 4 | type = c("Classification"), 5 | parameters = data.frame(parameter = c("parameter"), 6 | class = c("character"), 7 | label = c('parameter')), 8 | grid = function(x, y, len = NULL, search = "grid") 9 | data.frame(parameter = "none"), 10 | fit = function(x, y, wts, param, lev, last, classProbs, ...) 11 | SDDA::sdda(as.matrix(x), y, method = "qda", ...), 12 | predict = function(modelFit, newdata, submodels = NULL) 13 | predict(modelFit, as.matrix(newdata), type = "class"), 14 | prob = function(modelFit, newdata, submodels = NULL) 15 | predict(modelFit, as.matrix(newdata), type = "prob"), 16 | levels = function(x) x$obsLevels, 17 | tags = c("Discriminant Analysis", "Feature Selection Wrapper", "Polynomial Model"), 18 | sort = function(x) x) 19 | -------------------------------------------------------------------------------- /models/files/C5.0Rules.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Single C5.0 Ruleset", 2 | library = "C50", 3 | loop = NULL, 4 | type = "Classification", 5 | parameters = data.frame(parameter = c('parameter'), 6 | class = c("character"), 7 | label = c('none')), 8 | grid = function(x, y, len = NULL, search = "grid") data.frame(parameter = "none"), 9 | fit = function(x, y, wts, param, lev, last, classProbs, ...) 10 | C50:::C5.0.default(x = x, y = y, weights = wts, rules = TRUE, ...), 11 | predict = function(modelFit, newdata, submodels = NULL) 12 | predict(modelFit, newdata), 13 | prob = function(modelFit, newdata, submodels = NULL) 14 | predict(modelFit, newdata, type= "prob"), 15 | predictors = function(x, ...) { 16 | vars <- C50::C5imp(x, metric = "splits") 17 | rownames(vars)[vars$Overall > 0] 18 | }, 19 | levels = function(x) x$obsLevels, 20 | varImp = function(object, ...) C50::C5imp(object, ...), 21 | tags = c("Rule-Based Model", "Implicit Feature Selection", "Handle Missing Predictor Data", "Accepts Case Weights"), 22 | trim = function(x) { 23 | x$boostResults <- NULL 24 | x$size <- NULL 25 | x$call <- NULL 26 | x$output <- NULL 27 | x 28 | }, 29 | sort = function(x) x[order(x[,1]),]) 30 | -------------------------------------------------------------------------------- /models/files/C5.0Tree.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Single C5.0 Tree", 2 | library = "C50", 3 | loop = NULL, 4 | type = "Classification", 5 | parameters = data.frame(parameter = c('parameter'), 6 | class = c("character"), 7 | label = c('none')), 8 | grid = function(x, y, len = NULL, search = "grid") data.frame(parameter = "none"), 9 | fit = function(x, y, wts, param, lev, last, classProbs, ...) 10 | C50:::C5.0.default(x = x, y = y, weights = wts, ...), 11 | predict = function(modelFit, newdata, submodels = NULL) 12 | predict(modelFit, newdata), 13 | prob = function(modelFit, newdata, submodels = NULL) 14 | predict(modelFit, newdata, type= "prob"), 15 | predictors = function(x, ...) { 16 | vars <- C50::C5imp(x, metric = "splits") 17 | rownames(vars)[vars$Overall > 0] 18 | }, 19 | levels = function(x) x$obsLevels, 20 | varImp = function(object, ...) C50::C5imp(object, ...), 21 | tags = c("Tree-Based Model", "Implicit Feature Selection", 22 | "Handle Missing Predictor Data", "Accepts Case Weights"), 23 | sort = function(x) x[order(x[,1]),], 24 | trim = function(x) { 25 | x$boostResults <- NULL 26 | x$size <- NULL 27 | x$call <- NULL 28 | x$output <- NULL 29 | x 30 | }) 31 | -------------------------------------------------------------------------------- /models/files/CSimca.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "SIMCA", 2 | library = c("rrcov","rrcovHD"), 3 | loop = NULL, 4 | type = c("Classification"), 5 | parameters = data.frame(parameter = 'parameter', 6 | class = "character", 7 | label = 'parameter'), 8 | grid = function(x, y, len = NULL, search = "grid") { 9 | data.frame(parameter = "none") 10 | }, 11 | fit = function(x, y, wts, param, lev, last, classProbs, ...) 12 | rrcovHD::CSimca(x, y, ...), 13 | predict = function(modelFit, newdata, submodels = NULL) 14 | rrcov::predict(modelFit, newdata)@classification, 15 | prob = NULL, 16 | tags = c('Robust Model'), 17 | levels = function(x) names(x@prior), 18 | sort = function(x) x) 19 | -------------------------------------------------------------------------------- /models/files/Linda.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Robust Linear Discriminant Analysis", 2 | library = "rrcov", 3 | loop = NULL, 4 | type = c('Classification'), 5 | parameters = data.frame(parameter = c('parameter'), 6 | class = c('character'), 7 | label = c('none')), 8 | grid = function(x, y, len = NULL, search = "grid") 9 | data.frame(parameter = "none"), 10 | fit = function(x, y, wts, param, lev, last, classProbs, ...) 11 | rrcov:::Linda(x, y, ...) , 12 | predict = function(modelFit, newdata, submodels = NULL) 13 | rrcov:::predict(modelFit, newdata)@classification, 14 | prob = function(modelFit, newdata, submodels = NULL) { 15 | probs <- rrcov:::predict(modelFit, newdata)@posterior 16 | colnames(probs) <- names(modelFit@prior) 17 | probs 18 | }, 19 | tags = c("Discriminant Analysis", "Linear Classifier", "Robust Model"), 20 | levels = function(x) names(x@prior), 21 | sort = function(x) x) 22 | -------------------------------------------------------------------------------- /models/files/Mlda.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Maximum Uncertainty Linear Discriminant Analysis", 2 | library = "HiDimDA", 3 | loop = NULL, 4 | type = c('Classification'), 5 | parameters = data.frame(parameter = c('parameter'), 6 | class = c("character"), 7 | label = c('parameter')), 8 | grid = function(x, y, len = NULL, search = "grid") 9 | data.frame(parameter = "none"), 10 | fit = function(x, y, wts, param, lev, last, classProbs, ...) 11 | HiDimDA::Mlda(x, y, q = param$.q, maxq = param$.q, ...), 12 | predict = function(modelFit, newdata, submodels = NULL) { 13 | out <- predict(modelFit, newdata)$class 14 | out <- modelFit$obsLevels[as.numeric(out)] 15 | out 16 | }, 17 | levels = function(x) x$obsLevels, 18 | prob = NULL, 19 | tags = c("Discriminant Analysis", "Linear Classifier"), 20 | sort = function(x) x[order(x[,1]),]) 21 | -------------------------------------------------------------------------------- /models/files/QdaCov.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Robust Quadratic Discriminant Analysis", 2 | library = "rrcov", 3 | loop = NULL, 4 | type = "Classification", 5 | parameters = data.frame(parameter = "parameter", 6 | class = "character", 7 | label = "parameter"), 8 | grid = function(x, y, len = NULL, search = "grid") data.frame(parameter = "none"), 9 | fit = function(x, y, wts, param, lev, last, classProbs, ...) 10 | rrcov:::QdaCov(x, y, ...), 11 | predict = function(modelFit, newdata, submodels = NULL) 12 | rrcov::predict(modelFit, newdata)@classification, 13 | prob = function(modelFit, newdata, submodels = NULL) { 14 | probs <- rrcov::predict(modelFit, newdata)@posterior 15 | colnames(probs) <- names(modelFit@prior) 16 | probs 17 | }, 18 | tags = c("Discriminant Analysis", "Polynomial Model"), 19 | levels = function(x) names(x@prior), 20 | sort = function(x) x) 21 | -------------------------------------------------------------------------------- /models/files/RFlda.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Factor-Based Linear Discriminant Analysis", 2 | library = "HiDimDA", 3 | loop = NULL, 4 | type = c('Classification'), 5 | parameters = data.frame(parameter = c('q'), 6 | class = c('numeric'), 7 | label = c('# Factors')), 8 | grid = function(x, y, len = NULL, search = "grid") { 9 | if(search == "grid") { 10 | out <- data.frame(q = 1:len) 11 | } else { 12 | out <- data.frame(q = unique(sample(1:10, size = len, replace = TRUE))) 13 | } 14 | out 15 | }, 16 | fit = function(x, y, wts, param, lev, last, classProbs, ...) 17 | HiDimDA::RFlda(x, y, q = param$q, maxq = param$q, ...), 18 | predict = function(modelFit, newdata, submodels = NULL) { 19 | out <- predict(modelFit, newdata)$class 20 | out <- modelFit$obsLevels[as.numeric(out)] 21 | out 22 | }, 23 | levels = function(x) x$obsLevels, 24 | prob = NULL, 25 | tags = c("Discriminant Analysis", "Linear Classifier"), 26 | sort = function(x) x[order(x[,1]),]) 27 | -------------------------------------------------------------------------------- /models/files/RSimca.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Robust SIMCA", 2 | library = "rrcovHD", 3 | loop = NULL, 4 | type = c("Classification"), 5 | parameters = data.frame(parameter = 'parameter', 6 | class = "character", 7 | label = 'parameter'), 8 | grid = function(x, y, len = NULL, search = "grid") { 9 | data.frame(parameter = "none") 10 | }, 11 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 12 | require(rrcovHD) 13 | rrcovHD::RSimca(x, y, ...) 14 | }, 15 | predict = function(modelFit, newdata, submodels = NULL) 16 | predict(modelFit, newdata)@classification, 17 | prob = NULL, 18 | notes = paste( 19 | "Unlike other packages used by `train`, the `rrcovHD`", 20 | "package is fully loaded when this model is used." 21 | ), 22 | tags = c('Robust Model', "Linear Classifier"), 23 | levels = function(x) names(x@prior), 24 | sort = function(x) x) 25 | -------------------------------------------------------------------------------- /models/files/amdai.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Adaptive Mixture Discriminant Analysis", 2 | library = "adaptDA", 3 | loop = NULL, 4 | type = c("Classification"), 5 | parameters = data.frame(parameter = "model", 6 | class = "character", 7 | label = "Model Type"), 8 | grid = function(x, y, len = NULL, search = "grid") data.frame(model = "lda"), 9 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 10 | mod <- adaptDA::amdai(x, as.numeric(y), 11 | model = as.character(param$model), ...) 12 | mod$levels <- levels(y) 13 | mod 14 | }, 15 | predict = function(modelFit, newdata, submodels = NULL) { 16 | out <- predict(modelFit, newdata, K = length(modelFit$levels))$cls 17 | factor(modelFit$levels[out], levels = modelFit$levels) 18 | }, 19 | prob = function(modelFit, newdata, submodels = NULL){ 20 | out <- predict(modelFit, newdata, K = length(modelFit$levels))$P 21 | factor(modelFit$levels[out], levels = modelFit$levels) 22 | colnames(out)<- modelFit$obsLevels 23 | out 24 | }, 25 | varImp = NULL, 26 | predictors = function(x, ...) predictors(x$terms), 27 | levels = function(x) if(any(names(x) == "obsLevels")) x$obsLevels else NULL, 28 | tags = c("Discriminant Analysis", "Mixture Model"), 29 | sort = function(x) x) 30 | -------------------------------------------------------------------------------- /models/files/bag.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Bagged Model", 2 | library = "caret", 3 | loop = NULL, 4 | type = c('Regression', 'Classification'), 5 | parameters = data.frame(parameter = c('vars'), 6 | class = c('numeric'), 7 | label = c('#Randomly Selected Predictors')), 8 | grid = function(x, y, len = NULL, search = "grid") 9 | data.frame(vars = ncol(x)), 10 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 11 | out <- caret::bag(x, y, vars = param$vars, ...) 12 | out$xNames <- colnames(x) 13 | out 14 | }, 15 | predict = function(modelFit, newdata, submodels = NULL) 16 | predict(modelFit, newdata), 17 | prob = function(modelFit, newdata, submodels = NULL) 18 | predict(modelFit, newdata, type= "prob"), 19 | predictors = function(x, ...) 20 | x$xNames, 21 | levels = function(x) x$obsLevels, 22 | varImp = NULL, 23 | tags = c("Bagging", "Ensemble Model"), 24 | sort = function(x) x) 25 | -------------------------------------------------------------------------------- /models/files/binda.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Binary Discriminant Analysis", 2 | library = "binda", 3 | loop = NULL, 4 | type = c("Classification"), 5 | parameters = data.frame(parameter = c("lambda.freqs"), 6 | class = c("numeric"), 7 | label = c('Shrinkage Intensity')), 8 | grid = function(x, y, len = NULL, search = "grid"){ 9 | if(search == "grid") { 10 | out <- data.frame(lambda.freqs = seq(0, 1, length = len)) 11 | } else { 12 | out <- data.frame(lambda.freqs = runif(len, min = 0, max = 1)) 13 | } 14 | out 15 | }, 16 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 17 | binda::binda(as.matrix(x), y, lambda.freqs = param$lambda.freqs, ...) 18 | }, 19 | predict = function(modelFit, newdata, submodels = NULL) { 20 | as.character(predict(modelFit, as.matrix(newdata))$class) 21 | }, 22 | prob = function(modelFit, newdata, submodels = NULL){ 23 | predict(modelFit, as.matrix(newdata))$posterior 24 | }, 25 | varImp = NULL, 26 | predictors = function(x, ...) rownames(x$logp0), 27 | levels = function(x) if(any(names(x) == "obsLevels")) x$obsLevels else names(x$logfreqs), 28 | tags = c("Discriminant Analysis", "Two Class Only", "Binary Predictors Only"), 29 | sort = function(x) x) 30 | -------------------------------------------------------------------------------- /models/files/blassoAveraged.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Bayesian Ridge Regression (Model Averaged)", 2 | library = "monomvn", 3 | type = "Regression", 4 | parameters = data.frame(parameter = "parameter", 5 | class = "character", 6 | label = "parameter"), 7 | grid = function(x, y, len = NULL, search = "grid") data.frame(parameter = "none"), 8 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 9 | out <- monomvn::blasso(as.matrix(x), y, ...) 10 | out 11 | }, 12 | predict = function(modelFit, newdata, submodels = NULL) { 13 | if(!is.matrix(newdata)) newdata <- as.matrix(newdata) 14 | out <- modelFit$beta %*% t(newdata) 15 | if(modelFit$icept) out <- out + (matrix(1, ncol = ncol(out), nrow = nrow(out)) * modelFit$mu) 16 | apply(out, 2, mean) 17 | }, 18 | predictors = function(x, s = NULL, ...) { 19 | x$xNames[apply(x$beta, 2, function(x) any(x != 0))] 20 | }, 21 | notes = "This model makes predictions by averaging the predictions based on the posterior estimates of the regression coefficients. While it is possible that some of these posterior estimates are zero for non-informative predictors, the final predicted value may be a function of many (or even all) predictors. ", 22 | tags = c("Linear Regression", "Bayesian Model", "L1 Regularization"), 23 | prob = NULL, 24 | sort = function(x) x) 25 | -------------------------------------------------------------------------------- /models/files/bridge.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Bayesian Ridge Regression", 2 | library = "monomvn", 3 | type = "Regression", 4 | parameters = data.frame(parameter = "parameter", 5 | class = "character", 6 | label = "parameter"), 7 | grid = function(x, y, len = NULL, search = "grid") data.frame(parameter = "none"), 8 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 9 | out <- monomvn::bridge(as.matrix(x), y, ...) 10 | out 11 | }, 12 | predict = function(modelFit, newdata, submodels = NULL) { 13 | if(!is.matrix(newdata)) newdata <- as.matrix(newdata) 14 | out <- modelFit$beta %*% t(newdata) 15 | if(modelFit$icept) out <- out + (matrix(1, ncol = ncol(out), nrow = nrow(out)) * modelFit$mu) 16 | apply(out, 2, mean) 17 | }, 18 | predictors = function(x, s = NULL, ...) { 19 | x$xNames 20 | }, 21 | tags = c("Linear Regression", "Bayesian Model", "L2 Regularization"), 22 | prob = NULL, 23 | sort = function(x) x) 24 | -------------------------------------------------------------------------------- /models/files/brnn.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Bayesian Regularized Neural Networks", 2 | library = "brnn", 3 | type = "Regression", 4 | parameters = data.frame(parameter = 'neurons', 5 | class = "numeric", 6 | label = '# Neurons'), 7 | grid = function(x, y, len = NULL, search = "grid") { 8 | if(search == "grid") { 9 | out <- expand.grid(neurons = 1:len) 10 | } else { 11 | out <- data.frame(neurons = sample(1:20, replace = TRUE, size = len)) 12 | } 13 | out 14 | }, 15 | loop = NULL, 16 | fit = function(x, y, wts, param, lev, last, classProbs, ...) 17 | brnn::brnn(as.matrix(x), y, neurons = param$neurons, ...), 18 | predict = function(modelFit, newdata, submodels = NULL) 19 | predict(modelFit,as.matrix(newdata)), 20 | prob = NULL, 21 | predictors = function(x, s = NULL, ...) 22 | names(x$x_spread), 23 | tags = c("Bayesian Model", "Neural Network", "Regularization"), 24 | prob = NULL, 25 | sort = function(x) x[order(x[,1]),]) 26 | -------------------------------------------------------------------------------- /models/files/gpls.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Generalized Partial Least Squares", 2 | library = "gpls", 3 | loop = NULL, 4 | type = c('Classification'), 5 | parameters = data.frame(parameter = c('K.prov'), 6 | class = c('numeric'), 7 | label = c('#Components')), 8 | grid = function(x, y, len = NULL, search = "grid") { 9 | if(search == "grid") { 10 | out <- data.frame(K.prov =seq(1, len)) 11 | } else { 12 | out <- data.frame(K.prov = unique(sample(1:ncol(x), size = len, replace = TRUE))) 13 | } 14 | out 15 | }, 16 | fit = function(x, y, wts, param, lev, last, classProbs, ...) 17 | gpls::gpls(x, y, K.prov = param$K.prov, ...), 18 | predict = function(modelFit, newdata, submodels = NULL) 19 | predict(modelFit, newdata)$class, 20 | prob = function(modelFit, newdata, submodels = NULL) { 21 | out <- predict(modelFit, newdata)$predicted 22 | out <- cbind(out, 1-out) 23 | colnames(out) <- modelFit$obsLevels 24 | out 25 | }, 26 | predictors = function(x, ...) { 27 | out <- if(hasTerms(x)) predictors(x$terms) else colnames(x$data$x.order) 28 | out[!(out %in% "Intercept")] 29 | }, 30 | tags = c("Logistic Regression", "Partial Least Squares", "Linear Classifier"), 31 | sort = function(x) x[order(x[,1]),], 32 | levels = function(x) x$obsLevels) 33 | -------------------------------------------------------------------------------- /models/files/icr.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Independent Component Regression", 2 | library = "fastICA", 3 | loop = NULL, 4 | type = c('Regression'), 5 | parameters = data.frame(parameter = c('n.comp'), 6 | class = c('numeric'), 7 | label = c('#Components')), 8 | grid = function(x, y, len = NULL, search = "grid") { 9 | if(search == "grid") { 10 | out <- data.frame(n.comp = 1:len) 11 | } else { 12 | out <- data.frame(n.comp = unique(sample(1:ncol(x), size = len, replace = TRUE))) 13 | } 14 | out 15 | }, 16 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 17 | caret::icr(x, y, n.comp = param$n.comp, ...) 18 | }, 19 | predict = function(modelFit, newdata, submodels = NULL) predict(modelFit, newdata), 20 | prob = NULL, 21 | tags = c("Linear Regression", "Feature Extraction"), 22 | sort = function(x) x[order(x[,1]),]) 23 | -------------------------------------------------------------------------------- /models/files/lda.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Linear Discriminant Analysis", 2 | library = "MASS", 3 | loop = NULL, 4 | type = "Classification", 5 | parameters = data.frame(parameter = "parameter", 6 | class = "character", 7 | label = "parameter"), 8 | grid = function(x, y, len = NULL, search = "grid") data.frame(parameter = "none"), 9 | fit = function(x, y, wts, param, lev, last, classProbs, ...) MASS::lda(x, y, ...) , 10 | predict = function(modelFit, newdata, submodels = NULL) 11 | predict(modelFit, newdata)$class, 12 | prob = function(modelFit, newdata, submodels = NULL) 13 | predict(modelFit, newdata)$posterior, 14 | predictors = function(x, ...) if(hasTerms(x)) predictors(x$terms) else colnames(x$means), 15 | tags = c("Discriminant Analysis", "Linear Classifier"), 16 | levels = function(x) names(x$prior), 17 | sort = function(x) x) 18 | -------------------------------------------------------------------------------- /models/files/lmStepAIC.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Linear Regression with Stepwise Selection", 2 | library = "MASS", 3 | loop = NULL, 4 | type = "Regression", 5 | parameters = data.frame(parameter = "parameter", 6 | class = "character", 7 | label = "parameter"), 8 | grid = function(x, y, len = NULL, search = "grid") data.frame(parameter = "none"), 9 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 10 | dat <- if(is.data.frame(x)) x else as.data.frame(x, stringsAsFactors = TRUE) 11 | dat$.outcome <- y 12 | if(!is.null(wts)) 13 | { 14 | out <- MASS::stepAIC(lm(.outcome ~ ., data = dat, weights = wts), ...) 15 | } else out <- MASS::stepAIC(lm(.outcome ~ ., data = dat), ...) 16 | out 17 | }, 18 | predict = function(modelFit, newdata, submodels = NULL) { 19 | if(!is.data.frame(newdata)) newdata <- as.data.frame(newdata, stringsAsFactors = TRUE) 20 | predict(modelFit, newdata) 21 | }, 22 | prob = NULL, 23 | tags = c("Linear Regression", "Feature Selection Wrapper", "Accepts Case Weights"), 24 | sort = function(x) x) 25 | -------------------------------------------------------------------------------- /models/files/loclda.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Localized Linear Discriminant Analysis", 2 | library = "klaR", 3 | loop = NULL, 4 | type = "Classification", 5 | parameters = data.frame(parameter = "k", 6 | class = "numeric", 7 | label = "#Nearest Neighbors"), 8 | grid = function(x, y, len = NULL, search = "grid") { 9 | min_p <- ncol(x)/nrow(x) + .05 10 | p_seq <- seq(min_p , min(.9, min_p + 1/3), length = len) 11 | if(search == "grid") { 12 | out <- data.frame(k = floor(p_seq*nrow(x))) 13 | } else { 14 | by_val <- if(is.factor(y)) length(levels(y)) else 1 15 | out <- data.frame(k = floor(runif(len, min = nrow(x)*min_p, max = nrow(x)*min(.9, min_p + 1/3)))) 16 | } 17 | out 18 | }, 19 | fit = function(x, y, wts, param, lev, last, classProbs, ...) 20 | klaR::loclda(x, y, k = floor(param$k), ...) , 21 | predict = function(modelFit, newdata, submodels = NULL) 22 | predict(modelFit, newdata)$class, 23 | prob = function(modelFit, newdata, submodels = NULL) 24 | predict(modelFit, newdata)$posterior, 25 | predictors = function(x, ...) if(hasTerms(x)) predictors(x$terms) else colnames(x$means), 26 | tags = c("Discriminant Analysis", "Linear Classifier"), 27 | levels = function(x) names(x$prior), 28 | sort = function(x) x) 29 | -------------------------------------------------------------------------------- /models/files/lvq.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Learning Vector Quantization", 2 | library = "class", 3 | loop = NULL, 4 | type = "Classification", 5 | parameters = data.frame(parameter = c("size", "k"), 6 | class = c("numeric", "numeric"), 7 | label = c('Codebook Size', '#Prototypes')), 8 | grid = function(x, y, len = NULL, search = "grid"){ 9 | p <- ncol(x) 10 | ng <- length(levels(y)) 11 | n <- nrow(x) 12 | tmp <- min(round(0.4*ng*(ng-1 + p/2),0), n) 13 | if(search == "grid") { 14 | out <- expand.grid(size = floor(seq(tmp, 2*tmp, length = len)), 15 | k = -4 + (1:len)*5) 16 | out$size <- floor(out$size) 17 | } else { 18 | out <- data.frame(size = sample(tmp:(2*tmp), size = len, replace = TRUE), 19 | k = sample(1:(nrow(x) - 2), size = len, replace = TRUE)) 20 | } 21 | out <- subset(out, size < n & k < n) 22 | out 23 | }, 24 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 25 | class::lvq3(x, y, class::lvqinit(x, y, size = param$size, k = min(param$k, nrow(x)-length(levels(y)))), ...) 26 | }, 27 | predict = function(modelFit, newdata, submodels = NULL) 28 | class::lvqtest(modelFit , newdata), 29 | levels = function(x) x$obsLevels, 30 | prob = NULL, 31 | tags = "Prototype Models", 32 | sort = function(x) x[order(-x$k, -x$size),]) 33 | -------------------------------------------------------------------------------- /models/files/mda.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Mixture Discriminant Analysis", 2 | library = "mda", 3 | loop = NULL, 4 | type = c('Classification'), 5 | parameters = data.frame(parameter = c('subclasses'), 6 | class = c('numeric'), 7 | label = c('#Subclasses Per Class')), 8 | grid = function(x, y, len = NULL, search = "grid") 9 | data.frame(subclasses = (1:len) + 1), 10 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 11 | dat <- if(is.data.frame(x)) x else as.data.frame(x, stringsAsFactors = TRUE) 12 | dat$.outcome <- y 13 | mda::mda(as.formula(".outcome ~ ."), data = dat, 14 | subclasses = param$subclasses, ...) 15 | }, 16 | predict = function(modelFit, newdata, submodels = NULL) 17 | predict(modelFit, newdata), 18 | prob = function(modelFit, newdata, submodels = NULL) 19 | predict(modelFit, newdata, type = "posterior"), 20 | predictors = function(x, ...) predictors(x$terms), 21 | levels = function(x) x$obsLevels, 22 | tags = c("Discriminant Analysis", "Mixture Model"), 23 | sort = function(x) x[order(x[,1]),]) 24 | -------------------------------------------------------------------------------- /models/files/nb.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Naive Bayes", 2 | library = "klaR", 3 | loop = NULL, 4 | type = c('Classification'), 5 | parameters = data.frame(parameter = c('fL', 'usekernel', "adjust"), 6 | class = c('numeric', 'logical', "numeric"), 7 | label = c('Laplace Correction', 'Distribution Type', "Bandwidth Adjustment")), 8 | grid = function(x, y, len = NULL, search = "grid") 9 | expand.grid(usekernel = c(TRUE, FALSE), fL = 0, adjust = 1), 10 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 11 | if(param$usekernel) { 12 | out <- klaR::NaiveBayes(x, y, usekernel = TRUE, fL = param$fL, adjust = param$adjust, ...) 13 | } else out <- klaR::NaiveBayes(x, y, usekernel = FALSE, fL = param$fL, ...) 14 | out 15 | }, 16 | predict = function(modelFit, newdata, submodels = NULL) { 17 | if(!is.data.frame(newdata)) newdata <- as.data.frame(newdata, stringsAsFactors = TRUE) 18 | predict(modelFit , newdata)$class 19 | }, 20 | prob = function(modelFit, newdata, submodels = NULL) { 21 | if(!is.data.frame(newdata)) newdata <- as.data.frame(newdata, stringsAsFactors = TRUE) 22 | predict(modelFit, newdata, type = "raw")$posterior 23 | }, 24 | predictors = function(x, ...) if(hasTerms(x)) predictors(x$terms) else x$varnames, 25 | tags = c("Bayesian Model"), 26 | levels = function(x) x$levels, 27 | sort = function(x) x[order(x[,1]),]) 28 | -------------------------------------------------------------------------------- /models/files/nnls.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Non-Negative Least Squares", 2 | library = "nnls", 3 | loop = NULL, 4 | type = "Regression", 5 | parameters = data.frame(parameter = "parameter", 6 | class = "character", 7 | label = "parameter"), 8 | grid = function(x, y, len = NULL, search = "grid") data.frame(parameter = "none"), 9 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 10 | if(!is.matrix(x)) x <- as.matrix(x) 11 | out <- nnls::nnls(x, y) 12 | names(out$x) <- colnames(x) 13 | out 14 | }, 15 | predict = function(modelFit, newdata, submodels = NULL) { 16 | if(!is.matrix(newdata)) newdata <- as.matrix(newdata) 17 | out <- newdata %*% modelFit$x 18 | out[,1] 19 | }, 20 | prob = NULL, 21 | predictors = function(x, ...) names(x$x)[x$x != 0], 22 | tags = "Linear Regression", 23 | varImp = function(object, ...) { 24 | out <- data.frame(Overall = object$x) 25 | rownames(out) <- names(object$x) 26 | out 27 | out 28 | }, 29 | sort = function(x) x) 30 | -------------------------------------------------------------------------------- /models/files/null.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Non-Informative Model", 2 | library = NULL, 3 | type = c("Classification", "Regression"), 4 | parameters = data.frame(parameter = "parameter", 5 | class = "character", 6 | label = "parameter"), 7 | grid = function(x, y, len = NULL, search = "grid") data.frame(parameter = "none"), 8 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 9 | nullModel(y = y, ...) 10 | }, 11 | predict = function(modelFit, newdata, submodels = NULL) { 12 | predict(modelFit, newdata) 13 | }, 14 | prob = function(modelFit, newdata, submodels = NULL) { 15 | predict(modelFit, newdata, type = "prob") 16 | }, 17 | levels = function(x) x$levels, 18 | tags = NULL, 19 | notes = paste("Since this model always predicts", 20 | "the same value, R-squared values", 21 | "will always be estimated to be NA."), 22 | sort = function(x) x) 23 | -------------------------------------------------------------------------------- /models/files/ppr.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Projection Pursuit Regression", 2 | library = NULL, 3 | loop = NULL, 4 | type = c('Regression'), 5 | parameters = data.frame(parameter = c('nterms'), 6 | class = c('numeric'), 7 | label = c('# Terms')), 8 | grid = function(x, y, len = NULL, search = "grid") data.frame(nterms = 1:len), 9 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 10 | if(!is.null(wts)) 11 | { 12 | out <- ppr(as.matrix(x), 13 | y, 14 | weights = wts, 15 | nterms = param$nterms, 16 | ...) 17 | } else { 18 | out <- ppr(as.matrix(x), y, nterms = param$nterms, ...) 19 | } 20 | out 21 | }, 22 | predict = function(modelFit, newdata, submodels = NULL) predict(modelFit, newdata), 23 | prob = NULL, 24 | predictors = function(x, ...) x$xnames, 25 | tags = c("Feature Extraction", "Accepts Case Weights"), 26 | sort = function(x) x[order(x[,1]),]) 27 | -------------------------------------------------------------------------------- /models/files/qda.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Quadratic Discriminant Analysis", 2 | library = "MASS", 3 | loop = NULL, 4 | type = "Classification", 5 | parameters = data.frame(parameter = "parameter", 6 | class = "character", 7 | label = "parameter"), 8 | grid = function(x, y, len = NULL, search = "grid") data.frame(parameter = "none"), 9 | fit = function(x, y, wts, param, lev, last, classProbs, ...) MASS::qda(x, y, ...) , 10 | predict = function(modelFit, newdata, submodels = NULL) 11 | predict(modelFit, newdata)$class, 12 | prob = function(modelFit, newdata, submodels = NULL) 13 | predict(modelFit, newdata)$posterior, 14 | predictors = function(x, ...) if(hasTerms(x)) predictors(x$terms) else colnames(x$means), 15 | tags = c("Discriminant Analysis", "Polynomial Model"), 16 | levels = function(x) names(x$prior), 17 | sort = function(x) x) 18 | -------------------------------------------------------------------------------- /models/files/qrf.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Quantile Random Forest", 2 | library = "quantregForest", 3 | loop = NULL, 4 | type = c("Regression"), 5 | parameters = data.frame(parameter = "mtry", 6 | class = "numeric", 7 | label = "#Randomly Selected Predictors"), 8 | grid = function(x, y, len = NULL, search = "grid"){ 9 | if(search == "grid") { 10 | out <- data.frame(mtry = caret::var_seq(p = ncol(x), 11 | classification = is.factor(y), 12 | len = len)) 13 | } else { 14 | out <- data.frame(mtry = unique(sample(1:ncol(x), size = len, replace = TRUE))) 15 | } 16 | out 17 | }, 18 | fit = function(x, y, wts, param, lev, last, classProbs, ...) 19 | quantregForest::quantregForest(x, y, mtry = min(param$mtry, ncol(x)), ...), 20 | predict = function(modelFit, newdata, submodels = NULL) { 21 | out <- predict(modelFit, newdata, what = 0.5) 22 | if(is.matrix(out)) out <- out[,1] 23 | out 24 | }, 25 | prob = NULL, 26 | tags = c("Random Forest", "Ensemble Model", "Bagging", 27 | "Implicit Feature Selection", "Quantile Regression", 28 | "Robust Model"), 29 | sort = function(x) x[order(x[,1]),]) 30 | -------------------------------------------------------------------------------- /models/files/qrnn.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Quantile Regression Neural Network", 2 | library = "qrnn", 3 | loop = NULL, 4 | type = c('Regression'), 5 | parameters = data.frame(parameter = c('n.hidden', 'penalty', 'bag'), 6 | class = c('numeric', 'numeric', 'logical'), 7 | label = c('#Hidden Units', ' Weight Decay', 'Bagged Models?')), 8 | grid = function(x, y, len = NULL, search = "grid") expand.grid(n.hidden = ((1:len) * 2) - 1, 9 | penalty = c(0, 10 ^ seq(-1, -4, length = len - 1)), 10 | bag = FALSE), 11 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 12 | qrnn::qrnn.fit(as.matrix(x), matrix(y), 13 | n.hidden = param$n.hidden, 14 | print.level = 0, 15 | penalty = param$penalty, 16 | bag= param$bag, 17 | ...) 18 | }, 19 | predict = function(modelFit, newdata, submodels = NULL) 20 | qrnn::qrnn.predict(as.matrix(newdata), modelFit)[,1], 21 | prob = NULL, 22 | tags = c("Neural Network", "L2 Regularization", "Quantile Regression", "Bagging", 23 | "Ensemble Model", "Robust Model"), 24 | sort = function(x) x[order(x$n.hidden, -x$penalty),]) 25 | -------------------------------------------------------------------------------- /models/files/rFerns.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Random Ferns", 2 | library = "rFerns", 3 | loop = NULL, 4 | type = c('Classification'), 5 | parameters = data.frame(parameter = c('depth'), 6 | class = c('numeric'), 7 | label = c('Fern Depth')), 8 | grid = function(x, y, len = NULL, search = "grid") { 9 | if(search == "grid") { 10 | out <- data.frame(depth = unique(floor(seq(1, 16, length = len)))) 11 | } else { 12 | out <- data.frame(depth = unique(sample(1:16, size = len, replace = TRUE))) 13 | } 14 | out 15 | }, 16 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 17 | if(!is.data.frame(x) | inherits(x, "tbl_df")) 18 | x <- as.data.frame(x, stringsAsFactors = TRUE) 19 | rFerns::rFerns(x, y, depth = param$depth, ...) 20 | }, 21 | predict = function(modelFit, newdata, submodels = NULL) { 22 | if(!is.data.frame(newdata) | inherits(newdata, "tbl_df")) 23 | newdata <- as.data.frame(newdata, stringsAsFactors = TRUE) 24 | predict(modelFit, newdata) 25 | }, 26 | levels = function(x) x$obsLevels, 27 | prob = NULL, 28 | tags = c("Random Forest", "Ensemble Model", "Bagging", "Implicit Feature Selection"), 29 | sort = function(x) x[order(x[,1]),]) 30 | -------------------------------------------------------------------------------- /models/files/rocc.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "ROC-Based Classifier", 2 | library = "rocc", 3 | loop = NULL, 4 | type = c('Classification'), 5 | parameters = data.frame(parameter = c('xgenes'), 6 | class = c('numeric'), 7 | label = c('#Variables Retained')), 8 | grid = function(x, y, len = NULL, search = "grid") { 9 | if(search == "grid") { 10 | out <- data.frame(xgenes = caret::var_seq(p = ncol(x), 11 | classification = is.factor(y), 12 | len = len)) 13 | } else { 14 | out <- data.frame(xgenes = unique(sample(1:ncol(x), size = len, replace = TRUE))) 15 | } 16 | out 17 | }, 18 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 19 | newY <- factor(ifelse(y == levels(y)[1], 1, 0), levels = c("0", "1")) 20 | rocc::tr.rocc(g = t(as.matrix(x)), out = newY, xgenes = param$xgenes) 21 | }, 22 | predict = function(modelFit, newdata, submodels = NULL) { 23 | tmp <- rocc::p.rocc(modelFit, t(as.matrix(newdata))) 24 | factor(ifelse(tmp == "1", modelFit$obsLevels[1], modelFit$obsLevels[2]), 25 | levels = modelFit$obsLevels) 26 | }, 27 | levels = function(x) x$obsLevels, 28 | prob = NULL, 29 | predictors = function(x, ...) x$genes, 30 | tags = "ROC Curves", 31 | sort = function(x) x[order(x$xgenes),]) 32 | -------------------------------------------------------------------------------- /models/files/rqlasso.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Quantile Regression with LASSO penalty", 2 | library = "rqPen", 3 | type = "Regression", 4 | parameters = data.frame(parameter = 'lambda', 5 | class = "numeric", 6 | label = 'L1 Penalty'), 7 | grid = function(x, y, len = NULL, search = "grid"){ 8 | if(search == "grid") { 9 | out <- expand.grid(lambda = c(10 ^ seq(-1, -4, length = len))) 10 | } else { 11 | out <- data.frame(lambda = 10^runif(len, min = -5, 1)) 12 | } 13 | out 14 | }, 15 | loop = NULL, 16 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 17 | rqPen::rq.lasso.fit(as.matrix(x), y, lambda = param$lambda, ...) 18 | }, 19 | predict = function(modelFit, newdata, submodels = NULL) { 20 | predict(modelFit, newx = as.matrix(newdata))[,1] 21 | }, 22 | predictors = function(x, ...) { 23 | out <- coef(x) 24 | out <- out[names(out) != "intercept"] 25 | names(out)[out != 0] 26 | }, 27 | tags = c("Linear Regression", "Quantile Regression", "Implicit Feature Selection", "L1 Regularization"), 28 | prob = NULL, 29 | sort = function(x) x[order(-x$lambda),]) 30 | -------------------------------------------------------------------------------- /models/files/rvmLinear.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Relevance Vector Machines with Linear Kernel", 2 | library = "kernlab", 3 | loop = NULL, 4 | type = "Regression", 5 | parameters = data.frame(parameter = "parameter", 6 | class = "character", 7 | label = "parameter"), 8 | grid = function(x, y, len = NULL, search = "grid") data.frame(parameter = "none"), 9 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 10 | kernlab:::rvm(x = as.matrix(x), y = y, 11 | kernel = kernlab::vanilladot(), 12 | ...) 13 | }, 14 | predict = function(modelFit, newdata, submodels = NULL) 15 | kernlab::predict(modelFit, newdata), 16 | prob = NULL, 17 | predictors = function(x, ...) { 18 | if(hasTerms(x) & !is.null(x@terms)) 19 | { 20 | out <- predictors.terms(x@terms) 21 | } else { 22 | out <- colnames(attr(x, "xmatrix")) 23 | } 24 | if(is.null(out)) out <- names(attr(x, "scaling")$x.scale$`scaled:center`) 25 | if(is.null(out)) out <-NA 26 | out 27 | }, 28 | tags = c("Kernel Method", "Relevance Vector Machines", "Linear Regression", 29 | "Robust Methods"), 30 | sort = function(x) x) 31 | -------------------------------------------------------------------------------- /models/files/slda.R: -------------------------------------------------------------------------------- 1 | modelInfo <- list(label = "Stabilized Linear Discriminant Analysis", 2 | library = c("ipred"), 3 | loop = NULL, 4 | type = c("Classification"), 5 | parameters = data.frame(parameter = c('parameter'), 6 | class = c("character"), 7 | label = c('none')), 8 | grid = function(x, y, len = NULL, search = "grid") 9 | data.frame(parameter = "none"), 10 | fit = function(x, y, wts, param, lev, last, classProbs, ...) { 11 | dat <- if(is.data.frame(x)) x else as.data.frame(x, stringsAsFactors = TRUE) 12 | dat$.outcome <- y 13 | ipred::slda(.outcome ~ ., data = dat, ...) 14 | }, 15 | predict = function(modelFit, newdata, submodels = NULL) { 16 | if(!is.data.frame(newdata)) newdata <- as.data.frame(newdata, stringsAsFactors = TRUE) 17 | predict(modelFit, newdata)$class 18 | }, 19 | prob = function(modelFit, newdata, submodels = NULL) { 20 | if(!is.data.frame(newdata)) newdata <- as.data.frame(newdata, stringsAsFactors = TRUE) 21 | predict(modelFit, newdata)$posterior 22 | }, 23 | levels = function(x) x$obsLevels, 24 | predictors = function(x, ...) if(hasTerms(x)) predictors(x$terms) else predictors(x$mylda), 25 | tags = c("Discriminant Analysis", "Linear Classifier"), 26 | sort = function(x) x) 27 | -------------------------------------------------------------------------------- /models/parseModels.R: -------------------------------------------------------------------------------- 1 | setwd("~/github/caret/models/files") 2 | 3 | modelFiles <- list.files(pattern = "\\.R$") 4 | 5 | models <- vector(mode = "list", length = length(modelFiles)) 6 | names(models) <- gsub("\\.R$", "", modelFiles) 7 | 8 | for(i in seq(along = modelFiles)) { 9 | source(modelFiles[i]) 10 | modelInfo <- lapply(modelInfo, rlang::zap_srcref) 11 | models[[i]] <- modelInfo 12 | rm(modelInfo) 13 | } 14 | 15 | 16 | 17 | save(models, file = "../../pkg/caret/inst/models/models.RData", version = 2) 18 | 19 | # cat("\nYou can update your caret installation using the command:\n\n") 20 | # cat(sprintf(" cp models.RData %s/.\n", system.file("models", package="caret"))) 21 | -------------------------------------------------------------------------------- /models/sampling_methods.R: -------------------------------------------------------------------------------- 1 | sampling_methods <- list( 2 | down = function(x, y) 3 | downSample(x, y, list = TRUE), 4 | up = function(x, y) 5 | upSample(x, y, list = TRUE), 6 | smote = function(x, y) { 7 | checkInstall("themis") 8 | library(themis) 9 | dat <- 10 | if (is.data.frame(x)) { 11 | if (inherits(x, "tbl_df")) 12 | as.data.frame(x) 13 | else 14 | x 15 | } 16 | else 17 | as.data.frame(x) 18 | dat$.y <- y 19 | dat <- themis::smote(dat, var = ".y") 20 | list(x = dat[,!grepl(".y", colnames(dat), fixed = TRUE), drop = FALSE], 21 | y = dat$.y) 22 | }, 23 | rose = function(x, y) { 24 | checkInstall("ROSE") 25 | library(ROSE) 26 | dat <- 27 | if (is.data.frame(x)) 28 | x 29 | else 30 | as.data.frame(x) 31 | dat$.y <- y 32 | dat <- ROSE(.y ~ ., data = dat)$data 33 | list(x = dat[,!grepl(".y", colnames(dat), fixed = TRUE), drop = FALSE], 34 | y = dat$.y) 35 | } 36 | ) 37 | save(sampling_methods, file = "inst/models/sampling.RData", version = 2) 38 | -------------------------------------------------------------------------------- /pkg/caret/.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^\.travis\.yml$ 4 | ^revdep$ 5 | ^\.github/workflows/R-CMD-check\.yaml$ 6 | ^codecov\.yml$ 7 | ^\.github$ 8 | -------------------------------------------------------------------------------- /pkg/caret/.Rinstignore: -------------------------------------------------------------------------------- 1 | vignettes/rocVarImp.pdf 2 | vignettes/plsVarImp.pdf 3 | vignettes/filteredPred.pdf 4 | vignettes/allPred.pdf 5 | vignettes/speedup.pdf 6 | vignettes/min.pdf 7 | vignettes/algorithm.tex 8 | -------------------------------------------------------------------------------- /pkg/caret/.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /pkg/caret/R/basic2x2Stats.R: -------------------------------------------------------------------------------- 1 | basic2x2Stats <- function(x, y, pos, neg) 2 | { 3 | out <- vector(length = 4, mode = "numeric") 4 | out[1] <- sensitivity(x, y, pos) 5 | out[2] <- specificity(x, y, neg) 6 | out[3] <- posPredValue(x, y, pos) 7 | out[4] <- negPredValue(x, y, neg) 8 | names(out) <- c("Sensitivity", "Specificity", "Pos Pred Value", "Neg Pred Value") 9 | out 10 | } 11 | 12 | -------------------------------------------------------------------------------- /pkg/caret/R/classLevels.R: -------------------------------------------------------------------------------- 1 | 2 | #' @export 3 | levels.train <- function(x, ...) { 4 | if(any(names(x) == "levels")) { 5 | out <- x$levels 6 | attributes(out) <- NULL 7 | } else { 8 | if(x$modelType == "Classification") { 9 | if(!isS4(x$finalModel) && !is.null(x$finalModel$obsLevels)) 10 | return(x$finalModel$obsLevels) 11 | if(is.null(x$modelInfo)) { 12 | code <- getModelInfo(x$method, regex = FALSE)[[1]] 13 | } else code <- x$modelInfo 14 | if(!is.null(code$levels)){ 15 | checkInstall(code$library) 16 | for(i in seq(along.with = code$library)) 17 | do.call("requireNamespaceQuietStop", list(package = code$library[i])) 18 | out <- code$levels(x$finalModel, ...) 19 | } else out <- NULL 20 | } else out <- NULL 21 | } 22 | out 23 | } 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /pkg/caret/R/createResample.R: -------------------------------------------------------------------------------- 1 | 2 | #' @rdname createDataPartition 3 | #' @export 4 | createResample <- function(y, times = 10, list = TRUE) { 5 | if (inherits(y, "Surv")) 6 | y <- y[, "time"] 7 | trainIndex <- matrix(0, ncol = times, nrow = length(y)) 8 | out <- apply( 9 | trainIndex, 2, 10 | function(data) { 11 | index <- seq(along.with = data) 12 | out <- 13 | sort(sample(index, size = length(index), replace = TRUE)) 14 | out 15 | } 16 | ) 17 | 18 | if (list) { 19 | out <- as.data.frame(out, stringsAsFactors = TRUE) 20 | attributes(out) <- NULL 21 | names(out) <- prettySeq(out) 22 | } else { 23 | colnames(out) <- prettySeq(1:ncol(out)) 24 | } 25 | 26 | out 27 | } 28 | 29 | -------------------------------------------------------------------------------- /pkg/caret/R/diag.R: -------------------------------------------------------------------------------- 1 | # File src/library/stats/R/contrast.R 2 | # Part of the R package, http://www.R-project.org 3 | # 4 | # Copyright (C) 1995-2012 The R Core Team 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # A copy of the GNU General Public License is available at 17 | # http://www.r-project.org/Licenses/ 18 | 19 | ## a fast version of diag(n, .) / sparse-Diagonal() + dimnames 20 | ## Originally .Diag in stats:contrast.R 21 | 22 | .RDiag <- function (nms, sparse) { 23 | n <- as.integer(length(nms)) 24 | d <- c(n, n) 25 | dn <- list(nms, nms) 26 | # if (sparse) { 27 | # requireNamespace("Matrix", quietly = TRUE) 28 | # new("ddiMatrix", diag = "U", Dim = d, Dimnames = dn) 29 | # } 30 | # else 31 | array(c(rep.int(c(1, numeric(n)), n - 1L), 1), d, dn) 32 | } -------------------------------------------------------------------------------- /pkg/caret/R/getTrainPerf.R: -------------------------------------------------------------------------------- 1 | #' @export 2 | getTrainPerf <- function(x) { 3 | bestPerf <- x$bestTune 4 | colnames(bestPerf) <- gsub("^\\.", "", colnames(bestPerf)) 5 | out <- merge(x$results, bestPerf) 6 | out <- out[, colnames(out) %in% x$perfNames, drop = FALSE] 7 | colnames(out) <- paste("Train", colnames(out), sep = "") 8 | out$method <- x$method 9 | out 10 | } 11 | 12 | -------------------------------------------------------------------------------- /pkg/caret/R/predict.PLS.R: -------------------------------------------------------------------------------- 1 | 2 | #' @export 3 | predict.PLS <- function(object, newdata, 4 | ncomp = NULL, 5 | type = ifelse(object$isRegression, "response", "class"), ...) 6 | { 7 | 8 | if(is.null(ncomp) & !is.null(object$bestIter$.ncomp)) ncomp <- object$bestIter$.ncomp 9 | 10 | if(is.null(ncomp)) stop("the number of components must be given") 11 | 12 | # adapted from the pls package 13 | if(object$isRegression & c(type %in% c("class", "prob"))) 14 | stop("cannot get a class estimate if the original y was not a factor") 15 | 16 | if(!(type %in% c("response", "class", "prob"))) 17 | stop("type must be either response, class or prob") 18 | 19 | if(missing(newdata)) newdata <- object$x 20 | if(!is.matrix(newdata)) newdata <- as.matrix(newdata) 21 | 22 | # from coef.mvr in pls package 23 | B <- object$coefficients[, , 1:ncomp, drop = FALSE] 24 | dB <- dim(B) 25 | dB[1] <- dB[1] + 1 26 | dnB <- dimnames(B) 27 | dnB[[1]] <- c("(Intercept)", dnB[[1]]) 28 | BInt <- array(dim = dB, dimnames = dnB) 29 | BInt[-1, , ] <- B 30 | for (i in seq(along.with = 1:ncomp)) BInt[1, , i] <- object$Ymeans - object$Xmeans %*% B[, , i] 31 | B <- BInt 32 | # stop 33 | 34 | # from predict.mvr in pls package 35 | dPred <- dim(B) 36 | dPred[1] <- dim(newdata)[1] 37 | dnPred <- dimnames(B) 38 | dnPred[1] <- dimnames(newdata)[1] 39 | pred <- array(dim = dPred, dimnames = dnPred) 40 | predY <- sweep(newdata %*% B[-1, , ncomp], 2, B[1, , ncomp], "+") 41 | # stop 42 | 43 | out <- switch( 44 | type, 45 | response = predY, 46 | class = 47 | { 48 | classNum <- apply(predY, 1, which.max) 49 | factor(object$yLevels[classNum], levels = object$yLevels) 50 | }, 51 | # use softmax technique here 52 | prob = t(apply(predY, 1, function(data) exp(data)/sum(exp(data))))) 53 | 54 | out 55 | } 56 | -------------------------------------------------------------------------------- /pkg/caret/R/predictionFunction.R: -------------------------------------------------------------------------------- 1 | #' @rdname caret-internal 2 | #' @importFrom stats predict 3 | #' @export 4 | predictionFunction <- function(method, modelFit, newdata, preProc = NULL, param = NULL) 5 | { 6 | if(!is.null(newdata) && !is.null(preProc)) newdata <- predict(preProc, newdata) 7 | out <- method$predict(modelFit = modelFit, 8 | newdata = newdata, 9 | submodels = param) 10 | ## TODO convert to character with classification 11 | out 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /pkg/caret/R/print.mars.R: -------------------------------------------------------------------------------- 1 | #' @export 2 | print.bmars <- function (x, ...) 3 | { 4 | cat("\nCall:\n", deparse(x$call), "\n\n", sep = "") 5 | if(!is.null(x$x))cat("Data:\n # variables:\t", dim(x$x)[2], "\n # samples:\t", dim(x$x)[1], "\n") 6 | cat( 7 | "\nModel:", 8 | "\n B: \t", x$B, 9 | "\n degree: \t", x$fit[[1]]$degree, 10 | "\n nk: \t", x$fit[[1]]$nk, 11 | "\n penalty: \t", x$fit[[1]]$penalty, 12 | "\n threshold:\t", x$fit[[1]]$thresh, "\n") 13 | 14 | cat("\n") 15 | invisible(x) 16 | } 17 | 18 | -------------------------------------------------------------------------------- /pkg/caret/R/print.varImp.train.R: -------------------------------------------------------------------------------- 1 | #' @method print varImp.train 2 | #' @export 3 | "print.varImp.train" <- 4 | function(x, top = min(20, dim(x$importance)[1]), digits = max(3, getOption("digits") - 3), ...) 5 | { 6 | cat(x$model, "variable importance\n\n") 7 | 8 | printObj <- sortImp(x, top) 9 | 10 | if(dim(x$importance)[2] > 2) 11 | cat(" variables are sorted by maximum importance across the classes\n") 12 | 13 | if(top < dim(x$importance)[1]) 14 | cat(" only ", top, " most important variables shown (out of ", dim(x$importance)[1], ")\n\n", sep = "") 15 | 16 | if(dim(printObj)[2] == 2) 17 | { 18 | printObj <- printObj[,1,drop = FALSE] 19 | names(printObj) <- "Importance" 20 | } 21 | print(printObj, digits = digits, ...) 22 | invisible(x) 23 | } 24 | 25 | -------------------------------------------------------------------------------- /pkg/caret/R/probFunction.R: -------------------------------------------------------------------------------- 1 | #' @rdname caret-internal 2 | #' @export 3 | probFunction <- function(method, modelFit, newdata = NULL, preProc = NULL, param = NULL) 4 | { 5 | if(!is.null(newdata) && !is.null(preProc)) newdata <- predict(preProc, newdata) 6 | 7 | obsLevels <- levels(modelFit) 8 | 9 | classProb <- method$prob(modelFit = modelFit, 10 | newdata = newdata, 11 | submodels = param) 12 | if(!is.data.frame(classProb) & is.null(param)) 13 | { 14 | classProb <- as.data.frame(classProb, stringsAsFactors = TRUE) 15 | if(!is.null(obsLevels)) classprob <- classProb[, obsLevels] 16 | } 17 | classProb 18 | } 19 | -------------------------------------------------------------------------------- /pkg/caret/R/resampleWrapper.R: -------------------------------------------------------------------------------- 1 | #' @rdname caret-internal 2 | #' @export 3 | resampleWrapper <- function(x, ind) 4 | { 5 | out <- rep(NA, dim(x$data)[1]) 6 | trainData <- x$data 7 | x$data <- x$data[ind,] 8 | tmpModelFit <- do.call(createModel, x) 9 | outBagData <- trainData[-ind, ] 10 | outBagData$.outcome <- NULL 11 | 12 | out[-ind] <- if(is.factor(x$data$.outcome)) 13 | { 14 | as.character(predictionFunction(x$method, tmpModelFit, outBagData)) 15 | } else { 16 | predictionFunction(x$method, tmpModelFit, outBagData) 17 | } 18 | out 19 | } 20 | 21 | -------------------------------------------------------------------------------- /pkg/caret/R/sortImp.R: -------------------------------------------------------------------------------- 1 | #' @rdname caret-internal 2 | #' @importFrom stats runif 3 | #' @export 4 | sortImp <- function(object, top) 5 | { 6 | 7 | if(object$calledFrom == "varImp") 8 | { 9 | best <- switch( 10 | object$model, 11 | pam = "maxabs", 12 | "max") 13 | } else { 14 | best <- "max" 15 | } 16 | 17 | featureRank <- switch(best, 18 | max = rank(-apply(object$importance, 1, max, na.rm = TRUE)), 19 | min = rank(apply(object$importance, 1, min, na.rm = TRUE)), 20 | maxabs = rank(-apply(abs(object$importance), 1, max, na.rm = TRUE))) 21 | 22 | tiedRanks <- as.numeric(names(table(featureRank)[table(featureRank) > 1])) 23 | 24 | if(length(tiedRanks) > 0) 25 | { 26 | for(i in seq(along.with = tiedRanks)) 27 | { 28 | tmp <- featureRank[featureRank == tiedRanks[i]] 29 | featureRank[featureRank == tiedRanks[i]] <- tmp + runif(length(tmp), min = 0.001, max = 0.999) 30 | } 31 | } 32 | 33 | featureOrder <- order(featureRank) 34 | 35 | out <- object$importance[featureOrder,, drop = FALSE] 36 | out <- out[1:top,, drop = FALSE] 37 | out 38 | } 39 | 40 | -------------------------------------------------------------------------------- /pkg/caret/R/trim.R: -------------------------------------------------------------------------------- 1 | trim <- function(object, ...) UseMethod("trim") 2 | 3 | #' @export 4 | trim.train <- function(object, ...) { 5 | removals <- c("results", "pred", "bestTune", "call", "dots", 6 | "metric", "trainingData", "resample", "resampledCM", 7 | "perfNames", "maxmimize", "times") 8 | for(i in removals) 9 | if(i %in% names(object)) object[i] <- NULL 10 | c_removals <- c('method', 'number', 'repeats', 'p', 'initialWindow', 11 | 'horizon', 'fixedWindow', 'verboseIter', 'returnData', 12 | 'returnResamp', 'savePredictions', 'summaryFunction', 13 | 'selectionFunction', 'index', 'indexOut', 'indexFinal', 14 | 'timingSamps', 'trim', 'yLimits') 15 | for(i in c_removals) 16 | if(i %in% names(object$control)) object$control[i] <- NULL 17 | if(!is.null(object$modelInfo$trim)) 18 | object$finalModel <- object$modelInfo$trim(object$finalModel) 19 | object 20 | } -------------------------------------------------------------------------------- /pkg/caret/R/varImp.train.R: -------------------------------------------------------------------------------- 1 | #' @rdname varImp 2 | #' @export 3 | #' @importFrom recipes juice all_predictors all_outcomes 4 | "varImp.train" <- function(object, useModel = TRUE, nonpara = TRUE, scale = TRUE, ...) { 5 | code <- object$modelInfo 6 | if(is.null(code$varImp)) useModel <- FALSE 7 | if(useModel) { 8 | checkInstall(code$library) 9 | for(i in seq(along.with = code$library)) 10 | do.call("requireNamespaceQuietStop", list(package = code$library[i])) 11 | imp <- code$varImp(object$finalModel, ...) 12 | modelName <- object$method 13 | } else { 14 | if(inherits(object, "train.recipe")) { 15 | x_dat <- recipes::juice(object$recipe, all_predictors()) 16 | x_dat <- as.data.frame(x_dat, stringsAsFactors = FALSE) 17 | y_dat <- recipes::juice(object$recipe, all_outcomes()) 18 | y_dat <- getElement(y_dat, names(y_dat)) 19 | } else { 20 | isX <- which(!(colnames(object$trainingData) %in% ".outcome")) 21 | x_dat <- object$trainingData[, isX,drop = FALSE] 22 | y_dat <- object$trainingData[, -isX] 23 | } 24 | imp <- filterVarImp(x_dat, y_dat, 25 | nonpara = nonpara, 26 | ...) 27 | modelName <- ifelse(is.factor(y_dat), 28 | "ROC curve", 29 | ifelse(nonpara, "loess r-squared", "Linear model")) 30 | } 31 | if(scale) { 32 | if(class(object$finalModel)[1] == "pamrtrained") imp <- abs(imp) 33 | imp <- imp - min(imp, na.rm = TRUE) 34 | imp <- imp/max(imp, na.rm = TRUE)*100 35 | } 36 | out <- list(importance = imp, 37 | model = modelName, 38 | calledFrom = "varImp") 39 | 40 | structure(out, class = "varImp.train") 41 | } 42 | -------------------------------------------------------------------------------- /pkg/caret/caret.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: No 4 | SaveWorkspace: No 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: knitr 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | PackageRoxygenize: rd,collate,namespace 22 | -------------------------------------------------------------------------------- /pkg/caret/data/BloodBrain.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/pkg/caret/data/BloodBrain.RData -------------------------------------------------------------------------------- /pkg/caret/data/GermanCredit.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/pkg/caret/data/GermanCredit.RData -------------------------------------------------------------------------------- /pkg/caret/data/Sacramento.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/pkg/caret/data/Sacramento.RData -------------------------------------------------------------------------------- /pkg/caret/data/cars.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/pkg/caret/data/cars.RData -------------------------------------------------------------------------------- /pkg/caret/data/cox2.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/pkg/caret/data/cox2.RData -------------------------------------------------------------------------------- /pkg/caret/data/datalist: -------------------------------------------------------------------------------- 1 | BloodBrain: bbbDescr logBBB 2 | cars 3 | cox2: cox2Class cox2Descr cox2IC50 4 | dhfr 5 | GermanCredit 6 | mdrr: mdrrClass mdrrDescr 7 | oil: fattyAcids oilType 8 | pottery: potteryClass 9 | segmentationData 10 | tecator: absorp endpoints 11 | Sacramento 12 | scat: scat scat_orig -------------------------------------------------------------------------------- /pkg/caret/data/dhfr.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/pkg/caret/data/dhfr.RData -------------------------------------------------------------------------------- /pkg/caret/data/mdrr.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/pkg/caret/data/mdrr.RData -------------------------------------------------------------------------------- /pkg/caret/data/oil.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/pkg/caret/data/oil.RData -------------------------------------------------------------------------------- /pkg/caret/data/pottery.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/pkg/caret/data/pottery.RData -------------------------------------------------------------------------------- /pkg/caret/data/scat.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/pkg/caret/data/scat.RData -------------------------------------------------------------------------------- /pkg/caret/data/segmentationData.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/pkg/caret/data/segmentationData.RData -------------------------------------------------------------------------------- /pkg/caret/data/tecator.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/pkg/caret/data/tecator.RData -------------------------------------------------------------------------------- /pkg/caret/inst/CITATION: -------------------------------------------------------------------------------- 1 | citHeader("To cite caret in publications use:") 2 | 3 | utils::bibentry( 4 | bibtype = "Article", 5 | title = "Building Predictive Models in R Using the caret Package", 6 | volume = "28", 7 | url = "https://www.jstatsoft.org/index.php/jss/article/view/v028i05", 8 | doi = "10.18637/jss.v028.i05", 9 | number = "5", 10 | journal = "Journal of Statistical Software", 11 | author = "Kuhn, Max", 12 | year = "2008", 13 | pages = "1–26", 14 | textVersion = paste( 15 | "Kuhn, M. (2008). Building Predictive Models in R Using the caret Package. Journal of Statistical Software, 28(5), 1–26. https://doi.org/10.18637/jss.v028.i05" 16 | ) 17 | ) 18 | -------------------------------------------------------------------------------- /pkg/caret/inst/models/models.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/pkg/caret/inst/models/models.RData -------------------------------------------------------------------------------- /pkg/caret/inst/models/sampling.RData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/pkg/caret/inst/models/sampling.RData -------------------------------------------------------------------------------- /pkg/caret/man/BloodBrain.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/caret-package.R 3 | \docType{data} 4 | \name{BloodBrain} 5 | \alias{BloodBrain} 6 | \alias{bbbDescr} 7 | \alias{logBBB} 8 | \title{Blood Brain Barrier Data} 9 | \source{ 10 | Mente, S.R. and Lombardo, F. (2005). A recursive-partitioning model 11 | for blood-brain barrier permeation, \emph{Journal of Computer-Aided Molecular Design}, 12 | Vol. 19, pg. 465-481. 13 | } 14 | \value{ 15 | \item{bbbDescr}{data frame of chemical descriptors} \item{logBBB}{vector of assay results} 16 | } 17 | \description{ 18 | Mente and Lombardo (2005) develop models to predict the log 19 | of the ratio of the concentration of a compound in the brain 20 | and the concentration in blood. For each compound, they computed 21 | three sets of molecular descriptors: MOE 2D, rule-of-five and 22 | Charge Polar Surface Area (CPSA). In all, 134 descriptors were 23 | calculated. Included in this package are 208 non-proprietary 24 | literature compounds. The vector \code{logBBB} contains the concentration 25 | ratio and the data fame \code{bbbDescr} contains the descriptor values. 26 | } 27 | \keyword{datasets} 28 | -------------------------------------------------------------------------------- /pkg/caret/man/GermanCredit.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/caret-package.R 3 | \docType{data} 4 | \name{GermanCredit} 5 | \alias{GermanCredit} 6 | \title{German Credit Data} 7 | \source{ 8 | UCI Machine Learning Repository 9 | } 10 | \description{ 11 | Data from Dr. Hans Hofmann of the University of Hamburg. 12 | } 13 | \details{ 14 | These data have two classes for the credit worthiness: good or bad. There 15 | are predictors related to attributes, such as: checking account status, 16 | duration, credit history, purpose of the loan, amount of the loan, savings 17 | accounts or bonds, employment duration, Installment rate in percentage of 18 | disposable income, personal information, other debtors/guarantors, residence 19 | duration, property, age, other installment plans, housing, number of 20 | existing credits, job information, Number of people being liable to provide 21 | maintenance for, telephone, and foreign worker status. 22 | 23 | Many of these predictors are discrete and have been expanded into several 24 | 0/1 indicator variables 25 | } 26 | \keyword{datasets} 27 | -------------------------------------------------------------------------------- /pkg/caret/man/Sacramento.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/caret-package.R 3 | \docType{data} 4 | \name{Sacramento} 5 | \alias{Sacramento} 6 | \title{Sacramento CA Home Prices} 7 | \source{ 8 | SpatialKey website: 9 | \url{https://support.spatialkey.com/spatialkey-sample-csv-data/} 10 | } 11 | \value{ 12 | \item{Sacramento}{a data frame with columns '\code{city}', 13 | '\code{zip}', '\code{beds}', '\code{baths}', '\code{sqft}', '\code{type}', 14 | '\code{price}', '\code{latitude}', and '\code{longitude}'} 15 | } 16 | \description{ 17 | This data frame contains house and sale price data for 932 homes in 18 | Sacramento CA. The original data were obtained from the website for the 19 | SpatialKey software. From their website: "The Sacramento real estate 20 | transactions file is a list of 985 real estate transactions in the 21 | Sacramento area reported over a five-day period, as reported by the 22 | Sacramento Bee." Google was used to fill in missing/incorrect data. 23 | } 24 | \examples{ 25 | 26 | data(Sacramento) 27 | 28 | set.seed(955) 29 | in_train <- createDataPartition(log10(Sacramento$price), p = .8, list = FALSE) 30 | 31 | training <- Sacramento[ in_train,] 32 | testing <- Sacramento[-in_train,] 33 | 34 | 35 | } 36 | \keyword{datasets} 37 | -------------------------------------------------------------------------------- /pkg/caret/man/as.matrix.confusionMatrix.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/confusionMatrix.R 3 | \name{as.matrix.confusionMatrix} 4 | \alias{as.matrix.confusionMatrix} 5 | \alias{as.table.confusionMatrix} 6 | \title{Confusion matrix as a table} 7 | \usage{ 8 | \method{as.matrix}{confusionMatrix}(x, what = "xtabs", ...) 9 | } 10 | \arguments{ 11 | \item{x}{an object of class \code{\link{confusionMatrix}}} 12 | 13 | \item{what}{data to convert to matrix. Either \code{"xtabs"}, \code{"overall"} or \code{"classes"}} 14 | 15 | \item{\dots}{not currently used} 16 | } 17 | \value{ 18 | A matrix or table 19 | } 20 | \description{ 21 | Conversion functions for class \code{confusionMatrix} 22 | } 23 | \details{ 24 | For \code{as.table}, the cross-tabulations are saved. For \code{as.matrix}, the three object types are saved in matrix format. 25 | } 26 | \examples{ 27 | ################### 28 | ## 2 class example 29 | 30 | lvs <- c("normal", "abnormal") 31 | truth <- factor(rep(lvs, times = c(86, 258)), 32 | levels = rev(lvs)) 33 | pred <- factor( 34 | c( 35 | rep(lvs, times = c(54, 32)), 36 | rep(lvs, times = c(27, 231))), 37 | levels = rev(lvs)) 38 | 39 | xtab <- table(pred, truth) 40 | 41 | results <- confusionMatrix(xtab) 42 | as.table(results) 43 | as.matrix(results) 44 | as.matrix(results, what = "overall") 45 | as.matrix(results, what = "classes") 46 | 47 | ################### 48 | ## 3 class example 49 | 50 | xtab <- confusionMatrix(iris$Species, sample(iris$Species)) 51 | as.matrix(xtab) 52 | 53 | } 54 | \author{ 55 | Max Kuhn 56 | } 57 | \keyword{utilities} 58 | -------------------------------------------------------------------------------- /pkg/caret/man/cars.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/caret-package.R 3 | \docType{data} 4 | \name{cars} 5 | \alias{cars} 6 | \title{Kelly Blue Book resale data for 2005 model year GM cars} 7 | \source{ 8 | Kuiper, S. (2008). Introduction to Multiple Regression: How Much Is Your Car Worth?, 9 | \emph{Journal of Statistics Education}, Vol. 16 10 | \url{http://jse.amstat.org/jse_archive.htm#2008}. 11 | } 12 | \value{ 13 | \item{cars}{data frame of the suggested retail price (column \code{Price}) and various 14 | characteristics of each car (columns \code{Mileage}, \code{Cylinder}, \code{Doors}, \code{Cruise}, 15 | \code{Sound}, \code{Leather}, \code{Buick}, \code{Cadillac}, \code{Chevy}, \code{Pontiac}, \code{Saab}, 16 | \code{Saturn}, \code{convertible}, \code{coupe}, \code{hatchback}, \code{sedan} and \code{wagon})} 17 | } 18 | \description{ 19 | Kuiper (2008) collected data on Kelly Blue Book resale data for 804 GM cars (2005 model year). 20 | } 21 | \keyword{datasets} 22 | -------------------------------------------------------------------------------- /pkg/caret/man/cox2.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/caret-package.R 3 | \docType{data} 4 | \name{cox2} 5 | \alias{cox2} 6 | \alias{cox2Class} 7 | \alias{cox2Descr} 8 | \alias{cox2IC50} 9 | \title{COX-2 Activity Data} 10 | \source{ 11 | Sutherland, J. J., O'Brien, L. A. and Weaver, D. F. (2003). 12 | Spline-Fitting with a Genetic Algorithm: A Method for Developing 13 | Classification Structure-Activity Relationships, \emph{Journal of Chemical 14 | Information and Computer Sciences}, Vol. 43, pg. 1906-1915. 15 | } 16 | \value{ 17 | \item{cox2Descr}{the descriptors} \item{cox2IC50}{the IC50 data used 18 | to determine activity} 19 | 20 | \item{cox2Class}{the categorical outcome ("Active" or "Inactive") based on 21 | the $2^2.5$ cutoff} 22 | } 23 | \description{ 24 | From Sutherland, O'Brien, and Weaver (2003): "A set of 467 cyclooxygenase-2 25 | (COX-2) inhibitors has been assembled from the published work of a single 26 | research group, with in vitro activities against human recombinant enzyme 27 | expressed as IC50 values ranging from 1 nM to >100 uM (53 compounds have 28 | indeterminate IC50 values)." 29 | } 30 | \details{ 31 | The data are in the Supplemental Data file for the article. 32 | 33 | A set of 255 descriptors (MOE2D and QikProp) were generated. To classify the 34 | data, we used a cutoff of $2^2.5$ to determine activity 35 | } 36 | \keyword{datasets} 37 | -------------------------------------------------------------------------------- /pkg/caret/man/dhfr.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/caret-package.R 3 | \docType{data} 4 | \name{dhfr} 5 | \alias{dhfr} 6 | \title{Dihydrofolate Reductase Inhibitors Data} 7 | \source{ 8 | Sutherland, J.J. and Weaver, D.F. (2004). Three-dimensional 9 | quantitative structure-activity and structure-selectivity relationships of 10 | dihydrofolate reductase inhibitors, \emph{Journal of Computer-Aided 11 | Molecular Design}, Vol. 18, pg. 309-331. 12 | } 13 | \value{ 14 | \item{dhfr}{data frame of chemical descriptors and the activity 15 | values} 16 | } 17 | \description{ 18 | Sutherland and Weaver (2004) discuss QSAR models for dihydrofolate reductase 19 | (DHFR) inhibition. This data set contains values for 325 compounds. For each 20 | compound, 228 molecular descriptors have been calculated. Additionally, each 21 | samples is designated as "active" or "inactive". 22 | } 23 | \details{ 24 | The data frame \code{dhfr} contains a column called \code{Y} with the 25 | outcome classification. The remainder of the columns are molecular 26 | descriptor values. 27 | } 28 | \keyword{datasets} 29 | -------------------------------------------------------------------------------- /pkg/caret/man/dotPlot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/dotplot.varImp.train.R 3 | \name{dotPlot} 4 | \alias{dotPlot} 5 | \title{Create a dotplot of variable importance values} 6 | \usage{ 7 | dotPlot(x, top = min(20, dim(x$importance)[1]), ...) 8 | } 9 | \arguments{ 10 | \item{x}{an object of class \code{varImp.train}} 11 | 12 | \item{top}{the number of predictors to plot} 13 | 14 | \item{\dots}{options passed to \code{\link[lattice:xyplot]{dotplot}}} 15 | } 16 | \value{ 17 | an object of class \code{trellis}. 18 | } 19 | \description{ 20 | A lattice \code{\link[lattice:xyplot]{dotplot}} is created from an object of 21 | class \code{varImp.train}. 22 | } 23 | \examples{ 24 | 25 | 26 | data(iris) 27 | TrainData <- iris[,1:4] 28 | TrainClasses <- iris[,5] 29 | 30 | knnFit <- train(TrainData, TrainClasses, "knn") 31 | 32 | knnImp <- varImp(knnFit) 33 | 34 | dotPlot(knnImp) 35 | 36 | 37 | } 38 | \seealso{ 39 | \code{\link{varImp}}, \code{\link[lattice:xyplot]{dotplot}} 40 | } 41 | \author{ 42 | Max Kuhn 43 | } 44 | \keyword{hplot} 45 | -------------------------------------------------------------------------------- /pkg/caret/man/downSample.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/sampling.R 3 | \name{downSample} 4 | \alias{downSample} 5 | \alias{upSample} 6 | \title{Down- and Up-Sampling Imbalanced Data} 7 | \usage{ 8 | downSample(x, y, list = FALSE, yname = "Class") 9 | } 10 | \arguments{ 11 | \item{x}{a matrix or data frame of predictor variables} 12 | 13 | \item{y}{a factor variable with the class memberships} 14 | 15 | \item{list}{should the function return \code{list(x, y)} or bind \code{x} 16 | and \code{y} together? If \code{FALSE}, the output will be coerced to a data 17 | frame.} 18 | 19 | \item{yname}{if \code{list = FALSE}, a label for the class column} 20 | } 21 | \value{ 22 | Either a data frame or a list with elements \code{x} and \code{y}. 23 | } 24 | \description{ 25 | \code{downSample} will randomly sample a data set so that all classes have 26 | the same frequency as the minority class. \code{upSample} samples with 27 | replacement to make the class distributions equal 28 | } 29 | \details{ 30 | Simple random sampling is used to down-sample for the majority class(es). 31 | Note that the minority class data are left intact and that the samples will 32 | be re-ordered in the down-sampled version. 33 | 34 | For up-sampling, all the original data are left intact and additional 35 | samples are added to the minority classes with replacement. 36 | } 37 | \examples{ 38 | 39 | ## A ridiculous example... 40 | data(oil) 41 | table(oilType) 42 | downSample(fattyAcids, oilType) 43 | 44 | upSample(fattyAcids, oilType) 45 | 46 | 47 | } 48 | \author{ 49 | Max Kuhn 50 | } 51 | \keyword{utilities} 52 | -------------------------------------------------------------------------------- /pkg/caret/man/featurePlot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/featurePlot.R 3 | \name{featurePlot} 4 | \alias{featurePlot} 5 | \title{Wrapper for Lattice Plotting of Predictor Variables} 6 | \usage{ 7 | featurePlot( 8 | x, 9 | y, 10 | plot = if (is.factor(y)) "strip" else "scatter", 11 | labels = c("Feature", ""), 12 | ... 13 | ) 14 | } 15 | \arguments{ 16 | \item{x}{a matrix or data frame of continuous feature/probe/spectra data.} 17 | 18 | \item{y}{a factor indicating class membership.} 19 | 20 | \item{plot}{the type of plot. For classification: \code{box}, \code{strip}, 21 | \code{density}, \code{pairs} or \code{ellipse}. For regression, 22 | \code{pairs} or \code{scatter}} 23 | 24 | \item{labels}{a bad attempt at pre-defined axis labels} 25 | 26 | \item{\dots}{options passed to lattice calls.} 27 | } 28 | \value{ 29 | An object of class ``trellis''. The `update' method can be used to 30 | update components of the object and the `print' method (usually called by 31 | default) will plot it on an appropriate plotting device. 32 | } 33 | \description{ 34 | A shortcut to produce lattice graphs 35 | } 36 | \details{ 37 | This function ``stacks'' data to get it into a form compatible with lattice 38 | and creates the plots 39 | } 40 | \examples{ 41 | 42 | x <- matrix(rnorm(50*5),ncol=5) 43 | y <- factor(rep(c("A", "B"), 25)) 44 | 45 | trellis.par.set(theme = col.whitebg(), warn = FALSE) 46 | featurePlot(x, y, "ellipse") 47 | featurePlot(x, y, "strip", jitter = TRUE) 48 | featurePlot(x, y, "box") 49 | featurePlot(x, y, "pairs") 50 | 51 | } 52 | \author{ 53 | Max Kuhn 54 | } 55 | \keyword{hplot} 56 | -------------------------------------------------------------------------------- /pkg/caret/man/findLinearCombos.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/findLinearCombos.R 3 | \name{findLinearCombos} 4 | \alias{findLinearCombos} 5 | \title{Determine linear combinations in a matrix} 6 | \usage{ 7 | findLinearCombos(x) 8 | } 9 | \arguments{ 10 | \item{x}{a numeric matrix} 11 | } 12 | \value{ 13 | a list with elements: \item{linearCombos }{If there are linear 14 | combinations, this will be a list with elements for each dependency that 15 | contains vectors of column numbers. } \item{remove }{a list of column 16 | numbers that can be removed to counter the linear combinations} 17 | } 18 | \description{ 19 | Enumerate and resolve the linear combinations in a numeric matrix 20 | } 21 | \details{ 22 | The QR decomposition is used to determine if the matrix is full rank and 23 | then identify the sets of columns that are involved in the dependencies. 24 | 25 | To "resolve" them, columns are iteratively removed and the matrix rank is 26 | rechecked. 27 | } 28 | \examples{ 29 | 30 | testData1 <- matrix(0, nrow=20, ncol=8) 31 | testData1[,1] <- 1 32 | testData1[,2] <- round(rnorm(20), 1) 33 | testData1[,3] <- round(rnorm(20), 1) 34 | testData1[,4] <- round(rnorm(20), 1) 35 | testData1[,5] <- 0.5 * testData1[,2] - 0.25 * testData1[,3] - 0.25 * testData1[,4] 36 | testData1[1:4,6] <- 1 37 | testData1[5:10,7] <- 1 38 | testData1[11:20,8] <- 1 39 | 40 | findLinearCombos(testData1) 41 | 42 | testData2 <- matrix(0, nrow=6, ncol=6) 43 | testData2[,1] <- c(1, 1, 1, 1, 1, 1) 44 | testData2[,2] <- c(1, 1, 1, 0, 0, 0) 45 | testData2[,3] <- c(0, 0, 0, 1, 1, 1) 46 | testData2[,4] <- c(1, 0, 0, 1, 0, 0) 47 | testData2[,5] <- c(0, 1, 0, 0, 1, 0) 48 | testData2[,6] <- c(0, 0, 1, 0, 0, 1) 49 | 50 | findLinearCombos(testData2) 51 | 52 | } 53 | \author{ 54 | Kirk Mettler and Jed Wing (\code{enumLC}) and Max Kuhn 55 | (\code{findLinearCombos}) 56 | } 57 | \keyword{manip} 58 | -------------------------------------------------------------------------------- /pkg/caret/man/format.bagEarth.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/format.bagEarth.R 3 | \name{format.bagEarth} 4 | \alias{format.bagEarth} 5 | \title{Format 'bagEarth' objects} 6 | \usage{ 7 | \method{format}{bagEarth}(x, file = "", cat = TRUE, ...) 8 | } 9 | \arguments{ 10 | \item{x}{An \code{\link{bagEarth}} object. This is the only required 11 | argument.} 12 | 13 | \item{file}{A connection, or a character string naming the file to print to. 14 | If "" (the default), the output prints to the standard output connection. 15 | See \code{\link[base]{cat}}.} 16 | 17 | \item{cat}{a logical; should the equation be printed?} 18 | 19 | \item{\dots}{Arguments to \code{\link[earth]{format.earth}}.} 20 | } 21 | \value{ 22 | A character representation of the bagged earth object. 23 | } 24 | \description{ 25 | Return a string representing the \sQuote{bagEarth} expression. 26 | } 27 | \examples{ 28 | 29 | a <- bagEarth(Volume ~ ., data = trees, B= 3) 30 | format(a) 31 | 32 | # yields: 33 | # ( 34 | # 31.61075 35 | # + 6.587273 * pmax(0, Girth - 14.2) 36 | # - 3.229363 * pmax(0, 14.2 - Girth) 37 | # - 0.3167140 * pmax(0, 79 - Height) 38 | # + 39 | # 22.80225 40 | # + 5.309866 * pmax(0, Girth - 12) 41 | # - 2.378658 * pmax(0, 12 - Girth) 42 | # + 0.793045 * pmax(0, Height - 80) 43 | # - 0.3411915 * pmax(0, 80 - Height) 44 | # + 45 | # 31.39772 46 | # + 6.18193 * pmax(0, Girth - 14.2) 47 | # - 3.660456 * pmax(0, 14.2 - Girth) 48 | # + 0.6489774 * pmax(0, Height - 80) 49 | # )/3 50 | 51 | } 52 | \seealso{ 53 | \code{\link[earth]{earth}} 54 | } 55 | \keyword{models} 56 | -------------------------------------------------------------------------------- /pkg/caret/man/getSamplingInfo.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{getSamplingInfo} 4 | \alias{getSamplingInfo} 5 | \title{Get sampling info from a train model} 6 | \usage{ 7 | getSamplingInfo(method = NULL, regex = TRUE, ...) 8 | } 9 | \arguments{ 10 | \item{method}{Modeling method.} 11 | 12 | \item{regex}{Whether to use regex matching.} 13 | 14 | \item{...}{additional arguments to passed to grepl.} 15 | } 16 | \value{ 17 | A list 18 | } 19 | \description{ 20 | Placeholder. 21 | } 22 | \details{ 23 | Placeholder. 24 | } 25 | -------------------------------------------------------------------------------- /pkg/caret/man/index2vec.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/common_code.R 3 | \name{index2vec} 4 | \alias{index2vec} 5 | \title{Convert indicies to a binary vector} 6 | \usage{ 7 | index2vec(x, vars, sign = FALSE) 8 | } 9 | \arguments{ 10 | \item{x}{a vector of integers} 11 | 12 | \item{vars}{the number of possible locations} 13 | 14 | \item{sign}{a lgical; when true the data are encoded as -1/+1, and 0/1 15 | otherwise} 16 | } 17 | \value{ 18 | a numeric vector 19 | } 20 | \description{ 21 | The function performs the opposite of \code{which} converting a set of 22 | integers to a binary vector 23 | } 24 | \examples{ 25 | 26 | index2vec(x = 1:2, vars = 5) 27 | index2vec(x = 1:2, vars = 5, sign = TRUE) 28 | 29 | } 30 | \author{ 31 | Max Kuhn 32 | } 33 | -------------------------------------------------------------------------------- /pkg/caret/man/mdrr.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/caret-package.R 3 | \docType{data} 4 | \name{mdrr} 5 | \alias{mdrr} 6 | \alias{mdrrClass} 7 | \alias{mdrrDescr} 8 | \title{Multidrug Resistance Reversal (MDRR) Agent Data} 9 | \source{ 10 | Svetnik, V., Liaw, A., Tong, C., Culberson, J. C., Sheridan, R. P. 11 | Feuston, B. P (2003). Random Forest: A Classification and Regression Tool 12 | for Compound Classification and QSAR Modeling, \emph{Journal of Chemical 13 | Information and Computer Sciences}, Vol. 43, pg. 1947-1958. 14 | } 15 | \value{ 16 | \item{mdrrDescr}{the descriptors} \item{mdrrClass}{the categorical 17 | outcome ("Active" or "Inactive")} 18 | } 19 | \description{ 20 | Svetnik et al. (2003) describe these data: "Bakken and Jurs studied a set of 21 | compounds originally discussed by Klopman et al., who were interested in 22 | multidrug resistance reversal (MDRR) agents. The original response variable 23 | is a ratio measuring the ability of a compound to reverse a leukemia cell's 24 | resistance to adriamycin. However, the problem was treated as a 25 | classification problem, and compounds with the ratio >4.2 were considered 26 | active, and those with the ratio <= 2.0 were considered inactive. Compounds 27 | with the ratio between these two cutoffs were called moderate and removed 28 | from the data for twoclass classification, leaving a set of 528 compounds 29 | (298 actives and 230 inactives). (Various other arrangements of these data 30 | were examined by Bakken and Jurs, but we will focus on this particular one.) 31 | We did not have access to the original descriptors, but we generated a set 32 | of 342 descriptors of three different types that should be similar to the 33 | original descriptors, using the DRAGON software." 34 | } 35 | \details{ 36 | The data and R code are in the Supplemental Data file for the article. 37 | } 38 | \keyword{datasets} 39 | -------------------------------------------------------------------------------- /pkg/caret/man/oil.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/caret-package.R 3 | \docType{data} 4 | \name{oil} 5 | \alias{oil} 6 | \alias{oilType} 7 | \alias{fattyAcids} 8 | \title{Fatty acid composition of commercial oils} 9 | \source{ 10 | Brodnjak-Voncina et al. (2005). Multivariate data analysis in 11 | classification of vegetable oils characterized by the content of fatty 12 | acids, \emph{Chemometrics and Intelligent Laboratory Systems}, Vol. 13 | 75:31-45. 14 | } 15 | \value{ 16 | \item{fattyAcids}{data frame of fatty acid compositions: Palmitic, 17 | Stearic, Oleic, Linoleic, Linolenic, Eicosanoic and Eicosenoic. When values 18 | fell below the lower limit of the assay (denoted as 34 | } 35 | \keyword{multivariate} 36 | -------------------------------------------------------------------------------- /pkg/caret/man/predict.knnreg.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/knnreg.R 3 | \name{predict.knnreg} 4 | \alias{predict.knnreg} 5 | \title{Predictions from k-Nearest Neighbors Regression Model} 6 | \usage{ 7 | \method{predict}{knnreg}(object, newdata, ...) 8 | } 9 | \arguments{ 10 | \item{object}{object of class \code{knnreg}.} 11 | 12 | \item{newdata}{a data frame or matrix of new observations.} 13 | 14 | \item{...}{additional arguments.} 15 | } 16 | \value{ 17 | a numeric vector 18 | } 19 | \description{ 20 | Predict the outcome of a new observation based on k-NN. 21 | } 22 | \details{ 23 | This function is a method for the generic function \code{\link{predict}} for 24 | class \code{knnreg}. For the details see \code{\link{knnreg}}. This is 25 | essentially a copy of \code{\link[ipred]{predict.ipredknn}}. 26 | } 27 | \author{ 28 | Max Kuhn, Chris Keefer, adapted from \code{\link[class]{knn}} and 29 | \code{\link[ipred]{predict.ipredknn}} 30 | } 31 | \keyword{multivariate} 32 | -------------------------------------------------------------------------------- /pkg/caret/man/predictors.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/predictors.R 3 | \name{predictors} 4 | \alias{predictors} 5 | \alias{predictors.formula} 6 | \alias{predictors.terms} 7 | \alias{predictors.train} 8 | \alias{predictors.default} 9 | \alias{predictors.list} 10 | \alias{predictors.rfe} 11 | \alias{predictors.sbf} 12 | \title{List predictors used in the model} 13 | \usage{ 14 | predictors(x, ...) 15 | } 16 | \arguments{ 17 | \item{x}{a model object, list or terms} 18 | 19 | \item{\dots}{not currently used} 20 | } 21 | \value{ 22 | a character string of predictors or \code{NA}. 23 | } 24 | \description{ 25 | This class uses a model fit to determine which predictors were used in the 26 | final model. 27 | } 28 | \details{ 29 | For \code{\link[randomForest]{randomForest}}, \code{\link[party]{cforest}}, 30 | \code{\link[party]{ctree}}, \code{\link[rpart]{rpart}}, 31 | \code{\link[ipred:bagging]{ipredbagg}}, \code{\link[ipred]{bagging}}, 32 | \code{\link[earth]{earth}}, \code{\link[mda]{fda}}, 33 | \code{\link[pamr]{pamr.train}}, \code{\link[superpc]{superpc.train}}, 34 | \code{\link{bagEarth}} and \code{\link{bagFDA}}, an attempt was made to 35 | report the predictors that were actually used in the final model. 36 | 37 | The \code{predictors} function can be called on the model object (as opposed 38 | to the \code{\link{train}}) object) and the package will try to find the 39 | appropriate coed (if it exists). 40 | 41 | In cases where the predictors cannot be determined, \code{NA} is returned. 42 | For example, \code{\link[nnet]{nnet}} may return missing values from 43 | \code{predictors}. 44 | } 45 | \keyword{models} 46 | -------------------------------------------------------------------------------- /pkg/caret/man/print.confusionMatrix.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/confusionMatrix.R 3 | \name{print.confusionMatrix} 4 | \alias{print.confusionMatrix} 5 | \title{Print method for confusionMatrix} 6 | \usage{ 7 | \method{print}{confusionMatrix}( 8 | x, 9 | mode = x$mode, 10 | digits = max(3, getOption("digits") - 3), 11 | printStats = TRUE, 12 | ... 13 | ) 14 | } 15 | \arguments{ 16 | \item{x}{an object of class \code{confusionMatrix}} 17 | 18 | \item{mode}{a single character string either "sens_spec", "prec_recall", or 19 | "everything"} 20 | 21 | \item{digits}{number of significant digits when printed} 22 | 23 | \item{printStats}{a logical: if \code{TRUE} then table statistics are also 24 | printed} 25 | 26 | \item{\dots}{optional arguments to pass to \code{print.table}} 27 | } 28 | \value{ 29 | \code{x} is invisibly returned 30 | } 31 | \description{ 32 | a print method for \code{confusionMatrix} 33 | } 34 | \seealso{ 35 | \code{\link{confusionMatrix}} 36 | } 37 | \author{ 38 | Max Kuhn 39 | } 40 | \keyword{utilities} 41 | -------------------------------------------------------------------------------- /pkg/caret/man/print.train.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/print.train.R 3 | \name{print.train} 4 | \alias{print.train} 5 | \title{Print Method for the train Class} 6 | \usage{ 7 | \method{print}{train}( 8 | x, 9 | printCall = FALSE, 10 | details = FALSE, 11 | selectCol = FALSE, 12 | showSD = FALSE, 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{x}{an object of class \code{\link{train}}.} 18 | 19 | \item{printCall}{a logical to print the call at the top of the output} 20 | 21 | \item{details}{a logical to show print or summary methods for the final 22 | model. In some cases (such as \code{gbm}, \code{knn}, \code{lvq}, naive 23 | Bayes and bagged tree models), no information will be printed even if 24 | \code{details = TRUE}} 25 | 26 | \item{selectCol}{a logical whether to add a column with a star next to the 27 | selected parameters} 28 | 29 | \item{showSD}{a logical whether to show the standard deviation of the 30 | resampling results within parentheses (e.g. "4.24 (0.493)")} 31 | 32 | \item{\dots}{options passed to \code{\link[base]{format}}} 33 | } 34 | \value{ 35 | A matrix with the complexity parameters and performance (invisibly). 36 | } 37 | \description{ 38 | Print the results of a \code{\link{train}} object. 39 | } 40 | \details{ 41 | The table of complexity parameters used, their resampled performance and a 42 | flag for which rows are optimal. 43 | } 44 | \examples{ 45 | 46 | \dontrun{ 47 | data(iris) 48 | TrainData <- iris[,1:4] 49 | TrainClasses <- iris[,5] 50 | 51 | options(digits = 3) 52 | 53 | library(klaR) 54 | rdaFit <- train(TrainData, TrainClasses, method = "rda", 55 | control = trainControl(method = "cv")) 56 | rdaFit 57 | print(rdaFit, showSD = TRUE) 58 | } 59 | 60 | } 61 | \seealso{ 62 | \code{\link{train}} 63 | } 64 | \author{ 65 | Max Kuhn 66 | } 67 | \keyword{print} 68 | -------------------------------------------------------------------------------- /pkg/caret/man/resampleHist.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/resampleHist.R 3 | \name{resampleHist} 4 | \alias{resampleHist} 5 | \title{Plot the resampling distribution of the model statistics} 6 | \usage{ 7 | resampleHist(object, type = "density", ...) 8 | } 9 | \arguments{ 10 | \item{object}{an object resulting form a call to \code{\link{train}}} 11 | 12 | \item{type}{a character string. Either "hist" or "density"} 13 | 14 | \item{\dots}{options to pass to histogram or densityplot} 15 | } 16 | \value{ 17 | a object of class \code{trellis} 18 | } 19 | \description{ 20 | Create a lattice histogram or densityplot from the resampled outcomes from a 21 | \code{train} object. 22 | } 23 | \details{ 24 | All the metrics from the object are plotted, but only for the final model. 25 | For more comprehensive plots functions, see \code{\link{histogram.train}}, 26 | \code{\link{densityplot.train}}, \code{\link{xyplot.train}}, 27 | \code{\link{stripplot.train}}. 28 | 29 | For the plot to be made, the \code{returnResamp} argument in 30 | \code{\link{trainControl}} should be either "final" or "all". 31 | } 32 | \examples{ 33 | 34 | 35 | \dontrun{ 36 | data(iris) 37 | TrainData <- iris[,1:4] 38 | TrainClasses <- iris[,5] 39 | 40 | knnFit <- train(TrainData, TrainClasses, "knn") 41 | 42 | resampleHist(knnFit) 43 | } 44 | 45 | } 46 | \seealso{ 47 | \code{\link{train}}, \code{\link[lattice]{histogram}}, 48 | \code{\link[lattice:histogram]{densityplot}}, \code{\link{histogram.train}}, 49 | \code{\link{densityplot.train}}, \code{\link{xyplot.train}}, 50 | \code{\link{stripplot.train}} 51 | } 52 | \author{ 53 | Max Kuhn 54 | } 55 | \keyword{hplot} 56 | -------------------------------------------------------------------------------- /pkg/caret/man/resampleSummary.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/resampleSummary.R 3 | \name{resampleSummary} 4 | \alias{resampleSummary} 5 | \title{Summary of resampled performance estimates} 6 | \usage{ 7 | resampleSummary(obs, resampled, index = NULL, keepData = TRUE) 8 | } 9 | \arguments{ 10 | \item{obs}{A vector (numeric or factor) of the outcome data} 11 | 12 | \item{resampled}{For bootstrapping, this is either a matrix (for numeric 13 | outcomes) or a data frame (for factors). For cross-validation, a vector is 14 | produced.} 15 | 16 | \item{index}{The list to index of samples in each cross-validation fold 17 | (only used for cross-validation).} 18 | 19 | \item{keepData}{A logical for returning the observed and predicted data.} 20 | } 21 | \value{ 22 | A list with: \item{metrics }{A vector of values describing the 23 | bootstrap distribution.} \item{data }{A data frame or \code{NULL}. Columns 24 | include \code{obs}, \code{pred} and \code{group} (for tracking 25 | cross-validation folds or bootstrap samples)} 26 | } 27 | \description{ 28 | This function uses the out-of-bag predictions to calculate overall 29 | performance metrics and returns the observed and predicted data. 30 | } 31 | \details{ 32 | The mean and standard deviation of the values produced by 33 | \code{\link{postResample}} are calculated. 34 | } 35 | \examples{ 36 | 37 | resampleSummary(rnorm(10), matrix(rnorm(50), ncol = 5)) 38 | 39 | } 40 | \seealso{ 41 | \code{\link{postResample}} 42 | } 43 | \author{ 44 | Max Kuhn 45 | } 46 | \keyword{utilities} 47 | -------------------------------------------------------------------------------- /pkg/caret/man/scat.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/caret-package.R 3 | \docType{data} 4 | \name{scat} 5 | \alias{scat} 6 | \alias{scat_orig} 7 | \title{Morphometric Data on Scat} 8 | \source{ 9 | Reid, R. E. B. (2015). A morphometric modeling approach to 10 | distinguishing among bobcat, coyote and gray fox scats. \emph{Wildlife 11 | Biology}, 21(5), 254-262 12 | } 13 | \value{ 14 | \item{scat_orig}{the entire data set in the Supplemental Materials} 15 | \item{scat}{data on the three main species} 16 | } 17 | \description{ 18 | Reid (2015) collected data on animal feses in coastal California. The data 19 | consist of DNA verified species designations as well as fields related to 20 | the time and place of the collection and the scat itself. The data frame 21 | \code{scat_orig} contains while \code{scat} contains data on the three main 22 | species. 23 | } 24 | \keyword{datasets} 25 | -------------------------------------------------------------------------------- /pkg/caret/man/segmentationData.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/caret-package.R 3 | \docType{data} 4 | \name{segmentationData} 5 | \alias{segmentationData} 6 | \title{Cell Body Segmentation} 7 | \source{ 8 | Hill, LaPan, Li and Haney (2007). Impact of image segmentation on 9 | high-content screening data quality for SK-BR-3 cells, \emph{BMC 10 | Bioinformatics}, Vol. 8, pg. 340, 11 | \url{https://bmcbioinformatics.biomedcentral.com/articles/10.1186/1471-2105-8-340}. 12 | } 13 | \value{ 14 | \item{segmentationData}{data frame of cells} 15 | } 16 | \description{ 17 | Hill, LaPan, Li and Haney (2007) develop models to predict which cells in a 18 | high content screen were well segmented. The data consists of 119 imaging 19 | measurements on 2019. The original analysis used 1009 for training and 1010 20 | as a test set (see the column called \code{Case}). 21 | } 22 | \details{ 23 | The outcome class is contained in a factor variable called \code{Class} with 24 | levels "PS" for poorly segmented and "WS" for well segmented. 25 | 26 | The raw data used in the paper can be found at the Biomedcentral website. 27 | Versions of caret < 4.98 contained the original data. The version now 28 | contained in \code{segmentationData} is modified. First, several discrete 29 | versions of some of the predictors (with the suffix "Status") were removed. 30 | Second, there are several skewed predictors with minimum values of zero 31 | (that would benefit from some transformation, such as the log). A constant 32 | value of 1 was added to these fields: \code{AvgIntenCh2}, 33 | \code{FiberAlign2Ch3}, \code{FiberAlign2Ch4}, \code{SpotFiberCountCh4} and 34 | \code{TotalIntenCh2}. 35 | 36 | A binary version of the original data is at 37 | \url{http://topepo.github.io/caret/segmentationOriginal.RData}. 38 | } 39 | \keyword{datasets} 40 | -------------------------------------------------------------------------------- /pkg/caret/man/spatialSign.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/spatialSign.R 3 | \name{spatialSign} 4 | \alias{spatialSign} 5 | \alias{spatialSign.default} 6 | \alias{spatialSign.matrix} 7 | \alias{spatialSign.data.frame} 8 | \title{Compute the multivariate spatial sign} 9 | \usage{ 10 | spatialSign(x, ...) 11 | 12 | \method{spatialSign}{default}(x, na.rm = TRUE, ...) 13 | 14 | \method{spatialSign}{matrix}(x, na.rm = TRUE, ...) 15 | 16 | \method{spatialSign}{data.frame}(x, na.rm = TRUE, ...) 17 | } 18 | \arguments{ 19 | \item{x}{an object full of numeric data (which should probably 20 | be scaled). Factors are not allowed. This could be a vector, 21 | matrix or data frame.} 22 | 23 | \item{...}{Not currently used.} 24 | 25 | \item{na.rm}{A logical; should missing data be removed when 26 | computing the norm of the vector?} 27 | } 28 | \value{ 29 | A vector, matrix or data frame with the same dim names 30 | of the original data. 31 | } 32 | \description{ 33 | Compute the spatial sign (a projection of a data vector to a 34 | unit length circle). The spatial sign of a vector \code{w} is 35 | \code{w /norm(w)}. 36 | } 37 | \examples{ 38 | 39 | spatialSign(rnorm(5)) 40 | 41 | spatialSign(matrix(rnorm(12), ncol = 3)) 42 | 43 | # should fail since the fifth column is a factor 44 | try(spatialSign(iris), silent = TRUE) 45 | 46 | spatialSign(iris[,-5]) 47 | 48 | trellis.par.set(caretTheme()) 49 | featurePlot(iris[,-5], iris[,5], "pairs") 50 | featurePlot(spatialSign(scale(iris[,-5])), iris[,5], "pairs") 51 | 52 | } 53 | \references{ 54 | Serneels et al. Spatial sign preprocessing: a 55 | simple way to impart moderate robustness to multivariate 56 | estimators. J. Chem. Inf. Model (2006) vol. 46 (3) pp. 1402-1409 57 | } 58 | \author{ 59 | Max Kuhn 60 | } 61 | \keyword{manip} 62 | -------------------------------------------------------------------------------- /pkg/caret/man/summary.bagEarth.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/bagEarth.R, R/bagFDA.R 3 | \name{summary.bagEarth} 4 | \alias{summary.bagEarth} 5 | \alias{summary.bagFDA} 6 | \title{Summarize a bagged earth or FDA fit} 7 | \usage{ 8 | \method{summary}{bagEarth}(object, ...) 9 | 10 | \method{summary}{bagFDA}(object, ...) 11 | } 12 | \arguments{ 13 | \item{object}{an object of class "bagEarth" or "bagFDA"} 14 | 15 | \item{\dots}{optional arguments (not used)} 16 | } 17 | \value{ 18 | a list with elements \item{modelInfo}{a matrix with the number of 19 | model terms and variables used} \item{oobStat }{a summary of the out-of-bag 20 | statistics} \item{bmarsCall }{the original call to \code{bagEarth}} 21 | } 22 | \description{ 23 | The function shows a summary of the results from a bagged earth model 24 | } 25 | \details{ 26 | The out-of-bag statistics are summarized, as well as the distribution of the 27 | number of model terms and number of variables used across all the bootstrap 28 | samples. 29 | } 30 | \examples{ 31 | 32 | \dontrun{ 33 | data(trees) 34 | set.seed(9655) 35 | fit <- bagEarth(trees[,-3], trees[3]) 36 | summary(fit) 37 | } 38 | 39 | } 40 | \author{ 41 | Max Kuhn 42 | } 43 | \keyword{manip} 44 | -------------------------------------------------------------------------------- /pkg/caret/man/var_seq.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/misc.R 3 | \name{var_seq} 4 | \alias{var_seq} 5 | \title{Sequences of Variables for Tuning} 6 | \usage{ 7 | var_seq(p, classification = FALSE, len = 3) 8 | } 9 | \arguments{ 10 | \item{p}{The number of predictors} 11 | 12 | \item{classification}{Is the outcome a factor (\code{classification = TRUE} 13 | or numeric?)} 14 | 15 | \item{len}{The number of \code{mtry} values to generate.} 16 | } 17 | \value{ 18 | a numeric vector 19 | } 20 | \description{ 21 | This function generates a sequence of \code{mtry} values for random forests. 22 | } 23 | \details{ 24 | If the number of predictors is less than 500, a simple sequence of values of 25 | length \code{len} is generated between 2 and \code{p}. For larger numbers of 26 | predictors, the sequence is created using \code{log2} steps. 27 | 28 | If \code{len = 1}, the defaults from the \code{randomForest} package are 29 | used. 30 | } 31 | \examples{ 32 | 33 | var_seq(p = 100, len = 10) 34 | var_seq(p = 600, len = 10) 35 | 36 | } 37 | \author{ 38 | Max Kuhn 39 | } 40 | \keyword{models} 41 | -------------------------------------------------------------------------------- /pkg/caret/tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(caret) 3 | 4 | test_check("caret") 5 | -------------------------------------------------------------------------------- /pkg/caret/tests/testthat/test_BoxCox.R: -------------------------------------------------------------------------------- 1 | context('Box Cox transformations') 2 | 3 | ################################################################### 4 | ## Generate data and do BC using the source function to get 5 | ## expected results 6 | 7 | library(MASS) 8 | 9 | set.seed(1) 10 | dat <- matrix(runif(30), ncol = 3) 11 | dat[,1] <- exp(dat[,1]) 12 | colnames(dat) <- paste0("x", 1:3) 13 | 14 | exp_lambdas <- rep(NA, 3) 15 | for(i in 1:ncol(dat)) { 16 | tmp <- as.data.frame(dat, stringsAsFactors = TRUE)[,i,drop = FALSE] 17 | names(tmp)[1] <- "x" 18 | tmp_bc <- boxcox(x ~ 1, data = tmp, plotit = FALSE, lambda = seq(-2, 2, by = .1)) 19 | exp_lambdas[i] <- tmp_bc$x[which.max(tmp_bc$y)] 20 | } 21 | 22 | check_BoxCox <- function(x, expected = NULL) { 23 | pp1 <- preProcess(x, method = "BoxCox") 24 | obs_lambdas1 <- unlist(lapply(pp1$bc, function(x) x$lambda)) 25 | names(obs_lambdas1) <- NULL 26 | expect_equal(obs_lambdas1, expected) 27 | } 28 | 29 | check_BoxCox(dat, expected = exp_lambdas) 30 | check_BoxCox(as.data.frame(dat, stringsAsFactors = TRUE), expected = exp_lambdas) 31 | 32 | -------------------------------------------------------------------------------- /pkg/caret/tests/testthat/test_bad_class_options.R: -------------------------------------------------------------------------------- 1 | library(caret) 2 | 3 | test_that('bad class levels', { 4 | skip_on_cran() 5 | set.seed(1) 6 | dat <- twoClassSim(100) 7 | dat$Class <- factor(ifelse(dat$Class == "Class1", "1", "0")) 8 | foo <- function(train_dat) 9 | train(Class ~ ., data = train_dat, method = "rpart", 10 | metric = "ROC", 11 | trControl = trainControl(classProbs = TRUE, summaryFunction = twoClassSummary)) 12 | expect_error(foo(dat)) 13 | }) 14 | 15 | test_that('no class probs with ROC', { 16 | skip_on_cran() 17 | set.seed(1) 18 | dat <- twoClassSim(100) 19 | foo <- function(train_dat) 20 | train(Class ~ ., data = train_dat, method = "rpart", 21 | metric = "ROC", 22 | trControl = trainControl(summaryFunction = twoClassSummary)) 23 | expect_error(foo(dat)) 24 | }) 25 | 26 | test_that('numeric y and classification', { 27 | skip_on_cran() 28 | set.seed(1) 29 | dat <- twoClassSim(100) 30 | dat$Class <- ifelse(dat$Class == "Class1", 1, 0) 31 | foo <- function(train_dat) 32 | train(Class ~ ., data = train_dat, method = "rpart") 33 | expect_warning(foo(dat)) 34 | }) 35 | 36 | test_that('3+ classes and twoClassSummary', { 37 | skip_on_cran() 38 | foo <- function() { 39 | data(oil) 40 | train(x = fattyAcids, y = oilType, method = "rpart", 41 | metric = "ROC", 42 | trControl = trainControl(classProbs = TRUE, 43 | summaryFunction = twoClassSummary)) 44 | } 45 | expect_error(foo()) 46 | }) -------------------------------------------------------------------------------- /pkg/caret/tests/testthat/test_data_spliting.R: -------------------------------------------------------------------------------- 1 | context("Data Spliting") 2 | 3 | test_that("createTimeSlices works as expected", { 4 | 5 | s1 <- createTimeSlices(1:8, 5, horizon = 1) 6 | s2 <- createTimeSlices(1:8, 5, horizon = 1, skip = 3) 7 | s3 <- createTimeSlices(1:10, 5, horizon = 1, fixedWindow = FALSE, skip = 3) 8 | s4 <- createTimeSlices(1:10, 5, horizon = 2, skip = 2) 9 | 10 | expect_equal(s1, list(train = list(Training5 = 1:5, Training6 = 2:6, Training7 = 3:7), 11 | test = list(Testing5 = 6L, Testing6 = 7L, Testing7 = 8L))) 12 | 13 | expect_equal(s2, list(train = structure(list(Training5 = 1:5)), 14 | test = structure(list(Testing5 = 6L)))) 15 | 16 | expect_equal(s3, list(train = list(Training5 = 1:5, Training9 = 1:9), 17 | test = list(Testing5 = 6L, Testing9 = 10L))) 18 | 19 | expect_equal(s4, list(train = list(Training5 = 1:5, Training8 = 4:8), 20 | test = list(Testing5 = 6:7, Testing8 = 9:10))) 21 | }) 22 | -------------------------------------------------------------------------------- /pkg/caret/tests/testthat/test_gafs.R: -------------------------------------------------------------------------------- 1 | context('gafs') 2 | 3 | test_that("gafsControl errors working", { 4 | 5 | expect_error(gafsControl(method = "larry") 6 | ,"method should be one of") 7 | 8 | expect_error(gafsControl(metric = c("larry", "harry", "moe")) 9 | ,"should be a two-element named vector") 10 | 11 | expect_error(gafsControl(maximize = c("larry", "harry", "moe")) 12 | ,"should be a two-element named vector") 13 | 14 | }) 15 | 16 | test_that("high level tests", { 17 | 18 | expect_silent(pop <- gafs_initial(vars = 10, popSize = 10)) 19 | expect_silent(gafs_lrSelection(population = pop, fitness = 1:10)) 20 | expect_silent(gafs_spCrossover(population = pop, fitness = 1:10, parents = 1:2)) 21 | 22 | 23 | train_data <- twoClassSim(10, noiseVars = 1) 24 | test_data <- twoClassSim(10, noiseVars = 2) 25 | 26 | expect_silent( 27 | ctrl <- gafsControl(functions = rfGA, 28 | method = "cv", 29 | number = 3) 30 | ) 31 | 32 | ## Too slow 33 | # expect_silent( 34 | # rf_search <- gafs(x = train_data[, -ncol(train_data)], 35 | # y = train_data$Class, 36 | # iters = 2, 37 | # gafsControl = ctrl) 38 | # ) 39 | 40 | }) 41 | -------------------------------------------------------------------------------- /pkg/caret/tests/testthat/test_ggplot.R: -------------------------------------------------------------------------------- 1 | context("Test ggplot") 2 | skip_if_not_installed("kernlab") 3 | 4 | test_that("ggplot.train correctly orders factors", { 5 | library(caret) 6 | library(kernlab) 7 | data(mtcars) 8 | m <- train( 9 | mpg ~ cyl + disp, 10 | data = mtcars, 11 | method = "svmRadial", 12 | tuneGrid = expand.grid(C = 1:2, sigma = c(0.0001, 0.01, 1)) 13 | ) 14 | g <- ggplot(m, plotType = "level") 15 | 16 | # Test plot data 17 | obj_sigma <- as.numeric(levels(g$data$sigma)) 18 | obj_C <- as.numeric(levels(g$data$c)) 19 | expect_equal(obj_sigma, sort(obj_sigma)) 20 | expect_equal(obj_C, sort(obj_C)) 21 | 22 | # Test axes' labels on a built plot 23 | build <- ggplot2::ggplot_build(g) 24 | obj_x <- as.numeric(build$layout$panel_ranges[[1]]$x.labels) 25 | obj_y <- as.numeric(build$layout$panel_ranges[[1]]$y.labels) 26 | expect_equal(obj_x, sort(obj_x)) 27 | expect_equal(obj_y, sort(obj_y)) 28 | }) 29 | 30 | test_that("ggplot.train correctly orders facets' labels", { 31 | library(caret) 32 | library(kernlab) 33 | data(mtcars) 34 | m <- suppressWarnings(train( 35 | mpg ~ cyl + disp, 36 | data = mtcars, 37 | method = "svmPoly", 38 | tuneGrid = expand.grid( 39 | degree = c(0.0001, 0.01, 1), 40 | scale = c(0.0001, 0.01, 1), 41 | C = c(0.0001, 0.01, 1) 42 | ) 43 | )) 44 | g <- ggplot(m, plotType = "level", nameInStrip = TRUE) 45 | 46 | # Test plot data 47 | obj_C <- as.numeric(gsub( 48 | 'Cost: ', 49 | '', 50 | levels(g$data$C) 51 | )) 52 | expect_equal(obj_C, sort(obj_C)) 53 | 54 | # Test axes' labels on a built plot 55 | build <- ggplot2::ggplot_build(g) 56 | obj_labels <- as.numeric(gsub( 57 | 'Cost: ', 58 | '', 59 | levels(build$layout$panel_layout$C) 60 | )) 61 | expect_equal(obj_labels, sort(obj_labels)) 62 | }) 63 | -------------------------------------------------------------------------------- /pkg/caret/tests/testthat/test_glmnet_varImp.R: -------------------------------------------------------------------------------- 1 | 2 | library(caret) 3 | 4 | context('Testing varImp') 5 | 6 | test_that('glmnet varImp returns non-negative values', { 7 | skip_on_cran() 8 | skip_if_not_installed('glmnet') 9 | set.seed(1) 10 | dat <- SLC14_1(200) 11 | 12 | reg <- train(y ~ ., data = dat, 13 | method = "glmnet", 14 | tuneGrid = data.frame(lambda = .1, alpha = .5), 15 | trControl = trainControl(method = "none")) 16 | 17 | # this checks that some coefficients are negative 18 | coefs <- predict(reg$finalModel, s=0.1, type="coef") 19 | expect_lt(0, sum(0 > coefs)) 20 | # now check that all elements of varImp are nonnegative, 21 | # in spite of negative coefficients 22 | vis <- varImp(reg, s=0.1, scale=F)$importance 23 | expect_true(all(vis >= 0)) 24 | }) 25 | -------------------------------------------------------------------------------- /pkg/caret/tests/testthat/test_minimal.R: -------------------------------------------------------------------------------- 1 | context('Minimal Tests') 2 | stats <- caret:::basic2x2Stats(factor(0:1), factor(0:1), pos='1', neg='0') 3 | expect_equal(stats[['Sensitivity']], 1) 4 | expect_equal(stats[['Specificity']], 1) 5 | expect_equal(stats[['Pos Pred Value']], 1) 6 | expect_equal(stats[['Neg Pred Value']], 1) 7 | 8 | test_that("resampling method 'none' doesn't conflict with default tuneLength", { 9 | 10 | data(BloodBrain) 11 | 12 | expect_error(train(bbbDescr, logBBB, 13 | method = "earth", 14 | tuneLength = 2, 15 | trControl = trainControl(method = "none"))) 16 | 17 | expect_error(train(bbbDescr, logBBB, 18 | method = "earth", 19 | tuneLength = 2, 20 | trControl = trainControl(method = "none"))) 21 | 22 | expect_error(train(mpg ~ cyl + disp, data = mtcars, 23 | method = "gam", 24 | tuneLength = 2, 25 | trControl = trainControl(method = "none"))) 26 | 27 | }) 28 | 29 | -------------------------------------------------------------------------------- /pkg/caret/tests/testthat/test_misc.R: -------------------------------------------------------------------------------- 1 | 2 | context('misc functions') 3 | 4 | 5 | test_that("R2 and RMSE are calculating correctly", { 6 | 7 | pred <- runif(25) 8 | obs <- runif(25) 9 | 10 | expect_equal(R2(pred, obs), cor(obs, pred)^2) 11 | expect_equal(RMSE(pred, obs), sqrt(mean((pred - obs)^2))) 12 | 13 | }) 14 | 15 | 16 | test_that("auc calculation is > .5 when Xs provide prediction", { 17 | skip_if_not_installed("MLmetrics") 18 | skip_if_not_installed("earth") 19 | skip_if_not_installed("mda") 20 | 21 | trCntlListMulti <- 22 | trainControl( 23 | method = "cv", 24 | number = 3, 25 | verboseIter = FALSE, 26 | classProbs = TRUE, 27 | summaryFunction = multiClassSummary 28 | ) 29 | 30 | set.seed(3453) 31 | knnFit <- train(Species ~ ., 32 | data = iris, 33 | method = "knn", 34 | trControl = trCntlListMulti) 35 | 36 | expect_true(all(knnFit$resample$AUC > .5)) 37 | 38 | library(caret) 39 | 40 | set.seed(1) 41 | tr_dat <- twoClassSim(200) 42 | te_dat <- tr_dat 43 | tr_dat$Class = factor(tr_dat$Class, levels = rev(levels(te_dat$Class))) 44 | 45 | modle <- train( 46 | Class ~ ., 47 | data = te_dat, 48 | method = "fda", 49 | tuneLength = 10, 50 | metric = "ROC", 51 | trControl = trainControl(classProbs = TRUE, 52 | summaryFunction = twoClassSummary) 53 | ) 54 | 55 | expect_true(all(modle$resample$AUC > .5)) 56 | 57 | }) 58 | -------------------------------------------------------------------------------- /pkg/caret/tests/testthat/test_models_bagEarth.R: -------------------------------------------------------------------------------- 1 | # This is an extremely basic test that would catch serious kinds of errors 2 | # such as the bagEarth() not returning the right kind of object, that one of 3 | # the functions (bagEarth, format, predict) crash during normal usage, or that 4 | # bagEarth cannot model a simplistic kind of linear equation. 5 | context("earth") 6 | test_that('bagEarth simple regression', { 7 | skip_on_cran() 8 | data <- data.frame(X = 1:100) 9 | data$Y <- data$X * 2 10 | data$training <- data$X %% 2 11 | fit <- bagEarth(Y ~ X, data=data[1==data$training,], B=3) 12 | expect_that(format(fit, cat=FALSE), is_a('character')) 13 | expect_that(fit, is_a('bagEarth')) 14 | data$pred <- predict(fit, newdata=data) 15 | data$resid <- with(data, Y - pred) 16 | mae <- mean(abs(data$resid)) 17 | expect_equal(mae, 0) 18 | }) 19 | 20 | test_that('bagEarth simple classification', { 21 | skip_on_cran() 22 | data <- twoClassSim(n=1000) 23 | fit <- bagEarth(Class ~ ., data=data, B=3, glm=list(family=binomial)) 24 | expect_that(format(fit, cat=FALSE), is_a('character')) 25 | expect_that(fit, is_a('bagEarth')) 26 | 27 | pred_response <- predict(fit, newdata=data) 28 | expect_is(pred_response, "factor") 29 | expect_equal(length(pred_response), nrow(data)) 30 | 31 | pred_class <- predict(fit, newdata=data, type="class") 32 | expect_is(pred_class, "factor") 33 | expect_equal(length(pred_class), 1000) 34 | 35 | pred_prob <- predict(fit, newdata=data, type="prob") 36 | expect_is(pred_prob, "data.frame") 37 | expect_equal(ncol(pred_prob), 2) 38 | expect_equal(nrow(pred_prob), 1000) 39 | expect_true(0 <= min(pred_prob)) 40 | expect_true(max(pred_prob) <= 1) 41 | }) 42 | -------------------------------------------------------------------------------- /pkg/caret/tests/testthat/test_nearZeroVar.R: -------------------------------------------------------------------------------- 1 | context("Test nearZeroVar") 2 | 3 | test_that("nearZeroVar works properly with foreach", { 4 | ## shouldn't trigger error 5 | r <- nearZeroVar(iris, foreach = T) 6 | 7 | ## should pick up x, y and z 8 | bad.iris <- cbind(iris, 9 | x = rep(-1, nrow(iris)), 10 | y = rep(0, nrow(iris)), 11 | z = rep(1, nrow(iris))) 12 | r1 <- nearZeroVar(bad.iris) 13 | r2 <- nearZeroVar(bad.iris, foreach = T) 14 | expect_equal(r1, r2) 15 | 16 | r1 <- nearZeroVar(bad.iris, names = T) 17 | r2 <- nearZeroVar(bad.iris, names = T, foreach = T) 18 | expect_equal(r1, r2) 19 | 20 | r1 <- nearZeroVar(bad.iris, saveMetrics = T) 21 | r2 <- nearZeroVar(bad.iris, saveMetrics = T, foreach = T) 22 | expect_equal(r1, r2) 23 | }) 24 | -------------------------------------------------------------------------------- /pkg/caret/tests/testthat/test_preProcess.R: -------------------------------------------------------------------------------- 1 | context('Test preProcess') 2 | 3 | # Helper function 4 | check.medianImpute <- function(x) { 5 | # Reference column medians for checks 6 | med <- apply(x, 2, median, na.rm=TRUE) 7 | anyEmptyColumn <- any(is.na(med)) 8 | med[is.na(med)] <- 0 9 | 10 | if(anyEmptyColumn) { 11 | expect_warning( 12 | pp <- preProcess(x, method = "medianImpute"), 13 | "never filled" 14 | ) 15 | } else { 16 | pp <- preProcess(x, method = "medianImpute") 17 | } 18 | expect_equal(pp$median, med) 19 | 20 | x.filled <- predict(pp, newdata=x) 21 | expect_false(any(is.na(x.filled))) 22 | expect_equal(x[!is.na(x)], x.filled[!is.na(x)]) 23 | 24 | med.filled <- apply(x.filled, 2, median) 25 | expect_equal(med.filled, med) 26 | } 27 | 28 | # Tested data matrix 29 | set.seed(1) 30 | x <- matrix(rnorm(20, mean=10,sd=5), nrow=4) 31 | x[2,1] <- x[3,4] <- x[2,5] <- x[4,5] <- NA 32 | x[,3] <- NA 33 | 34 | colnames(x) <- paste0("Var.",1:ncol(x)) 35 | 36 | test_that("median Impute works for matrix with named columns", { 37 | check.medianImpute(x) 38 | }) 39 | 40 | test_that("median Impute works for data.frames", { 41 | check.medianImpute(as.data.frame(x, stringsAsFactors = TRUE)) 42 | }) 43 | 44 | test_that("correlation filter", { 45 | expect_equal( 46 | preProcess(iris, "corr")$method, 47 | list(ignore = "Species", remove = "Petal.Length") 48 | ) 49 | }) 50 | 51 | 52 | -------------------------------------------------------------------------------- /pkg/caret/tests/testthat/test_preProcess_internals.R: -------------------------------------------------------------------------------- 1 | context('Test preProcess internals') 2 | 3 | test_that("handles situation when there's a single column per transformation", { 4 | # For the data below, the list of transformations used internally by 5 | # "preProcess" contains a single related attribute 6 | # for each transformation; namely, `method=list(center="y", ignore="x")`. 7 | # At certain point such setting didn't work properly. 8 | x <- data.frame(x=factor(c("a", "a")), y=c(1, 2), stringsAsFactors = TRUE) 9 | model <- caret::preProcess(method="center", x=x) 10 | preprocessed <- predict(model, x) 11 | expect_equal(preprocessed, data.frame(x=c("a", "a"), y=c(-0.5, 0.5), stringsAsFactors = TRUE)) 12 | }) 13 | -------------------------------------------------------------------------------- /pkg/caret/tests/testthat/test_ptypes.R: -------------------------------------------------------------------------------- 1 | context('ptypes') 2 | 3 | data("Sacramento", package = "caret") 4 | 5 | mtcars_0 <- mtcars[0, -1] 6 | sac_0 <- Sacramento[0, -7] 7 | wt_0 <- mtcars[0, 6, drop = FALSE] 8 | 9 | # ------------------------------------------------------------------------------ 10 | 11 | none <- trainControl(method = "none") 12 | 13 | f_plain <- train(mpg ~ ., data = mtcars, method = "lm", trControl = none) 14 | f_oned <- train(mpg ~ wt, data = mtcars, method = "lm", trControl = none) 15 | f_inter <- train(mpg ~ (.)^2, data = mtcars, method = "lm", trControl = none) 16 | f_dmmy <- train(price ~ ., data = Sacramento, method = "lm", trControl = none) 17 | 18 | xy_plain <- train(x = mtcars[, -1], y = mtcars$mpg, method = "lm", trControl = none) 19 | xy_oned <- train(x = mtcars[, "wt", drop = FALSE], y = mtcars$mpg, method = "lm", trControl = none) 20 | xy_dmmy <- train(x = Sacramento[, -7], y = Sacramento$price, method = "lm", trControl = none) 21 | 22 | # ------------------------------------------------------------------------------ 23 | 24 | test_that("ptypes for formulas", { 25 | expect_equal(f_plain$ptype, mtcars_0) 26 | expect_equal(f_oned$ptype, wt_0) 27 | expect_equal(f_inter$ptype, mtcars_0) 28 | expect_equal(f_dmmy$ptype, sac_0) 29 | }) 30 | 31 | test_that("ptypes for formulas", { 32 | expect_equal(xy_plain$ptype, mtcars_0) 33 | expect_equal(xy_oned$ptype, wt_0) 34 | expect_equal(xy_dmmy$ptype, sac_0) 35 | }) 36 | -------------------------------------------------------------------------------- /pkg/caret/tests/testthat/test_recipe_upsample.R: -------------------------------------------------------------------------------- 1 | context('upsampling with recipes') 2 | 3 | test_that("model test", { 4 | skip_if_not_installed("themis") 5 | withr::local_seed(2542) 6 | dat <- twoClassSim(200, intercept = 6) 7 | 8 | rec <- 9 | recipe(Class ~ TwoFactor1 + TwoFactor2 + Linear01, data = dat) %>% 10 | themis::step_upsample(Class, seed = 534) 11 | 12 | mod <- train(rec, dat, method = "knn", trControl = trainControl(method = "cv")) 13 | expect_equivalent( 14 | rep(max(table(dat$Class)), 2), 15 | as.vector(table(mod$finalModel$learn$y)) 16 | ) 17 | }) 18 | -------------------------------------------------------------------------------- /pkg/caret/tests/testthat/test_sparse_Matrix.R: -------------------------------------------------------------------------------- 1 | context("Testing sparse Matrix") 2 | 3 | test_that("caret can return sparse Matrix object", { 4 | skip_on_cran() 5 | skip_if_not_installed('glmnet') 6 | skip_if_not_installed('Matrix') 7 | 8 | x <- Matrix::Matrix(as.matrix(mtcars)[, -1], sparse=TRUE) 9 | y <- mtcars$mpg 10 | expect_warning(train(x, y, method="glmnet"), NA) 11 | expect_warning(train(as.matrix(x), y, method="glmnet"), NA) 12 | 13 | cls_y <- factor(rep_len(letters[1:2], nrow(mtcars))) 14 | ctrl <- trainControl(method = "cv", 15 | classProbs = TRUE, 16 | summaryFunction = twoClassSummary) 17 | expect_error(train(x, cls_y, method="glmnet", metric = "ROC", trControl = ctrl), NA) 18 | expect_error(train(as.matrix(x), cls_y, method="glmnet", metric = "ROC", trControl = ctrl), NA) 19 | }) 20 | -------------------------------------------------------------------------------- /pkg/caret/tests/testthat/test_spatialSign.R: -------------------------------------------------------------------------------- 1 | context('spatialSign') 2 | 3 | test_that("errors working", { 4 | 5 | # vector 6 | expect_error(spatialSign(iris$Species) 7 | ,"not defined" 8 | ) 9 | 10 | # matrix 11 | expect_error(spatialSign(as.matrix(iris)) 12 | ,"not defined" 13 | ) 14 | 15 | # data.frame 16 | expect_error(spatialSign(iris) 17 | ,"not defined" 18 | ) 19 | 20 | }) 21 | 22 | test_that("results match", { 23 | 24 | x = -100:100 25 | expect_true(all(spatialSign(x) == x/sqrt(sum(x^2)))) 26 | 27 | i4 <- spatialSign(iris[,1:4]) 28 | expect_true(all(as.matrix(i4) == t(apply(iris[,1:4], 1, spatialSign)))) 29 | 30 | }) 31 | 32 | 33 | test_that("high level tests", { 34 | 35 | i4 <- spatialSign(iris[,1:4]) 36 | 37 | expect_true(all(colnames(i4) == names(iris[1:4]))) 38 | expect_true(all(dim(i4) == dim(iris[1:4]))) 39 | 40 | }) 41 | 42 | 43 | test_that("missing data", { 44 | 45 | iris[c(1, 51, 101), 1] <- NA 46 | 47 | i5 <- spatialSign(iris[,1:4]) 48 | 49 | exp_res <- iris[,1:4] / 50 | apply(iris[,1:4], 1, function(x) sqrt(sum(x^2, na.rm = TRUE))) 51 | 52 | expect_equivalent(i5, as.matrix(exp_res)) 53 | 54 | }) 55 | 56 | -------------------------------------------------------------------------------- /pkg/caret/tests/testthat/test_twoClassSummary.R: -------------------------------------------------------------------------------- 1 | 2 | context('twoClassSummary testing') 3 | 4 | 5 | test_that("twoClassSummary is calculating correctly", { 6 | set.seed(1) 7 | tr_dat <- twoClassSim(100) 8 | te_dat <- twoClassSim(100) 9 | mod <- knn3(x = as.matrix(tr_dat[, 1:5]), y = tr_dat$Class) 10 | te_pred <- predict(mod, te_dat[, 1:5], type = "class") 11 | te_prob <- predict(mod, te_dat[, 1:5], type = "prob") 12 | te_prob <- as.data.frame(te_prob, stringsAsFactors = TRUE) 13 | 14 | cm <- caret::confusionMatrix(te_pred, te_dat$Class) 15 | library(pROC) 16 | roc_crv <- pROC::roc(te_dat$Class, te_prob$Class1, direction = ">", quiet = TRUE) 17 | roc_auc <- as.numeric(pROC::auc(roc_crv)) 18 | 19 | te_res <- te_prob 20 | te_res$pred <- te_pred 21 | te_res$obs <- te_dat$Class 22 | 23 | tcs_res <- twoClassSummary(te_res, lev = levels(te_pred)) 24 | expect_equal(roc_auc, unname(tcs_res["ROC"])) 25 | expect_equal(unname(cm$byClass["Sensitivity"]), unname(tcs_res["Sens"])) 26 | expect_equal(unname(cm$byClass["Specificity"]), unname(tcs_res["Spec"])) 27 | }) 28 | -------------------------------------------------------------------------------- /pkg/caret/tests/testthat/test_varImp.R: -------------------------------------------------------------------------------- 1 | context('varImp') 2 | 3 | test_that("high level tests", { 4 | 5 | data(iris) 6 | TrainData <- iris[,1:4] 7 | TrainClasses <- iris[,5] 8 | 9 | expect_silent( 10 | knnFit1 <- train(TrainData, TrainClasses, 11 | method = "knn", 12 | preProcess = c("center", "scale"), 13 | tuneLength = 10, 14 | trControl = trainControl(method = "cv")) 15 | ) 16 | 17 | expect_silent(vv <- varImp(knnFit1)) 18 | 19 | expect_true(ncol(vv$importance) == length(levels(TrainClasses))) 20 | expect_true(nrow(vv$importance) == ncol(TrainData)) 21 | 22 | }) 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /release_process/Open_Data_Science_Conference/caret.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/release_process/Open_Data_Science_Conference/caret.pdf -------------------------------------------------------------------------------- /release_process/Open_Data_Science_Conference/coverage_12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/release_process/Open_Data_Science_Conference/coverage_12.png -------------------------------------------------------------------------------- /release_process/Open_Data_Science_Conference/min_graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/release_process/Open_Data_Science_Conference/min_graph.pdf -------------------------------------------------------------------------------- /release_process/Open_Data_Science_Conference/new_graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/release_process/Open_Data_Science_Conference/new_graph.pdf -------------------------------------------------------------------------------- /release_process/Open_Data_Science_Conference/old_graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/release_process/Open_Data_Science_Conference/old_graph.pdf -------------------------------------------------------------------------------- /release_process/Open_Data_Science_Conference/outline.md: -------------------------------------------------------------------------------- 1 | Package Maintenance for caret 2 | === 3 | 4 | 5 | 1. The caret package 6 | * what it does 7 | * large number of package dependencies 8 | * potential issues with package versions, naming conflicts, bugs, etc 9 | * large number of complex functions require a lot of documentation 10 | * most model code stored outside of the reach of `R CMD check` 11 | 12 | 2. Version control 13 | * originally subversion via R-Forge 14 | * shortcomings of R-Forge 15 | * move to github: why? 16 | 17 | 3. github and R packages 18 | 19 | 4. How we release versions 20 | * create certain man pages 21 | * sync code and use `R CMD check --as-cran` to ensure passing tests (+unit) 22 | * update all packages (and R) 23 | * run regression tests and evaluate results 24 | * send to CRAN (repeat as needed) 25 | * install `caret` locally 26 | * generate HTML documentation and sync github io branch 27 | * profit 28 | -------------------------------------------------------------------------------- /release_process/Open_Data_Science_Conference/test_coverage_report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/release_process/Open_Data_Science_Conference/test_coverage_report.png -------------------------------------------------------------------------------- /release_process/README.md: -------------------------------------------------------------------------------- 1 | Pre-Release Work 2 | --- 3 | 4 | 5 | 0. Install latest devel version of R ([here](http://r.research.att.com/snowleopard/R-devel/R-devel-snowleopard-signed.pkg) for OS X) 6 | 0. Sync `git` project 7 | 0. Run `models/parseModels.R` to get new model results into package 8 | 0. Run code to update all `caret` related packages (see `release_process/update_pkgs.R`) _outside of RStudio_. Beware that this might reinstall `caret` 9 | 0. Install current CRAN version of `caret` and run regression tests (via `RegressionTests/move_files.R`) 10 | 0. Install devel version of `caret` 11 | 1. Run the check for reverse dependencies using `revdepcheck::revdep_check(num_workers = 4)` 12 | 1. Run regression tests (via `move_files.R` again) 13 | 0. Compare results to see if any models fail or substantively change results using `RegressionTests/compare.R` 14 | 0. Run `release_process/make_model_Rd.R` to make the models man file and move this to `pkg/caret/man` 15 | 1. Look to find any CRAN policy changes [here](https://github.com/eddelbuettel/crp/commits/master/texi/CRAN_policies.texi). 16 | 2. Look at the [CRAN Package Check Results](https://cran.r-project.org/web/checks/check_results_caret.html) 17 | 0. Run `devtools::check()` 18 | 0. (Max only) use `devtools::build_win()` to check on CRAN servers 19 | 0. Run `html/makeHTML.R` to make new HTML files for github 20 | 0. Send to CRAN via [web form](https://xmpalantir.wu.ac.at/cransubmit/) 21 | 1. Once accepted, use `git tag -a 6.0-xx -m "Version 6.0-xx release"` to mark the release. 22 | 23 | -------------------------------------------------------------------------------- /release_process/talk/caret.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/topepo/caret/c98cc1a3ba5f0b087d51f5c4362a3b751515e243/release_process/talk/caret.pdf -------------------------------------------------------------------------------- /release_process/talk/outline.md: -------------------------------------------------------------------------------- 1 | Package Maintenance for caret 2 | === 3 | 4 | 5 | 1. The caret package 6 | * what it does 7 | * large number of package dependencies 8 | * potential issues with package versions, naming conflicts, bugs, etc 9 | * large number of complex functions require a lot of documentation 10 | * most model code stored outside of the reach of `R CMD check` 11 | 12 | 2. Version control 13 | * originally subversion via R-Forge 14 | * shortcomings of R-Forge 15 | * move to github: why? 16 | 17 | 3. github and R packages 18 | 19 | 4. How we release versions 20 | * create certain man pages 21 | * sync code and use `R CMD check --as-cran` to ensure passing tests (+unit) 22 | * update all packages (and R) 23 | * run regression tests and evaluate results 24 | * send to CRAN (repeat as needed) 25 | * install `caret` locally 26 | * generate HTML documentation and sync github io branch 27 | * profit 28 | --------------------------------------------------------------------------------