: fits a model and returns the train and validation errors as a list
fit_and_report(X, y, Xv, yv, method, m_type = "regression")
X | The features of the training set |
---|---|
y | The target of the training set |
Xv | The feature of the validation set |
yv | The target of the validation set |
method | A machine learning model, can either be classification or regression |
m_type | The type for calculating error (default = 'regression') |
an array of train and validation error
x1<- iris[1:2][1:100,] x2<-iris[1:2][100:150,] y1<- iris$Petal.Length[1:100] y2<-iris$Petal.Length[100:150] result_r <- fit_and_report(x1,y1,x2,y2,'glm','regression')