R/isregression.R

`isregression` <-
function(y, regression = FALSE)
{
	if(regression != TRUE)
	{
		# find out whether this is a regression or classification problem
		if(sum(y == -1) + sum(y == 1) < length(y))
		{
			# there are labels which are not element of {-1, 1} => regression problem
			regression <- TRUE
		}
	}
	
	return(regression)
}

Try the rdetools package in your browser

Any scripts or data that you put into this service are public.

rdetools documentation built on May 2, 2019, 7:02 a.m.