text
stringlengths
81
47k
source
stringlengths
59
147
Question: <p>I've researched online and seen many papers on the use of RNNs (like LSTMs or GRUs) to autocomplete for, say, a search engine, character by character. Which makes sense since it inherently predicts character-by-character in a sequential manner. </p> <p>Would it be possible to use the transformer architect...
https://ai.stackexchange.com/questions/21277/can-you-use-transformer-models-to-do-autocomplete-tasks
Question: <p>My understanding of a transformer model is that it uses the given input to calculate internal query of relate-ness of word meanings, and generate a meaningful response based on its meaning. But if your given sentence has no meaning, then won't the model fail to capture any meaningful input so that the outp...
https://ai.stackexchange.com/questions/39681/how-does-transformer-models-like-gpt-generate-valid-meaningful-response-for-mean
Question: <p>I created my first transformer model, after having worked so far with LSTMs. I created it for multivariate time series predictions - I have 10 different meteorological features (temperature, humidity, windspeed, pollution concentration a.o.) and with them I am trying to predict time sequences (24 consecuti...
https://ai.stackexchange.com/questions/30379/transformer-model-is-very-slow-and-doesnt-predict-well
Question: <p>I want to train my vision transformer model on a benchmark for an image segmentation task: (<a href="https://arxiv.org/abs/2110.08733" rel="nofollow noreferrer">LoveDA: A Remote Sensing Land-Cover Dataset for Domain Adaptive Semantic Segmentation</a>) (<a href="https://github.com/Junjue-Wang/LoveDA" rel="n...
https://ai.stackexchange.com/questions/35833/what-considerations-should-i-take-to-train-my-transformer-model
Question: <p>There was a <a href="https://ai.stackexchange.com/questions/17140/can-sequence-to-sequence-models-be-used-to-convert-source-code-from-one-programm">question</a> like this in 2019. I hope things have changed since then.</p> <p>Concretely, I am looking for a way to train a transformer model to convert code f...
https://ai.stackexchange.com/questions/40792/can-transformer-models-be-used-to-convert-code-from-one-programming-language-to
Question: <p>Can the decoder in a transformer model be parallelized like the encoder?</p> <p>As far as I understand, the encoder has all the tokens in the sequence to compute the self-attention scores. But for a decoder, this is not possible (in both training and testing), as self-attention is calculated based on prev...
https://ai.stackexchange.com/questions/12490/can-the-decoder-in-a-transformer-model-be-parallelized-like-the-encoder
Question: <p>I'm trying to predict pregnancy codes with a basic transformer model architecture. These pregnancy codes are like following prg001, prg002 to prg030. Prg001 would be antenatal screening and prg030 would be maternal outcome of delivery.</p> <p>The source is codes in one year (2022 for example) and the targe...
https://ai.stackexchange.com/questions/47521/why-would-my-transformer-model-always-predict-the-same-pregnancy-code
Question: <p>I am working on the Transformer example demonstrated on TensorFlow's website. <a href="https://www.tensorflow.org/text/tutorials/transformer" rel="nofollow noreferrer">https://www.tensorflow.org/text/tutorials/transformer</a></p> <p>In this example, Machine Translation model is trained to translate from Po...
https://ai.stackexchange.com/questions/38356/fine-tuning-transformer-model-for-machine-translation
Question: <p>Models based on the transformer architectures (GPT, BERT, etc.) work awesome for NLP tasks including taking an input generated from words and producing probability estimates of the next word as the output.</p> <p>Can an existing transformer model, such as GPT-2, be modified to perform the same task on a se...
https://ai.stackexchange.com/questions/27044/can-an-existing-transformer-model-be-modified-to-estimate-the-next-most-probable
Question: <h2>Context</h2> <p>I was making a Transformer Model to convert English Sentences to German Sentences. But the loss stops reducing after some time.</p> <h2>Code</h2> <pre><code>import string import re from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import...
https://ai.stackexchange.com/questions/25065/why-does-the-loss-stops-reducing-after-a-point-in-this-transformer-model
Question: <p>I’m working on a custom seq2seq transformer model for translating between two sets of token IDs.</p> <p>My input and translation token IDs range from 0 to 8191.</p> <p>Example:</p> <pre><code>input_ids = [2034, 4043, ...., 3] # length is 2048 translation_input_ids = [3042, 9123, ...., 3285] # length is 2...
https://ai.stackexchange.com/questions/46974/training-custom-seq2seq-transformer-model-without-any-tokenizer
Question: <p>The Transformer model proposed in "Attention Is All You Need" uses sinusoid functions to do the positional encoding. </p> <p>Why have both sine and cosine been used? And why do we need to separate the odd and even dimensions to use different sinusoid functions?</p> Answer:
https://ai.stackexchange.com/questions/15386/why-do-both-sine-and-cosine-have-been-used-in-positional-encoding-in-the-transfo
Question: <p>Is there a general guideline on how the Transformer model parameters should be selected, or the range of these parameters that should be included in a hyperparameter sweep?</p> <ul> <li>Number of heads</li> <li>Number of encoder &amp; decoder layers</li> <li>Size of transformer model (<code>d_model</code> ...
https://ai.stackexchange.com/questions/27254/how-to-select-model-parameters-for-transformer-heads-number-of-layers-etc
Question: <p>Is it possible to update the weights of a vanilla transformer model using counterexamples alongside examples?</p> <p>For example, from the <a href="https://github.com/google-research-datasets/paws" rel="nofollow noreferrer">PAWS</a> data set, given the phrases "Although interchangeable, the body pieces on...
https://ai.stackexchange.com/questions/15707/how-to-train-a-transformer-text-to-text-model-on-counterexamples
Question: <p>I am trying to look through a code of the transformer model from Pytorch. However, I do not understand why batch size needs to multiply with cross-entropy loss given that loss is calculated based on data at a given timestep.</p> <p>This is from the line: <strong>&quot;total_loss += batch_size * criterion(o...
https://ai.stackexchange.com/questions/36395/why-cross-entropy-loss-has-to-be-multiplied-by-a-batch-size-during-an-evaluation
Question: <p>I'm working with OpenAI's CLIP model and trying to understand the output of the text encoder. When I input a short prompt like &quot;cat&quot;, the output is a tensor of shape [77, 1024]. My understanding is that the 1024 represents the dimensionality of the embeddings, and the 77 represents the maximum se...
https://ai.stackexchange.com/questions/41653/understanding-embedding-outputs-in-transformer-models-like-clip
Question: <p>I'm wondering what the origins of the transformer as proposed in <a href="https://arxiv.org/pdf/1706.03762.pdf" rel="nofollow noreferrer">Attention Is All You Need</a> are. The paper itself provides some interesting pointers to the literature on self-attention such as:</p> <ol> <li><a href="https://aclanth...
https://ai.stackexchange.com/questions/36584/what-is-the-most-important-predecessor-of-the-transformer-model
Question: <p>I currently learning on Transformers, so check my understanding I tried implementing a small transformer-based language model and compare it to RNN based language model. Here's the code for transformer. I'm using PyTorch inbuilt layer for Transformer Encoder</p> <pre><code>class TransformerLM_1(nn.Module):...
https://ai.stackexchange.com/questions/23809/transformer-language-model-generating-meaningless-text
Question: <p>Which framework should I use for training transformer language models with reinforcement learning (e.g., GRPO)? Any recommendation?</p> <div class="s-table-container"><table class="s-table"> <thead> <tr> <th style="text-align: left;">Feature</th> <th style="text-align: left;"><a href="https://github.com/hu...
https://ai.stackexchange.com/questions/48596/which-framework-should-i-use-for-training-transformer-language-models-with-reinf
Question: <p>GPT3 and 4 are both examples of decoder-only models. However OpenAI offers an text embedding API endpoint based on these models. This begs the general question how can one obtain text embeddings from a decoder-only transformer model?</p> Answer: <p>The GPT models (as manifested using the decoder block in ...
https://ai.stackexchange.com/questions/41161/how-can-an-decoder-only-transformer-be-used-for-document-embedding
Question: <p>I noticed that in many (every ?) transformer architecture, the FFN (i.e the MLP network at the end of one transformer block) consists of two linear layers (with an activation) where the first layer goes from D1 channels to D2 channels and the second layer goes back from D2 to D1.</p> <p>For instance we can...
https://ai.stackexchange.com/questions/43630/why-feed-forward-neural-network-ffn-in-transformer-block-has-a-contract-and-e
Question: <p>In transformers model, we have multiple transformer blocks each with multiple attention heads.</p> <p>So assume a model has <code>N</code> transformer blocks with each having <code>M</code> attention heads, why don't we just use a single transformer block with <code>NxM</code> attention heads ?</p> <p>That...
https://ai.stackexchange.com/questions/46983/why-not-increase-the-number-of-attention-heads-rather-than-stacking-transformer
Question: <p>What does attending to future tokens mean? From my understanding, the transformer model works by inputting a prompt and predicting the next word in a sequence and this process just keeps repeating while attending to the words from the prompt and the already generated words. However, the explanations for tr...
https://ai.stackexchange.com/questions/40614/how-can-a-transformer-encoder-attend-to-future-tokens
Question: <p><strong>Background:</strong> It's well-known that transformers offer great performance across a large number of tasks, and this is largely a consequence of their powerful attention mechanisms and flexibility. However, in this post I'm curious about the <em>opposite</em>:</p> <p><strong>Question:</strong> N...
https://ai.stackexchange.com/questions/48329/what-are-transformers-worse-at-than-classical-deep-learning-models
Question: <p>I'm currently experimenting with training a model that employs a single transformer encoder on time-series signal data. Despite having a relatively small dataset of around 50 examples, each with a sequence length of approximately 1000, the model seems to excel at understanding and memorizing these examples...
https://ai.stackexchange.com/questions/45708/determining-optimal-data-size-for-generalization-in-transformer-encoders-partic
Question: <p>In the original transformer paper &quot;Attention is all you need&quot; in section 3.2.2 it is written:</p> <p>Instead of performing a single attention function with dmodel-dimensional keys, values and queries, we found it beneficial to linearly <strong>project the queries, keys and values h times</strong>...
https://ai.stackexchange.com/questions/39867/redundancy-of-value-projection-matrix-in-multi-headed-attention-in-transformer-m
Question: <p>I'm trying to implement transformer model using <a href="https://www.tensorflow.org/tutorials/text/transformer#create_the_transformer" rel="noreferrer">this tutorial</a>. In the decoder block of the Transformer model, a mask is passed to &quot;<strong>pad and mask future tokens in the input received by th...
https://ai.stackexchange.com/questions/23889/what-is-the-purpose-of-decoder-mask-triangular-mask-in-transformer
Question: <p>I have a set of data that contains the different lengths of sequences. On average the sequence length is 600. The dataset is like this:</p> <pre><code>S1 = ['Walk','Eat','Going school','Eat','Watching movie','Walk'......,'Sleep'] S2 = ['Eat','Eat','Going school','Walk','Walk','Watching movie'.......,'Eat']...
https://ai.stackexchange.com/questions/27471/embedding-from-transformer-based-model-from-paragraph-or-documnet-like-doc2vec
Question: <p>I am currently looking for ways to improve Transformers performance in image processing, especially in image segmentation. I found this <a href="https://arxiv.org/abs/2112.13890" rel="nofollow noreferrer">paper</a> by Kong, Z., et al called &quot;SPViT: Enabling Faster Vision Transformers via Latency-aware...
https://ai.stackexchange.com/questions/46791/how-to-induce-or-teach-pretrained-model-to-a-continous-transformer-token-pru
Question: <p>Suppose we have a transformer LLM which can do a task such as summarising.</p> <p>I know transformer <em>can</em> technically handle any input length (assume we are not using learned positional embeddings) because the architecture doesn’t define a fix length for input. However, the quadratic complexity and...
https://ai.stackexchange.com/questions/45949/is-a-small-transformer-model-able-to-effectively-handle-any-input-length-provide
Question: <p>Are multi-head attention matrices weighted adjacency matrices?</p> <p>The job of the multi-head-attention mechanism in transformer models is to determine how likely a word is to appear after another word. In a sense this makes the resulting matrix a big graph with nodes and edges, where a node represents a...
https://ai.stackexchange.com/questions/32036/is-the-multi-head-attention-in-the-transformer-a-weighted-adjacency-matrix
Question: <p>I have recently come across transformers, I am new to Deep Learning. I have seen a <a href="https://arxiv.org/pdf/2007.10819.pdf" rel="nofollow noreferrer">paper</a> using CNN and BiLSTM on top of a transformer, the paper uses a transformer(XLM-R) for sentiment analysis in code-mixed domain. But many of ...
https://ai.stackexchange.com/questions/25962/is-using-a-lstm-cnn-or-any-other-neural-network-model-on-top-of-a-transformeru
Question: <p>I'm trying to understand how context length is calculated in transformer models, especially in NLP tasks using open-source models like llama, which can be run locally. I'm confused about how this is defined and whether hardware specifications (like GPU/CPU memory) affect the context length.</p> <p>From wha...
https://ai.stackexchange.com/questions/46803/how-is-context-length-calculated-in-transformers-and-why-isnt-hardware-specifi
Question: <p>How were the language models of virtual assistants (Siri, Google Assistant, Alexa, etc.) designed and trained before transformers? What were their architectures?</p> Answer: <p>Before transformers for the <a href="https://en.wikipedia.org/wiki/Natural_language_understanding" rel="nofollow noreferrer">natu...
https://ai.stackexchange.com/questions/47883/language-models-of-virtual-assistants-before-transformers
Question: <p>When it comes to using Transformers for image captioning is there any reason to use masking?</p> <p>I currently have a resnet101 encoder and am trying to use the features as the input for a transformer model in order to generate a caption for the image, is there any need to use masking? and what would I ma...
https://ai.stackexchange.com/questions/23703/how-to-implement-or-avoid-masking-for-transformer
Question: <p>I have developed a multi label classifier using BERT. I'm leveraging Hugging Face Pytorch implementation for transformers.</p> <p>I have saved the pretrained model into the file directory in dev environment. Now, the application is ready to be moved the production environment.</p> <p>Is it a good practice ...
https://ai.stackexchange.com/questions/22700/is-it-good-practice-to-save-nlp-transformer-based-pre-trained-models-into-file-s
Question: <p>This code snippet is from <a href="https://huggingface.co/blog/annotated-diffusion" rel="nofollow noreferrer">here</a> under the section named &quot;Position embeddings&quot;.</p> <pre><code>class SinusoidalPositionEmbeddings(nn.Module): def __init__(self, dim): super().__init__() self....
https://ai.stackexchange.com/questions/41670/why-use-exponential-and-log-in-positional-encoding-of-transformer
Question: <p>I am playing around with a decoder only transformer model,</p> <p>The Colab is here if you find that easier <a href="https://colab.research.google.com/drive/1SHyJ9Oa3E4j1x8YFlXQbd1mjUjWhHGOV#scrollTo=60e13119" rel="nofollow noreferrer">https://colab.research.google.com/drive/1SHyJ9Oa3E4j1x8YFlXQbd1mjUjWhHG...
https://ai.stackexchange.com/questions/40080/playing-around-with-transformer-accuracy-not-improving
Question: <p>In a classic <strong>GridWorld Environment</strong> where the possible <strong>actions</strong> of an agent are (Up, Down, Left, Right), can another potential output of Action be "x amount of steps" where the agent takes 2,3,.. steps in the direction (U,D,L,R) that it chooses? If so, how would one go about...
https://ai.stackexchange.com/questions/21955/additional-potential-action-for-agent-in-mazegrid-environment-reinforcement-l
Question: <p>Reading the paper 'Reinforcement Learning for FX trading 'at <a href="https://stanford.edu/class/msande448/2019/Final_reports/gr2.pdf" rel="nofollow noreferrer">https://stanford.edu/class/msande448/2019/Final_reports/gr2.pdf</a> it states:</p> <blockquote> <p>While our end goal is to be able to make decisi...
https://ai.stackexchange.com/questions/22665/when-to-apply-reward-for-time-series-data
Question: <p>I have a card game where on a player's turn, the player sequentially draws two cards. Each card may be drawn from another player's discard stack (face up), or from the deck (face down).</p> <p>Thinking how to encode this into an action space, I could naively assume the two draws are independent. The action...
https://ai.stackexchange.com/questions/25400/rl-encoding-action-conditioned-on-previous-action
Question: <p>I have tried several environment libraries like OpenAI gym/gridworld but now I am trying to create a toy environment for experimentation. The environment I've created is as follows: </p> <ol> <li><p>State: grid with n rows by m columns, represented by a boolean matrix. Each grid cell can be empty or fille...
https://ai.stackexchange.com/questions/5221/agent-in-toy-environment-only-learns-to-act-optimally-with-small-discount-factor
Question: <p>I'm now reading <a href="https://medium.com/emergent-future/simple-reinforcement-learning-with-tensorflow-part-7-action-selection-strategies-for-exploration-d3a97b7cceaf" rel="nofollow noreferrer">the following blog post</a> but on the epsilon-greedy approach, the author implied that the epsilon-greedy app...
https://ai.stackexchange.com/questions/7397/does-epsilon-greedy-approach-always-choose-the-best-action-100-of-the-time
Question: <p>To me it seems to be ill defined. Partially because of absence of knowledge which points are to be considered outliers in the first place.</p> <p>The problem which I have in mind is "bad market data" detection. For example if a financial data provider is good only most of the time, but about 7-10% of data...
https://ai.stackexchange.com/questions/8193/is-it-possible-to-state-an-outliers-detection-problem-as-a-reinforcement-learnin
Question: <p>I'm trying to create a simple Dyna-Q agent to solve small mazes, in python. For the Q function, Q(s, a), I'm just using a matrix, where each row is for a state value, and each column is for one of the 4 actions (up, down, left, right).</p> <p>I've implemented the "real experience" part, which is basically...
https://ai.stackexchange.com/questions/8344/dyna-q-algorithm-having-trouble-when-adding-the-simulated-experiences
Question: <p>In the book "Reinforcement Learning: An Introduction", by Sutton and Barto, they provided the "Q-learning prioritized sweeping" algorithm, in which the model saves the next state and the immediate reward, for each state and action, that is, <span class="math-container">$Model(S_{t},A_{t}) \leftarrow S_{t+1...
https://ai.stackexchange.com/questions/10441/what-should-be-saved-in-sarsa-prioritized-sweeping
Question: <p>Anyone knows a resources (papers, articles and especially repositories) regarding controlling multiple units with RL.</p> <p>The controlled units should not be fixed, for example in Real Time Strategy the agent builds various units (workers, soldiers ...) and later controls them. During the game various u...
https://ai.stackexchange.com/questions/12037/code-examples-of-controlling-multiple-units-with-rl
Question: <p><strong>Background</strong></p> <p>I am working on a robotic arm controlled by a DQN + a python script I wrote. The DQN receives the 5 joint states, the coordinates of a target, the coordinates of the obstacle and outputs the best action to take (in terms of joint rotations). The python script checks if t...
https://ai.stackexchange.com/questions/12209/dqn-agent-helped-by-a-controller-on-which-action-should-i-perform-backprop
Question: <p>I started to learn reinforcement learning a few days ago. And I want to use that to solve resource allocation problem something like given a constant number, find the best way to divide it into several real numbers each is non-negative.</p> <p>For example, to divide the number 1 into 3 real numbers, the a...
https://ai.stackexchange.com/questions/12646/how-to-represent-action-space-in-reinforcement-learning
Question: <p>The problem I am trying to attack is a predator-prey pursuit problem. There are multiple predators that pursue multiple preys and preys tried to evade predators. I am trying to solve a simplified version - one predator tries to catch a static prey on a plane. There is bunch of literature on the above probl...
https://ai.stackexchange.com/questions/13709/how-to-solve-optimal-control-problem-with-reinforcement-learning
Question: <p>Prediction's goal is to get an estimate of a performance of a policy given a specific state. </p> <p>Control's goal is to improve the policy wrt. the prediction. </p> <p>The alternation between the two is the basis of reinforcement learning algorithms. </p> <p>In the paper <a href="https://arxiv.org/abs...
https://ai.stackexchange.com/questions/15526/why-doesnt-stability-in-prediction-imply-stability-in-control-in-off-policy-rei
Question: <p>I have a use case where the state of the environment could change due to random events in between time steps that the agent takes actions. For example, at t1, the agent takes action a1 and is given the reward and the new state s1. Before the agent takes the next action at t2, some random events occurred in...
https://ai.stackexchange.com/questions/15626/rf-how-to-deal-with-environments-changing-state-due-to-external-factors
Question: <p>I am training an RL agent (specifically using the <a href="https://arxiv.org/pdf/1707.06347.pdf" rel="nofollow noreferrer">PPO algorithm</a>) on a game environment with 2 possible actions <strong>left</strong> or <strong>right</strong>.</p> <p>The actions can be taken with varying "force"; e.g. go <strong...
https://ai.stackexchange.com/questions/16669/effects-of-translating-rl-action-probability-through-non-linearity
Question: <p>Does it make sense to use Reinforcement Learning methods in an environment that does not have trajectories?</p> <p>I have a lot of states and actions in my environment. However, there are no trajectories.</p> <p>If the agent takes action <span class="math-container">$a$</span> in the state <span class="m...
https://ai.stackexchange.com/questions/17143/reinforcement-learning-without-trajectories
Question: <p>We are currently using a RL network with the following simple structure to train a model which helps to solve a transformation task:</p> <p>Environment (a binary file) + reward ---> LSTM (embedding) --> FC layer --> FC layer --> FC layer --> decision (to select and apply a kind of transformation toward t...
https://ai.stackexchange.com/questions/17158/how-to-perform-interpretability-analysis-toward-a-simple-reinforcement-learning
Question: <p>This is a piece of code from my homework. </p> <pre><code># action policy: implements epsilon greedy and softmax def select_action(self, state, epsilon): qval = self.qtable[state] prob = [] if (self.softmax): # use Softmax distribution prob = sp.softmax(qval / epsilon) ...
https://ai.stackexchange.com/questions/17667/is-the-temperature-equal-to-epsilon-in-reinforcement-learning
Question: <p>From what I can find, reinforcement algorithms work on a grid or 2-dimensional environment. How would I set up the problem for an approximate solution when I have a 1-dimensional signal from a light sensor. The sensor sits some distance away from a lighthouse. The intent would be to take the reading fro...
https://ai.stackexchange.com/questions/21018/is-there-1-dimensional-reinforcement-learning
Question: <p>I have a simple question about model-free reinforcement. In a model I'm writing about, I want to know the value 'gain' we'd get for executing an action, relative to the current state. That is, what will I get if I moved from the current state <span class="math-container">$s$</span> taking action <span clas...
https://ai.stackexchange.com/questions/21571/calculating-the-advantage-gain-of-actions-in-model-free-reinforcement-learning
Question: <p>I am doing an online course on Reinforcement Learning from university of Alberta. It focus too much on theory. I am engineering and I am interested towards applying RL to my applications directly. </p> <p>My question is, is there any website which has sample programmers for beginners. Small sample progra...
https://ai.stackexchange.com/questions/21576/is-there-any-programming-practice-website-for-beginners-in-reinforcement-learnin
Question: <p>According to the definition, the AI agent has to play a game by it's own. A typical domain is the blocksworld problem. The AI determines which action the robot in a game should execute and a possible strategy for determine the action sequence is reinforcement learning. Colloquial spoken, reinforcement lear...
https://ai.stackexchange.com/questions/15720/can-reinforcement-learning-be-utilized-for-creating-a-simulation
Question: <p>I am new to machine learning and AI, so forgive me if this is obvious. I was talking with a friend on how to solve this problem, and neither of us could figure out how to do it.</p> <p>Say I have a grid area of 100x100 blocks, and I want a robot to build a horizontal 100x100 grid, and 3 blocks high. I am ...
https://ai.stackexchange.com/questions/5098/move-blocks-to-create-a-designed-surface
Question: <p>Let's say we have a task where the cost depends entirely on the path length to a terminal state, so the goal of an agent would be to take actions to reach terminal state as quickly as possible.</p> <p>Now let us say, we know the optimal path length is of length <span class="math-container">$10$</span>, an...
https://ai.stackexchange.com/questions/13502/why-is-on-policy-mc-td-algorithm-guaranteed-to-converge-to-optimal-policy
Question: <p>I have read most of Sutton and Barto's introductory text on reinforcement learning. I thought I would try to apply some of the RL algorithms in the book to a previous assignment I had done on <a href="https://www.sokobanonline.com/" rel="nofollow noreferrer">Sokoban</a>, in which you are in a maze-like gri...
https://ai.stackexchange.com/questions/28141/what-are-the-various-problems-rl-is-trying-to-solve
Question: <p>While I've been able to solve MountainCar-v0 using Deep Q learning, no matter what I try I can't solve this enviroment using policy-gradient approaches. As far as I learnt searching the web, this is a really hard enviroment to solve, mainly because the agent is given a reward only when it reaches the goal,...
https://ai.stackexchange.com/questions/12160/a3c-fails-to-solve-mountaincar-v0-enviroment-implementation-by-openai-gym
Question: <p>I would like the community to help me understand if the following example would be better represented as episodic or continuous task, this will help me structure the problem and chose the right RL algorithm.</p> <p>The agent start with an initial score <code>x</code> of let's say 100. The agent objective i...
https://ai.stackexchange.com/questions/33941/should-i-represent-my-reinforcement-learning-as-an-episodic-or-continuous-task
Question: <p>I want to use a Deep Q-Network for a specific problem. My immediate rewards (<span class="math-container">$r_t = 0$</span>) are all zeros. But my terminal reward is a large positive value <span class="math-container">$(r_T=100$</span>). How could I normalize rewards to stabilize the training? I think clip...
https://ai.stackexchange.com/questions/33947/how-to-normalize-rewards-in-dqn
Question: <p>I've recently come across the client-server model. From my understanding, the client requests the server, to which the server responds with a response. In this case, both the request and responses are vectors.</p> <p>In reinforcement learning, the agent communicates with the environment via an &quot;action...
https://ai.stackexchange.com/questions/6897/is-there-an-analogy-between-client-server-in-web-development-and-agent-environme
Question: <p>I've been reading about reinforcement learning, and it seems to me that reinforcement learning assumes the environment is static, and therefore that the reward for taking a particular action will be the same from time to time. But what if something happens outside the agent's control, that changes the rewa...
https://ai.stackexchange.com/questions/34146/does-reinforcement-learning-lend-itself-well-to-changes-in-the-environment-due-t
Question: <p>Let <span class="math-container">$\pi$</span> be an <span class="math-container">$\epsilon-soft$</span> policy with state-action value function <span class="math-container">$q_{\pi}(s,a)$</span> and <span class="math-container">$\pi'$</span> be an <span class="math-container">$\epsilon-greedy$</span> polic...
https://ai.stackexchange.com/questions/34514/confusion-about-state-action-value-function-notation-used-in-sutton-barto-rl-boo
Question: <p>In <a href="http://incompleteideas.net/book/RLbook2020trimmed.pdf" rel="nofollow noreferrer">Sutton &amp; Barto Reinforcement learning book</a>, page 103 (chapter: off-policy learning via importance sampling), the following statement is given:</p> <p>&quot;In order to use episodes from <span class="math-co...
https://ai.stackexchange.com/questions/34390/behaviour-policy-must-be-stochastic-in-states-where-it-is-not-identical-to-the-o
Question: <ol> <li><p>If the agent wins the game, the agent is rewarded</p> </li> <li><p>If the agent wins the game, the game is rewarded</p> </li> <li><p>Both the agent and the game are reinforcement learning agents.</p> </li> </ol> <p>When the agent wins the game, the game is rewarded, so the game creates various gam...
https://ai.stackexchange.com/questions/34702/do-you-think-this-method-of-creating-ai-is-valid
Question: <p>In Sutton-Barto RL's book (page 174) it says:</p> <blockquote> <p>The advantage of sample updates shown in Figure 8.7 is probably an underestimate of the real effect. In a real problem, the values of the successor states would be estimates that are themselves updated. By causing estimates to be more accura...
https://ai.stackexchange.com/questions/34940/confusing-statement-in-sutton-bartos-rl-book-in-section-8-5-expected-vs-samp
Question: <p>In reinforcement learning problems like cartpole, usually the environment is a single system that takes an input and gives an output. For example, in cartpole, given positions, velocities as input we can tell if pole is going to fall. Hence, we can craft observation space from positions and velocities.</p>...
https://ai.stackexchange.com/questions/35265/in-reinforcement-learning-how-to-craft-observation-space-when-environment-is-ma
Question: <p>so far I have seen people implementing reinforcement learning to build an AI to play and complete games on gym retro, such as street fighter, racing games and so on. However, I was wondering if it is possible to play against your own trained AI to get some sort of human evaluation? Anyone has any idea for ...
https://ai.stackexchange.com/questions/36398/play-against-your-own-rl-trained-ai-from-gym-retro
Question: <p>I have a certain scheduling problem and I would like to know in general whether I can use Reinforcement learning (and if so what kind of RL) to solve it. Basically my problem is a mixed-integer linear optimization problem. I have a building with an electric heating device that converts electricity into hea...
https://ai.stackexchange.com/questions/28888/reinforcement-learning-applicable-to-a-scheduling-problem
Question: <p>For some environments taking an action may not update the environment state. For example, a trading RL agent may take an action to buy shares s. The state at time t which is the time of investing is represented as the interval of 5 previous prices of s. At t+1 the share price has changed but it may not be ...
https://ai.stackexchange.com/questions/21084/is-it-required-that-taking-an-action-updates-the-state
Question: <p>I recently came across a <a href="https://www.quora.com/I-found-many-of-your-answers-on-reinforcement-learning-extremely-insightful-Im-at-Google-and-you-mentioned-that-you-were-giving-a-talk-about-imagination-learning-I-would-love-to-attend-if-possible" rel="nofollow noreferrer">Quora post</a>, where I saw...
https://ai.stackexchange.com/questions/5451/what-is-imagination-learning-and-imagination-machines
Question: <p>I found a <a href="https://youtu.be/vppFvq2quQ0" rel="nofollow noreferrer">video for the paper <em>DeepMimic: Example-Guided Deep Reinforcement Learning of Physics-Based Character Skills</em> </a> on YouTube.</p> <p>I looked in the related paper, but could not find details of how to the environment was cr...
https://ai.stackexchange.com/questions/7958/what-is-the-physics-engine-used-by-deepmimic
Question: <p>I am working on a RL project,but got stuck at one point: The task is continuous (Non-episodic). Following some suggestion from Sutton's <a href="http://incompleteideas.net/book/bookdraft2017nov5.pdf" rel="nofollow noreferrer">RL book</a>, I am using a value function approximation method with average reward...
https://ai.stackexchange.com/questions/8662/how-to-design-the-reward-for-an-action-which-is-the-only-legal-action-at-some-st
Question: <p>At the appendix A of paper "<a href="https://arxiv.org/abs/1810.01257" rel="nofollow noreferrer">near-optimal representation learning for hierarchical reinforcement learning</a>", the authors express the <span class="math-container">$\gamma$</span>-discounted state visitation frequency <span class="math-co...
https://ai.stackexchange.com/questions/11888/intuition-behind-gamma-discounted-state-frequency
Question: <p>Let's say our task is to pick and place a block, like: <a href="https://gym.openai.com/envs/FetchPickAndPlace-v0/" rel="nofollow noreferrer">https://gym.openai.com/envs/FetchPickAndPlace-v0/</a></p> <p>Reward function 1: -1 for block not placed, 0 for block placed</p> <p>Reward function 2: 0 for block no...
https://ai.stackexchange.com/questions/13785/why-do-these-reward-functions-give-different-training-curves
Question: <p>My goal is to train an agent to play MarioKart on the Nintendo DS. My first approach (in theory) was to setup an emulator on my pc and let the agent play for ages. But then a colleague suggested to train the agent first on pre recorded humanly played video data, to achieve some sort of base level. And then...
https://ai.stackexchange.com/questions/17166/how-does-reinforcement-learning-with-video-data-work
Question: <p>I would like to add a short ~1-3 minute video to a presentation, to demonstrate how Reinforcement Learning is used to solve problems. I am thinking something like a short gif of an agent playing an Atari game, but for my audience it would probably be better to have something more manufacturing/industry bas...
https://ai.stackexchange.com/questions/22951/where-can-i-find-short-videos-of-examples-of-rl-being-used
Question: <p>I have built a wildfire 'simulation' in unity. And I want to train an RL agent to 'control' this fire. However, I think my task is quite complicated, and I can't work out to get the agent to do what I want.</p> <p>A fire spreads in a tree-like format, where each node represents a point burning in the fire....
https://ai.stackexchange.com/questions/26845/train-agent-to-surround-a-burning-fire
Question: <p>I try to apply RL for a control problem, and I intend to either use Deep Q-Learning or SARSA.</p> <p>I have two heating storage systems with one heating device, and the RL agent is only allowed to heat up 1 for every time slot. How can I do that?</p> <p>I have two continuous variables <span class="math-con...
https://ai.stackexchange.com/questions/32042/is-it-possible-to-tell-the-reinforcement-learning-agent-some-rules-directly-with
Question: <p>Let's imagine this simple environment :</p> <p>Each episode has a length of 1 step. Each action leads to a reward for this action.</p> <p>The action space is of 3 : 'UP', 'DOWN', 'UNKNOWN'</p> <p>Most of the time, the observation is a random vector. But sometimes, it is a sinusoid. The player has to predic...
https://ai.stackexchange.com/questions/36310/is-this-simple-game-solvable-with-reinforcment-learning
Question: <p>The following is from the book &quot;Reinforcement learning and optimal control&quot;, by D. P. Bertsekas.</p> <p>Chapter 2, page 52:</p> <p>&quot;The motivation for <span class="math-container">$l$</span>-step lookahead is that for increasing values of <span class="math-container">$l$</span>, one may requ...
https://ai.stackexchange.com/questions/38920/why-is-l-step-lookahead-better-in-rl
Question: <p>After reading an excellent BLOG post <a href="http://karpathy.github.io/2016/05/31/rl/" rel="nofollow noreferrer"><strong>Deep Reinforcement Learning: Pong from Pixels</strong></a> and playing with the code a little, I've tried to do something simple: use the same code to train a logical XOR gate.</p> <p>...
https://ai.stackexchange.com/questions/9838/how-to-train-a-logical-xor-with-reinforcement-learning
Question: <p>there is one problem which bugs me quite a long time, it is the non-convex loss shape (multiple minima, e.g. shown <a href="https://medium.com/swlh/non-convex-optimization-in-deep-learning-26fa30a2b2b3" rel="nofollow noreferrer">here</a>) of neural networks which use a quadratic loss function.</p> <p>Quest...
https://ai.stackexchange.com/questions/37039/non-convex-loss-surface-although-quadratic-loss-function
Question: <p>Suppose I am utilising a neural network to predict the next state, <span class="math-container">$s'$</span> based on the current <span class="math-container">$(s, a)$</span> pairs. </p> <p>all my neural network inputs are between 0 and 1 and the loss function for this network is defined as the mean square...
https://ai.stackexchange.com/questions/20199/is-mean-squared-error-loss-function-a-good-loss-function-for-continuous-variable
Question: <p>Where can I find a machine learning library that implements <code>loss functions</code> measuring the <a href="http://www.scholarpedia.org/article/Algorithmic_information_theory#:%7E:text=Algorithmic%20information%20theory%20(AIT)%20is,computation%2C%20information%2C%20and%20randomness.&amp;text=presumably...
https://ai.stackexchange.com/questions/22475/loss-function-in-units-of-bits
Question: <p>I used following custom loss function.</p> <pre><code>def custom_loss(epo): def loss(y_true,y_pred): m=K.binary_crossentropy(y_true, y_pred) x=math.log10(epo) y=x*x y=(math.sqrt(y)/100) l=(m*(y)) return K.mean(l, axis=-1) return loss </code></pre> <p>and this is ...
https://ai.stackexchange.com/questions/14249/how-to-update-loss-function-parameter-after-compilation
Question: <p>Normally, in practice, people use those loss functions with minima, e.g. <span class="math-container">$L_1$</span> mean absolute loss, <span class="math-container">$L_2$</span> mean squared error, etc. All those come with a minimum to optimize to. <a href="https://i.sstatic.net/RSccA.png" rel="nofollow nor...
https://ai.stackexchange.com/questions/22786/how-could-logistic-loss-be-used-as-loss-function-for-an-ann
Question: <p>A loss function is a measure of how bad our neural network is. We can decrease the loss by proper training.</p> <p>I came across the phrase &quot;adaptive loss function&quot; in several research papers. For example: consider the following excerpt from the &quot;Introduction&quot; of the research paper titl...
https://ai.stackexchange.com/questions/31523/when-can-we-call-a-loss-function-adaptive
Question: <p>To practice what I learned about PyTorch, I gave myself the following problem:</p> <blockquote> <p>Create a model that given a vector, predicts what the 2nd largest number in it is.</p> </blockquote> <p>For example, <code>model([ 0.3, 0.4. 0.9 0.7 ])</code> should return <code>[ 0.0 0.0 0.0 1.0 ]</code>. I...
https://ai.stackexchange.com/questions/46593/loss-function-not-decreasing
Question: <p>I am working with a feedforward neural network to fit the following simple function:</p> <pre><code>N(1) = -1 N(2) = -1 N(3) = 1 N(4) = -1 </code></pre> <p>But I don't want to use the Mean-Squared Error; I'm using a custom loss function that &quot;guides&quot; the network to the correct output in a differe...
https://ai.stackexchange.com/questions/46523/custom-loss-function-traps-network-in-local-optima
Question: <p>Can't the loss function used in backpropagation be used as a fitness function in an evolutionary algorithm?</p> Answer: <p>It definitely can. It took a bit but I found discussion on NEAT for supervised classification.</p> <p>But for the record, evolutionary algorithms are a lot more interesting on proble...
https://ai.stackexchange.com/questions/45740/cant-the-loss-function-be-used-as-a-fitness-function
Question: <p>Typically in supervised learning, a neural networks' output is compared to the targets through a loss function, and the gradients are backpropagated. Is it a bad idea to also have a loss function on intermediate layers? I feel that restricts the networks ability to actually optimize the final, global loss ...
https://ai.stackexchange.com/questions/47288/loss-function-on-intermediate-layers-of-the-networks
Question: <p>I am working on a Midi Generation project that takes tracks as inputs, and outputs a complimentary track of notes.</p> <p>The tracks are basically a list of notes created of:</p> <ul> <li>Time</li> <li>Duration</li> <li>Pitch</li> <li>Velocity</li> </ul> <p>I am one-hot encoding the pitch and duration (128...
https://ai.stackexchange.com/questions/46306/transformer-loss-function-for-music-generation
Question: <p>We require to find the gradient of loss function(cost function) w.r.t to the weights to use optimization methods such as SGD or gradient descent. So far, I have come across two ways to compute the gradient:</p> <ol> <li>BackPropagation</li> <li>Calculating gradient of loss function by calculus</li> </ol> ...
https://ai.stackexchange.com/questions/19895/different-methods-of-calculating-gradients-of-cost-functionloss-function