What does the notation $[m]=\{1, \ldots, m\}$ mean in the equation of the empirical error? The empirical error equation given in the book Understanding Machine Learning: From Theory to Algorithms is

My intuition for this equation is: total wrong predictions divided by the total number of samples $m$ in the given sample set $S$ (Correct me if I'm wrong). But, in this equation, the $m$ takes $\{ 1, \dots, m \}$. How is this actually calculated, as I thought it should be one number (the size of the sample)?

This is a commonly used notation in theoretical computer science.

$[m]$ is not the variable $m$, but is instead the set of integers from $1$ to $m$ inclusive. The empirical error equation thus reads in English:

The cardinality of a set consisting of the elements $i$ of the set of integers $[m]$ such that the hypothesis given input $x_i$ disagrees with label $y_i$, normalized by $m$.


What is the difference between game theory and machine learning? What is the difference between game theory and machine learning?

I had gone through the papers Deep Learning for Predicting
Human Strategic Behavior, by Jason Hartford et al., and When Machine Learning Meets AI and Game
Theory, by Anurag Agrawal et al., but I am not able to understand.

These are big areas, so here is a brief description of the differences:

Game theory is concerned with studying solutions for 'games', which are basically a set of decisions leading to certain outcomes. In game theory you look at strategies to achieve the best outcome for a given participant. One classic example (which isn't really a game in the traditional sense) is the Prisoner's Dilemma: you and your friend have been arrested, and if only one of you testifies against the other, that person gets a reduced sentence, and the other one a much longer one. If you both testify against each other, you both get a medium sentence, and if you both keep quiet, you both go free. You don't know what your partner in crime does, so do you a) testify, or b) keep quiet? If you keep quiet, you might go free if your partner also keeps quiet, but if he testifies, you are in it for a long time. So it's risky to keep quiet, even though you get the better outcome. If you testify you might avoid a longer sentence, but also will not go free. What is your best choice?

Game theory is often used in economics to model behaviour, as a rational agent would try to optimise gains.

Machine Learning, on the other hand, is a way of training a statistical classifier. You feed features into an algorithm, and the algorithm then gives you a certain output, depending on the data you have trained it with. This hasn't got anything to do with game theory per se, but I guess you could use machine learning to train an algorithm to choose moves in a game situation and then compare how that matches the optimal choices according to game theory.

As I said, this is a very brief comparison. For more details I suggest you follow the links to read up on those two fields.

UPDATE: Now that the papers are accessible — game theory is indeed used as a benchmark. In the first paper, the rational agent assumption from game theory is being modeled, but without a human expert telling the algorithm what that means. So you learn (using deep learning) what it means to be rational. In the second paper the authors attempt to learn a better algorithm than tit-for-tat, and indeed use game theory as a theoretical framework for comparison/evaluation.


How can I solve the zero subset sum problem with hill climbing? I want to solve the zero subset sum problem with the hill-climbing algorithm, but I am not sure I found a good state space for this.

Here is the problem: consider we have a set of numbers and we want to find a subset of this set such that the sum of the elements in this subset is zero.

My own idea to solve this by hill-climbing is that in the first step, we can choose a random subset of the set (for example, the main set is $X= \{X_1,\dots,X_n\}$ and we chose $X'=\{X_{i_1},\dots,X_{i_k}\}$ randomly), then the children of this state can be built by adding an element from $X-X'$ to $X'$ or deleting an element from $X'$ itself. This means that each state has $n$ children. and the objective function could be the sum of the elements in $X'$ that we want to minimize.

Is this a good modeling? Are there better modelings or objective functions that can work more intelligently?

The hill-climbing algorithm to implement is as follows:

The algorithm should take four inputs: as always, there will be a multiset S and integer
k, which are the Subset and Sum for the Subset Sum problem; in addition, there
will be two integers q and r, with roles defined below.
Do the following q times:

(a) Choose a random subset (multiset) $S_0$ of S as the current subset.

(b) Do the following (hill climbing) r times:

i. Find a random neighbor T (see definition of neighbor below) of the current
subset.

ii. If neighbor T has smaller residue, then make T the current subset.

(c) Keep track of the residue of the final current subset when starting with subset
$S_0$.

Return the smallest residue of the q subsets tested by the algorithm.

Definition: Subset (multiset) B ⊆ S is a neighbor of a subset A of S if you can transform
A into B by moving one or two integers from A to B, or by moving one or two integers from
B to A, or by swapping one integer in A with one integer in B.
An easy way to generate a random neighbor B of a subset A of S is as follows:

Order the elements of S as $x_1, x_2, ..., x_n$.
Initialize B to be a clone of A.
Choose two distinct random indices i and j, where $1 ≤ i; j ≤ n$.
if $x_i$ is in A, remove it from B. Otherwise, add xi to B.
if $x_j$ is in A, then with probability 0.5, remove it from B. If $x_j$ is not in A, then with
probability 0.5, add $x_j$ to B.


How to report the solution path of a search algorithm on a graph? I'm working on a problem where we are given a graph and asked to perform various search algorithms (BFS, DFS, UCS, A*, etc.) and the goal state is to visit all nodes in the graph. After all nodes are visited, we need to print out the "solution path." However, I am a bit confused on what "path" means in AI.

For simplicity, let's just consider a graph of 3 nodes: A, B and C with 2 undirected edges (A, B) (A, C). If we perform BFS on this graph starting at node A and traversing alphabetically, we'd visit A, then B, then C.  So, in this case, is the solution path A -> B -> C, i.e. the order in which the nodes are visited? Or is the solution path A -> B -> A -> C? Basically saying that we go from A to B, but to go from B to C, we must go through A again.

Defining Path

You are right to be confused if your professors did not clarify (see warning at end). The term "path" can mean a few things:

"Concrete" Path:
Recall, a graph is a collection of vertices and edges. A path on the graph is then:

$$v_1\xrightarrow{e_1} v_2\xrightarrow{e_2} \cdots \xrightarrow{e_{n-1}} v_n$$

Where $v_i$ are vertices on the graph and the arrows denote the direction traversed over the undirected edges $e_j$. Observe, this definition explicitly defines some "chain" of vertices connected by specific edges.

"Abstract" Path: Say there is some task that involves a serious of repeated actions but does not depend on specific objects. We can define this as a chain of composed functions:

$$f_n\circ\cdots \circ f_1$$

The idea, is that this definition is little more abstract. Though, there are many other ways one could define "path."

"Solution Path"

A Subtlety

  So, in this case, is the solution path A -> B -> C, i.e. the order in which the nodes are visited? Or is the solution path A -> B -> A -> C? Basically saying that we go from A to B, but to go from B to C, we must go through A again.

BFS does not "go through A again." Considering you are using a queue based implementation, once A has been visited there will be no need to "visit" it again. That is, we have added all nodes we need to the queue and marked A as being seen. This leads into:

  How to report the solution path of a search algorithm on a graph?

Since, these algorithms do not revisit nodes, what is most likely being asked of you is for you to report the order of the visits - this is what my professors wanted in my AI & Algorithms courses.

A Warning: I can only answer what my professors wanted. Please clarify this with your instructors.


Back propagation on matrix of weights I am trying to implement a Neural Network for binary classification using python and numpy only.

My network structure is as follows:
input features: 2 [1X2] matrix
Hidden layer1: 5 neurons [2X5] matrix
Hidden layer2: 5 neurons [5X5] matrix
Output layer: 1 neuron [5X1]matrix
I have used the sigmoid activation function in all the layers.

Now lets say I use binary cross entropy as my loss function.
How do I do the back propagation on these matrices to update weights?

class Layer():
    def __init__(self,number_of_neurons,number_of_inputs):
        self.weights=np.random.rand(number_of_neurons, number_of_inputs)
        self.bias=np.random.rand(number_of_neurons,1)

class NeralNetwork():
        def __init__(self, layer1, layer2,layer3):
            self.layer1 = layer1
            self.layer2 = layer2
            self.layer3 = layer3

        def sigmoid(self,x):
            return 1 / (1 + np.exp(-x))

        def derivative_sigmoid(self,x):
            return x*(1-x)

        def get_cost_value(self,Y_hat, Y):
            m = Y_hat.shape[1]
            cost = -1 / m * (np.dot(Y, np.log(Y_hat).T) + np.dot(1 - Y, np.log(1 - Y_hat).T))
            return np.squeeze(cost)

        def get_cost_derivative(self,Y_hat,Y):
            return  - (np.divide(Y, Y_hat) - np.divide(1 - Y, 1 - Y_hat))

        def train(self,inputs,labels,epocs):
            for epoc in range(1,epocs+1):
                z1=np.dot(self.layer1.weights,inputs)+self.layer1.bias
                a1=self.sigmoid(z1)
                z2=np.dot(self.layer2.weights,a1)+self.layer2.bias
                a2=self.sigmoid(z2)
                #print(a2.shape)
                z3=np.dot(self.layer3.weights,a2)+self.layer3.bias
                a3=self.sigmoid(z3)
                #print(a3.shape)
                if epoc%100 is 0:
                    print(a3)

                cost=self.get_cost_value(a3,labels)
                #print(cost)

                layer3_delta=self.derivative_sigmoid(a3)*self.get_cost_derivative(a3,labels)
                print(layer3_delta.shape)
                Dw_layer3=np.dot(layer3_delta,a2.T)
                Db_layer3=layer3_delta
                #print(Dw_layer3.shape)
                layer2_delta=np.dot(self.layer3.weights.T,layer3_delta)*self.derivative_sigmoid(a2)
                #print(layer2_delta.shape)
                Dw_layer2=np.dot(layer2_delta,a1.T)
                Db_layer2=layer2_delta

                layer1_delta=np.dot(self.layer2.weights.T,layer2_delta)*self.derivative_sigmoid(a1)
                Dw_layer1=np.dot(layer1_delta,inputs.T)
                Db_layer1=layer1_delta
                #print(Dw_layer1)

                self.layer1.weights-=((1/epoc)*Dw_layer1)
                self.layer2.weights-=((1/epoc)*Dw_layer2)
                self.layer3.weights-=((1/epoc)*Dw_layer3)

                self.layer1.bias-=((1/epoc)*Db_layer1)
                self.layer2.bias-=((1/epoc)*Db_layer2)
                self.layer3.bias-=((1/epoc)*Db_layer3)

So far I have tried to implement this as shown above. But there seems to be a mistake because, after training, the network doesn't seem to have learned. Please let me know if you have any inputs.

The back propagation must be done in two steps.

Transfer derivative

Given the output value, you must calculate its slope. This is simple as you are using the sigmoid activation function. So the derivative can be calculated as follows

# Calculating slope
def transfer_derivative(output):
    return output * (1.0 - output)

Back propagate the error

Calculate the errors for the various layers of the network and update the weights and bias.

# Error calculation

# For output layer
error = (expected - output) * transfer_derivative(output)

# Hidden layers
error = (weight_k * error_j) * transfer_derivative(output)

Where error_j is the error signal from the jth neuron in the output layer, weight_k is the weight that connects the kth neuron to the current neuron and output is the output for the current neuron.

And finally updating weights

weight = weight + learning_rate * error * input

Here is a detailed explanation of implementing neural networks from scratch using Python along with sample code. Give it a read.


Does self-supervised learning require auxiliary tasks? Self-supervised learning algorithms provide labels automatically. But, it is not clear what else is required for an algorithm to fall under the category "self-supervised":
Some say, self-supervised learning algorithms learn on a set of auxiliary tasks [1], also named pretext task [2, 3], instead of the task we are interested in. Further examples are word2vec or autoencoders [4] or word2vec [5]. Here it is sometimes mentioned that the goal is to "expose the inner structure of the data".
Others do not mention that, implying that some algorithms can be called to be "self-supervised learning algorithms" if they are directly learning the task we are interested in [6, 7].
Is the "auxiliary tasks" a requirement for a training setup to be called "self-supervised learning" or is it just optional?

Research articles mentioning the auxiliary / pretext task:

Revisiting Self-Supervised Visual Representation Learning, 2019, mentioned by [3]:

The self-supervised learning framework requires only unlabeled data in order to formulate a pretext learning task such as predicting context or image rotation, for which a target objective can be computed without supervision.

Unsupervised Representation Learning by Predicting Image Rotations,  ICLR, 2018, mentioned by
[2]:

a prominent paradigm is the so-called self-supervised learning that defines an annotation free pretext task, using only the visual information present on the images or videos, in order to provide a surrogatesupervision signal for feature learning.

Unsupervised Visual Representation Learning by Context Prediction, 2016, mentioned by
[2]:

This converts an apparently unsupervised problem (finding a good similarity metric between words) intoa “self-supervised” one:  learning a function from a givenword to the words surrounding it.  Here the context predic-tion  task  is  just  a  “pretext”  to  force  the  model  to  learn  agood word embedding, which, in turn, has been shown tobe useful in a number of real tasks, such as semantic wordsimilarity.

Scaling and Benchmarking Self-Supervised Visual Representation Learning, 2019:

In discriminative self-supervised learning, which is the main focus of this work, a model is trained on an auxiliary or ‘pretext’ task for which ground-truth is available for free. In most cases, the pretext task involves predicting some hidden portion of the data (for example, predicting color for gray-scale images

Most (if not all) self-supervised learning techniques for (visual or textual) representation learning use pre-text tasks, and many pre-text tasks have been proposed in recent years.
However, as I say in my other answer (which you cite), the term SSL has also been used (at least, in robotics: for example, see this paper, which I am very familiar with) to refer to techniques that automatically (although approximately) label the unlabelled dataset for your downstream task (i.e. image recognition), i.e. they automatically create a labeled dataset of pairs $(x_i, \hat{y}_i)$, where $x_i$ is an image that contains an object and $\hat{y}_i$ is the automatically (and possibly approximately) generated label (such as "dog"). This latter use of the term SSL is closer to some weakly supervised learning (WSL) techniques. Actually, it can be considered a WSL technique.
Now, in this specific paper, they actually solve some kind of pre-text task, i.e. they exploit the relations between two different sensors to produce the labels.
To answer your question more directly: in all SSL papers that I have come across, some kind of pre-text task is always solved, i.e., in some way, you need to automatically generate the supervisory signal, and that task that we solve with the automatically generated learning signal (with the purpose of learning representations or generating a labeled dataset) can be considered the pre-text task (which may coincide with the downstream task, for example, in the case you're training an auto-encoder with an unlabelled dataset for the purposes of image denoising).
In any case, I wouldn't bother too much about it. Just keep your context in mind when reading your paper. If you're really worried about it, then you should probably read almost all SSL-related papers, but, in that case, by the end of that, you will be an expert on the topic and you will not need our help (or my help).


Is there a theory behind which model is good for a classification task for the convolutional neural network? Let say I'm trying to apply CNN for image classification. There are lots of different models to choose and we can try an ensemble, but given a limit amount of resources, it does not allow to try everything.

Is there a theory behind which model is good for a classification task for the convolutional neural network?

Right now, I'm just taking an average of three predictions.

predictions_model = [y_pred_xceptionAug,y_pred_Dense121_Aug,y_pred_resnet50Aug]
predictions = np.mean(predictions_model,axis=0)

But each model's performance is different. Is there better way for ensemble methods?

Ensembles aren't very popular in the field of computer vision. The main reason why this is, is that models are already so large parameter-wise that it is hard to fit multiple models in-memory for classification. Since there are effective ways of training very large models, people would rather create a larger networks if they had the capacity than averaging the results from multiple ones.

That being said, there is no reason why ensembling wouldn't have beneficial results for your task.

One way would be, as you do, to average the results of the models. This is usually used to reduce the bias of weaker models. Another way would be to use meta-modelling, i.e. create a fourth model (even as simple as a linear classifier) that will be trained with the outputs of the three CNNs as its input features. The idea is that the meta-model will learn the best way to weight the outputs of the CNNs so that, instead of them all having an equal vote (as is the case when you average them), the meta-model will learn the best way to weigh them.


How can one distinguish between an AI and a "sufficiently advanced algorithm"? Any sufficiently advanced algorithm is indistinguishable from AI.---Michael Paulukonis

According to What are the minimum requirements to call something AI?, there are certain requirements that a program must meet to be called AI.

However, according to that same question, the term AI has became a buzzword that tends to be associated with new technologies, and that certain algorithms may be classified in AI in one era and then dismissed as boring in another era once we understand how the technology works and be able to properly utilize it (example: voice recognition).

Humans are able to build complex algorithms that can engage in behaviors that are not easy to predict (due to emergent complexity). These "sufficiently advanced" algorithms  could be mistaken for AI, partly because humans can also engage in behaviors that are not easy to predict. And since AI is a buzzword, humans may be tempted to engage in this self-delusion, in the hopes of taking advantage of the current AI hype.

Eventually, as humanity's understanding of their own "sufficiently advanced algorithms" increase, the temptation to call their algorithms AI diminishes. But this temporary period of mislabeling can still cause damage (in terms of resource misallocation and hype).

What can be done to distinguish a sufficiently advanced algorithm from AI? Is it even possible to do so? Is a sufficiently advanced algorithm, by its very nature, AI?

As you correctly pointed out, people tend to misinterpret the expression AI since they do not know what's behind an AI; it is pretty clear that in AI there is no more than just a bunch of algorithms and flowing bits. Talking about the nature of an AI without talking about the algorithmic paradigm of that AI is pointless and antiscientific.

This point of view is quite cynical; what we call intelligence is just the capability of solving particular problems.

The quote you cited in the title it's a derived version of the quote below, by a science fiction writer.

  Any sufficiently advanced technology is indistinguishable from magic. - Arthur C. Clarke

Hence I doubt that a scientific answer exists since science lacks a formal definition of sufficiently advanced algorithm and advanced algorithm.


How to use RNN With Attention Mechanism on Non Textual Data? Recurrent Neural Networks (RNN) With Attention Mechanism is generally used for Machine Translation and Natural Language Processing. In Python, implementation of RNN With Attention Mechanism is abundant in Machine Translation (For Eg. https://talbaumel.github.io/blog/attention/, however what I would like to do is to use RNN With Attention Mechanism on a temporal data file (not any textual/sentence based data). I have a CSV file with of dimensions 21000 x 1936, which I have converted to a Dataframe using Pandas. The first column is of Datetime Format and last column consists of target classes like "Class1", "Class2", "Class3" etc. which I would like to identify. So in total, there are 21000 rows (instances of data in 10 minutes time-steps) and 1935 features. The last (1936th column) is the label column.

It is predominant from existing literature that an Attention Mechanism works quite well when coupled into the RNN. I am unable to locate any such implementation of RNN with Attention Mechanism, which can also provide a visualisation as well. Any help in this regard would be highly appreciated. Cheers!

The article referenced doesn't highlight the most common terms, which is why you may not be finding what you want. We've found that not all the designs have public implementations in every language. Some we've had to translate from Python or Java to C++ to get the speed we needed for embedded applications. Attention mechanisms are not one thing either. There are attention mechanisms in the cells, before the layers, after the layers, as oversight mechanisms, and in push-pull balancing arrangements. The common cell using attention ideas use gates in the cell and the article only briefly mentions it. That's the long-short term memory cell, which is a type of RNN. Look for LSTM and B-LSTM for the first examples, which are gated. The GRU is also a type of RNN cell with gating. This paper is recent and proposes two mechanisms: https://www.aaai.org/ocs/index.php/AAAI/AAAI18/paper/viewFile/16126/16099. If you search for DiSAN there are a few implementations. The newest kind, which has promise is not really an RNN strictly. That's the recursive network, which can have attention mechanisms but can build learned graph structures instead of tensors. That may also be what you want.


Is it possible to classify resistors using ResNet50? I want to train ResNet50 model using resistor images like below:

I tried it by collecting data from google images and there were quite few. So accuracy was very low (around %10) but I wonder If it is due lack of images or is it really possible to classify these images? Because as it is seen the object to be classified is very small and its value as color coded. I thought maybe this is not a good idea. Searched it on google but could not find anybody tried to do it before. I have also tried data augmentation and changing to other models but still its accuracy was quite low.
P.S: I have also tried changin epoch numbers, optimizers and all other parameters. So I want to make sure If it is due low data or is it just very hard task to complete for a computer vision model.
And Is it rational to crop the image by using a mask before classifying it to make sure all color codes are bigger and easily valuable by model?

Yes it should be possible. You may have a bug in your code, or the wrong hyperparameters. Training ResNet-50 will take a long time. Try training on other sets of images and see what accuracy you get to check if your approach is correct. Or, try loading a pretrained model, and training from that.


Emotional Speech Synthesis We are a team of computer science our graduation project about EmotionalSpeech Synthesis.

We've found valuable information like research papers and WaveNet, Tacotron.
A website (https://www.voicery.com/)

we were hoping to get to know more information from you.

We need more details what should we start with to grasp the fundamentals to build this idea, what is the architecture to be used in this project, whether there are papers, a GitHub Repository containing helpful documentation, datasets, some other resources, previous knowledge.

Since I am working with audio synthesis projects, I can suggest you to go through the recently released paper "MelNet: A Generative Model for Audio in the Frequency Domain", in this architecture human like speech is synthesized, I think this might be better than WaveNet where the generated audio does contain robotic nature, I think this will definitely help you with Emotional speech synthesis as it generates human-like voices.
You can check for online demos as well.

Demo

Here Is the Paper!

Related YouTube Video

Hope this helps!


What is the difference between the ant system and the max-min ant system? I'm studying ant colony optimization. I'm trying to understand the difference between the ant system (AS) and the max-min ant system (MMAS) approaches. As far as I found out, the main difference between these 2 is that in AS the pheromone trail is updated after all ants have finished the tour (it means all ants participate in this update), but in MMAS, only the best ant updates this value. Am I right? Is there any other significant difference?

Let's start by making clear that both AS and MMAS use only global pheromone update. Now, the MMAS has two main differences regarding AS:

In AS, all ants that completed a solution are used for the update, while in MMAS only the best ant with a complete solution is used for update (as you had pointed out).

In AS, the pheromone values are not explicitly bounded. In MMAS, the pheromones are enforced to lie within a pre-set interval $\tau_{min} \leq \tau_{ij} \leq \tau_{max}$ (which gives its name to the algorithm). To ensure this condition, the pheromone update is done by means of the formula

$$
\tau_{ij} \leftarrow \left[ (1-\rho) \cdot \tau_{ij} + \Delta \tau_{ij}^{best} \right]_{\tau_{min}}^{\tau_{max}},
$$
with the operator $[x]_a^b$ defined as
$$
[x]_a^b=
\begin{cases}
    a \qquad \mathrm{if} \quad x > a\\
    b \qquad \mathrm{if} \quad x < b\\
    x \qquad \mathrm{otherwise}
\end{cases}
$$
Reference: Ant Colony Optimization. Artificial Ants as a Computational Intelligence Technique.


Can an AI make a constructed (natural) language? "An artificial or constructed language (sometimes called a conlang) is a language that has been created by a person or small group, instead of being formed naturally as part of a culture." (Source: Simply English Wikipedia)

My question is, could an AI make construct it's own natural language, with words, conjugations and grammar rules? Basically, a language that humans could use to speak to each other. (Preferably to communicate abstract, high-level concepts.)

What techniques could such an AI use? Could it be based on existing natural languages or would it have few connections to existing natural languages? Could it design a language that's easier to learn than existing languages (even Esperanto)?

could an AI make construct it's own natural language, with words,
  conjugations and grammar rules?

Sure. This might be helpful: Simulated Evolution of Language: a Review of the Field

  Basically, a language that humans could use to speak to each other.
  (Preferably to communicate abstract, high-level concepts.)

I'm not sure how useful such a machine adapted language would be to human speech. I suspect not very. Perhaps it could be useful as a kind of "common byte-code format" to translate between multiple human languages... But English kind of already serves in that role. Doing so would probably be an academic exercise.

  Could it be based on existing natural languages or would it have few
  connections to existing natural languages?

You could probably generate languages in either direction. Languages not linked to human-natural languages will probably take shapes that reflect the problem spaces they work with. For instance, if this is an ant simulation, the generated words will probably reflect states related to food, energy, other ants, etc.

  Could it design a language that's easier to learn than existing
  languages (even Esperanto)?

Easier for a machine? Definitely. Easier for a human? Probably not. Our brains are somewhat adapted to the languages we use. And the languages we use are somewhat adapted to our brains.

What is your goal? To create a language that is easier to use for humans than existing human languages?

If your intention is to build a "universal language" that could be "the most efficient" for machines, humans and aliens - no such thing can exist. The space of all possible machines is infinite and therefor limits our ability to define communicative abstractions that have utility across all contexts.

If we make lots of assumptions about machines, like they have intentions, they exist in 3 dimensions, they differentiate between temporally linked events, they have eye balls, a need to consume foods and liquids, a need to carry the food from place to place, etc... Then yes, common communicative abstractions may have utility across the set of those kinds of machines. But then we're no longer dealing with the general case, but one much more specific.

These links also seem interesting and somewhat related:

Grammar Induction and Genetic Algorithms: An Overview. [pdf]
A Model of Children's Acquisition of Grammatical Word Categories Using an Adaptation and Selection Algorithm [pdf]
The processing of verbs and nouns in neural networks: insights from synthetic brain imaging


How to distinguish between proper nouns and other words in NLP? If an NLP system processes a text containing proper nouns like names, trade marks, etc. without knowing anything about the language (ie no lexicon), is it possible to recognise them?

Essentially you would need to train a named entity recognizer (NER) to recognize the names out of the common words.

There are many works that try to use a similar language to the language in question as a pivot to train a full NER model (for example, Cheap Translation for Cross-Lingual Named Entity Recognition).

Your task might be slightly simpler, as you are interested only in one class: whether it is a named entity or not. But in general it is very similar to this setup.


Machine learning with graph as input and output In my application, I have inputs and outputs that could be represented as graphs. I have a number of acceptable pairs of input and output graphs. I want to use these to train a model.

I am looking for pointers where simple examples of learning methods with graphs as input are discussed. Please note that the graph size is not fixed.

A sample input is

Graph:
  Node A: Component X with parameter size = 12
  Node B: Component Y with parameter size = 30
  Node C: Component Y with parameter size = 30
  A connects to B
  A connects to C

Sample output:

Node A: x=0, y=0
Node B: x=-21, y=0
Node C: x=21, y=0

In this case, we expect the model to understand that input graph is symmetric and a particular way of arranging them is preferred. We want to train the model over a large set of such input-output pairs and then use it to generate output on new inputs.

You can flatten the graph into a matrix and then train it like a normal neural network input. Perhaps an adjacency graph or maybe simply a series of linear equations representing the nodes and convert it into matrix form.


Keras pattern finding between hash and word My goal is to build a neural net that can find patterns between a hash and a word on it's own. So that it returns the word of any hash that I will input.

Unfortunatally my skill in the area of neural net isn´t advanced, and I want to use this project to learn more. So I use a German dictionary and encode it via one_hot encoding. Then I generate the sha256 value of every word inside (before I have done this I cleaned the file and wrote every word in another line) it. So I got an big array with the shape of 20000x20000 for the words and another for the hashs.

So then I used the a example of the Keras homepage for binary classification because the one_hot values are represented by ones and zeros.

So if I want to predict a hashs I get these error: Error when checking : expected dense_1_input to have shape (20000,) but got array with shape (1,). So I don't know if this model is working for my problem but I couldn't convert one hash into a size of 20000x20000. (The hash will one_hot encoded for that prediction). So how could I get it to accept different shaped hashs/one hash only?

Is there a way to train the model with each hash after another for example with a for loop?!
EDIT: So I figured out that I can convert a list of characters into a numpy.array with 2 dimensions. So I hot_encoded every character and create a list of them, these list I passed inside the np.array(words,ndim=2). So this I have done for my hashs aswell. Then after I run the code I got this error: ValueError: setting an array element with a sequence So I tried to reshape the array with the .reshape(20000) command but nothing chaged. So what to do with that? EDIT2: I figured out now that the problem is that enhot_encoding generates diffrent sized "arrays" for each word, and if I fill this into a real array and this into a neuronal net it have to return this error. But still the question is: How to convert single words and hashs to a format that I can train a neuronal net with and get usefull output so I can enter any hash and it should return some kind of word(lable). If you need the actual code please inform me and I will upload it`s current state.
Code:

model = Sequential()
model.add(Dense(64, input_shape=20000, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(64, activation='relu'))
model.add(Dense(units=64, activation="relu"))
model.add(Dropout(0.5))
model.add(Dense(19957, activation='sigmoid'))
model.compile(loss='binary_crossentropy',optimizer='rmsprop', metrics=['accuracy'])
print("Fitting data...")
model.fit(test_hashs,test_words ,epochs=10,batch_size=128, verbose=1)

train_y=input("Input a hash that is not contained in the training data: ")
#train_x=pd.Series(hashlib.sha256(str.encode(train_y)).hexdigest())
train_y=pd.Series(train_y)
#test_x=pd.get_dummies(train_x)
test_y=pd.get_dummies(train_y)
model.save("first_test")
print(model.evaluate(test_y))
#score=model.evaluate(test_x, test_y, batch_size=128,)
print("Score: "+score)
prediction=model.predict(test_x,verbose=1)
for i in prediction:
    print(i)

I'm not quite sure it's possible. Hash functions are used to map an input to an output in a way that is not reversible.

Many companies store a hash of your password on their servers so in case of a security breach they haven't given the adversaries a long list of passwords.

As far as it goes for finding the exact hash of a word, it seems infeasible.

Edit: Binary classification refers to the possible output being two possible states. A ten dimensional one-hot vector is not binary.


What is the best neural network architecture for this problem? I built a three-layer neural network (first is 1D convolutional and the remaining two are linear). It takes an input of 5 angles in radians, and outputs two numbers from 0 to 1, which are respectively the probability of failure or success. The NN is trained in a simulation.
The simulation goes this way: it takes 5 angles in radians and calculates the vector sum of 5 vectors having $x$ as module and $\alpha$ as angles (taken from the input). It returns $1$ if the vector sum has a module greater than $y$, or $0$ if it is less than $y$.
My intention is to be able to tell sequences of radians that will generate vectors with a sum greater than $y$ in module from the ones which won't.
Which would be the best configuration to achieve this? Is the configuration I set up (1D convolution layer + 2 linear layers) efficient? If so, would it be easy to find the right size for the convolution? Or should I just remove it?
I noticed that if I change the order of the input angles the output of the simulation will be the same. Is there a particular configuration you should use when dealing with these cases?

I'm not completely sure I understand your simulation. What I think you are doing is:

Generate 5 angles specified in radians (Are these always normalized to within (0, $2*\pi$)?).
Interpret each angle as a unit vector in a 2d space.
Add the unit vectors together, yielding a vector that lies somewhere inside a circle with radius 5.
Ask whether the summed vector is more or less than a distance $y$ from the origin of the circle.

If you're doing that, your problem looks like trying to learn a separation of two concentric rings, which is a well known benchmarking problem for classification.

I am reasonably certain you can learn this pattern with several layers of ReLU neurons. I'm not certain that convolutional layers will help you much here. The main patterns I'd expect the network to learn are:

perhaps 2-3 layers to learn whether the point lies far away from the origin in each of several different directions.
1 layer to learn where the decision boundary is in each of 4 directions away from the origin.
1 layer to inclusive-OR the 4 decision boundaries together.

My guess is that this is fairly easy to learn with 4 layers of 8 ReLU neurons, or something like it.


Is accuracy of a machine learning algorithm independent of the features? I’ve been experimenting on several datasets and found something very strange while implementing ML.
I’ll Explain after the code…

import numpy as np
from sklearn import datasets
iris = datasets.load_iris()

# 4 features in np array - 150 rows

case = 1        # change cases to see variation

if case == 1:   # first feature deleted
    iris.data = np.delete(iris.data,0, 1)

if case == 2:   # first 2 features deleted
    iris.data = np.delete(iris.data,0, 1)
    iris.data = np.delete(iris.data,0, 1)

if case == 3:   # first 3 features deleted (1 feature left)
    iris.data = np.delete(iris.data,0, 1)
    iris.data = np.delete(iris.data,0, 1)
    iris.data = np.delete(iris.data,0, 1)

if case == 4:   # only second feature deleted from np array
    iris.data = np.delete(iris.data,1, 1)

if case == 5:   # only third feature deleted from np array
    iris.data = np.delete(iris.data,2, 1)

if case == 6:   # only last feature deleted from np array
    iris.data = np.delete(iris.data,3, 1)

# print iris.data
# exit()

from sklearn.naive_bayes import GaussianNB
gnb = GaussianNB()
pred = gnb.fit(iris.data, iris.target).predict(iris.data)
# pred = gnb.fit(iris.data, iris.target).predict(test_data)

from sklearn.metrics import accuracy_score
print accuracy_score(iris.target, pred)

I’m using the basic fisher iris dataset from sklearn, it has 150 rows and 4 columns (features).
Using training data as test data.

So i tried to remove a few features and see if accuracy changed.
And I thought it would.
But till case 1, 2, and 3, I removed 1, 2 and 3 features respectively and there was no change in the accuracy. It stayed 96%.

Then on running cases 4,5 and 6, The accuracy changed. Why?

On comparing case 2 and 4,
Both have second feature removed from the dataset, so clearly, removing second feature is responsible for change in accuracy (as seen in case 4)
So why does it not change in case 2?
Just because it had first feature removed too? to balance out the second? (If that were true, case 1 would have given different accuracy)
Why does accuracy not change in first 3 cases, but it does in the last 3 cases?

Is ML dependent on the order in which features are feeded to the algorithm?

What am I missing here?

Would be great if someone could clear this doubt.

Thanks!

This is a result of overfitting, I think. Your model is allowed to explain the phenomenon using any combination of variables, whether or not such a  combination constitutes a true signal.

I am not familiar with the details of a NBC, but I suspect that the model has some bias/offset/constant variable, that can be combined with your input features.

Thusly, what you see is just an expression that  the classifier has been able to combine each set of features and the constant variables in such a way that they perfectly describe the phenomenon. These combinations will be non-linear, so the logic as to how dependent the model is on any parameter is not a simple "it follows"-reasoning.

However, if you evaluate OUT of sample, you will see a much better reflection of how useful individual features are, and how bad the performance becomes when you remove the first three features.

For example, do a K-folds test (say, K=10) of the six different models, preserving 20% of the dataset as test-data.

Here you would likely see the following rankings:

(4, 5, 6, 1 ~ equal) > 2 > 3


Why is update rule of the value function different in policy evaluation and policy iteration? In the textbook "Reinforcement Learning: An Introduction", by Richard Sutton and Andrew Barto, the pseudo code for Policy Evaluation is given as follows:

The update equation for $V(s)$ comes from the Bellman equation for $v_{\pi}(s)$ which is mentioned below (the update equation) for your convenience:
$$v_{k+1}(s) = \sum_{a} \pi(a|s)\sum_{s',r}p(s',r|s,a)[r+\gamma v_{k}(s')]$$

Now, in Policy Iteration, the Policy Evaluation comes in stage 2, as mentioned in the following pseudo code:

Here, in the policy Evaluation stage, $V(s)$ is updated using a different equation:
$$\begin{align} v_{k+1}(s) = \sum_{s',r}p(s',r|s,\pi (s))[r + \gamma v_{k}(s)] \end{align}$$ where $a = \pi(s)$ is used.

Can someone please help me in understanding why this change is made in Policy Iteration? Are the two equations the same?

Yes, the two update equations are equivalent. As an aside, technically the equation you give is not the Bellman equation, but the update step re-written as an equation - in the Bellman equation instead of $v_{k+1}(s)$ or $v_{k}(s)$ (showing iterations of approximate value functions), you would have $v_{\pi}(s)$ (representing the true value of a state under policy $\pi$).
The difference between the equations is that

In the first case of Policy Evaluation, in order to be general, a stochastic policy $\pi(a|s): \mathcal{S} \times \mathcal{A} \rightarrow \mathbb{R} = Pr\{A_t = a|S_t =s\}$ is used. That means to get the expected value, you must sum over all possible actions $a$ and weight them by the policy function output.

In the case of Policy Iteration, a deterministic policy $\pi(s): \mathcal{S} \rightarrow \mathcal{A}$ is used. For that, you don't need to know all possible values of $a$ for probabilities, but use the output of the policy function directly as the action that is taken by the agent. That action therefore has a probability of $1$ of being chosen by the policy in the given state.

The equation used in Policy Iteration is simplified for a deterministic policy. If you want you could represent the policy using $\pi(a|s)$ and use the same equation as for Policy Evaluation. If you do that, you would also need to alter the Policy Improvement policy update step to something like:

$a_{max} \leftarrow \text{argmax}_a\sum_{r,s'}p(r,s'|s,a)[r + \gamma V(s')]$
$\text{ for each } a \in \mathcal{A(s)}$:
$\qquad \pi(a|s) \leftarrow 1 \text{ if } a = a_{max}, 0 \text{ otherwise }$

Doing this will result in exactly the same value function and policy as before. The only reason to do this would be to show the equivalence between the two sets of update equations when dealing with a deterministic policy.


Get Neural Network to predict a tag/class on a certain word using the surrounding words as context [PyTorch]? I am somewhat a novice at the topic of Neural Netoworks and PyTorch.
I am trying to create a model that takes a word (that I have modified very slightly) and a 'window' of context around it and predicts one of 5 tags (the tags relate to what sort of action I should perform on that word to get its correct form).
For example, here's what I would call a window of size 7 and it's tag (what it means isn't too important, it's just the 'target'):
        Sentence                    Label
here is a sentence for my network     N

sentence is the word that I want the network to predict the label for, but the 3 words on either side provide contextual meaning. My problem is, how would I get a network to know I want it to predict for that central word but not outright ignore the others? I am familiar with more normal NLP tasks such as NMT and character level classification.
I have already gotten my dataset 'padded' out so they're all of equal size.
Any help is appreciated

You may want to take a look at this article, but I'll summarize. You can use BERT (or some other tool) to make embeddings of every word in every sentence. Then for each word, make a contextualized embedding vector using the rest of the sentence. bert-embedding does all of this itself. Then keep the embedding vector for the important words.
For each important word, you would then have two pieces of information: the embedding vector and the correct label (which could easily be made into an integer from $0$ to $4$). Depending on the size of the embedding vectors, you could use PCA to reduce the size, although this may not be needed. Using this data, you can then train a neural network or use a k-nearest neighbors classifier.
There is more information in the article, which I suggest that you read. They do a better job explaining than me and also have some actual code you may want to look at.


How does Mask R-CNN automatically output a different number of objects on the image? Recently, I was reading Pytorch's official tutorial about Mask R-CNN.
When I run the code on colab, it turned out that it automatically outputs a different number of channels during prediction. If the image has 2 people on it, it would output a mask with the shape 2xHxW. If the image has 3 people on it, it would output the mask with the shape 3xHxW.
How does Mask R-CNN change the channels? Does it have a for loop inside it?
My guess is that it has region proposals and it outputs masks based on those regions, and then it thresholds them (it removes masks that have low probability prediction). Is this right?

Object detection models usually generate multiple detections per object. Duplicates are removed in a post-processing step called Non-Maximum Suppression (NMS).
The Pytorch code that performs this post-processing is called here in the RegionProposalNetwork class. The filtering loop you've mentioned performs the NMS and applies the score_thresh threshold (although it seems to be zero by default).


What is the difference between 2d vs 3d convolutions? I was trying to understand the definition of 2d convolutions vs 3d convolutions. I saw the "simplest definition" according to Pytorch and it seems the following:

2d convolutions map $(N,C_{in},H,W) \rightarrow (N,C_{out},H_{out},W_{out})$
3d convolutions map $(N,C_{in},D,H,W) \rightarrow (N,C_{out},D_{out},H_{out},W_{out})$

Which make sense to me. However, what I find confusing is that I would have expected images to be considered 3D tensors but we apply 2D convolutions to them. Why is that? Why is the channel tensor not part of the "definitionality of the images"?

I also asked this question at https://forums.fast.ai/t/what-is-the-difference-between-2d-vs-3d-convolutions/52495.

Looking at it from the perspective of input to output in that fashion is probably not the best. So lets start with our goal and how these ND convolutions accomplish that (Note these are in my own words, and may not be best stated).

Assumption: There exists highly correlative local associations

Goal: Have a linear model that takes advantage of these local associations

Solution: The ND Convolution

Explanation: ND convolutions take advantage of our locality assumption by connecting only local nodes/neurons. The fact that its a sliding window allows us to learn filters for any location along with ones that can be reusable.

Your Question:  Where does the N in ND convolution matter?:
When using an ND convolution we are working off the assumption that there exists this locality in N dimensions and nothing more. So we connect all other components of the input in a dense matter because we have no assumptions to work on in this space. So now going to the shapes you mentioned such as the input and output of the 2D convolution. We are convolving a filter of size $(C_{in}, k_h, k_w)$ with a $(C_{in},H,W)$ activation shaped map (the $N$ just refers to the number of activation maps, and there is no association between them). We use $C_{in}$ channels on the kernel because we are not making any assumptions about locality between channels.  On the other hand in a 3D convolution we make locality assumption is 3 dimensions, so our kernel will be ($C_{in}, k_h, k_w, k_r$). These kernel sizes are actually determined by the input size, the amount of dimensions of the kernel will actually match the inputs (minus the batch) because it needs to densely match each one.

You may be thinking now, that in torch this is not the case: This is because its rare to want a 2D Convolution with an inputs that's different than the one you mention, so they only implemented it for a singular shape. I hope this clears up the convolutions and helps you understand not just for 2 and 3 dimensional convolutions, but for all N.


Automatic image classification I'm a complete newbie to NNs, and I need your advice.

I have a set of images of symbols, and my goal is to categorize and divide them into groups of symbols that look alike. Without teaching NN anything about the data.

What is the best way to do this? What type of NN suits the best? Maybe there are any ready solutions?

Thank you!

This is called "clustering" , If the network is already trained with data that has similar features as of the "symbols", you can use that network with its last classification layer removed , then run a clustering algorithm like "k-means" on top of the vectors obtained from the last layer of the network.


Use ConvNet to predict bitmap I want to build a classifier which takes an aerial image and outputs a bitmap. The bitmap is supposed to be 1 at every pixel where the aerial image has water. For this process I want to use a ConvNet but I am unsure about the output layer. I identified two approaches:

Have an output layer with exactly 2 nodes which specify wether or not the center pixel of the aerial image corresponds to water or not.
Have an output layer with one node for every pixel. So for a 64x64 image I would have 4096 nodes.

What approach would be preferred and why?

Another thing that is unclear to me is how to get the actual bitmap with only zeros and ones from the output of the ConvNet. Assuming we used a approach 2 then for each pixel our ConvNet would give us a probability between 0 and 1 that the this pixel corresponds to water. How do I decide that this probability is high enough to set the value in my bitmap to 1? Do I just define a threshold, say 0.5, and if the value exceeds that threshold I set the pixel to 1 or is there a more sophisticated approach?

Your first approach doesn't make any sense to me. After all, you are not just interested in the centre pixel are you? And if you have two nodes for every pixel, what are those two nodes encoding? For the probability of water you just need one.

So clearly approach two. I would just use 0.5 as cutoff. Using a higher or lower cutoff only makes sense, if either false positives or false negatives are for some reason more problematic. Using some additional heuristic to adjust the given probabilities would just do what the ConvNet should already have done.

If 4096 output nodes is too expensive you can always make it a bit fuzzier, for example by predicting the probability that at least one of four pixels shows water, reducing the number of nodes to 1024.


Designing a reinforcement learning AI for a game of connect 4 I've made a connect 4 game in javascript, and I want to design an AI for it. I made a post the other day about what output would be needed, and I think I could use images of the board and a CNN. I did some research into Reinforcement learning, and I think that's what I need to do. I don't have much experience with ML in general, much less RL with Q-learning, but that is what I'd like to do.

Now, I don't really know how to start out with such a big project. I have a few questions first:

What do I do with my input? I'm thinking I give the AI 7 options for moves to make, one for each row of the board. How do I implement a way that it can "look" at the board? Can I just import an image of the current board state?
How do I make a reward table? How should I do the points system for the Q-learning? I'm thinking something like: If it drops a chip it gets a point, if it lines up 2 chips in a row it gets 5 points, if it gets 3 in a row it gets 30, and if it gets 4 in a row it gets 100. Would that be an effective way to do this? How do I implement this?
Is there a library I can use to do any of the work where I make an algorithm and board states and reward tables? Or do I have to hard code any of it?
I've done some research, are there any links or tutorials you think I should read or follow along with? Any other general advice or help for me?

I greatly appreciate anyone who answers one or all of these questions! Thank you so much!

1) your input should be so that you describe your entire environment. This could be done by 8 (length)* 8 (height)* 3 (either empty space, opponent chip or your chip) = 192 input neurons. you can just import a image of the current boardstate (which is width pixels * height pixels input neurons), but this means you task the neural network with learning to read the image as wel as playing the game.

2) rewards for a game like this are (most of the time) 1 for a winning move and 0 for a losing move. if you do it your way it might have side effects like prioritizing lining 2 chips up instead of going for a winning move.

3) Tensorflow is most commenly used. (this is python and not javascript though)

4) I liked the book Reinforcement learning, an introduction and would recommand this to anyone.


Which predictive algorithm is most appropriate for a proceeding situation? I'm new to artificial intelligence. I am looking for the most appropriate AI solution for my application, which is developing an algorithm to predict a proceeding situation (edited: I want my algorithm to predict a situation or more than one to happen at a predefined moment) and, at the same time, to learn from the iterative stages of my application.

Any suggestions? Any help? Any proposals?

One approach would be to use a Sequence Processing Neural architecture - one option is a recurrent network. These were specifically designed with your intent in mind.

They can consume sequences of data and learn from these in order to predict subsequent time-steps. Though these will require you to understand best practices for implementation.

If your task isn't too complex you could make use of a forward algorithm or some variant. Many of these models make use of simplifying assumptions - if your use case cannot admit these you'll have to go for something more advanced.

If your prediction task is complex and requires heavy use of long term dependencies you may have to go for a more cutting edge architecture like a transformer - but I heard that these are difficult to implement and most definitely require familiarity with deep learning systems.

Finally, if you need a system that can understand data and dependencies across very large spans of time then you may have to wait for the science to progress.

I hope this helps.


How to encode card game state into neural network input I'm trying create neural network to predict moves in a card game.  I am looking for recommendations on encoding the game state to my input layer.  It's a complex turn based collectible card game (think Magic the Gathering).  I need to represent cards being in various areas of the game board (deck, discard pile, hand, etc).  It seems difficult to assign cards to these areas because the number of cards in these areas is never constant.

I was thinking of an approach where I assign each card in the game to being in a specific card area.  The number of total cards in the game should be constant (let's assume that).  This approach I feel should give me a potentially less sparse input.

Also, With this approach what is the best way to handle card duplicates?  Let's say I have 3 copies of the exact same card in my deck.  Maybe 1 of the copies is in my hand and 2 in my discard pile.  It does not matter which of the 3 copies is in my hand because they are all the same exact card.  There is now multiple ways to represent this same exact game state in my network because each individual card has it's own state.  To me this does not seem good.  How much will this effect my neural network's ability to learn the game?

I am not sure what you mean by

There is now multiple ways to represent this same exact game state in my network because each individual card has it's own state. To me this does not seem good.

We can think of game state as a column vector of the form $1Xn$. In this case, you can formalize cards held according to some encoding. This can be anything from a Gödel Numbering to simple integer assignment. Here is an example for poker in python: https://pypi.org/project/treys/
In the example of duplicates you would have a column vector that simply has duplicate indices. I.e: {241, 424, 112, 112, 455}$


Which artificial intelligence algorithms could use tensor specific hardware? AI algorithms involving neural networks can use tensor specific hardware. Are there any other artificial intelligence algorithms that could benefit from many tensor calculations in parallel?  Are there any other computer science algorithms (not part of AI) that could benefit from many tensor calculations in parallel?

Have also a look at TensorApplications and Application Theory.

There are a lot of other potential applications. It's a good idea to start with GPU related problems, since GPUs are essentially doing a slightly wider set of operations, slightly slower. Some possible problems where TPUs might be advantageous are:

Shaders are algorithms for rendering graphics in one style or another. Since computer graphics can be understood as mostly linear algebra, it is natural to view this as operations over tensors.
Physical simulations, which again involve multiplication of vectors by a series of matrices.
Options Pricing, which again involves the multiplication of vectors by a series of matrices, especially when more complex derivatives are prices and the lattice becomes multi-dimensional.

Within AI, there are many other algorithms optimized to work with GPUs, and that could be modified to work with tensor specific hardware. For example, we have:

Genetic Programming on GPUs
Multiagent Systems on GPUs
SAT solving on GPUs

There does not yet seem to be much work optimizing these other problems for Tensor Processing units, but TPUs are also not yet very old. It took several years following the availability of inexpensive consumer GPUs before we started to see widespread use in AI. I suspect we will see more TPU-tailored code for other problems soon.


Can we implement ML engine using any general purpose Micro controller? I have read some articles, some tutorials but I am still didn't implemented any AI system. So , My question may seem inappropriate for the giants in this field. But I have build certain program , downloaded to microcontroller and it will perform its task. But How to do all this with machine learning. Can I implement AI engine using C like language and make it working in any GPP uC? Please feel free to modify, edit and upgrade this questions if you get my actual problem idea.

It depends on what you mean by "ML engine" and whether you want to train models on the uC or just make predictions.  IF you're doing something simple (maybe linear regression, logistic regression, etc.) you might be able to get away with doing training on a uC, especially for small amounts of data.  But you're almost certainly not going to be training deep neural networks on one of those things, at least not in any reasonable amount of time.

OTOH, the "making a prediction part" is usually much cheaper computationally, so if you have a pre-trained model and some prediction engine that can use that model, you could possibly use that on a microcontroller.


How to graphically represent a RNN architecture implemented in Keras? I'm trying to create a simple blogpost on RNNs, that should give a better insight into how they work in Keras. Let's say:
model = keras.models.Sequential()
model.add(keras.layers.SimpleRNN(5, return_sequences=True, input_shape=[None, 1]))
model.add(keras.layers.SimpleRNN(5, return_sequences=True))
model.add(keras.layers.Dense(1))

I came up with the following visualization (this is only a sketch), which I'm quite unsure about:

The RNN architecture is comprised of 3 layers represented in the picture.
Question: is this correct? Is the input "flowing" thought each layer neuron to neuron or only though the layers, like in the picture below. Is there anything else that is not correct - any other visualizations to look into?

Update: my assumptions are based on my understanding from what I saw in Geron's book. The recurrent neurons are connected, see: https://pasteboard.co/JDXTFVw.png ... he then proceeds to talk about connections between different layers, see: https://pasteboard.co/JDXTXcz.png - did I misunderstand him or is it just a peculiarity in keras framework?

The first image is correct. The information will flow from left to right in each layer and from top to bottom in between layers.


How can we efficiently and unbiasedly decide which children to generate in the expansion phase of MCTS? When executing MCTS' expansion phase, where you create a number of child nodes, select one of the numbers, and simulate from that child, how can you efficiently and unbiasedly decide which child(ren) to generate?

One strategy is to always generate all possible children. I believe that this answer says that AlphaZero always generates all possible ($\sim 300$) children. If it were expensive to compute the children or if there were many of them, this might not be efficient.

One strategy is to generate a lazy stream of possible children. That is, generate one child and a promise to generate the rest. You could then randomly select one by flipping a coin: heads you take the first child, tails you keep going. This is clearly biased in favor of children earlier in the stream.

Another strategy is to compute how many $N$ children there are and provide a function to generate child $X < N$ (of type Nat -> State). You could then randomly select one by choosing uniformly in the range $[0, N)$. This may be harder to implement than the previous version because computing the number of children may be as hard as computing the children themselves. Alternatively, you could compute an upper-bound on the number of children and the function is partial (of type Nat -> Maybe State), but you'd be doing something like rejection sampling.

I believe that if the number of iterations of MCTS remaining, $X_t$, is larger than the number of children, $N$, then it doesn't matter what you do, because you'll find this node again the next iteration and expand one of the children. This seems to suggest that the only time it matters is when $X_t < N$ and in situations like AlphaZero, $N$ is so much smaller than $X_0$, that this basically never matters.

In cases where $X_0$ and $N$ are of similar size, then it seems like the number of iterations really needs to be changed into something like an amount of time and sometimes you spend your time doing playouts while other times you spend your time computing children.

Have I thought about this correctly?

The first thing to consider in this question is: what do we mean when we talk about "generating a child/node". Just creating a node for a tree data structure, and allocating some memory (initialised to nulls / zeros) for data like deeper children, visit counts, backpropagated scores, etc., is rarely a problem in terms of efficiency.

If you also include generating a game state to store in that node when you say "generating a node", that can be a whole lot more expensive, since it requires applying the effects of a move to the previous game state to generate the new game state (and, depending on implementation, probably also requires first copying that previous game state). But you don't have to do this generally. You can just generate nodes, and only actually put a game state in them if you later on reach them again through the MCTS Selection phase.

For example, you could say that AlphaZero does indeed generate all the nodes for all actions immediately, but they're generally "empty" nodes without game states. They do get "primed" with probabilities computed by the policy network, but that policy network doesn't require successor states inside those nodes; it's a function $\pi(s, a)$ of the current state $s$ (inside the previous node), and the action $a$ leading to the newly-generated node.

But if you're really sure that, for your particular problem domain, the generation of nodes itself already is inefficient, then...

  [...] This is clearly biased in favor of children earlier in the stream.

Yes, you would get a significant bias with such a stream-based approach, probably wouldn't work well.

  [...] This may be harder to implement than the previous version because computing the number of children may be as hard as computing the children themselves. [...]

Again I agree with your observation, I don't think there are many problems where this would be a feasible solution.

  I believe that if the number of iterations of MCTS remaining, X_t, is larger than the number of children, N, then it doesn't matter what you do, because you'll find this node again the next iteration and expand one of the children.

This would only be correct for the children of the root node. For any nodes deeper in the tree, it is possible that MCTS never reaches them again even if $X_t > N$, because it could dedicate most of it search effort to different subtrees.

I think your solution would have to involve some sort of learned function (like the policy network in AlphaZero) which can efficiently compute a recommendation for a node to generate, only using the inputs that are already available before you pick a node to generate. In AlphaZero's policy network, those inputs would be the state $s$ in your current node, and the outward actions $a$ (each of which could lead to a node to be generated). This would often actually be very far from unbiased, but I imagine a strong, learned bias would likely be desireable anyway if you're in a situation where the mere generation of nodes is a legitimate concern for performance.


Why is the behaviour policy denoted by $\beta$ and the exploration policy by $ \mu'$ in the DDPG paper? I am learning about the deep deterministic policy gradient (DDPG) (Lillicrap et al, 2016) and got confused about the notation of the behavior policy.
Lillicrap et al. denote the policy gradient by
$$\nabla _{\theta^\mu} J \approx \mathbb{E}_{s_t \sim \rho^\beta} \left[ \nabla _{\theta^\mu} Q(s,a|\theta^Q) | s=s_t, a=\mu(s_t ; \theta ^\mu)  \right],$$
where $\beta$ denotes the behavior policy (equation 5 in the original paper).
However, when they talk about exploration, they denote the exploration policy by $ \mu'$. This notation seems confusing to me since the target actor network is also denoted by $\mu'(s|\theta^{\mu'})$.
As far as I understand, the exploration policy is not directly linked to the target critic network but rather corresponds to the previously mentioned behavior policy $\beta$. Is this correct or am I understanding it wrong?

You are right, it is sloppy notation by the authors. However, the target network is not necessarily linked to the behaviour policy $\beta$ either.
Essentially when they take the expectation with respect to $\rho^\beta$ they are taking expectation with respect to a state distribution induced by some policy $\beta$ that is not necessarily the same as our current policy -- this is what makes DDPG an off-policy algorithm.
The target actor network $\mu'$ is used in the loss function for the critic; the target for the critic (ignoring parameters for brevity) $y = r + \gamma Q(s', \mu'(s'))$ where $s'$ is the state we transitioned to from $s$ when we took an action $a$.
Now, $a$ was sampled as part of the tuple $(s, a, r, s')$ from our replay buffer, meaning that $a$ will have been chosen according to some past version of our policy, plus some exploration noise $\mathcal{N}$. The way this links to the behaviour policy $\beta$ is that because we have sampled it from some old version of our policy, i.e. not our current policy, it is instead coming from this behaviour policy $\beta$.
The target network $\mu'$ is simply a copy of the current actor network where the weights are updated using the polyak averaging technique and is not really related to the behaviour policy $\beta$, at least not in any useful way for you to think about it.


Are there any agents that are based on quantum computing? Assuming the definition of an agent to be:

An entity that perceives its environment, processes the perceived information, and acts on the environment such that some goal is fulfilled.

Are there any agents that are based on quantum processing/computing (i.e. implemented by a network of quantum gates)?
Is there any work done towards this end? If so, could someone provide references?

I think you are looking for quantum machine learning (QML), which is a relatively new field that sits at the intersection of quantum computing and machine learning.
If you are not familiar with quantum computing (QC) and you are interested in QML, I suggest that you follow this course by prof. Umesh Vazirani and read the book Quantum Computing for Computer Scientists (2008) by Yanofsky and Mannucci. If you have a solid knowledge of linear algebra, you should not encounter big problems while learning QC. Be prepared to deal with the weirdness and beauty of qubits, quantum entanglement, and so on.
If you want to directly dive into QML (although I am not familiar with the details of QML, I suggest that you first get familiar with the basics of QC, which I am familiar with) there are already several courses, papers, overviews, and libraries (such as TensorFlow Quantum) on quantum machine learning.
If you are interested in quantum reinforcement learning, maybe have a look at the paper Quantum Reinforcement Learning (2008) by Daoyi Dong et al.


Mathematical calculation behind decision tree classifier with continuous variables Problem Description
I am working on a binary classification problem having continuous variables (Gene expression Values). My goal is to classify the samples as case or control using gene expression values (from Gene-A, Gene-B and Gene-C) using decision tree classifier. I am using the entropy criteria for node splitting and is implementing the algorithm in python. The classifier is easily able to differentiate the samples.
Below is the sample data,
sample training set with labels
Gene-A    Gene-B    Gene-C    Sample
   1        0         38       Case
   0        7         374      Case
   1        6         572      Case
   0        2         538      Control
   33       5         860      Control

sample testing set labels
Gene-A    Gene-B    Gene-C    Sample
  1         6        394       Case
  13        4        777       Control

I have gone through a lot of resources and have learned, how to mathematically calculate Gini-impurity, entropy and information gain.
I am not able to comprehend how the actual training and testing work. It would be really helpful if someone can show the calculation for training and testing with my sample datasets or provide an online resource?
I have asked this question initially on Mathematics Stack Exchange but was redirected here.

Of course, it depends on what algorithm you use. Typically, a top-down algorithm is used.
You gather all the training data at the root. The base decision is going to be whatever class you have most of. Now, we see if we can do better.
We consider all possible splits. For categorical variables, every value gets its own node. For continuous variables, we can use any possible midpoint between two values (if the values were sorted). For your example, possible splits are Gene-A < 0.5, Gene-A < 17, Gene-B < 1, Gene-B < 3.5, and so on. There is a total of 10 possible splits.
For each of those candidate splits, we measure how much the entropy decreases  (or whatever criterion we selected) and, if this decrease looks significant enough, we introduce this split.
For example. Our entropy in the root node is $-0.4 \log_2 0.4 - 0.6 \log_2 0.6 \approx 0.97$. If we introduce the split Gene-A < 0.5, we get one leaf with entropy $1$ (with 2 data points in it), and one leaf with entropy $0.918$ (with 3 data points). The total decrease of entropy is $0.97 - (\frac25 \times 1 + \frac35 \times 0.918) \approx 0.02$.
For the split Gene-A < 17 we get a decrease of entropy of about $0.3219$.
The best splits for the root are Gene-B < 5.5 and Gene-C < 456. These both reduce the entropy by about $0.42$, which is a substantial improvement.
When you choose a split, you introduce a leaf for the possible outcomes of the test. Here it's just 2 leaves: "yes, the value is smaller than the threshold" or "no, it is not smaller". In every leaf, we collect the training data from the parent that corresponds to this choice. So, if we select Gene-B < 5.5 as our split, the "yes" leaf will contain the first, fourth and fifth data points, and the "no" leaf will contain the other data points.
Then we continue, by repeating the process for each of the leaves. In our example, the "yes" branch can still be split further. A good split would be Gene-C < 288, which results in pure leaves (they have 0 entropy).
When a leaf is "pure enough" (it has very low entropy) or we don't think we have enough data, or the best split for a leaf is not a significant improvement, or we have reached a maximum depth, you stop the process for that leaf. In this leaf you can store the count for all the classes you have in the training data.
If you have to make a prediction for a new data point (from the test set), you start at the root and look at the test (the splitting criterion). For example, for the first test point, we have that Gene-B < 5.5 is false, so we go to the 'no' branch. You continue until you get to a leaf.
In a leaf, you would predict whatever class you have most of. If the user wants, you can also output a probability by giving the proportion.
For the first test point, we go to the "no" branch of the first test, and we end up in a leaf; our prediction would be "Case". For the second test point, we go to the "yes" branch of the first test. Here we test whether 777 < 288, which is false, so we go to the "no" branch, and end up in a leaf. This leaf contains only "Control" cases, so our prediction would be "Control".


Why is Sanskrit the best language for AI? According to NASA scientist Rick Briggs, Sanskrit is the best language for AI. I want to know how Sanskrit is useful. What's the problem with other languages? Are they really using Sanskrit in AI programming or going to do so? What part of an AI program requires such language?

Rick Briggs refers to the difficulty an artificial intelligence would have in detecting the true meaning of words spoken or written in one of our natural languages. Take for example an artificial intelligence attempting to determine the meaning of a sarcastic sentence.

Naturally spoken, the sentence "That's just what I needed today!" can be the expression of very different feelings. In one instance, a happy individual finding an item that had been lost for some time could be excited or cheered up from the event, and exclaim that this moment of triumph was exactly what their day needed to continue to be happy. On the other hand, a disgruntled office employee having a rough day could accidentally worsen his situation by spilling hot coffee on himself, and sarcastically exclaim that this further annoyance was exactly what he needed today. This sentence should in this situation be interpreted as the man expressing that spilling coffee on himself made his bad day worse.

This is one small example explaining the reason linguistic analysis is difficult for artificial intelligence. When this example is spoken, small tonal fluctuations and indicators are extremely difficult for an AI with a microphone to detect accurately; and if the sentence was simply read, without context how would one example be discernible from the other?

Rick Briggs suggests that Sanskrit, an ancient form of communication, is a naturally spoken language with mechanics and grammatical rules that would allow an artificial intelligence to more accurately interpret sentences during linguistic analysis. More accurate linguistic analysis would result in an artificial intelligence being able to respond more accurately. You can read more about Rick Brigg's thoughts on the language here.


Human Height estimation using person detection techniques I have a pedestrian dataset and would like to estimate human height in a video survillance using person detection techniques like YOLO Darknet or SSD (Single Shot Detectors). Would this technique work? Also, the videos that I have are in a constrained environment with good illumination. The idea is to get the coordinates from the bounding box and try to estimate pixel height. After getting the pixel height, some correlation could be estimated between pixel height and real world height. Note that I won't be using camera calibration.

Eh, "I won't be using camera calibration." .. Not sure, what you mean.

1st

At first, imagine a sheet of paper laying there on the floor. And first to try to transform the paper sheet (i.e. with some text on it), the picture of the sheet angled by paralaxe to the straight view: Just a transformation by a matrix. It would be highly valuable to have there some floor of square tiles. And once you would estimate/set size of the tiles on the floor, you can then transform the paper sheet.

Then, also some vertical calibration will be needed: Wherever within the scene. A wall of tiles of known shape & size would be perfect. But not really necessary: Any known/premeasured chair would be enough! ..rather two such chairs, in an opposite nooks, for numerical stability.

So yes, that could be treated as "camera calibration".

2nd

Then you can advance to the next level of the image processing:

Once you see feet of the person, on which tile of the floor the person stays,
and with the known vertical direction,

by the hid/covered known background, you can decide their height, pretty precisely, yes.

The "known background"

Just two images should be enough, of the background place: empty non-occupied, and hid/covered. The clear-empty room can be taken either onence, or periodically, or even just a partial image should be enough: just to detect shape of the person-figure.

3rd

And the third level: Really high. The person could stay in some deformed position. By interpolation of the known human skeleton to the shape of the person-figure on the screen, you can assume the curves of the skeleton of the person, so your estimated/measured total height of the person would be immune to the non-strightened angles in joints of their limbs/backbone. So even if the person knows about your observing, the AI would not get fooled. But you would need/find more refencial points on their body, to interconnect the 2D shape to the internal 3D model.

quantity of snaps in general

More snaps of the person, as they walk through the room, would be helpful: Any model, set up by any single image, should be verifiable/applicable to each of the rest of the images of the same person. Again: stability and "back testing", verifications, robustness.

You are not limited to just a single image, you can have as many as your camera is able to make. So use them, to get not only the measured size, but also to level up the "probability" of the measured result, the accuracy.

On the other hand, you can also flip the coin, and to try to guess the maximum info from the minimum snaps of the scene. But it does not seem, this would be your case. Still: Processing 24 fps recording 20 seconds long.. That definitely requires some power/time to process.

Summary

The 3D models are necessary: Of the surrounding space, of the outer shapes of the person-figure, of the internal structure of the measured body.


What is the concept of channels in CNNs? I am trying to understand what channels mean in convolutional neural networks. When working with grayscale and colored images, I understand that the number of channels is set to 1 and 3 (in the first conv layer), respectively, where 3 corresponds to red, green, and blue.

Say you have a colored image that is 200x200 pixels. The standard is such that the input matrix is a 200x200 matrix with 3 channels. The first convolutional layer would have a filter that is size $N \times M \times 3$, where $N,M<200$ (I think they're usually set to 3 or 5).

Would it be possible to structure the input data differently, such that the number of channels now becomes the width or height of the image? i.e., the number of channels would be 200, the input matrix would then be 200x3 or 3x200. What would be the advantage/disadvantage of this formulation versus the standard (# of channels = 3)? Obviously, this would limit your filter's spatial size, but dramatically increase it in the depth direction.

I am really posing this question because I don't quite understand the concept of channels in CNNs.

Say you have a colored image that is 200x200 pixels. The standard is such that the input matrix is a 200x200 matrix with 3 channels. The first convolutional layer would have a filter that is size $N×M×3$, where $N,M<200$ (I think they're usually set to 3 or 5).

  Would it be possible to structure the input data differently, such that the number of channels now becomes the width or height of the image? i.e., the number of channels would be 200, the input matrix would then be 200x3 or 3x200. What would be the advantage/disadvantage of this formulation versus the standard (# of channels = 3)? Obviously, this would limit your filter's spatial size, but dramatically increase it in the depth direction.

The different dimensions (width, height, and number of channels) do have different meanings, the intuition behind them is different, and this is important. You could rearrange your data, but if you then plug it into an implementation of CNNs that expects data in the original format, it would likely perform poorly.

The important observation to make is that the intuition behind CNNs is that they encode the "prior" assumption or knowledge, the "heuristic", the "rule of thumb", of location invariance. The intuition is that, when looking at images, we often want our Neural Network to be able to consistently (in the same way) detect features (maybe low-level features such as edges, corners, or maybe high-level features such as complete faces) regardless of where they are. It should not matter whether a face is located in the top-left corner or the bottom-right corner of an image, detecting that it is there should still be performed in the same way (i.e. likely requires exactly the same combination of learned weights in our network). That is what we mean with location invariance.

That intution of location invariance is implemented by using "filters" or "feature detectors" that we "slide" along the entire image. These are the things you mentioned having dimensionality $N \times M \times 3$. The intuition of location invariance is implemented by taking the exact same filter, and re-applying it in different locations of the image.

If you change the order in which you present your data, you will break this property of location invariance. Instead, you will replace it with a rather strange property of... for example, "width-colour" invariance. You might get a filter that can detect the same type of feature regardless its $x$-coordinate in an image, and regarldess of the colour in which it was drawn, but the $y$-coordinate will suddenly become relevant; your filter may be able to detect edges of any colour in the bottom of an image, but fail to recognize the same edges in the top-side of an image. This is not an intuition that I would expect to work successfully in most image recognition tasks.

Note that there may also be advantages in terms of computation time in having the data ordered in a certain way, depending on what calculations you're going to perform using that data afterwards (typically lots of matrix multiplications). It is best to have the data stored in RAM in such a way that the inner-most loops of algorithms using the data (matrix multiplication) access the data sequentially, in the same order that it is stored in. This is the most efficient way in which to access data from RAM, and will result in the fastest computations. You can generally safely expect that implementations in large frameworks like Tensorflow and PyTorch will already require you to supply data in whatever format is the most efficient by default.


What is the Preferred Mathematical Representation for a Forward Pass in a Neural Network? I know this may be a question of semantics but I always see different articles explain forward pass slightly different. e.g. Sometimes they represent a forward pass to a hidden layer in a standard neural network as np.dot(x, W) and sometimes I see it as np.dot(W.T, x) and sometimes np.dot(W, x).
Take this image for example. They represent the input data as a matrix of [NxD] and weight data as [DxH] where H is the number of neurons in the hidden layer. This seems the most natural since input data will often be in tabular format with rows as samples and columns as features.

Now an example from the CS231n course notes. They talk about this below example and cite the code used to compute it as:
f = lambda x: 1.0/(1.0 + np.exp(-x)) # activation function (use sigmoid)
x = np.random.randn(3, 1) # random input vector of three numbers (3x1)
h1 = f(np.dot(W1, x) + b1) # calculate first hidden layer activations (4x1)
h2 = f(np.dot(W2, h1) + b2) # calculate second hidden layer activations (4x1)
out = np.dot(W3, h2) + b3 # output neuron (1x1)

Where W is [4x3] and x is [3x1]. I would expect the weight matrix to have dimensions equal to [n_features, n_hidden_neurons] but in this example it just seems like they transposed it naturally before it was used.

I guess I am just confused about general nomenclature in how data should be shaped and used consistently when computing neural network forward passes. Sometimes I see transpose, sometimes I don't. Is there a standard, preferred way to represent data in accordance to a diagram like these This question may be silly but I just wanted to discuss it a bit. Thank you.

I don't think there's a "standard way" of expressing the forward pass: you use the transpose when you need to use it, and this depends on how you define the weights and inputs matrices, and on the architecture of your neural network. For example, in a fully connected feedforward neural network, you know that every neuron in the previous layer is connected to every neuron in the current layer, so, as long as this is satisfied when you multiply the matrices, it does not matter whether you use transposes or not, and I don't think that, in computational terms, it makes any difference if you use transposes or not. (By the way, if you are writing something, I suggest that you always specify the dimensions of your matrices and your conventions).
Of course, if you want to use a library like TensorFlow, you will probably need to follow the conventions of the library, but this is another story.


Why are weights not initialized with mean=1? I wonder why weights are initialized with zero-mean. It is one of the reasons, why deep architectures cannot be trained without skip connections. Without the skip connections, the zero initialization becomes problematic, because the identity function cannot be learned in earlier layers (this is a simplified explanation I know). But why can we not initialize weights around one? This would enhance the intrinsic learning of the identity function. Of course, the skip connections also allow a better backpropagation of the gradients, but couldn't this be helpful anyways? Can anyone tell me, why this is not done?

Interesting question,
I can come with 2 explanations why we don't initialize weights with 1 mean value :

It may be easier for the network to learn identity function, but we may have a similar issue about not being able to learn comparison, comparison is quite an important reasoning in my opinion, this is why having negative weight values is important, and initializing all weights around 1 may make it difficult for the network to get negative weights.
Maybe it causes an issue with the non-linearity of the activation functions. If we use ReLU function for example, it only is non linear if there are negative values in the network. It is not uncommon to have positive inputs for a network, so initializing all weights around 1 may lead to have only positives values on the network, which makes ReLU function linear.

Anyway weight initialization has always been a complicated topic and it seems there is no definitive answer to what should be done about initializing weights. I am not an expert of the topic, just giving you my thoughts about it.


Rescaling time-series data with very spiky pattern for training data in LSTM network I am working with some time-series hydrology data. Our goal is to forecast the time series forward, meaning predicting the data 1 month, 3 months ,6 months into the future. The data itself(image below) is characterized by mostly 0 or very small rates of flow expect for brief periods that are characterized by high flow. So I get this crazy spiky pattern where the median is around 0 or 1-2 meters^3/min, but at the same time there are periods of 5000 meters^3/minute, etc. I am not sure of the exact scale dimensions, but the picture below tells the tale.

So I was trying to figure out a good way to scale this type of spiky data. I have been using a MinMaxScaler just to start with, to rescale the values between (-1, 1). But that approach is not going to work well, especially because at the top ends of the range, the difference between 1000 m^3/min and 5000 m^3/min will be like 0.001 difference.
Does anyone have a good suggestion of how to rescale data like this for time-series analysis in an LSTM or RNN network?

First, if your data has a minimum of 0 and maximum of 5000, 1000 will get rescaled to .2 and 5000 will get rescaled to 1. So it's not a .001 difference as you suggest.
If you just used a regular loss function (e.g. mean squared error), I'm not sure you'd be able to achieve good predictions. In the literature this type of data might be called "sharp". There are some special loss functions such as DILATE (link) or soft-DTW (link) which are specially designed for time series like the one you show.


Diagnosing mental health problems using Artificial Intelligence / Machine Learning techniques I've seen events, like CogX and articles which describe how
  machine learning techniques or algorithms can be used to diagnose
  mental health issues.

Here is my question;

How can artificial intelligence and machine learning algorithms or techniques be used in diagnosing mental health issues, besides for e.g. Facebook using machine learning algorithms to detect people who may commit suicide?

There's a strong sentiment towards the idea that medical diagnosis is largely Abductive Reasoning. See this presentation for additional details.  One approach to automated abductive reasoning is parsimonious covering theory.

If you want a relatively in-depth look at all of this, check out the book Abductive Inference Models for Diagnostic Problem-Solving .

Expert systems have also been shown to work very well for medical diagnosis. As far back as the 1970's, systems like MYCIN could beat human experts in terms of diagnosis and treatment plans.

From what I can tell, there doesn't seem to be any reason in principle to think that AI/ML can't be used across the board for medical diagnosis, mental health or otherwise.


Can the first emergence of consciousness in evolution be replicated in AI? At some point in time during the evolution, because of some factors, some beings first started to become conscious of themselves and their surroundings. That conscious experience is beyond some mere sensory reflexive actions trained. Can that be possible with AI?

Current limitations in our knowledge mean that the question is not directly answerable:

There is no scientific consensus on what consciousness is. Therefore any device designed to "be conscious" is necessarily going to be built on the premise of unsupported, maybe fringe, theory.
There is no robust measure of consciousness. If any AI system was built in order to exhibit conscious behaviour, there would be no way to prove it is conscious. There is no general agreement or theory on whether any particular animal species is conscious for example. This is often limited by communication. Of the few animals smart enough to be trained in communication with humans, there appears to be conscious behaviour. Researcher opinion ranges from "all non-humans do not possess consciousness" to "all animals have some degree of consciousness".
There is incomplete understanding of what the components of consciousness are. A bottom-up build of a conscious machine requires a baseline theory of what those components are.
We may be able to ignore lack of knowledge and take a very high level of abstraction, such as A-life or evolutionary approach where nothing is assumed and the hope is that consciousness would spontaneously emerge from a complex enough simulation (as we assume it has done with organic life in the real world). However, this would seem to require many orders of magnitude more computing power than is currently possible.

To answer the question as written:

  Can the first emergence of consciousness in the Evolution be replicated in AI?

Despite the many books, articles and posts written on this subject over many years, the answer is two-fold:

We do not know of any fundamental reason why AI could not be conscious.
We have no theory or experimental proof that AI can replicate consciousness.

I would go further than this, and say that anyone who tells you otherwise on these two points has already subscribed to some unproven theory of consciousness.

As well as well-thought-out peer-reviewed theories and experiments by scientists and researchers, there is a lot of pseudo-scientific junk published on the internet on this subject. So take care if researching reading material.


Can the normal equation be used to optimise the RNN's weights? I have made an RNN from scratch in Tensorflow.js. In order to update my weights (without needing to calculate the derivatives), I thought of using the normal equation to find the optimal values for my RNN's weights. Would you recommend this approach and if not why?

Unfortunately, this is not possible. The normal equation can only directly optimise a single layer that connects input and output. There is no equivalent for multiple layers such as those in any neural network architecture.