# How do I classify measurements into only two classes?

I am a member of a robotics team that is measuring the amount of reflected IR light to determine the lightness/darkness of a given material. We eventually hope to be able to use this to follow a line using a pre-set algorithm, but the first step is determining whether the material is one of the binary options: light or dark.

Given a large population of values between 0 and 1023, probably in two distinct groupings, how can I best go about classifying a given point as light or dark?

## 1 Answer

The way to categorize measurements into two separate populations is through what ML people currently term unsupervised learning. Such a process is part of the AI tool chest. Statistics is part, but not all, of the mathematics involved in the theory that leads to algorithms that learn without labeling the array of points light or dark in advance.

Reflected IR light can be specular or mirror in nature and significant levels of IR emission will also occurs, without raising the surface temperature of materials under most common circumstances. There is also refraction and transmission to be considered in the robotics space.

Materials will not exhibit lightness. The material composition, coating, and surface texture will exhibit various reflectivities, emission dependent on the absolute temperature raised to the fourth power1, and transmission of light entering the material from various directions, possibly diffused internally.

We eventually hope to be able to use this to follow a line using a pre-set algorithm.

That is one of the primary objectives of computer vision and has been since the first digital signal processing in the mid twentieth century.

The first step is determining whether the material is one of the binary options, light or dark.

That may be an experimental first step, but the loss of information from taking a number that discretely represents a cube in horizontal-vertical-frame space, each of which has $$\tau$$ channels of $$\beta$$ bits, is not a good computer vision strategy. The total number of bits of IR information is given by

$$\tau \beta \; \text{,}$$

so the data loss will be, in percent,

$$\dfrac {100 \, (\tau \beta - 1)} {\tau \beta} \; \text{.}$$

Object recognition and thus collision avoidance will be frustrated by that much data loss, even if only one IR spectral range is contained in the cube ($$\tau = 1$$).

Given a large population of values between 0 and 1023, probably in two distinct groupings, how can I best go about classifying a given point as light or dark?

It appears that $$\tau$$ does equal one and $$\beta = \log_{2} (1023 - 0 + 1) = 10$$, thus the information in bits per cube (pixel in a frame) is 10. If the project, for some reason, requires that 9 bits be discarded in a way to conserve as much of the original 10 bits as possible (perhaps to maintain a particular throughput through a transmission or processing bottleneck), then the way to do it is through a one bit feature extraction, meaning that the output of the artificial network should be one bit. These are a few unsupervised learning options to investigate.

• RBMs (restricted Boltzmann machine)

• K-means clustering

• Gaussian mixture models

Most AI and artificial network frameworks and libraries will have examples of these in the example directory. It is advisable to approach the project like this.

• Find web pages or articles using the above as search terms until an explanation that is clear to the team is found.

• Study all three for at least a few hours each as a team.

• Find a library or framework that contains all three.

• Install the necessary prerequisites for all three on the lab computer(s).

• Produce a working example of the three types so that selection is not a function of which one is easiest to get running (something which would qualify as an research anti-pattern).

• Make a choice.

• Change the working code, one verifiable step at a time into the desired unsupervised learning program.

• Eventually, when thoroughly ready, make the jump from the example data set to the robotic IR light frame set.

Footnotes

[1] Stefan-Boltzmann law

• This looks like part of what I was looking for but it is not particularly feasible for our project and I don’t understand all of it. We can’t use any libraries and have to rely on our own code. All I need to do is classify a few points. Would it be easier to simply have a hard-coded cutoff value? – dalearn Jan 26 at 19:50
• Under ordinary circumstances I would certainly agree with you but we are doing this as a high school project on a platform with very minimal computing power. We simply want to follow a line with a sensor to improve the accuracy of our autonomous algorithm on game boards that may be smudged or of varying quality and we wanted to do it in a higher-level way than the typical method of deciding on an arbitrary value somewhere in the middle of the available range. – dalearn Jan 27 at 2:53