how to classify dataset based on multiple criterion?

2 views (last 30 days)
i wanna classify dataset based on multiple criterion. nested if else statements will get me the results but i would like use more efficient and elegant method (something like supervised learning method).
for example
p range p1 range p2 range output
0 to -1 0 to 1 < 50 class 1
p range p1 range p2 range output
0 to -1 0 to 1 50 to 100 class 2
p range p1 range p2 range output
0 to -1 0 to 1 >100 class 3
p range p1 range p2 range output
0.1 to 1 -0.1 to -1 < 50 class 4
p range p1 range p2 range output
0.1 to 1 -0.1 to -1 50 to 100 class 5
p range p1 range p2 range output
0.1 to 1 -0.1 to -1 > 100 class 6
I tried classification learner app but couldn't achieve the results. kindly help me.

Answers (1)

Image Analyst
Image Analyst on 24 Oct 2016
If those are your known criteria, then you don't need any fancy classification code or functions, simple use a series of if/else statements:
if p > -1 && p < 0 && p1 > 0 && p1 < 1 && p2 < 50
theClass = 1;
elseif p > -1 && p < 0 && p1 > 0 && p1 < 1 && p2 > 50 && p2 < 100
theClass = 2;
etc.

Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!