text:
Does the weight vector form imply feature space curvature?
I came across this sentence when exploring a simple nearest neighbor classifier method using Euclidean distance (link):

The slightly odd thing about using the Euclidean distance to compare features is that each dimension (or feature) is compared using the same scale.

This got me thinking - if flat feature space implies that each feature contributes equally to the distance (score function), then curved feature space changes the scale between features, so that the features then contribute different amounts to the score function. For example, imagine we have a 2D feature space - a flat piece of paper - with two points, $X_1$ and $X_2$ on it, between which we wish to calculate the distance. If we then bend this into U-shape along, say, y-axis (so, no curvature introduced in y-dimension), the distances along the x-axis would be larger in the bent case than in the flat case:

In other words, feature x would contribute more to the score function than feature y. This sounds awfully like weighing the feature inputs with weight vectors. Does this imply, that weight vectors (and matrices) have a direct effect on curvature of feature space? Does an identity weight matrix (or a vector of all 1s) imply our feature space is flat (and curved otherwise)? Lastly, could it then be said that whenever we are training an ML model, we are in fact learning the approximate curvature of the feature space we wish to model?

When you say "I came across this sentence", it may be a good idea to provide the link to the source where you found this sentence.

Certainly - added the link. It's a free course on AI for beginners, titled "Building AI" as part of "Elements of AI" website. Although one might have to register in order to view the contents, I am not sure.

No, it does not take into account the curvature. But, if curvature is important for you, then, it would be a good idea to look at Ricci flow and its applications in neural networks.


text:
What is the paper that states that humans incorrectly trust the incorrect explanations of the AI?
I was reading a paper on the subject of explainable AI and interpretability, in particular the tendency of people (even experts) to excessively trusting explanations given by AI. In the intro the author describes riding in a self-driving car with a screen on the passenger side that depicts the car's vision and classification of the objects on the road, ostensibly to improve the level of trust in the car's decision-making. Later the author quotes a study in which experts in a field give good ratings to an AI's explanations for its decision-making, even when the explanations given are intentionally incorrect.
I cannot for the life of me remember which paper this is or what it covers in its main sections, and after searching through dozens of my saved papers as well as online search engines I cannot recover it. The paper also mentions a specific term for trusting machines/AI, which I also can't remember and would definitely help me find the paper if I could.
If anyone is familiar with this paper or the study it quotes, I would really appreciate a link.

I can give you the name in the area of explainability. Cynthia Rudin. Given the description, you have given it looks more like a psychology experiment like experience sampling.

source: Stack Exchange

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

sort: votes


text:
Best Machine Learning Model for "Predicted" Image Generation
I am currently working on undergraduate research to determine hotspots for hand-surface contact. Ideally, I would like to give the model a depth image as input:

Example of synthetic depth image
and return an image mask indicating where the surface was touched:

Example of synthetic contact mask
I have worked with Machine Learning before but am struggling to determine what model I should use. My understanding is that CNNs are typically intended for classification tasks. And while GANs are used to generate new images, they can produce these images independently of an input. Assuming I have a large dataset of depth images and the respective black and white contact mask, what model can be used to efficiently predict a contact mask given an unseen depth image?

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


text:
Compressing Parameters of an Response System
I have an input-output system, which is fully determined by 256 parameters, of which I know a significant amount are of less importance to the input-output pattern.
The data I have is some (64k in total) input-parameter-output match.
My goal is to compress these 256 parameters to a smaller scale (like 32) using an encoder of some kind while being able to preserve the response pattern.
But I can't seem to find a proper network for this particular problem, because I'm not trying to fit these parameters (they all have a mean of one and variance of 1/4), but rather its influence on the output, so traditional data-specific operations will not work in this case.


text:
Is there any way where you can train a Neural Network with only one data point in the dataset?
I was working on a project involving the search for biosignatures (signs of life) on exoplanets and the probability of that planet harboring life. In this case, we know that Earth is the only planet confirmed to have life on it. So the parameters of atmospheric conditions, radius, temperature, distance from the star for planets confirmed to have life is one (Earth).
Is there any way to use NNs to predict the probability of an exoplanet harboring life if we have the data of all these parameters for that planet?

@DuttaA thanks for the insight. I too think the same. I doubt that there's any substantial way to achieve it, given that the data we have is insufficient

https://exoplanetarchive.ipac.caltech.edu/cgi-bin/FDL/nph-fdl?atmos
Turns out that astrobiologists at SETI and NASA have come up with a dataset with simulated stable atmospheres for Earth-like exoplanets that might allow them to harbour life. This would probably be the only way to solve the one data point problem


text:
Is there data available about successful neural network architectures?
I am curious to if there is data available for MLP architectures in use today, their initial architecture, the steps that were taken to improve the architecture to an acceptable state and what the problem is the neural network aimed to solve.
For example, what the initial architecture (amount of hidden layers, the amount of neurons) was for a MLP in a CNN, the steps taken to optimize the architecture (adding more layers and reducing nodes, changing activation functions) and the results each step produced (i.e. increased error or decreased error). What the problem is the CNN tried to solve (differentiation of human faces, object detection inteded for self driving cars etc.)
Of course I used a CNN as an example but I am referring to data for any MLP architecture in plain MLPs or Deep Learning architectures such as RNNs, CNNs and mroe. I am focused on the MLP architecture mostly.
If there is not how do you think one can accumulate this data?

Thank you this was insightful. I wanted the data to analyze it and see if there is any potential patterns that could emerge to the steps that was taken to optimize the architectures of MLP.


text:
What consequence would a polynomial time algorithm for SAT have on AGI?
$P$ vs $NP$ is a famous problem. We generally believe $P\neq NP$. However suppose there is a polynomial time algorithm of order say $O((n+m)^2)$ or $O((n+m)^3)$ (a low degree polynomial complexity with small hidden constants) for $n$ variable SAT problem in $m$ clauses, then what consequence would it have on $AI$ and machine learning? Would $AGI$ be any closer?

I would rewrite the title to be "what consequences would P=NP have on AI?", because right now it seems that you're asking any polynomial time algorithms and there are many.

I have specified quadratic or cubic complexity and have specifically mentioned low degree polynomial with small hidden constants complexity.

See this post too.

-1 what a nonsense. P vs NP from https://en.wikipedia.org/wiki/Theory_of_computation and AGI are not related at all.

It seems this post could be an answer to your question. In sum, it says that AGI is more related to interactional complexity than classical complexity. Therefore, these two are perpendicular concepts to each other. However, the consequence of $P = NP$ might affect that some problems in AGI will be more fastly computed, but there is no way in that sense to show whether AGI has been achieved or not!


text:
Open AI Taxi - Agent fails to learn an effective policy
I'm trying to solve the openai gym taxi problem (v3) using deep q learning.  I've already had some success with the q-table approach, but for the life of me cannot manage to train a NN to learn a reasonable action policy.  I'm doing the training using an AWS p3.2xlarge instance.
My approach is fairly straightforward, I set up the environment and agent, then run the training loop.
My code more or less looks like this:
import gym
from taxi_agent import Agent

env = gym.make('Taxi-v3').env
optimizer = Adam(learning_rate=0.001)
agent = Agent(env, optimizer)

batch_size = 32
num_of_episodes = 200
timesteps_per_episode = 120

The agent was cobbled together from various examples online:
import numpy as np
import random
from IPython.display import clear_output
from collections import deque
from tensorflow.keras import Model, Sequential
from tensorflow.keras.layers import Dense, Embedding, Reshape
from tensorflow.keras.callbacks import ModelCheckpoint, TensorBoard

class Agent:
    def __init__(self, environment, optimizer):

        # Initialize atributes
        self._state_size = environment.observation_space.n
        self._action_size = environment.action_space.n
        self._optimizer = optimizer

        self.expirience_replay = deque(maxlen=2000)

        # Initialize discount and exploration rate
        self.gamma = 0.6
        self.epsilon = 0.5

        # Build networks
        self.q_network = self._build_compile_model()
        self.target_network = self._build_compile_model()
        self.align_target_model()

        #: Set up some callbacks
        self.checkpoint_filepath = 'checkpoints/'
        model_checkpoint_callback = ModelCheckpoint(
            filepath=self.checkpoint_filepath,
            save_weights_only=True,
            save_freq='epoch'
        )
        # tensorboard_callback = TensorBoard('logs', update_freq=1)
        self.model_callbacks = [model_checkpoint_callback]

        self.history = []

    def store(self, state, action, reward, next_state, terminated):
        self.expirience_replay.append((state, action, reward, next_state, terminated))

    def _build_compile_model(self):
        model = Sequential()
        model.add(Embedding(self._state_size, 10, input_length=1))
        model.add(Reshape((10,)))
        model.add(Dense(48, activation='tanh'))
        model.add(Dense(24, activation='tanh'))
        model.add(Dense(self._action_size, activation='linear'))

        model.compile(loss='mse', optimizer=self._optimizer)
        return model

    def restore_weights(self):
        path = self.checkpoint_filepath
        print(f"restoring model weights from {path}")
        self.q_network.load_weights(path)

    def align_target_model(self):
        self.target_network.set_weights(self.q_network.get_weights())

    def act(self, state, environment):
        if np.random.rand() <= self.epsilon:
            return environment.action_space.sample()

        q_values = self.q_network.predict(state)
        return np.argmax(q_values[0])

    def retrain(self, batch_size, epochs=1):
        minibatch = random.sample(self.expirience_replay, batch_size)

        for state, action, reward, next_state, terminated in minibatch:

            target = self.q_network.predict(state)

            if terminated:
                target[0][action] = reward
            else:
                t = self.target_network.predict(next_state)
                target[0][action] = reward + self.gamma * np.amax(t)

            history = self.q_network.fit(state, target, epochs=1, verbose=0, callbacks=self.model_callbacks)
            self.history.append(history.history)

The training loop uses the agent to act in the environment up to a number of batch_size actions.  Next, it retrains the model based on a random sample of the experience for every subsequent timestep.
I have it set to print out feedback whenever the environment terminates (achieves the objective).  In practice this never happens.
I've reloaded trained models from weights and trained for cumulative 24 hours without much success.  I've also tried silly things like updating the target network after N steps just so it learns something - no luck.
If I try to use my trained model to solve an example env instance, it just wants to move south other than the random actions it set to do 50% of the time.
It would be great it someone could give me some advice towards what to try next.  I can keep playing around with hyperparameters but I don't have the best intuition around where to optimize my efforts.
iterations = 0
state = env.reset()
env.render()
while not terminated:
    state = np.reshape(state, [1, 1])
    action = agent.act(next_state, env)
    next_state, reward, terminated, info = env.step(action)
    next_state = state
    if iterations % 10: env.render()
    iterations += 1
    if iterations > 1000: break

Could you please put your specific question in the title so that people immediately understand what your specific question is?

I added more detail to the title.


text:
Can a single neural network handle recognizing two types of objects, or should it be split into two smaller networks?
In particular, an embedded computer (with limited resources) analyzes live video stream from a traffic camera, trying to pick good frames that contain license plate numbers of passing cars. Once a plate is located, the frame is handed over to an OCR library to extract the registration and use it further.
In my country two types of license plates are in common use - rectangular (the typical) and square - actually, somewhat rectangular but "higher than wider", with the registration split over two rows.
(there are some more types, but let us disregard them; they are a small percent and usually belong to vehicles that lie outside our interest.)
Due to the limited resources and need for rapid, real-time processing, the maximum size of the network (number of cells and connections) the system can handle is fixed.
Would it be better to split this into two smaller networks, each recognizing one type of registration plates, or will the larger single network handle the two types better?

Well, I do not know what type of features you are giving to your neural network. However, in general, I would go with a single neural network. It seems that you have no limitation in resources for training your network and the only problem is resources while you apply your network.
The thing is that probably the two problems have things in common (e.g. both types of plates are rectangular). This means that if you use two networks, each has to solve the same sub-problem (the common part) again. If you use only one network the common part of the problem takes fewer cells/weights to be solved and the remaining weights/cells can be employed for better recognition.
In the end, if I was in your place I would try both of them. I think that is the only way to be really sure what is the best solution. When speaking theoretically it is possible that we do not include some factors.

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


text:
Is Lisp still being used to tackle AI problems?
I know that language of Lisp was used early on when working on artificial intelligence problems. Is it still being used today for significant work? If not, is there a new language that has taken its place as the most common one being used for work in AI today?

Overall, the answer is no, but the current paradigms owe a lot to LISP. The language most commonly used today is python.
Relevant answers:

Stack Overflow thread explaining why LISP was thought of as the AI language: Why is Lisp used for AI
Quora answer by Peter Norvig, who wrote a popular textbook on the subject and is currently Director of Research at Google: Is it true that Lisp is highly used programming language in AI?

LISP pioneered many important concepts in what we now call functional programming, with a key attraction being how close the programs were to math. Many of these features have since been incorporated into modern languages (see the Wikipedia page). LISP is very expressive: it has very little syntax (just lists and some elementary operations on them) but you can write short succinct programs that represent complex ideas. This amazes newcomers and has sold it as the language for AI. However, this is a property of programs in general. Short programs can represent complex concepts. And while you can write powerful code in LISP, any beginner will tell you that it is also very hard to read anyone else's LISP code or to debug your own LISP code. Initially, there were also performance considerations with functional programming and it fell out of favor to be replaced by low level imperative languages like C. (For example, functional programming requires that no object ever be changed ("mutated"), so every operation requires a new object to be created. Without good garbage collection, this can get unwieldy). Today, we've learned that a mix of functional and imperative programming is needed to write good code and modern languages like python, ruby and scala support both. At this point, and this is just my opinion, there is no reason to prefer LISP over python.
The paradigm for AI that currently receives the most attention is Machine Learning, where we learn from data, as opposed to previous approaches like Expert Systems (in the 80s) where experts wrote rules for the AI to follow. Python is currently the most widely used language for machine learning and has many libraries, e.g. Tensorflow and Pytorch, and an active community. To process the massive amounts of data, we need systems like Hadoop, Hive or Spark. Code for these is written in python, java or scala. Often, the core time-intensive subroutines are written in C.
The AI Winter of the 80s was not because we did not have the right language, but because we did not have the right algorithms, enough computational power and enough data. If you're trying to learn AI, spend your time studying algorithms and not languages.

I definitely continue to often use Lisp when working on AI models.
You asked if it is being used for substantial work.  That's too subjective for me to answer regarding my own work, but I queried one my AI models whether or not it considered itself substantial, and it replied with an affirmative response.  Of course, it's response is naturally biased as well.
Overall, a significant amount of AI research and development is conducted in Lisp.  Furthermore, even for non-AI problems, Lisp is sometimes used.  To demonstrate the power of Lisp, I engineered the first neural network simulation system written entirely in Lisp over a quarter century ago.

LISP is still used significantly, but less and less. There is still momentum due to so many people using it in the past, who are still active in the industry or research (anecdote: the last VCR was produced by a Japanese maker in July 2016, yes). The language is however used (to my knowledge) for the kind of AI that does not leverage Machine Learning, typically as the reference books from Russell and Norvig. These applications are still very useful, but Machine Learning gets all the steam these days.
Another reason for the decline is that LISP practitioners have partially moved to Clojure and other recent languages.
If you are learning about AI technologies, LISP (or Scheme or Prolog) is good choice to understand what is going on with "AI" at large. But if you wish or have to be very pragmatic, Python or R are the community choices
Note: The above lacks concrete example and reference. I am aware of some work in universities, and some companies inspired by or directly using LISP.

To add on @Harsh's answer, LISP (and Scheme, and Prolog) has qualities that made it look like it was better suited for creating intelligent mechanisms---making AI as perceived in the 60s.
One of the qualities was that the language design leads the developer to think in a quite elegant way, to decompose a big problem into small problems, etc. Quite "clever", or "intelligent" if you will. Compared to some other languages, there is almost no choice but to develop that way. LISP is a list processing language, and "purely functional".
One problem, though, can be seen in work related to LISP. A notable one in the AI domain is the work on the Situation Calculus, where (in short) one describes objects and rules in a "world", and can let it evolve to compute situations---states of the world. So it is a model for reasoning on situations. The main problem is called the frame problem, meaning this calculus cannot tell what does not change---just what changes. Anything that is not defined in the world cannot be processed (note the difference here with ML). First implementations used LISPs, because that was the AI language then. And there were bound by the frame problem. But, as @Harsh mentioned, it is not LISP's fault: Any language would face the same framing issue (a conceptual problem of the Situation Calculus).
So the language really does not matter from the AI / AGI / ASI perspective. The concepts (algorithms, etc.) are really what matters.
Even in Machine Learning, the language is just a practical choice. Python and R are popular today, primarily due to their library ecosystem and the focus of key companies. But try to use Python or R to run a model for a RaspberryPI-based application, and you will face some severe limitations (but still possible, I am doing it :-)). So the language choice burns down to pragmatism.

Clojure, a dialect of Lisp (implemented for the Java Virtual Machine), was used to implement Clojush, a PushGP system, i.e. a genetic programming (which is a sub-class of evolutionary algorithms) system based on the use of the Push programming language, which is a stack-based programming language. The lead developer of Clojush, Lee Spector, and other people still do research on these topics. So, yes, Lisp is still being used in artificial intelligence!
However, it's also true that Python and C/C++ (to implement the low-level stuff) are probably the two most used programming languages in AI nowadays, especially for deep learning.

authors: Дмитрий Кононец

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


text:
Is it possible to apply deep dream technique for the audio streams?
What happens if you apply the same deep dream technique which produces "dream" visuals but to media streams such as audio files?
Does changing image functions into audio and enhancing the logic would work, or will it no longer work/doesn't make any sense?
My goal is to create "dream" like audio based on the two samples.

As far as I can see, there's no reason why you couldn't (for example) take the convolutional inputs to deepdream from adjacent sample points, rather than adjacent spatial positions, as is the case with image input.
Given the 'self similar' nature of deep dream images, listening to this fractal granular synthesis technique might be of interest/inspiration.


text:
What kind of problems require more than 2 hidden layers?
I've read that the most of the problems can be solved with 1-2 hidden layers.
How do you know you need more than 2? For what kind of problems you would need them (give me an example)?

Formally, a single hidden layer is sufficient to approximate a continuous function to any desired degree of accuracy, so in that sense, you never need more than 1. This is called the Universal Approximation Theorem.
Finding the best topology for a given problem is an open research problem. As far as I know, there are few universal 'rules of thumb' for this.
For a given problem, one option is to apply a neuroevolutionary approach such as NEAT, which attempts to find a topology that works well for the problem at hand.


text:
How would one go about generating *sensible* responses to chat?
I have recently gone about and made a simple AI, one that gives responses to an input (albeit completely irrelevant and nonsensical ones), using Synaptic.js. Unfortunately, this is not the type of text generation I am looking for. What I am looking for would be a way to get connections between words and generate text from that. (What would be preferable would be to also generate at least semi-sensible answers also.)
This is part of project Raphiel, and can be checked out in the room associated with this site. What I want to know is what layer combination would I use for text generation?
I have been told to avoid retrieval-based bots.
I have the method to send and receive messages, I just need to figure out what combination of layers would be the best.
Unless I have the numbers wrong, this will be SE's second NN chatbot.

To run the simple AI, please type a vocab into the text area, click load, and run in the console init(). Then, you can click the "test" button.

Oh, and Raphiel is currently running under my account.

This seems like a problem for the use of an encoder-decoder pair such as those seen in text summarization (see this paper by Rush et al.: https://arxiv.org/pdf/1509.00685.pdfï%C2%BC).
You would need the following layers:

LSTM layer to encode the given input text into an embedding
LSTM layer the looks over the currently generated output to encode the text into an embedding
A dense soft-max layer for generating words probabilistically based on the output of the two contextual LSTM encoders

Please see the following blog post by Jason Brownlee that outlines this approach and others, while giving implementation details and snippets (https://machinelearningmastery.com/encoder-decoder-models-text-summarization-keras/)!
Also note that this would require a large set of training examples of input text and reasonable responses. You might be able to scrape Reddit post responses and comments off of those for a start? Let me know if I misunderstood the question.

You did not misunderstand the question, but I am using JS, and Synaptic.js at that. The documentation is here. I am unable to use Keras, for I am not using Python.

Wait.... That image looks familiar: https://3qeqpr26caki16dnhd19sv6by6v-wpengine.netdna-ssl.com/wp-content/uploads/2017/09/General-Text-Summarization-Model-in-Keras.png

I think I have it down. Just one more question: Does the embedding layer mean that it turns text into something the NN can understand, such as floating point numbers, while the output layer turns that back into text?

@Pheo, yes you are correct, it turns each word into a stream of numbers, often times a vector. This is what Word2Vec and GloVe does, which you can load into your model in python. And then the last layer looks at these and can choose the output in a variety of ways, these are known as decoders. I apologize I'm not very familiar with JS, but if you have any conceptual questions I should be able to help out.

Conceptual question: Is the vector an array of indexes or an array representation of the Unicode values?

Neither, it actually is a vector representing the symantic meaning of a word. That's why many people choose to make their own embedding through training or use Google's Word2Vec or GloVe since they've already been trained over a large set


text:
What is the difference between a feed-forward neural network and a liquid state machine?
I have used a FFNN and LSM to perform the same task, namely, to predict the sentence "How are you". The LSM gave me more accurate results than FFNN. However, the LSM did not produce perfect prediction and there are missing letters. More specifically, LSM produced "Hw are yo" and the FFNN predicted "Hnw brf ypu".
What is the difference between a FFNN and a LSM, in terms of architecture and purpose?

What did you use to implement the LSM? Just curious. I’ve never used one.

I believe I used tensorflow.js. @Hanzy


text:
FIlling space with empty bounding box
I'm detecting objects on images. I want to detect up to 10 objects, however, I'm not sure how to deal with the situation, where only one object is present.
Should I fill the remaining spaces in the label input data with vectors filled with 0? E.g:
[[xmin,ymin,xmax,ymax],[0,0,0,0]...]

Or is there any better way? Thanks for help!


text:
Are methods of exhaustive search considered to be AI?
Some programs do exhaustive searches for a solution while others do heuristic searches for a similar answer. For example, in chess, the search for the best next move tends to be more exhaustive in nature whereas, in Go, the search for the best next move tends to be more heuristic in nature due to the much larger search space.
Is the technique of brute force exhaustive searching for a good answer considered to be AI or is it generally required that heuristic algorithms be used before being deemed AI? If so, is the chess-playing computer beating a human professional seen as a meaningful milestone?

If one thinks of intelligence as a continuous measure of optimization power (that is, how much better are outcomes for any unit of cognitive effort expended), then exhaustive search has non-zero intelligence (in that it does actually give better outcomes as more effort is expended) but very, very low intelligence (as the outcomes are better mostly by luck, and the amount of effort expended can be impossibly large).

If a computer is just brute-forcing the solution, it's not learning anything or using any kind of intelligence at all, and therefore it shouldn't be called "artificial intelligence." It has to make decisions based on what's happened before in similar instances. For something to be intelligent, it needs a way to keep track of what it's learned. A chess program might have a really awesome measurement algorithm to use on every possible board state, but if it's always trying each state and never storing what it learns about different approaches, it's not intelligent.

Really any 'intelligence' exhibited by a computer is deemed AI, regardless of brute force or use of smart heuristics. For example, a chat bot can be coded to respond to most responses using many, many if statements. This is an AI no matter how poorly coded/designed it is.
The chess playing computer beating a human professional can be seen as a meaningful milestone. I mean, someone programmed a computer to beat grandmaster chess players and chess geniuses. Many thought that wasn't possible since chess is such a complex game. This kind of work likely segued into more complex AI, for if a computer could play chess, then it surely complete other complex tasks as well.
Note how refined chess programming is: magic bitboards, Zobrist hashing, pruning, lazy SMP, and many more. This is perhaps not the sort of milestone of AI that you thought, but again, the things that can be considered AI are pretty broad.

Brute force approach is certainly the first step of many in AI programming. But using these experiences the program must learn to find the best solution or at least a closer solution to the problem. Since the first goal in AI is to find any solution, nothing can beat the brute force approach. But then using the previous results of brute force approaches, the program must develop its own heuristics and use this data along with brute force to find the optimal solution.

"Nothing can beat the brute force approach"? Beat in which sense?

Welcome to AI  I might supplement this answer by noting that some problems are intractable, and can't be solved by brute force.  But I certainly agree that brute force algorithms are a fundamental form and function of AI. In a combinatorial game theory, it seems that a game or puzzle, such as Sudoku, may only be said to be solved through brute force (exhaustion).

I dont know why you wouldnt consider it ai since every single thing has used something like it thats been in the recent news.
evolving a neural network is very similar to brute force search,  just it hits local optima, because its not exhaustive.


text:
Can rule induction be considered a way to "hybridize" probabilistic / statistical approaches and symbolic approaches?
In years past, GOFAI (Good Old Fashioned AI) was heavily based on "rules" and symbolic computation based on rules.  Unfortunately, that approach ran into stumbling blocks, and the world moved heavily towards statistical/probabilistic approaches leading to the current wave of interest in "machine learning".
It seems though, that the symbolic/rule-based approach probably still has application. So, could one "learn" rules using a probabilistic rule induction method, and then layer symbolic computation on top? If so, how could the whole process be made truly two-way, so that something "learned" from processing rules, can be fed back into how the system learns rules?

Sure! This is a somewhat hot area right now.
There are lots of ways to do it.
Probably the main line of research is with Bayesian Networks (1980's) and Casual Networks (1990's). These are basically rule-based systems for reasoning probabilistically. They rely on a user-designed model, which corresponds well to rules (e.g. when blood pressure is high, then heart attack rates are elevated), but provide a robust way to reason about uncertainties in the presence of these rules. Contrast this with a pure learning approach, like a decision tree or a neural network, which tends to rely less on rules. Modern research in this area focuses on learning the structure of the network (which corresponds to the learning probabilistic rules) from data.
While it's possible to learn rules from data and then do symbolic reasoning atop them using other techniques (e.g. rule induction), this approach runs into the same problems that plague the learning of the structure of Bayesian networks: when is correlation causation? Causal Diagrams are the only good tool for answering this question, but my impression is that inferring their structure automatically is still an open question.


text:
Which machine learning algorithm is used in self-driving cars?
Which deep neural network is used in Google's driverless cars to analyze the surroundings? Is this information open to the public?

It will not be single DNN architecture, rather it will be a collection of different DNN architectures that are used together to make the final decision. Convolutions are using the images/videos from the camera. Other architectures use other sensory sources. These DNNs will be trained to compute the high-level features from their sensory sources and then those high-level features will probably be fed into an LSTM (or some other form of RNN) that is trained with some form of Reinforcement learning algorithm to compute the action (like slowing down, applying breaks etc).

What you are calling 'analyzing the surroundings' is generally referred to as perception. Self-driving cars sense their surroundings using cameras, radars, lidars often combining or fusing more than one sensor to paint a picture of the environment. A lot of algorithms get used for fusing the sensor data and then deriving an understanding of the surrounding. One such example is semantic scene segmentation of camera data that tries to identify object boundaries in camera images. Typically a fully convolutional neural network is used to achieve this.
To the best of my knowledge Google does not disclose the exact algorithms anywhere.

Self-driving cars use a combination of both supervised as well as reinforcement learning.
Huge amounts of sensor data are recorded in real-time. This data can be used to train all sorts of supervised classifiers, e.g. for predicting rain or switching on lights. You can also set up a model to predict pedestrians and other cars. This is supervised learning.
Reinforcement learning can be used in situations positive or negative signals appear when driving a car: Traffic lights, blinking signals from other vehicles and street signs in general. These signals can be used to train a reinforcement model and decide on best actions (adjust speed, steer,..) to get the maximal reward (or better minimize costs of a crash)

Hi and welcome to this community! You say "I think...", so it seems like you're guessing. This is a question that is looking for facts, not hypotheses. Can you please cite some external resources that support your claims?

Sorry, my wrong.

Can you support your claims with citations to reliable external sources?

The most common machine learning algorithms found in self driving cars involve object tracking based technologies used in order to pinpoint and distinguish between different objects in order to better analyse a digital landscape.

Algorithms are designed to become more efficient at this by modifying internal parameters and testing these changes.
I hope that provides a general overview of the subject.

Since Google's cars are in development and are proprietary, they will probably not share their specific algorithm, however you can take a look at similar technologies to learn more.

To find out more, take a look at an Oxford-based initiative in self driving cars and how they work.


text:
Why does a one-layer hidden network get more robust to poor initialization with growing number of hidden neurons?
In a nutshell: I want to understand why a one hidden layer neural network converges to a good minimum more reliably when a larger number of hidden neurons is used. Below a more detailed explanation of my experiment:
I am working on a simple 2D XOR-like classification example to understand the effects of neural network initialization better. Here's a visualisation of the data and the desired decision boundary:

Each blob consists of 5000 data points. The minimal complexity neural network to solve this problem is a one-hidden layer network with 2 hidden neurons. Since this architecture has the minimum number of parameters possible to solve this problem (with a NN) I would naively expect that this is also the easiest to optimise. However, this is not the case.
I found that with random initialization this architecture converges around half of the time, where convergence depends on the signs of the weights. Specifically, I observed the following behaviour:
w1 = [[1,-1],[-1,1]], w2 = [1,1] --> converges
w1 = [[1,1],[1,1]],   w2 = [1,-1] --> converges
w1 = [[1,1],[1,1]],   w2 = [1,1] --> finds only linear separation
w1 = [[1,-1],[-1,1]], w2 = [1,-1] --> finds only linear separation

This makes sense to me. In the latter two cases the optimisation gets stuck in suboptimal local minima. However, when increasing the number of hidden neurons to values greater than 2, the network develops a robustness to initialisation and starts to reliably converge for random values of w1 and w2. You can still find pathological examples, but with 4 hidden neurons the chance that one "path way" through the network will have non-pathological weights is larger. But happens to the rest of the network, is it just not used then?
Does anybody understand better where this robustness comes from or perhaps can offer some literature discussing this issue?
Some more information: this occurs in all training settings/architecture configurations I have investigated. For instance, activations=Relu, final_activation=sigmoid, Optimizer=Adam, learning_rate=0.1, cost_function=cross_entropy, biases were used in both layers.

The number of hidden units does not only depend on the complexity of the function, but also the number of samples you have. Consult this great reference.

@BartoszKP: Thanks a lot for the reference. It looks incredibly useful in general! In this case, I am not interested in a heuristic for choosing the optimal number of hidden units. I know the problem is solvable with 2 and overfitting/underfitting is a problem so the number of data points shouldn't be relevant. My goal is more to get an intuition into why having a network with redundant capacity seems beneficial here.

I may have scratched the surface of a much larger problem when I asked this question. In the meantime I have read Lottery Hypothesis paper: https://arxiv.org/pdf/1803.03635.pdf
Basically, if you overparameterise your network you are more likely to find a random initialisation that performs well: A winning ticket. The paper above shows that you can actually prune away the unneeded parts of the network after training. However, you need to overparameterise the network initially in order to increase the chance of randomly sampling a winning ticket configuration.
I believe the case in my question above is a minimal example of this.

You grasped a bit of the answer.

In the latter two cases the optimisation gets stuck in suboptimal local minima.

When you have only 2 dimensions, a local minima exists. When you have more dimensions, this minima gets harder and harder to reach, as its likelihood decreases. Intuitively, you have a lot more dimensions through which you can improve than if you only had 2 dimensions.
The problem still exists, even with 1000 neurons you could find a specific set of weights which was a local minimum. However, it just becomes so much less likely.

But local minima will always exist. Arguably, with 4 hidden neurons there will be many more local minims than with 2, correct? So why then does it become less likely to get stuck in one?

The local minima don't necessarily increase with more neurons (although they might!). Despite that, they're harder to find, because you have more dimensions, and it must be a minimum on all of those. So, a local minimum with XY just needs to be a local minimum for XY, while with 100 neurons, you'd need it to be a minimum on all 100 dimensions for backprop to settle there.

okay if the number of local minima grows slow enough with the number of hidden neurons this makes sense. Thanks for your answer! Do you know if there are any good materials out there discussing these things. That is, what the optimisation "landscape" looks like and how it is likely to change with the complexity of the network?

IIRC David Silver mentions the robustness of neural nets in this course, but I couldn't find the precise moment. He basically describes that the net has so many parameters it makes it robust to local minima. On visualizing the landscape, it's impossible with enough inputs. You could do it with your 2 input neurons, but more than that cannot be represented visually for humans. I made a workshop and mention some displays here

Classification tasks with continuous input? Sure they can. Any image recognition problem has a continuous input, where pixels are in the range [0, 255]


text:
Snake path finding variant : Algorithm choice
I am working on a project which maps to a variant of path finding problem. I am new to this area and I would be very grateful if you could give suggestions/ point to libraries for relevant algorithms.
A simplified version of my problem statement is as follows-
Goal: On a 2D grid, starting from a fixed point reach the destination in exactly N steps.
Allowed actions:
1. At every position, you have a choice of up to three moves (i.e. straight, curve left, curve right).
2. You cannot collide with the path traveled so far (just like in the snake game).
Dimension of the grid: N x N where N is between 100-1000
Scalable: Later on, the problem will be scaled to have multiple such snakes going between different pairs of points on the grid. The ultimate goal is to get ALL snakes to reach their respective destinations in a fixed number of steps without any collisions.
TL;DR:
Essentially I have to find a fixed length path on a dynamically generated directed graph. Is there a better choice than a A* / greedy heuristic? Is it worth taking a Q-
learning approach?
A rudimentary one snake version written in python can be found here -
Github Link
Thanks in advance!

I feel the need to add my own snake game... https://www.w3schools.com/code/tryit.asp?filename=FOVMY741OC7V


text:
What is the best algorithm for optimizing profit, rather than making predictions?
I am new to machine learning, so I am not sure which algorithms to look at for my business problem. Most of what I am seeing in tools like KNIME are geared toward making a prediction/classification, and focusing on the accuracy of that single prediction/classification.
Instead, in general terms, I want to optimize toward maximum profit of a business process/strategy, rather than simply trying to choose the "best" transaction from within a set of possible transactions, which is quite different. The latter approach will simply give the best "transaction success percentage", without regard for overall profit of the strategy in the aggregate.
This is how the business problem is structured: Each Opportunity is a type of business strategy "game" between Entities. Each Entity is unaware, unaffected, and uninterested in conditions or events outside of the Opportunity, such as Observers. Each Opportunity is an independent event with no affect on other concurrent or future Opportunities, and with no effect on decisions unrelated to the Opportunity itself. Each Opportunity will have one and only one Awarded Entity, which is the Entity that "wins" the business process.
Observers, however, may create a Market for each Opportunity. Within such an independent, ephemeral Market, the Observers may bid among themselves as to which Entity will be the Awarded Entity for the Opportunity. Each Bid is a fixed-size transaction. A Bid is associated with only one Entity within the Opportunity. Thus, a Bid is a type of vote on the outcome of the Opportunity. There is no limit to the number of Bids that an Observer may place into the Market, but each Observer may only place Bids on a single Entity within the Market. Thus, the total amount of Bids on an individual Entity within the Opportunity represent the confidence level, within that Market, of the prediction.
At the resolution of the Opportunity, one Entity will be the Awarded Entity for the Opportunity. This determination is made based on factors outside of the control of the Observers. The Observers have no influence over the Opportunity nor the Entities within it. When the Awarded Entity is determined, the total value of Bids placed on that Entity are refunded to the Observers that placed them. Additionally, the value of all Bids placed on other Entities are shared among the Observers who bid correctly on the Awarded Entity. Each Observer that placed a correct Bid on the Awarded Entity is entitled to a fraction of the remaining Market value, in equal proportion to the number of fixed Bids placed. In other words, the Market is a zero sum scenario. Bids may be placed at any time during the duration of the Opportunity, from when its Market is created, up until a deadline just shortly before its resolution. The total number of outstanding Bids on each Entity is another data point that is available in real time, and which fluctuates during the duration of the Opportunity, based on total Bids placed and the ratios between Bids on each Entity participating in the Opportunity.
To support the Observers' evaluation and prediction of Awarded Entity within the scope of Opportunities, there are thousands of data points available, as well as extensive history and analytics regarding each Entity involved. Each Observer will employ their own unique strategy to predict Opportunity outcomes. The objective of this algorithm is to optimize a prediction strategy that does not optimize for "percentage of correct predictions", but rather "maximum gain". Rather than be "most correct most often", the model should strive to use the data to create advantages for maximum gain in the aggregate, rather than strive to be the most correct. An Observer is rewarded not for being correct most often, but for recognizing inefficiencies in the Bids within the Market.
I am considering hand-coding a genetic algorithm for this, so that I can write a custom fitness function that computes overall profitability of the strategy, and run the generations to optimize profit instead of individual selection accuracy. However, I'd rather use an out-of-the-box algorithm supported by a tool like KNIME if possible.
Thank you!

I believe such an algorithm has been wanted since a million years. Why would you believe it exists? I guess there is none...

This sounds like a reinforcement learning algorithm. Exactly which one depends on more details which we need more context on, for example, at what point does the model know the cost/reward of the transaction it has just taken, at what point does the model know the cost/reward of every transaction given an opportunity (or if it does at all), does executing one transaction affect the future state of the model (which affects future transactions shown and the cost/reward profile of each transaction). Also describing what your training set looks like, and what is each training instance would help


text:
The analysis of the dynamic behaviour of neural networks involving the application of feedback
I am reading the Simon Haykin's cornerstone book, "Neural Networks, A Comprehensive Foundation, Second Edition" and I cannot understand a paragraph below:

The analysis of the dynamic behaviour of neural networks involving the
  application of feedback is unfortunately complicated by virute (or
  virtue I cannot get word appropriately) of the fact that the
  processing units used for the construction of the network are usually
  nonlinear. Further consideration of this issue is deferred to the
  latter part of the book.

Before the paragraph, the author analysis the affects of weight of synapsis to the neural network's stability. Roughly speaking, he says, if |w| >= 1 the neural network become unstable.
Could you please explain the paragraph? Thanks in advance.

Is "(or virtue I cannot get word appropriately)" part of the quote, or a note by you that you are having trouble reading the word? Seems a bit odd. Using square brackets usually indicates that you are commenting, and it is not part of the quote . . . the word should be "virtue". In addition, could you give chapter or other context for this paragraph . . .

Yes, you are right, it was my comment. The passage is in page 20, Chapter 1, "Introduction"


text:
Neural network returns similar output
I was following Daniel Shiffman's tutorials on how to write your own neural network from scratch. I specifically looked into his videos and the code he provided in here. I rewrote his code in Python, however, 3 out of 4 of my outputs are the same. The neural network has two input nodes, one hidden layer with two nodes and one output node. Can anyone help me to find my mistake? Here is my full code.
import random

nn = NeuralNetwork(2,2,1)
inputs  = np.array([[0, 0], [1, 0], [0, 1], [1, 1]])
targets = np.array([[0], [1], [1], [0]])
zipped = zip(inputs, targets)
list_zipped = list(zipped)

for _ in range(9000):
    x, y = random.choice(list_zipped)
    nn.train(x, y)

output = [nn.feedforward(i) for i in inputs]

for i in output:
   print("Output ", i)

#Output  [ 0.1229546]  when it should be around 0
#Output  [ 0.6519492]  ~1
#Output  [ 0.65180228] ~1
#Output  [ 0.66269853] ~0

EDIT_1: I tried debugging my code by choosing all weights and bias' values to 0.5. I did this in both my code and Daniel's. This obviously ended up showing me all outputs with the same value.
After that I increased my weights and bias' values variety from [0 , 1) to [-1, 1). By running this a few times, I would sometimes get the correct output:
[ 0.93749991] # should be ~1
[ 0.93314793] # ~1
[ 0.07001175] # ~0
[ 0.06576194] # ~0

If I ran nn.train() 100 000 times, I get the correct output 2/3 times.
Is this the issue of gradient descent, where it converges to the local minima?

You mean "two input nodes, 1 hidden layer with 2 neurons, and one output node" instead of "two input layers, 2 hidden layers and one output layers" right?

Yes, I will fix my question.

Local minima.
You have the exact same issue of this question. If you randomize your initial weights, you'll see sometimes you get the correct results, and others you won't. It's because when the weights are initialized with a certain range of values, they will converge to a local minima which you cannot escape with a low learning rate.
A simple solution is to increase the size of your hidden layer, which will make the network more robust to such issues.

When you have only 2 dimensions, a local minima exists. When you have more dimensions, this minima gets harder and harder to reach, as its likelihood decreases. Intuitively, you have a lot more dimensions through which you can improve than if you only had 2 dimensions.
The problem still exists, even with 1000 neurons you could find a specific set of weights which was a local minimum. However, it just becomes so much less likely.

XD So that is why 2 layers failed. I have some changes to make.

I see. So is it just a complete luck that if I ran Daniel's code, I get correct answer 9/10 times and if I run mine, I get the correct answer only 2/10 times?

It has to do with initialization, most likely. I havent seen his code, but i assume he uses some initialization method different than yours


text:
Questions regarding keras activation maximization visualization
I wanted to use the visualization of the activation maximization of the filters that is described in the following keras tutorial/blog:
https://blog.keras.io/how-convolutional-neural-networks-see-the-world.html
I'd like to know what is the intention behind the decision that filters that produce a loss <= 0 are skipped. I know for 0 that would be reasonable since their would be no gradient flowing then (I think) but what about negative values? And is it also reasonable to use the mean of the outputs of the filters as a loss? What if there are weights of a filter that have high negative and positive numbers. Would that be a problem?


text:
Help with deep Q learning for 2048 game getting stuck
I am having trouble making a reinforcement algorithm than can win the 2048 game.
I have tried with deep Q (which I think is the simplest algorithm that should be able to learn a winning strategy).
My Q function is given by a NN of two hidden layers 16 -> 8 -> 4. Weight initialization is XAVIER. Activation function is RELU. Loss function is cuadratic loss. Correction is via gradient descent.
To train the NN I used a reward given by :
$$r_t = \frac{1}{1024} \sum_{i=0}^{n}{p^i r_{((t-n)+i)}}$$
Where n is 20 or the amount of iterations since the last update if a game is lost and $p = 1.4$.
There is an epsilon for discovery, set at 100% at the start and it decreases by 10% until it reaches 1%.
I have tried to optimize the parameters but can't get better results than a "256" in the board. And the cuadratic loss seems to get stuck at 0.25:

Is there something I am missing?
Code:

public enum GameAction {
    UP, DOWN, LEFT, RIGHT
}

public final class GameEnvironment {

    public final int points;
    public final boolean lost;
    public final INDArray boardState;

    public GameEnvironment(int points, boolean lost, int[] boardState) {
        this.points = points;
        this.lost = lost;
        this.boardState = new NDArray(boardState, new int[] {1, 16}, new int[] {16, 1});
    }
}

public class SimpleAgent {
    private static final Random random = new Random(SEED);

    private static final MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()
            .seed(SEED)
            .weightInit(WeightInit.XAVIER)
            .updater(new AdaGrad(0.5))
            .activation(Activation.RELU)
            .optimizationAlgo(OptimizationAlgorithm.STOCHASTIC_GRADIENT_DESCENT)
            .weightDecay(0.0001)
            .list()
            .layer(new DenseLayer.Builder()
                    .nIn(16).nOut(8)
                    .build())
            .layer(new OutputLayer.Builder()
                    .nIn(8).nOut(4)
                    .lossFunction(LossFunctions.LossFunction.SQUARED_LOSS)
                    .build())
            .build();
    MultiLayerNetwork Qnetwork = new MultiLayerNetwork(conf);

    private GameEnvironment oldState;
    private GameEnvironment currentState;
    private INDArray oldQuality;

    private GameAction lastAction;

    public SimpleAgent() {
        Qnetwork.init();
        ui();
    }

    public void setCurrentState(GameEnvironment currentState) {
        this.currentState = currentState;
    }

    private final ArrayList<INDArray> input = new ArrayList<>();
    private final ArrayList<INDArray> output = new ArrayList<>();
    private final ArrayList<Double> rewards = new ArrayList<>();

    private int epsilon = 100;

    public GameAction act() {
        if(oldState != null) {
            double reward = currentState.points - oldState.points;

            if (currentState.lost) {
                reward = 0;
            }

            input.add(oldState.boardState);
            output.add(oldQuality);
            rewards.add(reward);

            if (currentState.lost || input.size() == 20) {
                for(int i = 0; i < rewards.size(); i++) {
                    double discount = 1.4;
                    double discountedReward = 0;

                    for(int j = i; j < rewards.size(); j++) {
                        discountedReward += rewards.get(j) * Math.pow(discount, j - i);
                    }

                    rewards.set(i, lerp(discountedReward, 1024));
                }

                ArrayList<DataSet> dataSets = new ArrayList<>();

                for(int i = 0; i < input.size(); i++) {
                    INDArray correctOut = output.get(i).putScalar(lastAction.ordinal(), rewards.get(i));

                    dataSets.add(new DataSet(input.get(i), correctOut));
                }

                Qnetwork.fit(DataSet.merge(dataSets));

                input.clear();
                output.clear();
                rewards.clear();
            }

            epsilon = Math.max(1, epsilon - 10);
        }

        oldState = currentState;
        oldQuality = Qnetwork.output(currentState.boardState);

        GameAction action;

        if(random.nextInt(100) < 100-epsilon) {
            action = GameAction.values()[oldQuality.argMax(1).getInt()];
        } else {
            action = GameAction.values()[new Random().nextInt(GameAction.values().length)];
        }

        lastAction = action;

        return action;
    }

    private static double lerp(double x, int maxVal) {
        return x/maxVal;
    }

    private void ui() {
        UIServer uiServer = UIServer.getInstance();
        StatsStorage statsStorage = new InMemoryStatsStorage();
        uiServer.attach(statsStorage);
        Qnetwork.setListeners(new StatsListener(statsStorage));
    }
}

Could you explain in detail how you handle exploration? It seems that you decrease epsilon very quickly (-10%) after each time step. Do you ever reset epsilon?

"Could you explain in detail how you handle exploration?" With a high epsilon at the start. "Do you ever reset epsilon?" No

Is a single call to act() analogous to one time step in the environment? Also, does a single call to startGame() play a single game (and then store the relevant data)?

"Is a single call to act() analogous to one time step in the environment?" Yes, each time a play is ready to be done act is called. "Also, does a single call to startGame() play a single game (and then store the relevant data)?" No, when the AI losses a new game is started. The same game is never played twice.

The AI doesn't store anything to disk.

one of problems is to treat all values on a board as categorial data, this single observation is crucial for solve this game, also then you can do cnn 1d, 2d or even 3d...

Q learning on its own isn't enough to learn a winning strategy for a game like 2048. 2048 requires predictive thinking for possible outcomes and good positional awareness. Performance of the agent is heavily dependent on the reward function. The approach to give the reward proportional to the obtained points after every move is naive since it might sacrifice better positional play for short term rewards. The way it's posed it seems like the agent will try to maximize its performance for the last 20 moves or so. That could lead an agent to the positional situation which leads to a loss in couple of moves. Possibly better strategy would be to give positive reward when the agent actually completes the 2048 tiles and negative reward if it loses. Such parse rewards would add difficulty to training since it would require sophisticated exploration strategies which $\epsilon$-greedy certainly isn't. The stochastic nature of the game would pose difficulty to the agent as well. Similar positions might lead to different outcomes because in some cases the new tile would spawn in a bad position for the continuation while in other cases it might be beneficial. The suggested approach would be to definitely include Monte Carlo tree search approach along with some RL algorithm which was successfully applied to agents like AlphaZero and AlphaGo. MCTS would sample moves ahead and agent would get better representation of how good certain actions are.

Tried a MCES, but it gets stuck, see here https://ai.stackexchange.com/q/22429/14892

There is an epsilon for discovery, set at 100% at the start and it decreases by 10% until it reaches 1%.

After looking through your code on the linked GitHub repository, I think that the annealing of the epsilon parameter is a major issue.  As clarified in the above comments, the act() method is called once per episode time step to determine the agent's choice of action. Within this method, it seems that epsilon is decreased extremely rapidly. The code states that epsilon = Math.max(1, epsilon - 10), which means epsilon is decreased to 1 after 10 time steps. Also as clarified in the comments, epsilon is never reset to a larger number. Therefore, it seems that epsilon will be reduced from 100 to 1 after 10 time steps after (most likely) a single episode, which in my opinion is much too quick and will stifle exploration.
As a first guess, I suggest annealing epsilon more slowly from 100 to 1 after roughly one million time steps. If you want to anneal the parameter linearly, then each of the first million time steps could reduce epsilon by  (starting epsilon - ending epsilon) / annealing time steps, where starting epsilon = 100, ending epsilon = 1, and annealing time steps = 1000000.
Other issues may crop up after making the above change, but I think this is a good starting point. This seems like a very fun project, and it would be fun if you kept us posted about the results!

I had considered that epsilon could be an issue, but never set it to reduce so slowly. Will try! Thanks!

After around 1M iterations it doesn't seem to be as good as it should be, only getting to 256 in best cases. I also gets considerably more often stuck.

Deep reinforcement learning is notoriously difficult to debug since bugs are often silent. The exploration problem that I helped with above is most likely only one problem with the code, albeit an important one. Unfortunately the rules in the Tour of this site discourage the discussion of programming issues and bugs, so I can't debug the entire codebase (I don't even know much Java). I suggest that you try your best to locate any other problems with the code and then post a more specific question about your code as a separate question in the future. I hope that you get good results!

Please see https://ai.stackexchange.com/q/22429/14892


text:
What is asymmetric relaxation backpropagation?
In Chapter 8, section 8.5.2, Raul Rojas describes how the weights for a layer of a neural network can be calculated using a pseudoinverse of the sigmoid function in the nodes, he explains this is an example of symmetric relaxation.
But the chapter doesn't explain what asymmetric relaxation would be or how it is done.
So, what is asymmetric relaxation and how would it be done in a simple neural network using a sigmoid function in its nodes?

I'll give you my initial $0.02 for symmetric relaxation or relaxation in general in working with neural networks. The book covers 'Weight perturbation' and this is a basic outline of that. Say you want to host a wedding and every person gives you a 'must-have' list of requirements for them to attend. You can abide by all the requirements of each wedding guest or start 'uninviting' guests whose restrictions cause too many complications.
There are several kinds of relaxation. I've only used Lagrangian relaxation, so my experience is biased to that application. Think of it like this: you are traveling from New York to LA and you want to optimize for time, if you 'relax' the constraints, you can just fly instead of driving. This, however, creates an increased cost of the air ticket. By relaxing the constraints you remove the isolating requirement that you must travel by car.
Symmetric relaxation can be a challenging subject, so I'll include a few links academic research
Academic research arxiv.org is another site I use for research. Hope this helps.
I also found a link on Medium which is another good source for application, theory, and implementation of algorithms. Medium Lagrangian Relaxation

Literally just realized that I had a typo in the final question, the question is about asymmetric relaxation, not symmetric.


text:
When do two identical neural networks have uncorrelated errors?
In Chapter 9, section 9.1.6, Raul Rojas describes how committees of networks can reduce the prediction error by training N identical neural networks and averaging the results.
If $f_i$ are the functions approximated by the $N$ neural nets, then:
$$
Q=\left|\frac{1}{N}(1,1, \ldots, 1) \mathbf{E}\right|^{2}=\frac{1}{N^{2}}(1,1, \ldots, 1) \mathbf{E} \mathbf{E}^{\mathrm{T}}(1,1, \ldots, 1)^{\mathrm{T}}\tag{9.4}\label{9.4}
$$
is the quadratic error of the average of the networks, where
$$
\mathbf{E}=\left(\begin{array}{cccc}
e_{1}^{1} & e_{2}^{1} & \cdots & e_{m}^{1} \\
\vdots & \vdots & \ddots & \vdots \\
e_{1}^{N} & e_{2}^{N} & \cdots & e_{m}^{N}
\end{array}\right),
$$
and $\mathbf{E}$'s rows are the errors of the approximations of the $N$ functions, i.e. $\mathbf{e}^{i} = f_i(\mathbf{x}^{i}) - t_i$, for each of the input-output pairs $\left(\mathbf{x}^{1}, t_{1}\right), \ldots,\left(\mathbf{x}^{m}, t_{m}\right)$ used in training.
Is there a way to assure that the errors for a neural network are uncorrelated to the errors of the others?
Raul Rojas says that the uncorrelation of residual errors is true for a not too large $N$ (i.e. $N < 4$). Why is that?

Maybe these notes https://people.math.umass.edu/~johnpb/s706/notes_mixed.pdf could be useful.

I think that the tag that you actually want to use is [tag:ensemble-learning] and not [tag:committees-of-networks], which I've never heard of, but it's possible it exists or has been used to refer to this approach.

@nbro section 9.1.6 is dedicated to it. Ensemble seems to be mixing different networks, or models. Committees is for identical networks, trained with the same data.

@nbro thanks for the pdf, but I don't understand how I should use that information to assure uncorrelated errors, is there an algorithm name I can look up (that use the Unconditional or marginal model or the Nonlinear mixed model as those are the nonlinear methods)?

I don't think that ensemble learning is restricted to different networks. Nowadays, it's typically used to indicate that you train multiple models and then combine them somehow, but I'm also not an expert in ensemble learning, to be honest. In any case, I've just looked at that chapter 9.1.6 again and he cites [399], which is a paper entitled "When Networks Disagree: Ensemble Methods for Hybrid Neural Networks".

The book you're reading is not very new (although still a good book, as far as I'm concerned), so, at the time of writing that book, maybe "ensemble learning" was not very used yet as a standard term.

Regarding the link above, I don't really know if it could help you. It talks about the correlation of errors in linear regression, so I thought it could be useful, at least, to understand what R. Rojas meant by "correlation". You could also interpret neural networks as performing non-linear regression, so that's another reason why I provided the link to that pdf, which, to be honest, I have only skimmed through.

its a theoretical question about a practical approach. the payoff from this technique would tend to depend in part on the data, the network architecture, the features extracted, etc... in other words, the answer would mostly come from experiments in particular situations. basically there is some randomness in training also in which different nets may "find" or "emphasize" different actual features of the data.

@vzn Should I try to make the starting weights be far apart from network to network? something like randomly nudge weights so that they are different from the other networks' weights?

yes try starting with different weights and possibly train the nets on different samples of the same data, ie try data segregation ideas. also Rojas was saying that it can work for as low as N=2 or N=3 but that doesnt mean to keep N in that range. the point is N varies for each situation and just test to find what works well/ is practical etc. you can ping me in [chat] or this chat room for further discussion https://chat.stackexchange.com/rooms/9446/theory-salon


text:
Use Machine/Deep Learning to Guess a String
I want to be able to input a block of text and then have it guess a string within a predefined range (i.e. a string that starts with three letters and ends with five numbers like "XXX12345", etc).  Ideally, the string it will be guessing will be somewhere in the block of text, but sometimes it won't be.
I have been struggling where to begin on this or if I am even going in the right direction for considering Machine/Deep learning to try to do this.
Help!

Sounds like a statistics problem. But sounds like you could  use recurrent neural networks

Is the block of text variable in size? Can you add an example of how the input would look like?

Yeah the block of text would be variable in size.  An example would be something like:
hello my name is richard cheese.
XXX12345
12345 Fake Street
Faketown, FakeState USA
or
XXX12345 is my handle.  my interests are posting on stackoverflow and drinking myself into a coma.  look forward to hearing from you!
...basically want a neural network to pick out the "handle" from any block of text that is given to it.

Sounds like you want to parse it, and not learn it. You could take a look at regular expressions. Here is an example.

Yes, that's what I've been using for this kind of stuff, but I was hoping that using a neural network would make it so that the handle could be identified even if the handle was misspelled or omitted entirely from the block of text as long as it had enough training.  Do you think what I'm asking is feasible?

Honestly, I don't know. I do suspect that there are better ways of doing this with more accuracy. It would heavily depend on the training data, and what misspellings you teach the algorithm. If you really want to use DL, I still stand by RNNs being your best choice here, since they can pick up "context". Check out colah's blog for more info on RNNs.

My initial plan was to modify this demo to fit my needs, but I'm unsure how to do so.

This makes more sense now! I'll answer when I have time (if no one else did so first :) )

you should definitely check about recurrent-neural networks trained on character level language data. but it make sure you have a relevant dataset.

Can you point me to an example of such an implementation that I can base my work around?

https://github.com/karpathy/char-rnn

I would also suggest character level Recurrent neural nets but with Normal Char level RNN we can only predict next chars based on previous chars so you should consider it to be bidirectional RNN because say we have text "xxx12345" basically if we feed this to our model our model should predict first three places based on last places ( in DL they call it as going back through time) and this is possible only by Bidirectional RNN.

Can you point me to an example of such an implementation that I can base my work around?

As Andreas has commented this is a problem of statistical language model (a probability distribution over a sequence of words). The important thing you need is a hash table mapping fixed-length to the expected ending chains of words in your dictionary.
Things that can make your prediction better:

Add better and more words to your dictionary.
Use text expansion.

What you are looking for will require a pinch of Reinforcement Learning too. You need to figure out a way to penalize and award the predictions and then use the result in future. Your case also requires you to build your own corpus, which is the hardest part. If your corpus is good, it will give better results.
This is the research paper that will help you a lot.

Can you point me to an example of such an implementation that I can base my work around?

I would suggest you use a sequence to sequence model with character level features. It is an easy task, provided you have data.

Can you point me to an example of such an implementation that I can base my work around?


text:
How to represent integer values in sequence to sequence prediction task in encoder-decoder LSTM?
I have a large 2D grid having 30k rows and 35k columns, so a total of 30x35k grid cells. Each grid cell is represented by a unique integer number (identity of grid cell). I have several trajectories that passes through these grid cells. Each trajectory is represented by a sequence of numbers (that are grid cells through which the trajectory passes through).
I want to solve the problem of trajectory prediction by giving the partial trajectory as input and predict the full trajectory. This becomes a sequence to sequence problem, where all sequences are integer values by default.
I am trying to solve this problem through encoder-decoder LSTM architecture. Most tutorials/examples regarding sequence to sequence on net are on machine translations in which vocabularies or characters are one-hot-encoded to represent the text as integer values. When I hot-encode my sequence values the one-hot vector becomes very large because there are (30x35)k grid cells, the program has given memory overflow error (because each vector has of size 1 million).
I am confused here, do I need to treat grid identity as categorical variable? because all grid identities are numeric numbers but these identities are not comparable (like prices).
Do I need to hot-encode my integer values in my sequence? Or is there any other alternative to solve this problem? I also appreciate if you suggest me the similar tutorials having the sequence to sequence prediction problem.

One hot encoding helps a lot. You can actually one hot encode each batch just before the training to reduce memory usage. One hot encoding makes the input data more intuitive for the network as a numeric value requires the network to do multiple comparisons to understand the value. For examples please tell me which deep learning framework you are using so I can give you some links or code. Hope I can help you.

I am trying to solve using encoder-decoder LSTM. especially I also need the
intuition/concept of onehot batch encoding, how it works?

What do you mean by one hot batch encoding? Thanks @Asif Khan

The statement in your answer "You can actually one hot encode each batch just before the training to reduce memory usage.". how to do this


text:
Combine two embeddding inputs to increase more performance in LSTM model
The situation I encountered here is that I have two inputs(for instance, image embedding, etc.) into the first lstm of a series of lstms to predict the next word to generate sentence(from the second lstm, it started to predict the next word from the current input word). The length of each of the two inputs is 512. Merely for the first input, it increases the measurement, say, for instance, perplexity, by about 3 from no this input at all. Merely for the second input, it increases the measurement, say, for instance, perplexity, by about 1 from no input at all. The problem is: Is it possible to combine these two inputs into a model that can produce a result of increasement more than 3 or the larger amount of increasement of the former two inputs models? If it is, how to build a model or what model should I build to combine them to do so?


text:
How to locate the invoice within a camera captured image?
The demand is to locate the invoice within a camera captured image about that invoice. The invoice is always a white paper with printed black or blue characters, tables and red stamps. Sometimes the background behind the invoice is dark(about 60% of all the samples), but others are not. Sometimes there is shadow on it.
The question is how to detect the vertices, edges and corners of the invoice in this image? What algorithms should be applied? The android application CamScanner seems to have this function but not is effective every time. So does the CIDetector interface on iOS. What algorithms does CamScanner or iOS use(traditional or deep)?

Does anyone has any suggestions?

@DuttaA Thanks a lot! I have posted it here: https://datascience.stackexchange.com/questions/51911/how-to-locate-the-invoice-within-a-camera-captured-image .

@DuttaA Would you please recommend someone to answer my question?


text:
Regression on extreme values
I have a data set that looks like this:

I would like to estimate a relationship between x-values and the corresponding 5% extreme y-values, something that might look like that :

Do you have an idea of an algorithm that might help me for this ? I thought about labelling the extreme values for later finding a separating hyperplane, but I have no clue on how to label these "extreme values" (I cannot just take the 5% lowest and highest values as all these would end up in the same region).
Thanks for your ideas !

Welcome to AI!  You many want to consider adding an addendum to explain that the overall problem is not restricted to two dimensions. :)

I don't know of a pre-canned algorithm but I would just sweep on the angle from zero to ninety degrees with a triangular region and count the points.  For each step in the sweep, record the angle and the count.  When the sweep is done you will have an array of angles with bin counts and then you can convert to percentage of total count.  You will have to figure out a resolution of the triangle's angle so that it is fine enough to capture less than 5% of the points.

Thanks for your idea ! I forgot to mention it but I used a 2-dimensional example only because it was easier to explain. I would like to do this in higher dimensions (more predictors), which makes it harder...

@user15281 I'd upvote this answer since you didn't specify n dimensions in the question, and it's useful to see 2D approaches in building toward n dimensional approaches.


text:
Can machine learning help me digest asymmetrical order descriptions?
I have order data, here's a sample:
Ninety-six (96) covered pans, desinated mark cutlery.
5 vovered pans by knife co.
(SEE SCHEDULE A FOR NUMBERS). 757 SOUP PANS
115 10-quart capacity pots.
Thirteen (13), 30 mm thick covered pans.

I have over 50k rows of data such as this. In a perfect world, the above would need to be tabulated as such:
count, type
96, covered pan
5, covered pan
757, soup pan
115, pot
13, covered pan

Could machine learning be the correct approach for a problem such as this?

Yes a variant of NLP processing could help find the correct number to extract and type of object in this data.
Compared to the spreadsheet, the raw text data is ambiguous without understanding language to a reasonable depth, and without knowing the business context in order to extract the relevant information.
For instance, you are expecting to extract "soup pan" and "covered pan", but not "capacity pot". Also that parts of phrases such as "30 mm" or "10-quart" are lower importance qualifiers, and not specifying quantity of something.
The current state of the art for extracting this kind of data would be a bidirectional LSTM (a type of Recurrent Neural Network). You would likely get it to flag the parts of each entry that were relevant to the tabulated data you wanted to extract, then feed those into a simpler stage that put them into the spreadsheet. However, there are two caveats:

You need a lot of correctly-labelled training data to get reasonable performance. Using a word embedding layer, such as word2vec or GloVe, should significantly reduce the amount of training data required, but may require a careful pre-processing stage, and may be less useful when you have a lot of jargon in your data.
Performance is never perfect, and the system can still make stupid mistakes, because it does not truly understand the text is is dealing with. That applies to all ML approaches to this problem, and likely also to coding up an "expert system", although it may be easier to write the expert system to recognise when it had failed and ask for help.

Maybe a simple regex solve this question. But problably you need supervise, approve and disapprove anomalies.
See this example, I had the same problem some time ago: https://stackoverflow.com/questions/50689935/regex-like-commands-python


text:
Neural network returns about the same output(mean) for every input
I tried to build a neural network from scratch to build a cat or dog binary classifier using a sigmoid output unit. I seem to get the output value around 0.5(+/- 0.002) for every input. This seems really weird to me. Here's my code, Please let me know if there is a mistake in the implementation.
def initialize_parameters_deep(layer_dims):
    l=len(layer_dims)
    parameters={}
    for l in range(1,len(layer_dims)):
        parameters['W'+str(l)]=np.random.randn(layer_dims[l],layer_dims[l-1])*0.01
        parameters['b'+str(l)]=np.zeros((layer_dims[l],1))
    return parameters

def linear_forward(A,W,b):
    Z=np.dot(W,A)+b
    cache=(A,W,b)
    return Z,cache

def sigmoid(Z):
    A = 1/(1+np.exp(-Z))
    cache=Z
    return A, cache

def relu(Z):
    A = np.maximum(0,Z)

    assert(A.shape == Z.shape)

    cache = Z
    return A, cache

def relu_backward(dA, cache):
    Z = cache
    dZ = np.array(dA, copy=True) # just converting dz to a correct object.

    # When z <= 0, you should set dz to 0 as well.
    dZ[Z <= 0] = 0

    assert (dZ.shape == Z.shape)

    return dZ

def sigmoid_backward(dA, cache):
    Z = cache

    s = 1/(1+np.exp(-Z))
    dZ = dA * s * (1-s)

    assert (dZ.shape == Z.shape)

    return dZ

def linear_activation_forward(A_prev,W,b,activation):
    if(activation=='sigmoid'):
        Z,linear_cache=linear_forward(A_prev,W,b)
        A,activation_cache=sigmoid(Z)
    elif activation=='relu':
        Z,linear_cache=linear_forward(A_prev,W,b)
        A,activation_cache=relu(Z)
    cache=(linear_cache,activation_cache)
    return A,cache

def L_model_forward(X,parameters):
    A=X
    L=len(parameters)//2
    caches=[]
    for l in range(1,L):
        A,cache=linear_activation_forward(A,parameters['W'+str(l)],parameters['b'+str(l)],'relu')
        caches.append(cache)
    AL,cache=linear_activation_forward(A,parameters['W'+str(L)],parameters['b'+str(L)],'sigmoid')
    caches.append(cache)
    return AL,caches

def compute_cost(AL,Y):
    m=Y.shape[1]
    cost=-1/m*np.sum(np.multiply(np.log(AL),Y)+np.multiply(np.log(1-AL),1-Y))
    return cost

def linear_backward(dZ,cache):
    A_prev,W,b=cache
    m=A_prev.shape[1]
    dW = np.dot(dZ,A_prev.T)/m
    db = np.sum(dZ,axis=1,keepdims=True)/m
    dA_prev = np.dot(W.T,dZ)
    return dA_prev,dW,db

def linear_activation_backward(activation,dA_prev,cache):
    linear_cache,activation_cache=cache
    if activation=='sigmoid':

        dZ=sigmoid_backward(dA_prev,activation_cache)
        dA_prev,dW,db=linear_backward(dZ,linear_cache)
    if activation=='relu':
        dZ=relu_backward(dA_prev,activation_cache)
        dA_prev,dW,db=linear_backward(dZ,linear_cache)
    return dA_prev,dW,db

def L_model_backward(AL,Y,caches):
    L=len(caches)
    m = AL.shape[1]
    Y = Y.reshape(AL.shape)
    dAL = - (np.divide(Y, AL) - np.divide(1 - Y, 1 - AL))

    grads={}
    current_cache=caches[-1]
    grads['dA'+str(L-1)],grads['dW'+str(L)],grads['db'+str(L)]=linear_activation_backward('sigmoid',dAL,current_cache)

    for l in reversed(range(L-1)):
        current_cache=caches[l]
        dA_prev_temp, dW_temp, db_temp = linear_activation_backward('relu',grads['dA'+str(l+1)],current_cache)
        grads["dA" + str(l)] = dA_prev_temp
        grads["dW" + str(l + 1)] = dW_temp
        grads["db" + str(l + 1)] = db_temp
    return grads
def Grad_Desc(parameters,grads,learning_rate):
    L=len(parameters)//2
    for l in range(L):
        parameters['W'+str(l+1)]=parameters['W'+str(l+1)]-learning_rate*grads['dW'+str(l+1)]
        parameters['b'+str(l+1)]=parameters['b'+str(l+1)]-learning_rate*grads['db'+str(l+1)]
    return parameters

def L_layer_model(X,Y,learning_rate,num_iter,layer_dims):
    parameters=initialize_parameters_deep(layer_dims)
    costs=[]
    for i in range(num_iter):
        AL,caches=L_model_forward(X,parameters)
        cost=compute_cost(AL,Y)
        grads=L_model_backward(AL,Y,caches)
        parameters=Grad_Desc(parameters,grads,learning_rate)
        if i%100==0:
            print(cost)
            costs.append(cost)
    plt.plot(np.squeeze(costs))
def predict(X,parameters):
    AL,caches=L_model_forward(X,parameters)
    prediction=(AL>0.5)
    return AL,prediction

L_layer_model(x_train,y_train,0.0075,12000,[12288,20,7,5,1])
prediction=predict(x_train,initialize_parameters_deep([12288,20,7,5,1]))

Typical. Fell for the same thing when I made my first one.

Uh... Which language are you using? Reminds me, we need to make tags for those.

Python...Can you make suggestions please?Is there anything I need to change?

Yes. Why are you starting from scratch? You should rethink about making your own AI library... Very hard.

Just want to understand how exactly it works..

How familiar are you with JS?

I am not very confident about JS. Python would be better or if you could just tell me if there's anything wrong in the logic of my code, that would be great.

I tried implementing a shallow network with two layers and it worked well. However, when I try generalizing for deep networks, I face this problem.

@user165213 I think what you need to do is split the image up into pieces... Not feed the network a whole.

There is a technique called Gradient checking.

With it, you can assert if you are calculating the correct gradient in the components of your ANN. The code implementation is:
def gradient_check_n(parameters, gradients, X, Y, epsilon = 1e-7):

parameters_values, _ = dictionary_to_vector(parameters)
grad = gradients_to_vector(gradients)
num_parameters = parameters_values.shape[0]
J_plus = np.zeros((num_parameters, 1))
J_minus = np.zeros((num_parameters, 1))
gradapprox = np.zeros((num_parameters, 1))

# Compute gradapprox
for i in range(num_parameters):

    thetaplus = np.copy(parameters_values)
    thetaplus[i][0] = thetaplus[i][0]+  epsilon
    J_plus[i], _ = forward_propagation_n(X, Y, vector_to_dictionary( thetaplus  ))

    thetaminus =  np.copy(parameters_values)
    thetaminus[i][0] = thetaplus[i][0]-  epsilon
    J_minus[i], _ = forward_propagation_n(X, Y, vector_to_dictionary( thetaminus  ))

    gradapprox[i] = (J_plus[i]-J_minus[i])/(2*epsilon)

numerator = np.linalg.norm(grad-gradapprox)
denominator = np.linalg.norm(grad) +  np.linalg.norm(gradapprox)
difference = numerator/denominator

if difference > 2e-7:
    print ("There is a mistake in the backward propagation. Difference = " + str(difference))
else:
    print ("Backward propagation is Okay. Difference = " + str(difference))

return difference

Where parameters is a dictionary with the parameters "W1","b1"...."Wl","bl"
and grad is the output of the L_model_backward which contains gradients of the cost with respect to the parameters. Also, if you could share the x_train,y_train so we can debug it, it would be great, good luck.


text:
Getting worse performance when training a pre-trained model with the existing class
I am training pre-trained SSD-InceptionV2-Coco to detect the "car",
which is one of the classes in mscoco label.
I train the model with ~50k sample from KITTI, 500k iteration with batch size 2.
I followed this script to generate tfrecord file.
Then I test both original pre-trained model and my trained model with one video.
The performance of my trained model is worse. More missing detected results.
One thing I found recently is the classification_loss/localization_loss increases when AvgNumGroundtruthBoxesPerImage increases.

EDIT

Another thing I found is the more ground truth boxes per image I have,
the less average num positive anchors per image I have.
This bothers me because if the number of anchors generated per image is fixed,
more ground truth boxes should provide more positive anchors per image.
So I wonder where to find the root cause.
Any suggestion is welcome.
Thank you for precious time on my question.


text:
How does query of LLM/GPT models work?
Training of LLM aka GPT models is clear on how is trained but can't find any info how is "mapped" query to internal tokens and generates response tokens more precise inference phase which consists of natural language processing and dialog management, with focus on how user input is computed to generate response tokens/content(dialog management part would be perfect but would work a general GPT inference too), mathematics and phases/steps are similar to traditional NLP models (matrix of vectors mapped to vocal vector)? Checked more resources but none provides a clear picture on how do work internally tokens, chatGPT and OpenAI chatGPT

Would you add more explain of "mapping" and "generating back"? Are you looking for Positional Encoding? Or is the mapping you mentioned that some functions at Tokenize data section at https://keras.io/examples/generative/text_generation_gpt/?

Is more how user input is actually computed to generate response, kinda response back, how is computed (matrix and vectors in distributed manner to tind starting of sequence and keep generating based on tokens and then a sum of product on response to generate desired length token response) ?

So you're looking inferencing (not training)?

Exactly, and in the question I do point out that training is very clear mathematically for me but can’t find math explanation related to inference phase which consists of natural language processing and dialog management …

Is this what you looking for https://pi-tau.github.io/posts/transformer/#inference?

Unfortunately not, looking for a math description on prompt engineering for the LLM models, how is query tokens “mapped” to an answer from the model.

If you are looking mathematical approach token mapping, it is related position in sentence. Here are two reference from spaCy Transition/Dependency Parser (https://spacy.io/api/dependencyparser) and Mathew's explanation on the Parser with number (https://explosion.ai/blog/parsing-english-in-python#example-usage)


text:
Input optimization on a supervised learning system
Problem
Given a collection of  pairs (X, y) where X belongs to R^n and y belongs to R, find the X such that the associated y would be maximum.
Example
Given:

(X=(1, 2), y=-9)
(X=(-2, 4), y=-36)
(X=(-4, 2), y=-24)
...

The algorithm should be able to detect that the function being applied to X is y=-(X[0]^2+2*(X[1]^2)) and find the input that maximizes this function, in this case X=(0,0) because y=0^2+2*0^2=0 and 0 is the maximum possible value, as all the other values are negative.
How I've tried to solve it
My first guess has been to create a neural network that predicts y given X, but, after that is done, I don't know how to go about optimizing the input.
Questions
Is there any algorithm that would help in this situation?
Also, would some other supervised learning algorithm fit better here than a neural network?

Because that is essentially the problem I want to solve, to get the input values such as the output is maximum.

In his recommender system he is using linear regression (he predicts values using a simple matrix multiplication) but, for this problem, the inputs and outputs are not correlated linearly.
I've edited the question to express better my problem.

Are you asking for a system that trains neural networks or are you asking for any method that can predict values?

What if, after you trained your network, you use some population based real valued global optimazitaion technique, where you use the network as the fitness function?

You can use a neural network for this (sort of), and you've got the first step right - train the network to predict $y$ given $x$ (i.e. train it to approximate the function $f$ such that $y = f(x)$). Because the entire neural network is differentiable (presumably), you can take gradients of the input (some $x$) with respect to the predicted output. Then you can use this to update $x$ the same way that you update the weights during training of the network. This let you find a local optimum from $x$. I don't know of a way to try to find a global optimum with a neural network like this except to find the local optimum near many $x$'s and then take the best of those.
If you want a concrete example, take a look at the tutorial on Neural Style Transfer with PyTorch: here you have a noise image as the input and you optimize it to minimize the "style distance" to a reference style image and the "content distance" to a reference content image (i.e. starting with noise, make it look like the content of one image but in the style of another). There's full code there, but here's a short PyTorch snippet that shows the main idea:
# I'm just optimizing one input; clone so that you don't modify the
# original tensor; let it know that we want gradients computed
inputs = train_inputs[0:1].clone().requires_grad_()
input_optimizer = torch.optim.Adam([inputs])

def optimize_input():
    input_optimizer.zero_grad()
    # where `model` is your trained neural network
    output = model(inp)
    (-output).backward()
    return output

output = []
for _ in range(10000):
    output.append(input_optimizer.step(optimize_input).detach().numpy())

output is a list at the end of what the predicted output was after each step of optimizing the input. You can use this to see if you've converged to a local optimum yet (and take more steps/fewer next time as necessary). inputs will be the optimized input at the end. Note that if there are constraints that your input should satisfy, you'll need to enforce those yourself (e.g. in neural style transfer, they have to enforce that the values are valid for an RGB image).
Note also that how well this works really depends on how well your network approximates $f$; you may well get some unreasonable $x$ for which the network predicts a very large $y$ because there was no training data similar to that $x$ so the network isn't constrained in that region. In general, you should probably be cautious of an $x$ you generate this way that doesn't seem similar to your training data (e.g. has larger/smaller value than any $x$ the network has seen before; interpolation is much easier than extrapolation).
I'm assuming that you have a single data set; if you're able to query for the $y$ values of given $x$'s, then you might want to take a look at Bayesian optimization - essentially the field of trying to find $x$ that maximizes $y = f(x)$ when $f$ is expensive to evaluate and you don't have gradients of it. Bayesian optimization seeks a global optimum.

You really need neural networks to return the maximum value from your data? This algorithm can't help you?
xdata = [
    (1, 2),
    (-2, 4),
    (-4, 2),
]

for test in list_tests:
    y = -(test[0]^2+2 * (test[1]^2))
    if y > 0:
        print("(X(%s, %s), y=%s)" % (test[0], test[1], y))

output:
(X(-2, 4), y=16)
(X(-4, 2), y=2)