Answers.Body: <p>The way to categorize measurements into two separate populations is through what ML people currently term <em>unsupervised learning</em>. 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.</p>
  
  <p>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.</p>
  
  <p>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 power<sup>1</sup>, and transmission of light entering the material from various directions, possibly diffused internally.</p>
  
  <blockquote>
    <p>We eventually hope to be able to use this to follow a line using a pre-set algorithm.</p>
  </blockquote>
  
  <p>That is one of the primary objectives of computer vision and has been since the first digital signal processing in the mid twentieth century.</p>
  
  <blockquote>
    <p>The first step is determining whether the material is one of the binary options, light or dark.</p>
  </blockquote>
  
  <p>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 <span class="math-container">$\tau$</span> channels of <span class="math-container">$\beta$</span> bits, is not a good computer vision strategy. The total number of bits of IR information is given by</p>
  
  <p><span class="math-container">$$ \tau \beta \; \text{,} $$</span></p>
  
  <p>so the data loss will be, in percent,</p>
  
  <p><span class="math-container">$$ \dfrac {100 \, (\tau \beta - 1)} {\tau \beta} \; \text{.} $$</span></p>
  
  <p>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 (<span class="math-container">$\tau = 1$</span>).</p>
  
  <blockquote>
    <p>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?</p>
  </blockquote>
  
  <p>It appears that <span class="math-container">$\tau$</span> does equal one and <span class="math-container">$\beta = \log_{2} (1023 - 0 + 1) = 10$</span>, 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.</p>
  
  <ul>
  <li><p>RBMs (restricted Boltzmann machine)</p></li>
  <li><p>K-means clustering</p></li>
  <li><p>Gaussian mixture models</p></li>
  </ul>
  
  <p>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.</p>
  
  <ul>
  <li><p>Find web pages or articles using the above as search terms until an explanation that is clear to the team is found.</p></li>
  <li><p>Study all three for at least a few hours each as a team.</p></li>
  <li><p>Find a library or framework that contains all three.</p></li>
  <li><p>Install the necessary prerequisites for all three on the lab computer(s).</p></li>
  <li><p>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).</p></li>
  <li><p>Make a choice.</p></li>
  <li><p>Change the working code, one verifiable step at a time into the desired unsupervised learning program.</p></li>
  <li><p>Eventually, when thoroughly ready, make the jump from the example data set to the robotic IR light frame set.</p></li>
  </ul>
  
  <hr>
  
  <p><strong>Footnotes</strong></p>
  
  <p>[1] Stefan-Boltzmann law</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-26T19:50:56.500Z
Answers.Text: 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?
Answers.UserDisplayName: dalearn
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-27T02:53:49.643Z
Answers.Text: 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.
Answers.UserDisplayName: dalearn
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-26T14:04:32.607Z
Answers.LastActivityDate: 2019-01-26T14:04:32.607Z
Answers.UserDisplayName: Douglas Daseeco
Body: <p>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.  </p>
  
  <p>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?</p>
  
Tags: <neural-networks><machine-learning><classification>
Title: How do I classify measurements into only two classes?
UserDisplayName: dalearn
ThreadText: # How do I classify measurements into only two classes?
  
  (Asked by: username_0 on 2019-01-25)
  
  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?
  
  **Tags:** neural-networks, machine-learning, classification
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-01-26. Score: 3
  
  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
  
  > **Comments:**
  > **username_0**: 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?  
  > **username_0**: 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.  
  
  ---
  
  