Predicts from a fitted classif object.

Share:

Description

Classifier of functional data by kernel method using functional data object of class classif.

Usage

1
2
## S3 method for class 'classif'
predict(object, new.fdataobj,type="class",...)

Arguments

object

Object object estimated by: k nearest neighbors method classif.knn, kernel method classif.kernel.

new.fdataobj

New functional explanatory data of fdata class.

type

Type of prediction ("class or probability of each group membership").

...

Further arguments passed to or from other methods.

Details

Returns the predicted classes using a previously trained model.

Value

If type="class", produces a vector of predictions.

If type="probs", a list with the following components is returned:

  • group.pred the vector of predictions.

  • prob.group the matrix of predicted probability by factor level.

Author(s)

Manuel Febrero-Bande, Manuel Oviedo de la Fuente manuel.oviedo@usc.es

References

Ferraty, F. and Vieu, P. (2006). Nonparametricc functional data analysis. Springer Series in Statistics, New York.

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

See Also

See also classif.np classif.glm, classif.gsam and classif.gkam .

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
data(phoneme)
mlearn<-phoneme[["learn"]][1:100]
glearn<-phoneme[["classlearn"]][1:100]

#	ESTIMATION knn
out1=classif.knn(glearn,mlearn,knn=3)
summary.classif(out1)

#	PREDICTION knn
mtest<-phoneme[["test"]][1:100]
gtest<-phoneme[["classtest"]][1:100]
pred1=predict.classif(out1,mtest)
table(pred1,gtest)

#	ESTIMATION kernel 
h=2^(0:5)
# using metric distances computed in classif.knn
out2=classif.kernel(glearn,mlearn,h=h,metric=out1$mdist)
summary.classif(out2)
#	PREDICTION kernel
pred2=predict.classif(out2,mtest)
table(pred2,gtest)

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.