text:
Train neural net on another computer?
I have a complex neural net that will take forever on my laptop to train and i dont have a computer with a GPU, is there a way to run a python script on another computer without having to install an IDE on that computer? (for instance, if i went to an internet cafe)

Python doesn't require an IDE. You just need to install the Python interpreter to run a Python program.
Running machine learning on another computer is in fact industry standard. Google, Amazon and Azure can provide you a virtual machine, which you can run anything you want.
I personally rent a powerful machine with GPUs on Google to do my machine learning analysis. It's not free but very powerful.

is it cheaper to go through google or to run it at an internet cafe?

@MarkMarkrowaveCharlton You can't do machine learning in an internet cafe. Why not just spend the Internet Cafe money on renting a cloud machine?

ok i will look into it


text:
Do images submitted to a segmentation network after training need to be the same size as the training images?
I have not seen this explicitly stated anywhere so I was curious. Say I have network trained to meet my segmentation needs using 250x250 images. After this training is complete and I wish to submit images in production for segmentation, do those production submitted images need to be 250x250 as well or can they be any reasonable size?
If they must be resized to 250x250 for segmentation, is it possible to scale up the segmentation regions to apply to a larger image? If so what is the name of that technique so I can research it a bit more.

Yes, you will need data that has the same dimensionality as your training set. Otherwise the model will either discard excess data, or will supplement missing data with a random number. This will likely lead to very poor results.
I would suggest to rescale your images to have the same pixel density as those you used for training (250x250) rather than scaling your model.
Methods for rescaling images and maintaining details are very well developed. Many exist and you can use existing tools such as Photoshop to change the pixel density of an image.

Yup, I can totally take the image and scale it down to the training size no problem. I'm attempting to use 3 class segmentation to build a rough image matte so while scaling it down to get the segments is no problem, I will need to scale that back up to properly matte the image. Scaling up while keeping a clean matte would be the trick.

Or I guess my other option is to train it on the image sizes I expect to feed it in production.

It is always best practice to train your model using data as similar to what you will be expecting on the field. Ideally, your data should be drawn independent and identically distributed (iid) from the real world distribution you will be using the model with.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Neural Network example
I read a lot about this, I understand how it work, but I would like the most simple example you can provide me, because I have no clue how I would make it in code. No matter the language( I would appreciate if it's derived from c), because I'm not here to copy-paste, and understand the essence.

Example of what? Specify what of neural networks you are trying to learn.

A very basic one, the first example is one that learns to make math amounts(1+1, 2+4, etc, I didnt learned math in english, sorry). It trains with random operations, and after the training to predict the result.

Not in C, JS but basically the simplest neural network I could come up with and tried to explain with basic concepts and doodles...
Making a simple neural network

This site is pretty ok, and I have to learn a lot from there! If I dont understand something I will come back, and ask. Again thanks!

I would like to add that although the language between neuroscience and neural networks seems to be very similar, it is very dangerous to say that they learn the same way. Lots of people will tell you that they are the same, but always be wary!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Selecting the right algorithm to predict disease from questions
I'm trying to come up with the right algorithm for a system in which the user enter symptoms and we starts triggering questions related to that symptoms and his answers will result a disease which is related to the answer which is given by the user
Let's assume that the user entered the following input:
Symptom - Deafness
Q1. How long have you had a problem with deafness
A)From few days B)From few weeks to months C)More than month D)Since Birth
Q2. What was the onset of the deafness
A) Sudden B) Gradual
Now we have a knowledge base like if a user select option 1 from question 1 and option 2 form question 2 then we will give him some disease. But i need an algorithm which will give % of success in backend so that i can throw the results of disease for example if a user select option 2 from question1 and option 1 from question 2, then when we compare from our knowledge base there will be one set over there which has  option 1 from question 1 and option 2 from question 2 then its a "SOME" disease.. now if we compare from our knowledgebase and we found even 50% of the choices is resulting this disease we will throw that disease name.
NOW i am confused what algo should be use for this approach for ai.

Possible duplicate of this https://ai.stackexchange.com/questions/1705/selecting-the-right-technique-to-predict-disease-from-symptoms?rq=1 ....Try to do research in this community carefully

i vote to close it or else...every new subject will do the same

If SO has some facility to merge questions, then I would support merging them. If not, I vote to leave this alone.  The sidebar surfaces the question you are referencing  as "related" so anybody looking at that has plenty of opportunity to explore the other one as well.

@mindcrime ,lets be professional here.Information Duplication will create confusion to future beings or researchers.

Like I've said multiple times now... I support merging these if it's possible.  But if it's not, it's not some big deal.  The amount of "confusion" that would be created is minuscule at best.  Yes, it's good to avoid duplication, but we also have to be pragmatic.  It's going to happen sometimes.

There is no defined rules for choosing a machine learning algorithm to learn some type of pattern. However, there are some guidelines to help you better select an algorithm which will yield a higher probability of success.
Some important considerations are:

Number of features: This is the number of questions that each patient had to answer.
Number of instances: This is the number of patients that took your survey.
Number of output classes: This is how specific you want your diagnosis of the disease. Is this a yes/no, or a 5-stage progression.

The larger your feature space and the more output classes you have, the higher the complexity of your model. This is problematic because a more complex model will require more instances of data to learn the underlining patterns. You need to have a good balance between the number of examples you have in your dataset and the complexity of your model.
If you have limited data then you will want to stay very far away from deep learning. In such cases, I prefer to use shallow methods such as SVM, Naive Bayes or Random Forests. These techniques have been shown to be able to capture non-linear relationships. SVM is particularly powerful, you can use the kernel trick! This will transform your feature space into a space that makes the differentiation between the classes easier to distinguish. Do not underestimate the power of this algorithm.
If you have a very large dataset (i.e. 100,000 instances) then you will want to use deep learning. Recently, these techniques have been shown to outperform shallow machine learning algorithms in almost all categories where data is plentiful. You will want to start with a shallow neural network and then increase the complexity of your graph as you see fit. By adding additional nodes per layer, or by adding additional layers. Each node you add will increase the number of variables you need to tune, thus increasing the complexity of your model. If your data is expected to have some type of time dependency which often the case in medical data. Then you can use a long-short term memory neural network (LSTM). These are capable of capturing latent relationships. You can also try a stacked auto-encodder.

Medical diagnosis often employs abductive inference (also known as "inference to the best explanation"), and automated approaches to abductive reasoning have been applied to medical diagnosis.  More concretely, a mechanism known as Parsimonious Covering Theory has been extensively researched as an approach to automated abductive reasoning in medical scenarios (among others).  You might consider giving that a look.
FWIW, one of the main researchers in the field is Professor James Reggia from UMD.  He and Yun Peng wrote a very accessible book on the subject - Abductive Inference Models for Diagnostic Problem Solving.
And to add to what JahKnows says - I'd say that where something like deep-learning would be most likely to come into play, would be building the initial knowledgebase that is used in the diagnostic system.  That is, if you have lots of data relating symptoms to diseases, you could use deep learning to help define the weighting between specific diseases and specific symptoms.  And note that while abductive inference is considered a branch of logic, and PCT dates back to the "GOFAI" era, it is not a strictly symbolic approach.  The Reggia & Peng book explains how to incorporate Bayesian reasoning into the abductive system.  Just FYI.
Disclosure: I've recently been researching this area and am working on a modern implementation of PCT using the Semantic Web stack.

This question is a total duplicate.

And?  It's here for better or for worse.  If SO has some means of merging questions, then maybe we can get it merged.  If not, it's hardly the end of the world.

So you support duplicating of information. https://ai.stackexchange.com/questions/1705/selecting-the-right-technique-to-predict-disease-from-symptoms?rq=1 ..... Next time try to review questions at first.

I don't support duplicating information, but it's hardly a big deal either.  And why are you bitching at me, this wasn't my question.  Talk to the OP if you have a problem with it.  And like I said, if there is some merge functionality, then maybe it can be merged.  I have no idea if SO has a feature like that or not.

It's alright by me and you.lets keep our community clean just like nerdy world for us in the small wires of internet.However,i would kindly request you to be analytical before answering.simple.Am on to you;simply,you have been around and you know whats going on here.professionally.

No, sorry, but I just don't care that much about your notion of "purity" and cleanliness.  Laissez-faire is the name of the game my man.

Not man or human;i'm just an extraterrestrial being with much love for humans.However,lets vote to close this question? or else..new subjects will create disaster in future.

@quintumnia i have already gone thorugh that question and beleive me its not duplicate.. becaure beleif network in not the solution for my problem because there is a nested option-question relation, please read the question carefully

@quintumnia and sorry but uh have written lots of things here may be you could have right the answer till now. if you have read the question carefully

@doe ,So scientifically,same concept but different solutions.Right?

@quintumnia cant argue anymore lots of things to do...please read the question first

These are scientific arguments.and we scientists we have to come up with a conclusion.


text:
Why do Decision Tree Learning Algorithm preferably outputs the smallest Decision Tree?
I have been following the ML course by Tom Mitchel.
The inherent assumption while using Decision Tree Learning Algo is: The algo. preferably chooses a Decision Tree which is the smallest.
Why is this so when we can have bigger extensions of the tree which could in principle perform better than the shorter tree?

Consider the LCD (least common denominator) principle in algebra. A larger denominator would work for most processes for which the LCD would be calculated, however the least is the one used by convention.  Why?  The interest in prime numbers in general is based on the value of reductive methodologies.
In philosophy, Occam's Razor is a principle that, given two conceptual constructs that correlate equally well with observations, the simpler is most likely the best.  A more formal and generalized prescription is this:

Given two mathematical models of a physical system with equal correlation to the set of all observations about the system being modeled, the simpler model is more likely to be the most likely to be predictive of conditions outside those of the observation set.

This principle of simplicity as the functional ideal is true of decision trees.  The more likely functional and clear decision tree resulting from a given data set driving its construction will be the simplest.  Without a clear reason for additional complexity, there may be no benefit derived from the complexity added and yet there may be penalties in terms of clarity and therefore maintainability and verifiability. There may be computational penalties too, in some applications.
The question mentions, "Bigger extensions of the tree which could in principle perform better," however the performance of the tree should be a matter optimization in preparing for execution and execution of the decision tree in real time.  In other words, the minimalist decision tree is the most clear, workable, and verifiable construct, however a clever software engineer could translate that minimalist construct to a run time optimized equivalent.
Just as with compilation of source code, performance is multidimensional in meaning.  There are time efficiency, memory efficiency, network bandwidth efficiency, or other performance metrics that could be used when optimizing the tree for run time.  Nonetheless, the simpler tree is the best starting point for any weighted combination of these interests.

The bigger your tree is the more overfitting your model is. In machine learning, we always prefer a simpler model unless there is good reason to go for complication.

Why would a bigger tree correspond to more overfitting? i don't see any logic behind it.

More complexity = more potential for noise and errors.  Although I'm not working in Machine Learning specifically, this is consistent with the KISS principle ingrained in me by the punch-card generation.  From a statistical standpoint, it sounds like, in this case, more complexity runs a large risk of reducing the reliability and value of the results.

@DukeZhou Correct. A big tree is more likely to be complicated and less likely be useful for prediction.

To me this does not make any valid reason. Why wouldn't i choose a bigger Decision Tree if it performs far far better than a shorter tree! There should be some mathematical foundation for it. Also, even if what you are saying is correct then there must be some foundation/validation of that. I couldn't find any.

@vinaykumar2491 please read a machine learning book carefully. What you ask is just beginner concepts. Pointless for me to explain. You need to put some efforts.

For some, the concept of overfitting by complexity may be simple at first glance, but the reason why can go as deep as Occam's Razor principle in philosophy.

Adding to SmallChess's answer ,
Larger trees(with many nodes) are too adapted to the training set, as a small change in the input train data might cause the trees to change very much and hence change the estimate value too much.This is mainly due to the hierarchical structures of trees(because a change in a higher node may cause all lower nodes to change).
As an extreme case you can think of a large tree where in each training example has its own node.Such a is absolutely useless for test prediction.

But, when we change the training dataset there is always a possibility of change in the tree structure (as we would not be knowing what the final outcome of new training will be). And if the new Tree performs better in terms of accuracy, time/space complexity etc. then why should not we choose it.

@vinaykumar2491 It's all about variance-bias tradeoff. I recommend a beginner machine learning book, otherwise you don't really know what you're talking about. You'll understand your question is not really a question.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Can a neural network learn to avoid wrong decisions using backpropagation?
I studied the articles on Neural Networks and Deep Learning from Michael Nielsen and developed a simple neural network based on his examples. I understand how backpropagation works and I already taught my neural network to not only play TicTacToe but also improve his own play by learning from his own successes using backpropagation.
Going forward with my experiments, I am facing the problem, that I won't always be able to show the network good moves to use for learning (maybe because I simply don't know what is correct in a certain situation), but I might be required to show it bad moves to avoid (because some of the bad moves are obvious). Teaching the network what to do using backpropagation is easy, but I haven't found a way to teach it what to avoid using similar techniques.
Is it possible to teach simple neural networks using negative examples like this or do I need other techniques? My gut feeling says, that it might be possible to "invert" gradient descent into gradient ascent to solve this problem. Or is it more complicated than this?

What you are describing is conceptually close to adversarial training. you should read more on adversarial examples and generative adversarial networks for more information.
The idea is that there is a discriminator network, whose job is to correctly discriminate between positive and negative examples. We also have a generative network, that learns to produce "adversarial examples" that "confuses" the discriminator network. By training these two networks side by side, both networks get better at their task. But it's usually the generator network that people are more interested in.
Intuitively, the naive implementation of the method you've described (gradient ascent on incorrect examples from a network in a clean/randomly-initialized state) shouldn't work. This is because negative examples don't form a "natural class" (all triangles have 3 edges, all things that are not triangles however....)


text:
Is the play of strong Chess AI easily distinguishable from human play?
I don't play nearly enough Chess to be able to answer.  For context, AlphaGo is stronger than the current strongest human player, but AlphaGo's game play has been cast as "inhuman" in the sense that it doesn't resemble human play. (In Go, this can involve aesthetic qualities.)
Really I'm wondering about "narrow" application of the Imitation Game/Turing Test, where one might design an automata to play more like a human, so that human players would be unable to determine if their opponent was a human or an automata.

AI programs that exist in today's world fall into the category of Narrow Intelligence. Narrow Intelligence
are easy to distinguish when compared to General Intelligence (ones that resemble more like humans).
Highly advanced AI can often resemble to act like humans thought. I will like to talk about Deep Blue here.
Garry Kasparov, in a series of matches during Feb 1996, even though
won three matches but, had a " shattering experience". Deep Blue
flummoxed him in that first game by making a move with no immediate
material advantage; nudging a pawn into a position where it could be
easily captured. He said, "It was a wonderful and extremely human
move" and this threw him for a loop. He further added that he had
played a lot of computers but had never experienced anything like
this. He added, "I could feel, I could smell, a new kind of intelligence
across the table."
Next year he lost to an improved version of Deep Blue. Here also he
lost mostly because of psychological reason. He later said that he
was riled by a move the computer made that was so surprising and
so un-machine-like that he was sure that IBM team had cheated.
It was later found out that it was a glitch in Deep Blue. The program
came across too many options and had no clear preference and thus
played a random move.
It was this random move that shifted the game in favour of Deep Blue.

One advantage that Deep Blue (or other programs) have is the ability to perform far more computations in a given time. Humans, on the other hand, can extend their decision tree only to very limited depth. On having no clear decision to take, we take a random decision and try to learn from the experience, unlike most Narrow Intelligence programs present today. We need a fair amount of
randomness and learning from experience to be added to the program in order
to make it more like a human.
The answer to this question also depends on your position on "Chinese Room Argument".
The argument holds that a program can't give a computer understanding
or consciousness regardless of how intelligently or human like
the program may make the computer behave. Chinese Room Argument focuses on something very important when it comes to "Consciousness v/s Simulation of Consciousness". John Searle argued there that it is possible for a machine (or human) to follow a huge number of predefined rules (algorithm), in order to complete the task, without thinking or possessing the mind.

This answer is very insightful.  As absurd as it may sound to many, my project involves making "dumb" in addition to "smart" AI because humans playing the game have different levels of skill, and losing every game is no kind of fun for the vast majority of players.  Your point about the mistakes re: Kasparov is highly useful! (We're planning on using "glacially slow" reinforcement learning to tune individual automata to their owners, and raising or lowering tactical capability through modifying depth of lookahead.)

I really liked the idea about making dumb plus smart AI. If we are trying to make something like humans, then we need to remember that humans also have IQ of 70 or 80 and not just 130+. @DukeZhou

Although the basic non-trivial form of the game is currently unsolved, my six year-old niece, without having a full grasp of the game mechanics, can beat our dumbest automata "Boopsie", which makes purely random moves.  (Even our currently strongest, weak AI presents a challenge to the average adult player, but generally doesn't win by a margin that leaves the human feeling discouraged or humiliated.) In this model, Player satisfaction trumps AI strength.

There are three cases in which it is easily possible to distinguish strong AI play from the strong human play:

The AI is playing at superhuman skill level

This seems obvious, but I want to mention it for the sake of completeness. The current skill ceiling of top-level chess is well known and an opponent playing way above this skill ceiling must either be an AI or a chess guru who hid in a cave for the last centuries. Applying Occam's razor I would go with the AI. So to mimic human play the AI must make sure to stay at a human ELO level.

The AI plays an obvious weak move in a losing or strange situation

When the AI is in a bad situation and still tries to win the game without any reasonable move available, it might be tempted to play an obviously bad move, because the decision engine assigns it the highest probability of success. Such moves are considered rude at high-level play and a human player would not play them but resign. The most famous example of this is move 101 in the fourth game between Lee Sedol and AlphaGo. AlphaGo just lost a big group but still played T9 to extend it even further. This is a move a rookie player stops making after his first 10 games because it is that obvious that it does not work. A professional go player would never do this under normal circumstances. AlphaGo was out of options and played the rude move instead of resigning. This doesn't mean an AI cannot be programmed to avoid such behavior, but dire or simply very strange situations might induce moves like this, giving the nature of the AI away.

Other factors than the actual moves are considered

Depending on the test scenario, the AI might give away its nature through other means than the actual moves. Things like moving too fast or playing without breaks for hours. But I assume the question was just focused on the actual play and not the surrounding factors.
Those are the obvious examples where an AI might give away his true nature. I highly doubt that a strong AI, playing at the strong human level, can really be identified because of his "inhuman" style. I think it is more of a psychological pitfall to consider innovative moves from an AI "inhuman" and the same move from a pro player as "brilliant" if you know who is who. I am an amateur 3dan Go player - far from the top but with several years of experience under the belt - and at least I wasn't able to see anything "inhuman" in AlphaGos play so far. Ingo, it is well known that there are different styles of play, and after reviewing enough pro games one gets a sense of which player might have been educated in Korea, China, or Japan because certain patterns of strategies are more or less common in those countries. The lack of such an individual nuance might be an indication, that the player is actually a strong AI, but I am confident, that even the strongest pro wouldn't have a high success rate guessing who is human and who is the AI.
In chess, there are significantly fewer options at every move, many fixed patterns especially in the opening, and therefore less room for an individual style. Therefore I consider the same challenge even more difficult than in go. So if an AI has reason to "play like a human", this should be possible with the current level of AI technology.

I recall a friend saying that yes, it is somewhat obvious if you are playing against an AI.
From what he said, against normal players, there is a certain rhythm and structure that "makes sense". But AI play doesn't have this quality, "it doesn't make sense, but it just works". This seems to echo what you mentioned about the aesthetic quality of Go
Apparently because of this, chess/go AI can be detected during online play.

Yes - in chess the term "computer move" is used to denote a move found by a chess engine that a human player would never find (often because they make some slight improvement that a human would not be able to calculate). Humans use pattern recognition and some calculation in order to understand the chess position they are in while computers are able to calculate (~30 - 120+) moves ahead, a feat that a human player cannot match. It is for this reason that one can distinguish a human move from a computer move at some times.

Are you sure the are able to calculate ~30 to 120+ moves ahead? That seems very much to me.

But couldn't that "bewildering to humans" move be perceived as a random choice, potentially played to disrupt?  And if it leads to a win, couldn't that be perceived as the disruption tactic having worked?  (I guess it partly depends on the expertise of the human competitor, as the Imitation Game is subjective...)  PS Welcome to AI!


text:
debugging perceptron for digital AND circuit
I was trying to code a single layer perceptron to understand binary AND:
1 1 1
0 1 0
1 0 0
0 0 0
I made up this code
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int input1, input2;
float weight1 = 0.3, weight2 = 0.4;
int output;
int training1, training2, expectedoutput;
int i;
int j=1;

//TRAINING
for(i=0; i<10000;i++)
{

    if(j=1)
    {
        training1 = 0;
        training2 = 1;
        expectedoutput = 0;
    }
    if(j=2)
    {
        training1 = 1;
        training2 = 0;
        expectedoutput = 0;
    }
    if(j=3)
    {
        training1 = 0;
        training2 = 0;
        expectedoutput = 0;
    }
    if(j=4)
    {
        training1 = 1;
        training2 = 1;
        expectedoutput = 1;
        j=1;
    }
    output = weight1*training1 + weight2*training2 + 2;

    if(output != expectedoutput )
    {
        weight1 = weight1 + 0.156 * training1 * (expectedoutput - output);
        weight2 = weight2 + 0.156 * training2 * (expectedoutput - output);
    }
    j++;
}

printf("training done\n");
printf("weight1 = %f" "weight2 = %f\n",weight1,weight2);

//TESTING THE PERCEPTRON
for(i=0; i<5 ; i++)
{
scanf ("%d%d", &input1, &input2 );
output = weight1*input1 + weight2*input2;
printf("\n%d\n", output);
}
return 1;
}

its supposed to input the 4 cases repeatedly and with a learning rate of 0.156 (which i set randomly) and i used the threshold as a weight of 2.
However after the training the perceptron still doesnt give the expected output. Is my understanding of perceptron rule wrong? Please help thank you!

For debugging the actual code, you probably want to try a different Stack such as Code Review or Cross Validated.  The part of this question related to your understanding of the perceptron rule is definitely on topic here on the general AI forum.  Welcome to AI!

This question will be probably valid for this site if you present the algorithm (lets say, a short pseudocode) instead of the C source.

(Hint: do not fix threshold = 2, learn it).

Improvement: as x and y = y and x, you need only one weight.

You have several flaws in your code that will lead to unexpected behavior. I identified the following flaws you need to address. Once you have fixed them, you should output your updated weights during each step of training to see what the learning algorithm actually does and if it is going in the right direction. I will not address pure style aspects (like using a simpler case-statement instead of a series of ifs and stuff like that) and focus on the real errors.
Skipping training case 1
Once you are in training case 4, you set j to 1, expecting to use training case 1 next. But later in your code you increase j by one (j++) and go directly to training case 2, skipping the first one. This means you only run through training case 1 during your first pass of the loop.
Assigning j a value instead of comparing it

if(j=1)

The if statement will always be true, because you do not compare j to 1 but you set j to 1. You basically assign a value and test if the value is true. Correct would be:

if(j==1)

Ignoring bias during test
During the test steps after training you forget to add the bias that you used during training:

output = weight1*input1 + weight2*input2

should actually be:

output = weight1*input1 + weight2*input2 + 2

Otherwise your perceptron behaves differently during training and testing.
Perceptron output must be 1 or 0
Those were all implementation issues. This point actually seems to come from a misunderstanding of perceptrons. A real perceptron can either fire or not, meaning it outputs either 1 or 0, nothing in between. You calculate your output the following way and use the output to compare to the expected output:

output = weight1*training1 + weight2*training2 + 2;
if(output != expectedoutput )

Your output here is a float value. Only in edge cases it will result in 1 or 0. What you actually want to do for a real perceptron is:

if (weight1*training1 + weight2*training2 + 2 >= 0) {
   output = 1
  } else {
   output = 0
  }
if(output != expectedoutput)

After you fixed those errors and studied the output of your learning algorithms, you should be able to get the perceptron to work. If you have any questions, please leave a comment and I will try to help.

Edit:
I don't have a C compiler here, so I quickly implemented your solution with my suggested fixes in Python 3.6 and the results are very close to the correct solution. The final weights obviously have to be -1 and -1 for an AND Gate with bias 2. The learning process gets very close but never reaches -1 and -1 exactly, which leads to the wrong output in the end. This is a very good showcase to illustrate why you prefer a sigmoid neuron instead of a perceptron in modern neural networks. Here is a relevant question from cross-validated concerning the difference of those two types of neurons.

I did the changes as suggested and indeed the learning process tends to 1. However i have a few questions.

why do the weights tend to -1 and -1? if i input 1 1, the output is -11 + -11 +2 =0. But the answer should be 1 according to AND truth table. It seems that the output is still not correct?

could someone explain or provide a link to the importance of learning rate here? i realize that the weights tend more to -1 if i use a small rate like 0.00015. and it gets less accurate when i use a higher learning rate. How do i determine the correct learning rate to use?

Thank you!

It tends towards 0 because 0 (or above) is the threshold for the perceptron to fire. Firing means "output 1" and not firing means "output 0". Using 0 is kind of arbitrary here, but that's what's usually used for perceptrons so I followed this convention. The learning rate just tells you how fast you are learning in each steps. A slower learning rate will require more training cycles but might get you closer to the "perfect" values in the end. There are mechanisms to determine a good constant or even dynamic learning rate, but in the beginning it is mostly trial and error. Hope that helps!


text:
Is a deep technical understanding of neural networks required outside of research?
To understand the inner workings of neural networks, a fair amount of mathematical concepts is required. Backpropagation alone is a challenging technique if you are not fluent in calculating local gradients. And that's just the start of the journey.
But the more I study neural networks, the more I get the impression that all those difficult mathematical concepts are only required if you are doing actual research in neural networks or want to know what's happening under the hood. If you "just" want to implement an AI utilizing a neural networks, there are several high level programming frameworks and libraries readily available including model zoos for state of the art neural networks (e.g. VGG, GoogLeNet and ResNet), that can be used.
So my question is, does a developer require a deep understanding of all the details nowadays, or have we reached a level, where frameworks take care of those details for us?

It depends on what exactly you want to be. You don't need to be mathematician if you just want to run neural networks. Most data scientists don't understand the mathematics, but they know how to run machine learning frameworks. Generally, only PhDs understand the mathematics.
In the industry, most job positions in machine learning (e.g software engineer, big data engineer etc) don't require advanced mathematics. But you should be very comfortable in programming, and understand simple things like matrix manipulation. Data engineers in the industry generally have good programming skills, but they can't read mathematical equations (or just simple equations).
However, quantitative positions in machine learning do require significant mathematics. That happens both in research and industry.
Good news --- if you don't have a PhD (e.g statistics) nobody would expect you understand the mathematics.
Summary:

If your job is more like a development position, mathematics is an advantage but not absolutely necessary
If your job is research, you do need advanced mathematics understanding (e.g. PhD)
If your job is not research but still quantitative based. Mathematics is very important.

PS: I work in research. Everybody I know who works in machine learning has a PhD.

Great answer!  This is also useful from the standpoint of a product manager (i.e. know as much as possible about every facet of the product and business, including the mathematical concepts where relevant b/c you may be called upon to drive product direction. But at the end of the day, the product manager's role to merely to act as a conduit, facilitating the people doing the actual work.  This often includes acting as a "translator" between the engineering and sales/marketing sides of the house.)

Backpropogation and step functions (as well as a basic understanding of human brain neurons) are absolutelly useful, in my opinion.  Rusel-Norvig have a great chapter about them in their "Intro to AI" book that will teach the basics. You don't need a PhD.

Backpropogation certainly doesn't require PhD, but it's just very basics in neural network. NN is way more complicated than that. OP was asking for "...all the details...". The details can be very technical.


text:
Will CNNs kill CAPTCHAs or can they survive in an evolved form?
CAPTCHAs, which are often seen in web applications, are working under the assumption, that they pose a challenge which a human can solve easily while a machine will most likely fail. Prominent examples are identifying distorted letters or categorizing certain objects in images.
Neural networks are threatening this approach, as they are capable of solving problems that are easy for humans and difficult for classic algorithms. Especially with the incredible results modern CNN architectures have achieved in image recognition during the last years, the established forms of CAPTCHAs won't be able to distinguish a human and a machine using a neural network anymore.
Is this the end of CAPTCHAs as we know them or are there evolved versions available or at least in the making that still pose a challenge to modern neural networks?
Clarification: I am talking about challenges that are feasible for use in web applications and do not have an unjustifiable impact on usability.

I think that captchas can be substituted or augmented by questions which require understanding of context, for example:

How many hands keep the rose?
Or

Which number of books under the bench and in hands?
These examples are simple, but they can be improved, for example, by generation of images with random  numbers of objects and their positions
It looks like it will be hard to use CNN to hack such kind of captchas, especially if we have a large amount of different objects and their combinations
In addition, it can be improved by adding more complicated logical questions to compositions on pictures

I like this answer, and will only note that Natural Language Processing is making enormous strides, and I'm not certain overly complex questions will serve the function, as CAPTCHS's have to be understandable to the human "lowest common denominator".  Another way to put it is that, automata keep getting smarter, but human intelligence stays about the same.

I suspect that a stronger image recognition+NLP AI will eventually be able determine with high confidence that "keep" is synonymous with relevant concepts such as "grasp".  Similarly, the AI should be able to determine that "hands" may be taken to indicate the single hand depicted (typo or determination that only one hand is visible, and therefore relevant.) But even with these simple examples, a growing subset of humans will become confused: i.e. what is the verb tense of "keep"?  Should the phrase be taken to mean that only one of the hands will ultimately possess the rose?

@DukeZhou: I also hope that AI reaches this level soon, because in this case we all will get ticket into a civilization of the second type by Kardashev scale. I described how it's possible to do it with such AI level here - https://ai.stackexchange.com/a/3791/8861

I guess we'll find out in the coming years.  I do think this answer is strengthened by the fact that botnets aren't likely going to have access to the same degree of rationality that the big boys like DeepMind can utilize (supercomputers, unlimited db volume) so they probably won't get smart enough in the near term to solve the type of captchas you propose.  But we can always hope!

This is a great question! (I doubt my answer will do it justice, but I wanted to get the ball rolling.)
Part of me want to take the position that if automata are smart enough to solve a new captcha, they "deserve" to spam a post. (By contrast the intelligence of the average human who uses social media does not impress me nearly as much;)

Clearly, making captchas NP-hard is not feasible, as you astutely point out

To me, this basic fact would seem to be an indicator of the impending demise of captchas.
Specifically:

Visual captchas are useful b/c they require only basic, human common sense.
Captchas cannot be too difficult because they must be solvable by the average human

Just based on random sampling of content that drives social media, the average human is not very smart.

My guess is that sites that want to block spam at the gateway will have to adopt some form of biometric validation, like the fingerprint scan on contemporary smartphones.


text:
Is it necessary to clear the replay memory regularly in a DQN when an agent plays against itself?
I studied the article "Demystifying Deep Reinforcement Learning" extensively during the last days, while trying to implement the proposed algorithms myself.
My goal is to have an agent learn by playing a simple board game against itself using the methods of deep reinforcement learning. The algorithm described in pseudo code in the chapter called "Deep Q-learning Algorithm" is straight forward, but I cannot wrap my head around the fact that the replay memory only gets initialized once and never gets cleared.
Besides the obvious issue of growing too large for the available memory, there seems to be a more fundamental flaw. In the beginning the games will appear almost random, because the Q-function just has been initialized randomly. This means that bad moves will hardly be punished by the opponent. It makes sense to learn from those random encounters in the beginning, as we do not have any better data to learn from and this actually describes the observed behavior of the environment very well.
But when the agent improves, the old memorized plays will no longer be valuable, as certain moves will no longer be played by the opponent and therefore the old games will no longer reflect the current behavior of the environment.
That's at least my interpretation. Now I am wondering if this is simply missing from the pseudo code in the article or if my way of thinking is wrong in this regard. My question is, if we need to flush the replay memory regularly in the given setup and how often it should be done?

This is an interesting question because in the case of mobile games in particular, allocated memory for a local AI may be highly restricted.  Assuming network connectivity is risky as interruption  would result in AI inoperability or drastically reduced performance.

The purpose of the replay memory in DQN and similar architectures is to ensure that the gradients of the deep net are stable and doesn't diverge. Limiting what memory to keep and how far into the past it reaches is a problem that arises in in practical AI deployments. Throwing it away usually isn't the best decision because the agent's gradients may become unstable. Rather, keeping a window of the last T timesteps/gameplays can keep enough information while ensuring that the data is relevant as the agent improves. There are some additional methods which can improve the results as well:

Only keeping relevant timesteps (relevant depends highly on the application)
Removing timesteps from memory with probability relative to their age (the oldest has the highest probability to be removed)

It should be noted, that a larger replay memory is usually better than a smaller one to ensure stability but although memory is cheap it isn't infinite.


text:
What type of neural network would be most feasible for playing a realtime game?
For implementing a neural network algorithm that can play air hockey, I had two ideas for input, and I'm trying to figure out which design would be most viable.
The output must be two analog values that dictate the best position on half of the table for the robot to be at a specific point in time, evaluated 60 times per second.
Having consulted with a professor who has experience with implementing parallel algorithms, it was recommended to me to use a convolutional neural network with a single hidden layer, and directly process the image data as the input layer, after processing it to visualize a direct view of the table and somehow emphasize the puck and mallets with pre-processing. I have already started work on this and have successfully implemented object detection for the puck and mallets using OpenCV to get the center coordinates for all 3 entities.
However, having been able to successfully and accurately pre-process these data at 60 times per second, my thought was to feed those (after normalizing the values using the error function) directly on the input layer and possibly implement a deep learning algorithm that employs more than one hidden layer. The problem is that I don't have any experience implementing neural networks, so I'm not even sure what type of layer would be best for this, or how I should seed the weights.
Another reason I want to consider my idea is that given the relatively few inputs and outputs, probably won't need a GPU to execute forward-propagation 60 times per second, whereas with the convolutional network my professor recommended, I know I'll need to implement using CUDA somehow.
Which of the two input methods would be most recommended for this, and if I were to try and implement my idea, what types of layers should I consider? Also any recommendations for existing frameworks to use for either approach would be highly appreciated.

I recommend you read up on reinforcement learning. Seeing how AirHockey is similar to the old Atari game Pong, here is a write-up (with code) about how to implement a simple neural network, that plays the game; Deep Reinforcement Learning: Pong from Pixels.
As far as the choice of layers go, again, you should read up on deep reinforcement learning, perhaps study some existing models that work, for a similar task and take their architecture as your starting point. The above link is a nice introduction into such thinking.
As a continuation, I would recomend you employ one of the well known, and developed, libraries, such as TensorFlow or pyTorch. They will allow you to run your models on GPU, like you desire.
For a toolkit, that specializes to reinforcement learning, see openAI gym.

The first link was immensely helpful, and based on the information, I believe I'll go with the convolutional neural network like my professor recommended, using the preprocessed image frames as input. However, I believe based on my updated understanding that my 2 outputs should be the velocity of moving up and to the right, (after subtracting 0.5 from each and normalizing to the highest velocity our robot can support), that way it's action based rather than location based.

I'm glad. Hope your project goes well.

I also recommend you take a look at the following work by Uber AI Labs who used an interesting approach to computer games:
https://eng.uber.com/deep-neuroevolution/

Nice link.  This topic has definitely come up on the forum.


text:
A good way to understand the mathematical details of variational autoencoders through implementation?
As a researcher, I am getting interested in deep learning (as everyone else:)), and I decided to start with the variational eutoencoders, since I am more interested in unsupervised than supervised learning. I have already read tutorials on the general idea of the mechanism of VAE, and what people usually suggest is to use TensorFlow, Keros, etc. to implement them. However, I do not just want to use machine learning, but also want to develop novel algorithms on top of the existing ones, so I want to deeply understand the mathematical details. And in my experience, in order to understand them, reading is not enough, you need to implement. Any suggestions on where/how to start? I have a general machine learning and programming background, but no experience on deep learning. I even don't know what exactly back-propagation is used for, if this would help.

I even don't know what exactly back-propagation is used for, if this would help.

Programming backprop manually is one of the best exercises in machine learning. In fact, to do this you don't need a special package, like Tensorflor or Keras, just a general computing library like NumPy (and a whiteboard).
Though I dare to say that VAE is not the best thing to implement, if you are not 100% familiar with backprop. It's pretty advanced technique and you risk to mix up fundamental (e.g. backprop) and specific ideas (e.g. deliberately crafted loss function) and slow down your understanding.
I really think that writing a simple feed-forward neural net (including forward and backward passes) is a very good starting point, after which you can move on to VAE details, if you'd like.

Any suggestions on where/how to start?

If you feel confident with algebra and calculus, I highly recommend this Stanford course, especially its assignments. The course itself is about computer vision and convolutional neural networks, but the first assignments are very general and will give a lot of insight of what and how neural networks are doing.


text:
Intuitively understanding translational invariance in CNNs
I'm currently in the process of learning about using CNNs in image recognition. Many of the different resources I read that were explaining the motivation referred to the fact that these networks are (to some degree) translationally invariant. My understanding is as follows:

Fully connected networks are ill-suited to image recognition because of the high dimensionality of the data and especially because they do not preserve the spatial relationships between pixels. I care about the state of the pixels surrounding pixel X as well as X itself.
CNNs remedy this because they look at the image in 2 dimensions so that surrounding pixels are being considered as well (the kernel does this). However, while I care about what is around X, I don't care where X is. So, I apply the kernel the same everywhere and I make a bunch of layers so that I can get a bunch of kernels.
I also use pooling. This reduces the data dimensions but also adds some of that translation invariance.

So, my question is: What feature of the CNN is causing the invariance? I saw some explanations saying it was a result of the maps basically activating when a certain feature shows up, regardless of where. Other said that the pooling meant that if a horizontal line, for instance, showed up in one place vs. a pixel over, the pooling would activate the same for both. It seems like the first reason would be totally sufficient and the second not really adequate but I could also see it being both.
I also read a paper (https://arxiv.org/pdf/1606.09549.pdf) about fully-convolutional networks. In section 2.1, the authors explain that they intentionally chose to make it fully-convolutional because that allowed them to "compute the similarity at all translated sub-windows on a dense grid in a single evaluation."
That sentence makes me think that it is more the first explanation. Anyways, I hope to gain a better intuitive understanding of how the different parts of the CNN come together to work particularly well on images. Thanks!

The translational invariance comes from the fact that the kernels are applied everywhere. Basically the kernels are "translated", i.e. shifted, and that means the feature they detect are detected everywhere.
Pooling may help with that in some cases, because in the end you need a dog at the right side to activate the same neuron as a dog on the left, so there needs to be funnelling of the information, but it is not strictly necessary. You could also imagine a CNN with a dog kernel in a late layer, which just recognises dogs everywhere, with no pooling necessary.
Fully connected networks are wasteful in that they don't share weights. To get the necessary translational invariance you therefore need to learn pretty much the same weights at all positions. But they do preserve the spatial relationship between pixels.
Pooling reduces the dimensionality, but it also forgets the precise position of a feature. This might help with generalisation, but I'm not sure whether that's a big factor.

Convolutional layers actually provide equivariance while pooling layers provide approximate invariance. This answer should be seriously revised.

Well, go and write your own answer.

@gunes Can you explain why pooling layers provide translation invariance?


text:
Is private research with low funds still feasible in the field of AI?
My question assumes that a private researcher doesn't have access to anything stronger than a modern PC with a high end GPU to implement his projects. He can also use cloud computing but with limited funds as well.
Is it still feasible to do research with those restrictions? AlphaGo used 1,202 CPUs and 176 GPUs to beat Lee Sedol. Is this enormous power only required to achieve the final optimizations or have we already reached a state where high end research can only be done with larger funding?
Please include in your answer examples of recent research results and the required infrastructure that was used to create them.

Yes, you can do research in Artificial Intelligence with low funds (but you need a lot of time!). Notably, because AI is not the same as applied machine learning (indeed running ML programs on big data requires a lot of computer power). For example, knowledge representation and reasoning or natural language processing (both are subfields of AI) generally don't require a lot of computer power. Even when interested in machine learning (which is not the same as AI, just a subfield of it among others), you can use a powerful PC or laptop for that.
A lot of recent papers (probably most of them) in journals like  Artificial Intelligence, or in conferences like IJCAI (see their past proceedings) are somehow theoretical, and when something is implemented, it runs on a laptop or desktop. Notice that both AI journal and IJCAI conferences are peer-reviewed with a very selective process.
Actually it is difficult and rare to find a research paper in AI mentioning that costly equipment was needed to do the research. Costly supercomputers used for research are generally not used by AI researchers (but by researchers in physics or bioinformatics), and AI researchers often don't even have access to such facilities.
For examples, recent IJCAI2016 papers such as Coco: Runtime Reasoning About Conflicting Commitments, Interdependent Scheduling Games, Control of Fair Division, Verifying Pushdown Multi-Agent Systems against Strategy Logics, etc. don't mention any costly computation.
Actually, it is likely that most recent papers don't use and don't need large scale costly cloud computing. And some of that research might not have been implemented (perhaps by some intern) in anything more than a toy prototype.

Please include in your answer examples of recent research results and the required infrastructure that was used to create them.

Here are some recent research publications, they all explicitly mention the needed computer equipment, follow the link to read them:
Event recent IJCAI experimental papers like A Multicore Tool for Constraint Solving, Compiling Constraint Networks
into Multivalued Decomposable Decision Graphs, External Memory Bidirectional Search, Multiple Constraint Acquisition, Completion of Disjunctive Logic Programs, Eliminating Disjunctions in Answer Set Programming by Restricted Unfolding and On the Empirical Time Complexity of Random 3-SAT at the Phase Transition mention at most a multi-core workstation (e.g. at most a dual Xeon socket workstation,  often a cheaper laptop or desktop). I guess that most authors need their GPU only as a graphics card, to use their display screen. BTW, papers in other journals, such as JAIR (like Improving the Efficiency of Dynamic Programming on Tree
Decompositions via Machine Learning), when they mention computer equipment, gives similar kind of machines (laptop or at most high-end desktop).
(Actually, I don't remember having read an AI paper mentioning costly computing equipment; and I believe the reason for that is that in the academic community access to supercomputers is nearly reserved to research in other domains: physics, bioinformatics, etc. For an AI researcher gaining such access is difficult and uncommon; BTW, in H2020 European research grants computing cost above 15% of the labor cost needs to be dully justified, so is exceptional)
However, you'll better publish your software as free software or open-source, and you need a lot of time (preferably full-time, or at least half-time) to do the research work, publish it, and follow outside progress in your area. BTW, contacting a nearby university could be helpful (you could attend some seminars, etc.)
You can find interesting blogs (e.g. the one of J.Pitrat) of AI researchers working on just a laptop or a desktop.
So, most research in AI (even in Machine Learning, read papers from JMLR) are done by researchers working on a laptop or desktop. I am not even sure you need a powerful GPU to do the research. You certainly can do interesting research with a desktop computer (probably running Linux, with 32Gb RAM, some AMD Ryzen or Intel i5 or i7) costing in 2017 less than 1500€ or maybe 2500€ (and sometimes a low end laptop is enough). In rare cases (a small minority of papers), you might need a dual-socket workstation (something costing perhaps 5000€).
Notice that Big Data is not considered as a field of Artificial Intelligence. I guess (but don't really know) that research in Big Data requires access to more computer power than a PC. BTW, I am not sure that AlphaGo is really a research project, it is more an industrial demo.
PS. See also http://norvig.com/21-days.html (notice who is the author!) and this Bismon draft report (developing programming techniques, in a GPLv3+ alpha-stage software prototype, notably frame-based or semantic-network related ones, with reflection and introspection, reusable and relevant to AI), and the RefPerSys project.

It is totally practical and encouraged to do research on even common laptops. Many questions about AI can be addressed using this architecture and for a reference, look at every AI grad student which may not have access to such a super computer (most of them). AI research is done on laptops. It's the presentation of a system on a difficult problem which may require a supercomputer. It's also the reason why every domain on OpenAI gym can easily run on a laptop, and as a case study,  Deepstack is a new AI system which can beat professional poker players and runs on a laptop.

A lot of research can be performed on some pretty basic computers. Not all machine learning research is based on very large neural networks. There is a lot of machine learning research that goes on with other more simple algorithms such as k-means clustering, and softmax regression. These algorithms are pretty basic, and so can run very fast, but they do not require massive super computers to train. Also, a decent high range GPU can train some pretty large neural networks. You can reasonably train some fairly large convolutional neural networks on a high end GPU. While training very large neural networks on millions of examples is a huge task and requires a lot of processing power, not all of machine learning is based around deep learning, and a lot of algorithms run extremely fast when they are GPU accelerated.

The field of AI is vast that there’s always room for small scale research and inquiry.  Utility of AI is key, but the potential applications are broad, and intelligence is a spectrum.
Fundamental Combinatronics, a collective with no current funding, is engaged in a project to develop “adaptive AI” for a set of consumer-oriented, combinatorial game products.  The requirements are distinct from real-world applications.
We can’t compete with the major players in terms of resources, and we’re late to the party in terms of Machine Learning and Neural Networks, and, because the AI is for a consumer, mobile game which carries significant restrictions in terms of the bounding rationality (networking cannot be assumed; software volume is measured in megabytes; memory is restricted to lowest-common-denominator consumer-grade devices with non-specialized processors.)  For these reasons, we
re going the opposite direction of current industry trends--the good-old "boring stuff".
Because the automata only need to outperform the average/above-average human player, an old-school, heuristic approach is feasible. (Fun also, because it involves solving non-trivial, partisan Sudoku games in a Combinatorial Game Theory sense, a type of research all on its own. Although the context is ultimately intractable, it is a context automata are well suited for.)
Old-school is beneficial in that it’s nice to have an app product with a decent AI that is under 7mb.  (No barrier to download or strong incentive to delete from the device.  While the new iPad has up to 128gb, only a small subset of players will be willing to devote significant volume for strong AI, and these players represent a distinct, secondary market segment.)  It’s not optimal for an AI take up any more volume than is strictly necessary for a given product.
Fuzzy logic should also be useful for its efficiency in terms of applicability under what would today be considered severe computational restrictions.
[M] games are economic so the model is interesting from a Game Theory standpoint in providing a novel, compact, intrinsic and highly mutable mathematical model based positional valuation in n dimensions in conjunction with stability states in a causal/temporal framework. The combinatorial nature of [M] is ideal for quantitative analysis, and the games involve blocking factors (sudoku) and symmetry breaking (even order gameboards). For players > 2 coalitions also become a factor.
The focus of the procedural research is currently in four main areas and what we’re terming “Adaptive AI” :
Dynamic Strength:
Sheer strength is not the goal.  We’re working on AI that tailor their strength to their human player’s strength and preferences.  For most humans, we don’t want the automata to win more than 2/3 games because always losing  is no fun and makes the product less "sticky". Even if the human player desires an automata it cannot beat, the automata should only be sufficiently strong to almost always beat their human. AI strength can be limited by restricting rationality (time and memory), which carries an added benefit of energy conservation (less bits flipped), but the rules-based approach is useful in that rules can be recombined combinatorially to produce automata of different strengths and preferences. Automata play against each other to determine strength hierarchies, and identify poor heuristics to be weeded out of stronger automata.
General Intelligence:
The automata have to function on an array of related games, where equilibria can be altered in numerous ways without adding mechanics. Additionally, mechanics can be added without altering the nature of the games, such as introducing Graeco-Latin squares. This presents a problem if each configuration has to be learned through intensive self-play because the automata must be able to play at a respectable strengths immediately.  Thus the goal is not sheer strength, but consistent strength across the widest array of contexts.  (“Respectably weak” and “semi-strong” automata have utility value in that those categorization may be said to describe the majority of human player base.)  The idea is an “axiomatic intelligence” that can be extended to include an ever increasing array of contexts.
Counter-Intuition:
The automata should not be prone to repetitive play.  Initially we’re using limited monte-carlo for positional selection tie-breaking, and the scope can be extend to larger arrays of positions with varying degrees of perceived optimality, up to rational but “counter-intuitive” decisions, which can be subsequently evaluated.  This may be useful in adapting to new, dominant strategies that emerge in allowing the automata to experiment with less obvious choices.  In situations where the automata is consistently winning, there is incentive to experiment, "investing in loss" in the sense that mistakes are useful from an experience/learning standpoint.
"Genetic" Evolution:
The eventual goal is to implement some form of local reinforcement where the automata learn through play against their human, and self play in restricted contexts, such as between turns when playing against their human.  With networking enabled, the automata can play against such automata, with the idea of producing strong automata with human play characteristics.  (It will be fun when we eventually put these automata up against pure deep learning algorithms in a wide array of [M] contexts with distinct mathematical properties.  My money would be on the ML and NN algorithms in sequential games, but in asynchronous games where there is no turn order, it will be interesting to see if the "axiomatic systems" can produce desirable outcomes by making sound decisions faster than smarter, more complex automata;)


text:
Are there real applications of fuzzy logic?
This question covers in detail, what fuzzy logic is and how it relates to other math fields, such as boolean algebra and sets theory.
This question is also very related, but the answers are focused more on general intuition and potential applicability. The only working system based on fuzzy logic, mentioned there, is MYCIN, which goes back to the early 70s. This quote from wiki summarizes my impression of it:

MYCIN was never actually used in practice.

From my experience in AI, the best tool to deal with uncertainty is Bayesian probability and inference. It allows to apply not only a wide range of probabilistic tools, such as expectation, MLE, cross-entropy, etc, but also calculus and algebra.
Can you call fuzzy logic a "pure theoretical" concept, which only played its role in the early development of AI? Are there real practical applications of fuzzy logic? What problem would you recommend to solve and to code using fuzzy logic?

Fuzzy logic seems to have multiple of applications historically in Automotive Engineering.
I found an interesting article on the subject from 1997. This excerpt provides an interesting rationale:

The key reason for fuzzy logic’s success in automotive engineering lies in the implications of its paradigm shift. Previously, engineers spent much time creating mathematical models of mechanical systems. More time went to real-world road tests that tuned the fudge factors of the control algorithms. If they succeeded, they ended up with a control algorithm of mathematical formulas involving many experimental parameters. Modifying or later optimizing such a solution is very difficult because of its lack of transparency. Fuzzy logic makes this design process faster, easier, and more transparent. It can implement control strategies using elements of everyday language. Everyone familiar with the control problem can read the fuzzy rules and understand what the system is doing and why. It also works for control systems with many control parameters. Designers can build innovative control systems that would have been intractable using traditional design techniques. SOURCE: Fuzzy Logic in
  Automotive Engineering, 1997

Here are some papers and patents for automatic transmission control in motor vehicles. One of them is fairly recent:
Automatic Transmission Shift Schedule Control Using Fuzzy Logic SOURCE: Society of Automotive Engineers, 1993
Fuzzy Logic in Automatic Transmission Control SOURCE: International Journal of Vehicle Mechanics and Mobility, 2007
Fuzzy Logic Based Controller For Automated
Gear Control in Vehicles SOURCE: International Journal of Computer Science, 2014
Fuzzy control system for automatic transmission | Patent | 1987
Transmission control with a fuzzy logic controller | Patent | 1992

Likewise with fuzzy logic anti-lock breaking systems (ABS):
Antilock-Braking System and Vehicle Speed Estimation using Fuzzy Logic SOURCE: FuzzyTECH, 1996
Fuzzy Logic Anti-Lock Break System SOURCE: International Journal of Scientific & Engineering Research, 2012
Fuzzy controller for anti-skid brake systems | Patent | 1993

This method seems to have been extended to aviation:
A Fuzzy Logic Control Synthesis for an Airplane Antilock-Breaking System SOURCE: Proceedings of the Romanian Academy, 2004
Landing gear method and apparatus for braking and maneuvering | Patent | 2003

You've obviously never heard of fuzzy logic washing machines.

● Typically, fuzzy logic controls the washing process, water intake,water temperature, wash time, rinse performance, and spin speed. This optimises the life span of the washing machine. More sophisticated machines weigh the load (so you can’t overload the washing machine), advise on the required amount of detergent, assess cloth material type and water hardness, and check whether the detergent is in powder or liquid form. Some machines even learn from past experience,memorising programs and adjusting them to minimise running costs.

Fuzzy logic is used in a variety of control applications.  If your furnace can only be on or off, for example, you might use a probabilistic function of temperature to determine when to turn it on and off, rather than having fixed high and low temperatures activate your thermostat.  In some applications, that's been found to improve perceived comfort or efficiency.
For more sophisticated AI applications, you could use fuzzy logic for activations in a neural net, but I don't think it's offering much improvement over fixed, weighted activations.

Actually, I have heard of them, but I never believe smart terms in marketing. It's possible that Samsung developers implemented some "smart" logic, but sales people decided that "fuzzy logic" sounds too cool in washing machines. If there's evidence that the implementation really uses Zadeh's fuzzy logic, I'd be happy to call it a real practical application.

@Maxim-- It's real-- the concept was eagerly embraced by Japanese engineers going back to the 70s : https://en.wikipedia.org/wiki/Fuzzy_logic#Early_applications

The site FuzzyTECH lists an array of applications:

Industrial Automation
Monitoring Glaucoma
Coal Power Plant
Complex Chilling Systems
Refuse Incineration Plant
Fuzzy Logic Design
Practical Design
Water Treatment System
Truck Speed Limiter
Medical Shoe
Fuzzy in Appliances
Automotive Engineering
Antilock Braking System
Aircraft Flight Path
Nucluar Fusion
Motorla 68HC12 MCU
Traffic Control
Sonar Systems

Most of the linked articles have good bibliographies citing numerous papers, although it's notable that most of the material is a few decades old.

Recently, I needed to develop a Fuzzy Logic algorithm to made inferences of any data entrance; the real case applied was in Oil and Gas Industry, that the code needs to infere Joint Types in Fluid Pipelines. But with this Algorithm, the Computer Science Developer can infere any problems data, follow the link bellow:
https://www.codeproject.com/Articles/5092762/Csharp-Fuzzy-Logic-API (C# Fuzzy Logic API)


text:
Linear regression: why is distance *squared* used as an error metric?
Usually when performing linear regression predictions and gradient descent, the measure of the level of error for a particular line will be measured by the sum of the squared-distance values.
Why distance squared?
In most of the explanations I heard, they claim that:

the function itself does not matter
the result should be positive so positive and negative deviations are still counted

However, an abs() approach would still work. And isn't it inconvenient that distance squared minimizes the distance result for distances lower than 1?
I'm pretty sure someone must have considered this already -- so why is distance squared the most used approach to linear regression?

Thank you very much for your answers -- all were very informative in a way and all of them addressed my questions from different points of view. I think I'm going to like this community. :)

I'm voting to close this question as off-topic (see scope defined in help center). At present it would rather migrate to Cross Validated to get an answer.

@EricPlaton, the functions used to gauge the fitness of a model to empirical data is central to learning. Although linear regression is centuries old and may not be an area of significant research today, classifying this question as off topic for machine learning is like stating that the embarrassment of hitting the ground in front of family and peers has nothing to do with learning to ride a bicycle.

If the function doesn't matter, how convergent would f(e) = e^(-2) be? If the function must be positive, why wouldn't f(e) = x^2 - 10^(100) produce the same linear regression formulae as x^2 + 10^(100)? Why would one waste the time to use gradient descent for a linear model? ... You may wish to question the veracity of our sources.

Brief Background
The error metric (an appropriate term used in the question title) quantifies the fitness of a linear or nonlinear model.
It aggregates individual errors across a set of observations (instances of training data).  In typical use, an error function is applied to the difference between the dependent variable vector predicted by the model and empirical observations.  These differences are calculated for each observation and then summed. 1
Why Distance Squared?
Legendre, who first published the sum of squares method for gauging fitness of the model (Paris 1705) stated correctly that squaring before summing is convenient.  Why did he write that?
One could use the absolute value of the error or the absolute value of its cube, but the discontinuity of the derivative of the absolute value makes the function NOT smooth.  Functions that are NOT smooth create unnecessary difficulties when employing linear algebra to derive closed forms (simple algebraic expressions).
Closed forms are convenient when one wants to quickly and easily calculate slope and intercept in linear regression. 2
Gradient Descent
Gradient descent is generally employed for nonlinear regression.  Lacking the ability to create closed forms for many nonlinear models, iteration becomes a dominant methodology for validating or tuning the model.
An intuitive understanding of gradient descent can be gained by considering a thirsty, blind person looking for water on land solely by taking calculated steps.  (In software, these steps are iterations.)  The blind person can only sense the direction of the altitude gradient (direction of slope) with their feet to descend to a local minimum altitude. 3
Anyone stating that, "The function itself does not matter," in relation to the usual applications of gradient descent would be a dangerous choice for guide in a blind hiking expedition.  For instance, the reciprocal of distance as an error function would likely lead to the dehydration and death of the hikers.
The selection criteria for error metrics is important if one is interested in the speed of convergence on a solution or whether the solution will ever be found. 4
Since the gradient of a plane (linear surface) is a constant, the use of gradient descent for linear models is wasteful.  The blind person need not continue to sample the angle of their foot.
Sign of the Error Metric
The statement, "The result should be positive so positive and negative deviations are still counted," is incorrect. 5
Effectiveness of Error Metrics in Relation to 1.0
Because of the partial derivative of the least squares error metric with respect to an error at any given point is constant, the least squares error metric converges similarly above and below 1.0.
Notes
[1] The dimensions of a model's independent and dependent variable vectors are, in machine learning, conventionally called features and labels respectively.
[2] Another smooth function, such as the error to the fourth power would also lead to closed forms for slope and intercept, although they would produce slightly different results if the correlation coefficient is non-zero.
[3] Gradient descent algorithms in general do not guarantee finding a global minimum.  In the example given, it would be quote possible to miss a small hole exists with water in it.  Depending on the surface features (terrain), sensing the angle of the foot (determining gradient) can be counterproductive. The search can becomes chaotic.  To extend the intuitive analogy, consider searching for the bottom of the stairs in Escher's Relativity lithograph.
[4] For an error metric to be likely to converge and therefore useful in regression regardless of the direction of the error the sign of the metric is irrelevant.  It is each of the set of partial derivatives of the error metric with respect to the corresponding set of distances between the model predictions and observations that should be positive to regress omnidirectionally.  It sounds more complicated, but even this corrected statement is an oversimplification.
[5] The error metric in gradient descent applications is often calculated using a convex function to avoid overshoot and possible oscillation and non-convergence.  In some cases error functions other that sum of squares is used.  The choice of function has to do with a number of factors:

The model to which the data is to be fit
Factors expected to affect or actually affecting deviations of
the observations (training data) from the model
Computational resources relative to the size of the data set

The squared form is sometimes called the Euclidean norm or L2 norm. One of its very helpful properties is that it has an easily defined derivative, which can be used in mathematical analysis and translated fairly easily into code.
Intuitively it is thought that it is advantageous to exaggerate the differences according to the value of the error, which squaring does. You might also use the powers 3 or 4, but the derivative is more complex.
A number of different norms may be used, according to the particular circumstances of the problem at hand.

Some suggestions: Also answer the second question about distances lower than 1 too. The two bulletted claims in the middle of the question incorrect and should be challenged. The term Euclidean Norm has ambiguous meaning according to the people at Wolfram (and that checks out), so the L2 Norm may want to be the only abbreviated term mentioned for the least squares error method.

One justification comes from the central limit theorem. If the noise in your data is the result of the sum of many independent effects, then it will tend to be normally distributed. And normally distributed means that the likelihood of the data is inversely proportional the exponential of the square of the distance to the mean.
In other words, minimizing the sum of squares of the distance to the mean amounts to finding the most likely value for the line assuming that the error is normally distributed. This is very often a reasonable assumption, but it is of course not always true.

Quantum noise is expensive to generate and rare. Most deviations between theoretical models and empirical data are systematic, often chaotic, possessing distributions that are not nearly normal. Using a square may be nicely aligned with the Q function as you stated, but that is not the historical or present reason for the square. Continuous functions allow the application of linear algebra to produce closed forms for slope and intercept for linear regression. Even functions (2, 4, ...) are continuous. The absolute values of odd functions are not.

It simply derives itself from the maximum likelihood estimation. where in we maximise the log likelihood function., for detailed insight see this lecture: The Method of Maximum Likelihood for Simple Linear Regression.

The least squares or L2 Norm is not often selected because of its derivation from the method of maximum likelihood. The distribution of errors in practice are rarely determined and when they are determined are rarely normal. It is out of the convenience of using an odd polynomial (with a continuous first derivative) and because of the low demand on computation resources that squaring is used.

Yes, that would be another great answer. But my answer is more based on theoretical or statistical aspect of linear regression.

One justification is that under homoscedasticity the L2 norm produces the minimum variance unbiased estimator (MVUE), see Gauss-Markov Theorem. It means that the fitted values are the conditional expectations given the explanatory variables which is in many cases a nice property. Further it is the best estimator if the previous property is desirable.
As a response to the claim that the function itself does not matter, different functions give solutions with very different properties and a lot of effort has gone in to finding appropriate penalty functions, see for example Ridge regression and LASSO. The penalty function does matter.
edit: In response to your question regarding distances lower than 1, nothing "goes wrong" when the distances are smaller than 1. We always want to minimize the distance and the squared loss does so everywhere.


text:
Do AIs based on MCTS start each game from scratch?
AIs that rely on MCTS - like AlphaGo - create their decision tree as the game progresses. Do they start from scratch each game and build a new tree or do they keep the tree and grow it from game to game further?
Besides the possible limitations of storage space for the search tree, I don't see any obvious drawback in keeping and growing the tree, which seems to me to be the preferred option. Are there other reasons to start from scratch each game?

Your intuition is right. The tree is grown after each game.
Before the first play through, the values of each decision point are initialized (randomly or to some constant). Then at the end of one play through, the weights of the decision points are updated using Monte Carlo methods. In this way, on the next play through, the updated weights help the agent make a decision in the next game.
As for how the decision points are added to the tree, it depends on the application. For simple games like TicTacToe, we know all of the decision points. For big games, there are methods to trim the tree of bad performing branches.


text:
Would convolutional NN recognize patterns in encoded images?
I have a set of images that I already trained a CNN to classify successfully. I wonder if it would be possible to encode the images (using XOR in combination with a key of the same length as the image) and train a new net on them.
Thinking logically, the features still exist in the same relation to each other, just in a different form (encoded). Considering that neural networks are incredible at pattern recognition, I assume that it would still be doable.
For people, who cannot imagine how a xor-encoded image would look like:

For a human, it may look like rubbish, but the information is definitely there.
Would love to read your opinion.

First you should give it a try, because anyone's guess could be off, as there isn't really a complete high level analytic model of how neural networks behave on real data. Most results with neural networks are informed by theory, but involve a whole lot of experimental testing.
I suspect your network might at least learn something from the new images, but would struggle to get anything like the same accuracy as without the noise, because the CNN filters rely on being able to detect similar features at different positions. In your scrambled image, there will not be any meaningful and consistent edges/corners etc that a single learned feature detector could learn to match (and therefore present to the next layer).
A fully-connected network would not have this limitation, and would learn just as well on a set of binary features that have been xor'd identically in each position for each example, as it did on the original copy (i.e. only if the picture was 1 bit depth). It would learn less well if each feature was a scaled 8-bit pixel value that was xor'd with the same 8 bit random number in each pixel position, because that would introduce many more non-linear mappings between input and output. Of course a fully-connected network will generally not learn image tasks as well as CNNs in the first place . . . but if it could learn anything useful at all for your image problem, then it will probably out-perform CNNs after the scrambling effect.
As a CNN usually has a few fully-connected layers, then it may be possible to get something from your scrambled images.

Thinking logically, the features still exist in the same relation to each other, just in a different form (encoded)

In terms of being recognisable in the way that a CNN filter extracts them, then the features do not exist. That is a problem.

Thank you for your answer, Neil. I tried some various CNN setups and, as expected, none were able to converge on the problem. That was very insightful for me, as my journey with machine learning just started. To respond to your suggestion concerning a fully-connected network, the beauty of CNN's is that different positions of the features don't hinder the network from performing. So even if a fully-connected structure would solve the problem of accurately representing information from the image, it would make the classification task undoable due to the variance of the training set.

The answer to your question depends on the nature of the noise that you have xor-ed the image with. If it is the case that the noise is random (or pseudorandom in the formal sense), then it is provably the case that the original pattern will not be learnable in the statistical learning theory sense; this scenario is equivalent to the application of a one-time pad.
To quote the relevant Wikipedia article:

One-time pads are "information-theoretically secure" in that the encrypted message (i.e., the ciphertext) provides no information about the original message to a cryptanalyst (except the maximum possible length[16] of the message). This is a very strong notion of security first developed during WWII by Claude Shannon and proved, mathematically, to be true for the one-time pad by Shannon about the same time.

Hi eric! I have generated a (pseudo)random key of the same length as the image with values in the range of 0-255 and then applied it to every single image in the dataset. From my perspective, because the network would see hundreds of thousands of images encoded with the same key, it could draw conclusions about which encoded pixels correlate with other encoded pixels in a sequence of images. But, as Neil mentioned above, CNN is not the right way to go on that, because optically, the noise doesn't make sense.

My gut feel based on the paper I will mention below is that YES, if you apply the same XOR operation on the train and test data, you will be able to train a very "accurate" classifier.
To elaborate on my "gut" feel, please allow me to introduce to you what I personally think is one of the most important paper that came out this year(in fact this paper won the best paper award at ICLR 2017):
 Understanding deep learning requires rethinking generalization.
In this paper, the authors showed that deep learning models will generalize to "any" datasets. To give an example of the sort of experiment they conducted on this paper:

They randomly shuffled the training and test set's labels around in such a manner that for example some images of cats were labeled as dogs whiles some dogs were named cats whilst some cats and dogs images remained correctly labeled. Now it is well understood that deep learning models(including CNNs) are quite resistant to a few noisy labels but in the experiments conducted in the paper mentioned above this was a significant amount of noisy which begs the question why neural networks still performed well on what ended up being a garbage dataset.

The moral of the story is that contrary to what most researchers believed in the past namely that deep learning models magically discover lower level features, middle-level features, and higher-level features hidden within the dataset more like the V1 system of the mammalian brain by learning to compress data, they seem to just memorize anything you give them, including random data.
In short the paper mentioned above showed that deep learning models generalize well to completely random noise(in your case, think images generated from random pixels). Deep learning models will generalize well to anything, anything. And if they can generalize to random data which have no structure, then images that underwent a fixed, predefined transformation like XOR have nothing to a deep learning model.
I must say, this are very worrying findings - to me at least.


text:
What's wrong with getting a dynamic RNN's output at the end of a padded sequence?
Would it not even be more helpful? It will have more time to transform the input with the extra zeros padded to the end.

There is nothing wrong in theory. It is reasonable to expect that for some problems it will work worse than taking the immediate answer on the last known part of the sequence, some it will have roughly the same effect, and for others it might result in a better result.
A trained RNN is essentially a learned arbitrary program. If a computer program that processed arrays would get a better result by running more iterations at the end of an array, then so might a RNN. One example that comes to mind is predicting the end point of a trajectory of an observed object, when you have a variable number of observations at the start. A program that simulated each timestep in a simple fashion could well perform better than one that attempted to analyse and project directly from whatever the last observed state was.
On the other hand, you may face some practical problems:

One practical detail of not padding sequences is that it may reduce computation time since the network is run less often.
A padded sequence will only get a gradient to learn from with the last output, after the padding. This could make learning harder than it needs to be with vanishing or exploding gradients (these are more of a problem, the more time steps you need take back through the network in order to assign correct weights due to influence of first input).

The usual way to find out is to try it in an experiment. See which approach does better on a hold-out test set when training with or without padding. Bear in mind that whatever the answer it will not hold in general, but is likely to hold for problems similar to the one you tested with.


text:
Predicting popular times
I have a MySQL database that contains datetime for every check-in with an RFID card. I have millions of records in it. It shouts machine learning prediction for me.
So I'd like to predict popular times to see when most people use the terminal. I'd like to represent it the same way as Google does at places:

This is the rare case when I do not ask for code, but keywords.
I assume I have to predict number of check-ins between time ranges. Also I am sure I have to make a dataset like this:
                        (These are the number of check-ins in hour ranges)
month | day | day-name | 0-1 | 1-2 | ... | 6-7 etc.
jan   | 1   | Monday   |  0  |  1  |     |  12
jan   | 2   | Tuesday  |  1  |  3  |     |  15

So it can predict today's popular times based on what day it is, also by day of given month (as Saturdays and Sundays will be dead, also 25th of December. A good prediction should know these from the dataset).
As I wrote this question I solved most of it it seems. The only thing I need is a keyword as I have little experience in this. What model fits this best?

An average hourly check-in on the day of the week would not be enough for a forecast?

"Regression", is to estimate a continuous value as a function of some other parameters.
There are different forms of regression, such as linear regression and logistic regression, that differ in the assumptions they make on the data.
You could try looking up those for a start.

I used Accord.net's Multivariate Linear Regression for it and it beautifully and very accurately predicts the numbers, even on the weekends when there it predicts accurately less people in given hours. Thank you again for the answer!


text:
Method for Multi-class/category?
I am having issues getting started with a multi class problem with multiple features and hoping someone could please point me in the right direction.
I have data that is structured like this for training:
Item State Code1 Code2 Code3 Route
---  ---   ---   ---   ---   ---
item1 MI   A1    33    blue  Route1
item2 TX   A3    35    yellow Route2
item3 NM   A4    36    green  Route3
item4 NM   A4    37    green  Route3

Essentially I am trying to figure out where to even start. The goal is to know where to route the Items based on the features State, Code1,2, and 3. The route is dependent on a mix of the codes and state, and I want to build a model that says when I have code X, Y, Z and Color XX, then it is probably route 1 (some routes of course in the training data might have X, Y as codes and a different Z)
I am assuming I will need to one-hot encode the features like the State and codes? But from there does anyone know of which type of model I should go for? I would assume a Neural Net of some kind, I've explored CNN's and Random Forrest.

What about Bayesian classifier or Decision Tree classifier?

Thanks, I've went with the Decision Tree Classifier and it seems to give me quite good results!

Superb man! That's cool! ;-)

Other answers are good, but kiner-shah comment about Decision Trees worked the best for me due to how the data was structured.

My money would be on something much simpler like Naive Bayes.
In my experience for small data NB outperforms the more exotic methods.
Also, if you want to get more value out of your training data, try 10 fold cross validation

You could probably use a simpler model if you do not have that much training data, but if you have a lot of training data, I would recommend taking this approach: you will want to one hot encode the states, and depending upon how many colors you have, you will either want to encode them in a color space such as RGB or one hot encode them if you do not have that many of them. Then, you will want to one hot encode the routes that you have. For code 2, it looks like it is quantitative so you can probably just normalize that row. For code 1, you will probably just have to one hot encode the letter, and normalize it. Once you have all of your training data in a quantitative form, if you have a lot of training data, and the training data is sufficiently complex, you can use a deep neural network. Otherwise, you could use a conventional single layer neural network.