# Can we use SVM and Random forest for classification of one-dimensional data?

I am working on flood inundation mapping using remote sensing data. I am using a single band, a simple threshold value can be used to separate land and water. I am interested in knowing, can we use SVM and Random forest for classification on one-dimensional data?

• The answer is trivially "yes," but one might instead ask "How does a random forest/svm for a 1-dimensional feature space compare to a logistic regression with a spline basis?" – Sycorax says Reinstate Monica Aug 8 '19 at 21:25

Yes, this is possible.

Consider a binary classification problem with real-valued (1d) inputs and class labels '0' and '1'. A linear classifier will find a decision boundary that separates the input space into two halves. In the 1d case, this is simply a threshold. Points will be assigned label '0' on one side of the boundary and label '1' on the other side. For example:

0   0 0  0 0   |   1  1 1  1


If the data fit this pattern, then a linear classifier is a good option. A non-linear classifier (e.g. random forest or kernelized SVM) is more appropriate when data from each class are distributed in multiple, interleaved regions, and can't be separated by a single threshold. For example:

0 0  0 0   |   1 11 11 1  |  0 0 0   0 0  0


You certainly can! Neither one has limits on the dimensions of the inputs. However, it may not produce substantially better performance than a simpler model, like a logit model.

• could there be any justification for using them? – user54272 Aug 8 '19 at 19:04
• Potentially - a random forest, for example, will fit a non-linear relationship better than a vanilla logit. – Louis Cialdella Aug 8 '19 at 20:50
• A logistic regression with regression splines would be a better comparison. – kjetil b halvorsen Aug 8 '19 at 21:02