#create Morse-Smale complex regression of fourpeaks2d data set
data(fourpeaks)
d <- fourpeaks()
#build Morse-Smale complex
ms <- msc.nn.svm(y=d[,1], x=d[, 2:3], pLevel=0.1, knn = 10)
msr <- msc.lm(ms)
#show slected persitence level by cross validtaion
msr$ms$predictLevel
#print mean squared crossvalidated error
msr$lms[[msr$ms$predictLevel]]$cv
#predict
fp <- predict(msr, d[, 2:3])
#fit an elastic model insteaed
msr <- msc.elnet(ms)
#prediction for ealstic model
fp <- predict(msr, d[, 2:3])
Run the code above in your browser using DataLab