Tag: Algorithm

I’m currently engaged writing Machine Learning for Dummies. The book is interesting because it turns math into something more than a way to calculate. Machine learning is about having inputs and a desired result, and then asking the machine to create an algorithm that will produce the desired result from the inputs. It’s about generalization. You know the specific inputs and the specific results, but you want an algorithm that will provide similar results given similar inputs for any set of random inputs. This is more than just math. In fact, there are five schools of thought (tribes) regarding machine learning algorithms that Luca and I introduce you to in Machine Learning for Dummies:

Symbolists: The origin of this tribe is in logic and philosophy. This group relies on inverse deduction to solve problems.

Connectionists: The origin of this tribe is in neuroscience. This group relies on backpropagation to solve problems.

Evolutionaries: The origin of this tribe is in evolutionary biology. This group relies on genetic programming to solve problems.

Bayesians: This origin of this tribe is in statistics. This group relies on probabilistic inference to solve problems.

Analogizers: The origin of this tribe is in psychology. This group relies on kernel machines to solve problems.

Of course, the problem with any technology is making it useful. I’m not talking about useful in a theoretical sense, but useful in a way that affects everyone. In other words, you must create a need for the technology so that people will continue to fund it. Machine learning is already part of many of the things you do online. For example, when you go to Amazon and buy a product, then Amazon makes suggestions on products that you might want to add to your cart, you’re seeing the result of machine learning. Part of the content for the chapters of our book is devoted to pointing out these real world uses for machine learning.

Some uses are almost, but not quite ready for prime time. One of these uses is the likes of Siri and other AIs that people talk with. The more you interact with them, the better they know you and the better they respond to your needs. The algorithms that these machine learning systems create get better and better as the database of your specific input grows. The algorithms are tuned to you specifically, so the experience one person has is different from an experience another person will have, even if the two people ask the same question. I recently read about one such system under development, Nara. What makes Nara interesting is that she seems more generalized than other forms of AI currently out there and can therefore perform more tasks. Nara is from the Connectionists and attempts to mimic the human mind. She’s all about making appropriate matches—everything from your next dinner to your next date. Reading about Nara helps you understand machine learning just a little better, at least, from the Connectionist perspective.

Machine learning is a big mystery to many people today. Given that I’m still writing this book, it would be interesting to hear your questions about machine learning. After all, I’d like to tune the content of my book to meet the most needs that I can. I’ve written a few posts about this book already and you can see them in the Machine Learning for Dummies category. After reading the posts, please let me know your thoughts on machine learning and AI. Where do you see it headed? What confuses you about it? Talk to me at John@JohnMuellerBooks.com.

There is a section entitled, “Templatizing a Function” that begins on page 528. You can see the code for this example in \Author\BookIV\Chapter05\FunctionOverloadingAndTemplates. The initial example is designed to fail, as explained on page 531. You’ll see the same error message and recommendations for both versions of CodeBlocks. In order to see this example work, you must comment out the line that reads:

cout << AbsoluteValue(10.5) << endl;

by highlighting the line of code and pressing Ctrl+Shift+C or by choosing Edit > Comment. Of course, you can simply add the comment manually by typing // at the beginning of the line. You must also comment these two functions out:

intAbsoluteValue(intx)

{

if(x >= 0)

returnx;

else

return-x;

}

floatAbsoluteValue(floatx)

{

if(x >= 0)

returnx;

else

return-x;

}

After you comment these lines out, you can uncomment the templated version of the function:

template<typenameT> T AbsoluteValue(T x)

{

if(x >= 0)

returnx;

else

return-x;

}

by highlighting the required lines of code and pressing Ctrl+Shift+X or choosing Edit > Uncomment. In addition, you must uncomment these lines of code to exercise the template:

cout << AbsoluteValue<int>(10) << endl;

cout << AbsoluteValue<float>(10.5) << endl;

At this point, the example will compile and run as expected. You’ll receive the same results in both CodeBlocks 8.02 and 10.05. Because so many people have complained about this particular example, I plan to provide two completely different source code files for the next edition of the book (so it won’t be necessary to comment/uncomment anything). Even so, the lines you must uncomment are clearly marked in the current source code file. The example found in the \Author\BookIV\Chapter05\ImFree folder requires similar commenting and uncommenting to see the full potential of the example, but this example doesn’t produce an error at the outset. The other examples in this chapter should work precisely as expected.

On to Book IV Chapter 6 (the last chapter in this mini-book). On page 555 you see Listing 6-8, which contains the code for \Author\BookIV\Chapter06\Sets2. This example won’t currently compile properly and you’ll find the explanation on page 557. In order to run, you must add another library, algorithm, to the group so that the list of includes looks like this:

#include <iostream>

#include <set>

#include <algorithm>

All of the other examples in this chapter run in CodeBlocks 10.05 without a problem on my system (let me know if you experience any problems on your system). In the next post I’ll start
with Book V Chapter 1. In the meantime, let me know if you have any
questions about the CodeBlocks 10.05 updates for this book at John@JohnMuellerBooks.com.