classif.ML: Functional classification using ML algotithms

classif.MLR Documentation

Functional classification using ML algotithms

Description

Computes functional classification using functional (and non functional) explanatory variables by rpart, nnet, svm or random forest model

Usage

classif.nnet(formula, data, basis.x = NULL, weights = "equal", size, ...)

classif.rpart(
  formula,
  data,
  basis.x = NULL,
  weights = "equal",
  type = "1vsall",
  ...
)

classif.svm(
  formula,
  data,
  basis.x = NULL,
  weights = "equal",
  type = "1vsall",
  ...
)

classif.ksvm(formula, data, basis.x = NULL, weights = "equal", ...)

classif.randomForest(
  formula,
  data,
  basis.x = NULL,
  weights = "equal",
  type = "1vsall",
  ...
)

classif.lda(
  formula,
  data,
  basis.x = NULL,
  weights = "equal",
  type = "1vsall",
  ...
)

classif.qda(
  formula,
  data,
  basis.x = NULL,
  weights = "equal",
  type = "1vsall",
  ...
)

classif.naiveBayes(formula, data, basis.x = NULL, laplace = 0, ...)

classif.cv.glmnet(formula, data, basis.x = NULL, weights = "equal", ...)

classif.gbm(formula, data, basis.x = NULL, weights = "equal", ...)

Arguments

formula

an object of class formula (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under Details.

data

List that containing the variables in the model.

basis.x

List of basis for functional explanatory data estimation.

weights

Weights:

  • if character string ='equal' same weights for each observation (by default) and ='inverse' for inverse-probability of weighting.

  • if numeric vector of length n, Weight values of each observation.

size

number of units in the hidden layer. Can be zero if there are skip-layer units.

...

Further arguments passed to or from other methods.

type

If type is"1vsall" (by default) a maximum probability scheme is applied: requires G binary classifiers. If type is "majority" (only for multicalss classification G > 2) a voting scheme is applied: requires G (G - 1) / 2 binary classifiers.

laplace

value used for Laplace smoothing (additive smoothing). Defaults to 0 (no Laplace smoothing).

Details

The first item in the data list is called "df" and is a data frame with the response and non functional explanatory variables, as glm.

Functional covariates of class fdata or fd are introduced in the following items in the data list.
basis.x is a list of basis for represent each functional covariate. The b object can be created by the function: create.pc.basis, pca.fd create.pc.basis, create.fdata.basis o create.basis.
basis.b is a list of basis for represent each functional beta parameter. If basis.x is a list of functional principal components basis (see create.pc.basis or pca.fd) the argument basis.b is ignored.

Value

Return classif object plus:

  • formula formula.

  • data List that containing the variables in the model.

  • group Factor of length n

  • group.est Estimated vector groups

  • prob.classification Probability of correct classification by group.

  • prob.group Matrix of predicted class probabilities. For each functional point shows the probability of each possible group membership.

  • max.prob Highest probability of correct classification.

  • type Type of classification scheme: 1 vs all or majority voting.

  • fit list of binary classification fitted models.

Note

Wrapper versions for multivariate and functional classification:

  • classif.lda,classif.qda: uses lda and qda functions and requires MASS package.

  • classif.nnet: uses nnet function and requires nnet package.

  • classif.rpart: uses nnet function and requires rpart package.

  • classif.svm,classif.naiveBayes: uses svm and naiveBayes functions and requires e1071 package.

  • classif.ksvm: uses weighted.ksvm function and requires personalized package.

  • classif.randomForest: uses randomForest function and requires randomForest package.

  • classif.cv.glmnet: uses cv.glmnet function and requires glmnet package.

  • classif.gbm: uses gbm function and requires gbm package.

Author(s)

Febrero-Bande, M. and Oviedo de la Fuente, M.

References

Ramsay, James O., and Silverman, Bernard W. (2006), Functional Data Analysis, 2nd ed., Springer, New York.

McCullagh and Nelder (1989), Generalized Linear Models 2nd ed. Chapman and Hall.

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S, New York: Springer. Regression for R. R News 1(2):20-25

See Also

See Also as: rpart.
Alternative method: classif.np, classif.glm, classif.gsam and classif.gkam.

Examples

## Not run: 
data(phoneme)
mlearn<-phoneme[["learn"]]
glearn<-phoneme[["classlearn"]]
mtest<-phoneme[["test"]]
gtest<-phoneme[["classtest"]]
dataf<-data.frame(glearn)
dat=ldata("df"=dataf,"x"=mlearn)
a1<-classif.rpart(glearn~x,data=dat)
a2<-classif.nnet(glearn~x,data=dat)
a3<-classif.gbm(glearn~x,data=dat)
a4<-classif.randomForest(glearn~x,data=dat)
a5<-classif.cv.glmnet(glearn~x,data=dat)
newdat<-list("x"=mtest)
p1<-predict(a1,newdat,type="class")
p2<-predict(a2,newdat,type="class")
p3<-predict(a3,newdat,type="class")
p4<-predict(a4,newdat,type="class")
p5<-predict(a5,newdat,type="class")
mean(p1==gtest);mean(p2==gtest);mean(p3==gtest)
mean(p4==gtest);mean(p5==gtest)

## End(Not run)


fda.usc documentation built on Oct. 17, 2022, 9:06 a.m.