Answers.Body: <p>It is possible, but is a pretty terrible idea.</p>
  
  <p>There are a few options. One is to not use the GA as a direct classifier, but instead use a GA to learn the parameters of another classification model like a neural network. The basic idea of a GA is that it (very roughly speaking) forms a black-box method for searching an arbitrary space for solutions that minimize or maximize some function.</p>
  
  <p>Here, you would be searching the space of possible neural network topologies and/or weights to find one that minimizes the misclassification rate.</p>
  
  <p>Another approach is that taken by what are sometimes called Learning Classifier Systems (LCS) or Genetics Based Machine Learning (GBML). This approach is to use evolutionary mechanics to evolve rule sets of the form "if X condition is true, then do/classify Y". That's a more direct method of solving this sort of problem. You define some features on your dataset, and the algorithm tries to learn rules based on those features.</p>
  
  <p>The problem with any of these approaches is just that there are so many better ways to solve the problem. Remember, a GA is basically a black-box that's supposed to work acceptably well for a huge range of unknown problems. But I'm not solving a huge range of unknown problems. I'm trying to separate ham from spam on one dataset. I can come up with methods that simply do that job better and more quickly than a GA has any real hope of doing.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-03T15:36:36.527Z
Answers.LastActivityDate: 2017-03-03T15:36:36.527Z
Answers.UserDisplayName: deong
Answers.Body: <p>You must understand that a genetic algorithm is an optimization algorithm. You can't feed it e-mails and make it classify spam. A genetic algorithm is used to train a model to classify spam. That something could be neural networks.</p>
  
  <p>What you need is a genetic algorithm that optimizes neural networks <a href="https://en.wikipedia.org/wiki/Neuroevolution" rel="nofollow noreferrer">neuroevolution</a>, which might roughly work as follows</p>
  
  <ol>
  <li>Start with a pool of neural networks</li>
  <li>Feed them e-mails, let them classify, and calculate fitness on % correct</li>
  <li>Select neural networks for crossover</li>
  <li>Crossover</li>
  <li>Mutate</li>
  </ol>
  
  <p>However, there are better ways for classifying e-mails (e.g. an algorithm that looks for certain "spam words"). </p>
  
  <p>But it is definitely possible. I have a <a href="https://github.com/wagenaartje/neataptic" rel="nofollow noreferrer">javascript library</a> set up for neuroevolution, if you're interested.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2017-03-04T12:53:13.280Z
Answers.LastActivityDate: 2019-07-07T21:54:10.840Z
Answers.LastEditDate: 2019-07-07T21:54:10.840Z
Answers.UserDisplayName: Thomas Wagenaar
Body: <p>Is it possible to classify data using a genetic algorithm? For example, would it be possible to sort <a href="https://archive.ics.uci.edu/ml/datasets/Spambase" rel="nofollow noreferrer">this database</a>?</p>
  
  <p>Any example in Matlab?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-05T23:09:11.797Z
Comments.Text: Yes. You may want to read this article: http://www.genetic-programming.com/jkpdf/tr1314.pdf and/or this book: http://dl.acm.org/citation.cfm?id=138936 .
Comments.UserDisplayName: user31264
Tags: <classification><genetic-algorithms><evolutionary-algorithms><matlab><neuroevolution>
Title: Is it possible to classify data using a genetic algorithm?
UserDisplayName: Ricardo Pouças
ThreadText: # Is it possible to classify data using a genetic algorithm?
  
  (Asked by: username_0 on 2017-03-03)
  
  Is it possible to classify data using a genetic algorithm? For example, would it be possible to sort [this database](https://archive.ics.uci.edu/ml/datasets/Spambase)?
  
  Any example in Matlab?
  
  **Tags:** classification, genetic-algorithms, evolutionary-algorithms, matlab, neuroevolution
  > **Comments:**
  > **username_1**: Yes. You may want to read this article: http://www.genetic-programming.com/jkpdf/tr1314.pdf and/or this book: http://dl.acm.org/citation.cfm?id=138936 .  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2017-03-03. Score: 3
  
  It is possible, but is a pretty terrible idea.
  
  There are a few options. One is to not use the GA as a direct classifier, but instead use a GA to learn the parameters of another classification model like a neural network. The basic idea of a GA is that it (very roughly speaking) forms a black-box method for searching an arbitrary space for solutions that minimize or maximize some function.
  
  Here, you would be searching the space of possible neural network topologies and/or weights to find one that minimizes the misclassification rate.
  
  Another approach is that taken by what are sometimes called Learning Classifier Systems (LCS) or Genetics Based Machine Learning (GBML). This approach is to use evolutionary mechanics to evolve rule sets of the form "if X condition is true, then do/classify Y". That's a more direct method of solving this sort of problem. You define some features on your dataset, and the algorithm tries to learn rules based on those features.
  
  The problem with any of these approaches is just that there are so many better ways to solve the problem. Remember, a GA is basically a black-box that's supposed to work acceptably well for a huge range of unknown problems. But I'm not solving a huge range of unknown problems. I'm trying to separate ham from spam on one dataset. I can come up with methods that simply do that job better and more quickly than a GA has any real hope of doing.
  
  
  ---
  
  ### Answer by username_3 on 2017-03-04. Score: 2
  
  You must understand that a genetic algorithm is an optimization algorithm. You can't feed it e-mails and make it classify spam. A genetic algorithm is used to train a model to classify spam. That something could be neural networks.
  
  What you need is a genetic algorithm that optimizes neural networks [neuroevolution](https://en.wikipedia.org/wiki/Neuroevolution), which might roughly work as follows
  
  1. Start with a pool of neural networks
  2. Feed them e-mails, let them classify, and calculate fitness on % correct
  3. Select neural networks for crossover
  4. Crossover
  5. Mutate
  
  However, there are better ways for classifying e-mails (e.g. an algorithm that looks for certain "spam words").
  
  But it is definitely possible. I have a [javascript library](https://github.com/wagenaartje/neataptic) set up for neuroevolution, if you're interested.
  
  
  ---
  
  