I never knew there is a package for it already

ElemStatLearn