category stringclasses 107
values | title stringlengths 15 179 | question_link stringlengths 59 147 | question_body stringlengths 53 33.8k | answer_html stringlengths 0 28.8k | __index_level_0__ int64 0 1.58k |
|---|---|---|---|---|---|
transformer models | Can you use transformer models to do autocomplete tasks? | https://ai.stackexchange.com/questions/21277/can-you-use-transformer-models-to-do-autocomplete-tasks | <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 architecture instea... | 112 | |
transformer models | How does transformer models like GPT generate valid meaningful response for meaningless garbage input? | https://ai.stackexchange.com/questions/39681/how-does-transformer-models-like-gpt-generate-valid-meaningful-response-for-mean | <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 output will al... | <p>If you give a human some input that doesn't seem to convey any meaning they will probably ask you for clarification. Presumably there are a lot of examples of this in the ChatGPT training data so that is exactly what it is going to do.</p>
| 113 |
transformer models | Transformer model is very slow and doesn't predict well | https://ai.stackexchange.com/questions/30379/transformer-model-is-very-slow-and-doesnt-predict-well | <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 consecutive values/... | <h2>Edit</h2>
<p>I just noticed that the model you are referring to is built very differently than the transformer from Attention is All You Need since it only uses one half of the architecture. Thus my answer below is not be complete. I thus have to add the following: (The final two paragraphs still apply as they are,... | 114 |
transformer models | What considerations should I take to train my transformer model? | https://ai.stackexchange.com/questions/35833/what-considerations-should-i-take-to-train-my-transformer-model | <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="nofollow no... | 115 | |
transformer models | Can transformer models be used to convert code from one programming language to another? | https://ai.stackexchange.com/questions/40792/can-transformer-models-be-used-to-convert-code-from-one-programming-language-to | <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 from SAS to... | <p>ChatGPT, which is based on the transformer, can already do this to some extent, so yes to your question, but I also doubt it will always be effective.</p>
<p>OpenAI also used to provide Codex (which is or was being used in <a href="https://github.com/features/copilot" rel="nofollow noreferrer">Github's copilot</a>),... | 116 |
transformer models | Can the decoder in a transformer model be parallelized like the encoder? | https://ai.stackexchange.com/questions/12490/can-the-decoder-in-a-transformer-model-be-parallelized-like-the-encoder | <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 previous times... | <blockquote>
<p><strong>Can the decoder in a transformer model be parallelized like the</strong>
<strong>encoder?</strong></p>
</blockquote>
<p><strong>Generally NO:</strong></p>
<p>Your understanding is completely right. In the decoder, the output of each step is fed to the bottom decoder in the next time step, just l... | 117 |
transformer models | Why would my transformer model always predict the same pregnancy code? | https://ai.stackexchange.com/questions/47521/why-would-my-transformer-model-always-predict-the-same-pregnancy-code | <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 target is the c... | 118 | |
transformer models | Fine Tuning Transformer Model for Machine Translation | https://ai.stackexchange.com/questions/38356/fine-tuning-transformer-model-for-machine-translation | <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 Portuguese t... | <p>Transfer learning in machine translation is a relatively common technique in machine translation. Mostly, it means fine-tuning pre-trained self-supervised sequence-to-sequence models, such as <a href="https://aclanthology.org/2020.tacl-1.47" rel="nofollow noreferrer">mBART</a>. It is also often used for low-resource... | 119 |
transformer models | Can an existing transformer model be modified to estimate the next most probable number in a sequence of numbers? | https://ai.stackexchange.com/questions/27044/can-an-existing-transformer-model-be-modified-to-estimate-the-next-most-probable | <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 sequence of ... | <p>To answer this, you need some constraints on the problem. Here are some sequences of numbers. No machine learning technique could be expected to learn all of them:</p>
<ul>
<li>the odd numbers</li>
<li>the primes</li>
<li>numbers expressed in digits, but listed in alphabetical order of their name in German</li>
<li>... | 120 |
transformer models | Why does the loss stops reducing after a point in this Transformer Model? | https://ai.stackexchange.com/questions/25065/why-does-the-loss-stops-reducing-after-a-point-in-this-transformer-model | <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 pad_seque... | 121 | |
transformer models | Training custom seq2seq transformer model without any tokenizer | https://ai.stackexchange.com/questions/46974/training-custom-seq2seq-transformer-model-without-any-tokenizer | <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 2048
</code... | 122 | |
transformer models | Why do both sine and cosine have been used in positional encoding in the transformer model? | https://ai.stackexchange.com/questions/15386/why-do-both-sine-and-cosine-have-been-used-in-positional-encoding-in-the-transfo | <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>
| 123 | |
transformer models | How to Select Model Parameters for Transformer (Heads, number of layers, etc) | https://ai.stackexchange.com/questions/27254/how-to-select-model-parameters-for-transformer-heads-number-of-layers-etc | <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 & decoder layers</li>
<li>Size of transformer model (<code>d_model</code> in Pytorch... | 124 | |
transformer models | How to train a transformer text-to-text model on counterexamples? | https://ai.stackexchange.com/questions/15707/how-to-train-a-transformer-text-to-text-model-on-counterexamples | <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 the 2 car... | 125 | |
transformer models | why cross entropy loss has to be multiplied by a batch size during an evaluation in transformer model? | https://ai.stackexchange.com/questions/36395/why-cross-entropy-loss-has-to-be-multiplied-by-a-batch-size-during-an-evaluation | <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>"total_loss += batch_size * criterion(output_flat... | <p>That is because the default reduction for the CEP loss calculation is mean. Hence to find the true average across all batches, you first multiply by the batch size and then divide by total number of data points. Note this only matters when all the batches are not equal, i.e. total number of data points do not perfec... | 126 |
transformer models | Understanding embedding outputs in transformer models like CLIP | https://ai.stackexchange.com/questions/41653/understanding-embedding-outputs-in-transformer-models-like-clip | <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 "cat", 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 sequence len... | <p>Usually the embeddings are not zero for the padding, since they are part fo the lookup table of the embedding layer, however in addition to the input, a mask is forwarded through the forward pass of the network to mask them out when it's relevant (in transformers encoder used in CLIP, in the cross-attention)</p>
<p>... | 127 |
transformer models | What is the most important predecessor of the transformer model? | https://ai.stackexchange.com/questions/36584/what-is-the-most-important-predecessor-of-the-transformer-model | <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://aclanthology.org/... | <p>An influential predecessor paper is indeed the work on <a href="https://arxiv.org/pdf/1409.0473.pdf" rel="nofollow noreferrer">NEURAL MACHINE TRANSLATION
BY JOINTLY LEARNING TO ALIGN AND TRANSLATE</a>. The paper outlines an attentional mechanism that is similar to the computation of the actual attentional weights in... | 128 |
transformer models | Transformer Language Model generating meaningless text | https://ai.stackexchange.com/questions/23809/transformer-language-model-generating-meaningless-text | <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):
def ... | <p>This is probably an issue of complete underfitting. How many training data do you use? What is your vocab size? What is your batch size and how many epochs did you train? Transformers always need more data than RNNs to reach good text quality.</p>
| 129 |
transformer models | Which framework should I use for training transformer language models with reinforcement learning? | https://ai.stackexchange.com/questions/48596/which-framework-should-i-use-for-training-transformer-language-models-with-reinf | <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/huggingface/... | 130 | |
transformer models | How can an decoder-only transformer be used for document embedding? | https://ai.stackexchange.com/questions/41161/how-can-an-decoder-only-transformer-be-used-for-document-embedding | <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>
| <p>The GPT models (as manifested using the decoder block in the original Transformer architecture) are not generating the embedding. However, the weights from the GPT are being used as the initial weights in a new model, dubbed CPT [<a href="https://openai.com/research/clip" rel="nofollow noreferrer">1</a>], that can ... | 131 |
transformer models | Why feed forward neural network (FFN) in transformer block has a "contract and expand" pattern? | https://ai.stackexchange.com/questions/43630/why-feed-forward-neural-network-ffn-in-transformer-block-has-a-contract-and-e | <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 see it in... | 132 | |
transformer models | Why not increase the number of attention heads rather than stacking transformer layers? | https://ai.stackexchange.com/questions/46983/why-not-increase-the-number-of-attention-heads-rather-than-stacking-transformer | <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 will also... | <p>In many NLP tasks information is intrinsically structured hierarchically, for instance, early layers in a transformer model may specialize in short-range dependencies such as syntactic relationships between adjacent tokens, while deeper layers specialize in long-range dependencies like semantic coherence across sent... | 133 |
transformer models | How can a transformer encoder attend to future tokens? | https://ai.stackexchange.com/questions/40614/how-can-a-transformer-encoder-attend-to-future-tokens | <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 transformers... | <p>Most of the recent hype around transformers is about the <a href="https://ai.stackexchange.com/questions/40179/how-does-the-decoder-only-transformer-architecture-work">decoder-only transformer architecture</a>. This architecture is different from the originally introduced <a href="https://proceedings.neurips.cc/pape... | 134 |
transformer models | What are Transformers worse at than classical deep learning models | https://ai.stackexchange.com/questions/48329/what-are-transformers-worse-at-than-classical-deep-learning-models | <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> Namely, wha... | <p>In edge computing or real-time IoT regression applications, transformer's quadratic attention time complexity and large parameter counts make them impractical, where other DL models such as LSTM which has much lower memory footprint are apparently more advantageous.</p>
<p>Furthermore, even for sequential or time-se... | 135 |
transformer models | Determining optimal data size for generalization in transformer encoders, particularly for Time-Series signal data | https://ai.stackexchange.com/questions/45708/determining-optimal-data-size-for-generalization-in-transformer-encoders-partic | <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. However,... | <p>In order for a neural network to generalize well, it has to be trained on tons and tons of data, otherwise if the model is shown very few samples of the training data, it will be biased towards these few samples and it will perform poorly on unseen data for sure.</p>
<p>Transformers are data hungry models and won't ... | 136 |
transformer models | Redundancy of Value-Projection-matrix in Multi-headed attention in Transformer model | https://ai.stackexchange.com/questions/39867/redundancy-of-value-projection-matrix-in-multi-headed-attention-in-transformer-m | <p>In the original transformer paper "Attention is all you need" 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> with diff... | <p>This performs <span class="math-container">$h$</span> different attention lookups in parallel. The amount of computation is kept the same, though, so each one is smaller. They found that multiple smaller lookups were more useful than one big lookup.</p>
<p>The matrices are not just split, projected and concatenated.... | 137 |
transformer models | What is the purpose of Decoder mask (triangular mask) in Transformer? | https://ai.stackexchange.com/questions/23889/what-is-the-purpose-of-decoder-mask-triangular-mask-in-transformer | <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 "<strong>pad and mask future tokens in the input received by the decoder<... | <p>The Transformer model presented in this tutorial is an auto-regressive Transformer. Which means that prediction of next token only depends on it's previous tokens.</p>
<p>So in order to predict next token, you have to make sure that only previous token are attended. (If not, this would be a cheating because model al... | 138 |
transformer models | Embedding from Transformer-based model from paragraph or documnet (like Doc2Vec) | https://ai.stackexchange.com/questions/27471/embedding-from-transformer-based-model-from-paragraph-or-documnet-like-doc2vec | <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']
............ | 139 | |
transformer models | How to 'induce' or 'teach' pretrained model to a continous Transformer token-pruning Algorithm | https://ai.stackexchange.com/questions/46791/how-to-induce-or-teach-pretrained-model-to-a-continous-transformer-token-pru | <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 "SPViT: Enabling Faster Vision Transformers via Latency-aware Soft Toke... | 140 | |
transformer models | Is a small transformer model able to effectively handle any input length provided it is fine-tuned on it? | https://ai.stackexchange.com/questions/45949/is-a-small-transformer-model-able-to-effectively-handle-any-input-length-provide | <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 unavailab... | 141 | |
transformer models | Is the multi-head attention in the transformer a weighted adjacency matrix? | https://ai.stackexchange.com/questions/32036/is-the-multi-head-attention-in-the-transformer-a-weighted-adjacency-matrix | <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 word and ... | <p>Short answer, yes I believe we can! One way feels more meaningful that the other. First, let's look at some nuance in the definition of attention. If <span class="math-container">$\text{score}(x_i, x_j) = \text{score}(x_j, x_i)$</span>, then the attention matrix is symmetric and naturally has the form of a weighted ... | 142 |
transformer models | Is using a LSTM, CNN or any other neural network model on top of a Transformer(using hidden states) overkill? | https://ai.stackexchange.com/questions/25962/is-using-a-lstm-cnn-or-any-other-neural-network-model-on-top-of-a-transformeru | <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 the blogs ... | 143 | |
transformer models | How is context length calculated in transformers, and why isn't hardware specification considered? | https://ai.stackexchange.com/questions/46803/how-is-context-length-calculated-in-transformers-and-why-isnt-hardware-specifi | <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 what I unders... | <p><strong>Context length is fixed</strong></p>
<p>128K refers to Llama 3.1's ability to take up to 128,000 tokens in a single forward pass. This limit is fixed during training.</p>
<p><strong>Inference on local hardware</strong></p>
<p>When running inference locally (assuming your question isn't about hardware for tra... | 144 |
transformer models | Language models of virtual assistants before transformers | https://ai.stackexchange.com/questions/47883/language-models-of-virtual-assistants-before-transformers | <p>How were the language models of virtual assistants (Siri, Google Assistant, Alexa, etc.) designed and trained before transformers? What were their architectures?</p>
| <p>Before transformers for the <a href="https://en.wikipedia.org/wiki/Natural_language_understanding" rel="nofollow noreferrer">natural language understanding (NLU)</a> NLP task, there was already the encoder-decoder architecture where LSTMs and GRUs RNN models act as encoder to transform input sequence and <a href="ht... | 145 |
transformer models | How to implement or avoid masking for transformer? | https://ai.stackexchange.com/questions/23703/how-to-implement-or-avoid-masking-for-transformer | <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 mask if I di... | <p>If you're using a library such as <a href="https://github.com/google/trax" rel="nofollow noreferrer">Trax</a> which contains great submodules for various Transformers (Skipping, BERT, Vanilla and Reformer) you can use the inbuilt <code>trax.data.inputs.add_loss_weights()</code> function and provide a value for the <... | 146 |
transformer models | Is it good practice to save NLP Transformer based pre-trained models into file system in production environment | https://ai.stackexchange.com/questions/22700/is-it-good-practice-to-save-nlp-transformer-based-pre-trained-models-into-file-s | <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 to save th... | 147 | |
transformer models | Why use exponential and log in Positional Encoding of Transformer | https://ai.stackexchange.com/questions/41670/why-use-exponential-and-log-in-positional-encoding-of-transformer | <p>This code snippet is from <a href="https://huggingface.co/blog/annotated-diffusion" rel="nofollow noreferrer">here</a> under the section named "Position embeddings".</p>
<pre><code>class SinusoidalPositionEmbeddings(nn.Module):
def __init__(self, dim):
super().__init__()
self.dim = dim
... | <p>The current code just implements the now-standard expressions for positional embeddings given in the original transformer paper (<a href="https://arxiv.org/pdf/1706.03762.pdf" rel="nofollow noreferrer">Attention is all you need</a>).</p>
<p>In section 3.5 of this paper they suggest the formula
<span class="math-cont... | 148 |
transformer models | Playing around with Transformer - accuracy not improving | https://ai.stackexchange.com/questions/40080/playing-around-with-transformer-accuracy-not-improving | <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/1SHyJ9Oa3E4j1x8YFlXQbd1mjUjWhHGOV#scrollT... | <p>Ok, so the solution to this was that I was randomizing both the key (a-z) and the value (0-9). That was too hard for a simple model to learn, so only randomizing the value worked. I also changed the positional embedding to be learned, which improved learning speed.</p>
<pre><code>import torch
import torch.nn as nn
f... | 149 |
reinforcement learning | Additional (Potential) Action for Agent in MazeGrid Environment (Reinforcement Learning) | https://ai.stackexchange.com/questions/21955/additional-potential-action-for-agent-in-mazegrid-environment-reinforcement-l | <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 doing it?... | <p>You can definitely define an environment that accepts more types of action, including actions that take multiple steps in a direction.</p>
<p>The first thing you would need to do is implement support for that action in the environment. That is not really a reinforcement learning issue, but like implementing the rul... | 150 |
reinforcement learning | When to apply reward for time series data? | https://ai.stackexchange.com/questions/22665/when-to-apply-reward-for-time-series-data | <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 decisions on a u... | 151 | |
reinforcement learning | RL: Encoding action conditioned on previous action | https://ai.stackexchange.com/questions/25400/rl-encoding-action-conditioned-on-previous-action | <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 space wou... | <p>It is hard to say for certain without knowing full details and results of experiments.</p>
<p>However, if the game allows for splitting decisions up, it will likely be better for the agent to take advantage of extra knowledge of the value of any previously hidden card just taken from the draw pile.</p>
<p>In general... | 152 |
reinforcement learning | Agent in toy environment only learns to act optimally with small discount factors | https://ai.stackexchange.com/questions/5221/agent-in-toy-environment-only-learns-to-act-optimally-with-small-discount-factor | <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 filled and the ... | <p>This is an episodic problem, and there should be no issue in theory with most learning algorithms coping without a discount factor (or setting gamma = 1).</p>
<blockquote>
<p>Are there any explanations to why the agent only works for small discount factors in this example?</p>
</blockquote>
<p>The most likely ex... | 153 |
reinforcement learning | Does epsilon-greedy approach always choose the "best action" (100% of the time) when it does not take the random path? | https://ai.stackexchange.com/questions/7397/does-epsilon-greedy-approach-always-choose-the-best-action-100-of-the-time | <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 approach take... | <p>Epsilon-greedy is most commonly used to ensure that you have some element of exploration in algorithms that otherwise output deterministic policies. </p>
<p>For example, value-based algorithms (Q-Learning, SARSA, etc.) do not directly have a policy as output; they have values for states or state-action pairs as out... | 154 |
reinforcement learning | Is it possible to state an outliers detection problem as a reinforcement learning problem? | https://ai.stackexchange.com/questions/8193/is-it-possible-to-state-an-outliers-detection-problem-as-a-reinforcement-learnin | <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 do not ma... | <p>It is quite often <em>possible</em> to frame a problem as a Reinforcement Learning (RL) problem at some level. However, this may turn out to be for no benefit, or a net cost towards solving the problem. Casting parameter or hyperparameter searches as RL can be adding a layer of complexity and reduce efficiency.</p>
... | 155 |
reinforcement learning | Dyna-Q algorithm, having trouble when adding the simulated experiences | https://ai.stackexchange.com/questions/8344/dyna-q-algorithm-having-trouble-when-adding-the-simulated-experiences | <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 just stra... | 156 | |
reinforcement learning | What should be saved in SARSA prioritized sweeping? | https://ai.stackexchange.com/questions/10441/what-should-be-saved-in-sarsa-prioritized-sweeping | <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}, R_{t+1}... | <p>SARSA is an on-policy method. Your historical choices of action will have been made using older Q values, and thus from a different policy. In addition, the action that was taken at the time may not have been typical for the agent (it may have been exploring). So you don't usually want to re-use historical action ch... | 157 |
reinforcement learning | Code examples of controlling multiple units with RL | https://ai.stackexchange.com/questions/12037/code-examples-of-controlling-multiple-units-with-rl | <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 units could... | 158 | |
reinforcement learning | DQN Agent helped by a controller: on which action should I perform backprop? | https://ai.stackexchange.com/questions/12209/dqn-agent-helped-by-a-controller-on-which-action-should-i-perform-backprop | <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 the action ... | <p>Q-learning - which DQN is based on - is an off-policy reinforcement learning (RL) method. That means it can learn a <em>target policy</em> of optimal control whilst acting using a different <em>behaviour policy</em>. In addition, provided you use single step learning (as opposed to n-step or Q(<span class="math-cont... | 159 |
reinforcement learning | How to represent action space in reinforcement learning? | https://ai.stackexchange.com/questions/12646/how-to-represent-action-space-in-reinforcement-learning | <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 allocation ... | 160 | |
reinforcement learning | How to solve optimal control problem with reinforcement learning | https://ai.stackexchange.com/questions/13709/how-to-solve-optimal-control-problem-with-reinforcement-learning | <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 problem when pr... | 161 | |
reinforcement learning | Why doesn't stability in prediction imply stability in control in off-policy reinforcement learning? | https://ai.stackexchange.com/questions/15526/why-doesnt-stability-in-prediction-imply-stability-in-control-in-off-policy-rei | <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/1606.0264... | <p>It is a mathematical problem. Usually, we use contraction mapping theorem for the proof of convergence. You should apply the Banach fixed point theorem for Bellman's functions.</p>
| 162 |
reinforcement learning | RF: How to deal with environments changing state due to external factors | https://ai.stackexchange.com/questions/15626/rf-how-to-deal-with-environments-changing-state-due-to-external-factors | <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 the envir... | 163 | |
reinforcement learning | Effects of translating RL action probability through non linearity | https://ai.stackexchange.com/questions/16669/effects-of-translating-rl-action-probability-through-non-linearity | <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>left</str... | <blockquote>
<p>I don't fully understand what the implications of doing this will be. </p>
</blockquote>
<p>Without other matching adjustments, you will break your agent.</p>
<p>The problem is how your new action space gets converted <em>back</em> into gradients to update the agent, after it has acted and needs to ... | 164 |
reinforcement learning | Reinforcement learning without trajectories | https://ai.stackexchange.com/questions/17143/reinforcement-learning-without-trajectories | <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="math-contai... | 165 | |
reinforcement learning | How to perform Interpretability analysis toward a simple reinforcement learning network | https://ai.stackexchange.com/questions/17158/how-to-perform-interpretability-analysis-toward-a-simple-reinforcement-learning | <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 the environ... | 166 | |
reinforcement learning | Is the temperature equal to epsilon in Reinforcement Learning? | https://ai.stackexchange.com/questions/17667/is-the-temperature-equal-to-epsilon-in-reinforcement-learning | <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)
#print(pro... | <p>Your are correct that epsilon in epsilon-greedy and temperature parameter in the "softmax distribution" are different parameters, although they serve a similar purpose. The original author of the code has taken a small liberty with variable names in the <code>select_action</code> method in order to use just one simp... | 167 |
reinforcement learning | Is there 1-dimensional reinforcement learning? | https://ai.stackexchange.com/questions/21018/is-there-1-dimensional-reinforcement-learning | <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 from the sens... | <blockquote>
<p>From what I can find, reinforcement algorithms work on a grid or 2-dimensional environment.</p>
</blockquote>
<p>A lot of teaching materials use a "grid world" presentation to demonstrate basic reinforcement learning (RL). However, the underlying Markov Decision Process (MDP) theory works on an arbit... | 168 |
reinforcement learning | Calculating the advantage 'gain' of actions in model-free reinforcement learning | https://ai.stackexchange.com/questions/21571/calculating-the-advantage-gain-of-actions-in-model-free-reinforcement-learning | <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 class="math-co... | 169 | |
reinforcement learning | Is there any programming practice website for beginners in Reinforcement Learning | https://ai.stackexchange.com/questions/21576/is-there-any-programming-practice-website-for-beginners-in-reinforcement-learnin | <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 programs.
I hav... | <p>Firstly, since you are a beginner, I strongly recommend you start reading <a href="http://incompleteideas.net/book/bookdraft2017nov5.pdf" rel="nofollow noreferrer">Sutton's book</a>. It is a really great book. </p>
<p>Then, some tutorials:</p>
<p><a href="https://www.udemy.com/course/machine-learning-beginner-rein... | 170 |
reinforcement learning | Can reinforcement learning be utilized for creating a simulation? | https://ai.stackexchange.com/questions/15720/can-reinforcement-learning-be-utilized-for-creating-a-simulation | <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 learning leads... | <blockquote>
<p>Can the Q-learning algorithm be utilized to build the simulation itself?</p>
</blockquote>
<p>Only in the presence of a meta-environment, or meta-simulation where the goals of creating the original simulation are encoded in the states, available actions and rewards.</p>
<p>A special case of this mig... | 171 |
reinforcement learning | Move blocks to create a designed surface | https://ai.stackexchange.com/questions/5098/move-blocks-to-create-a-designed-surface | <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 given a ra... | <p>Essentially, you could do something like have the robot randomly make moves (moving around and moving blocks) for some number of steps. Repeat this a bunch of times, and record the 'score' at the end (how close you are to a perfect result grid). Tell your algorithm to act more like the best scoring runs (Optimize a ... | 172 |
reinforcement learning | Why is On-Policy MC/TD Algorithm guaranteed to converge to optimal policy? | https://ai.stackexchange.com/questions/13502/why-is-on-policy-mc-td-algorithm-guaranteed-to-converge-to-optimal-policy | <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>, and there ar... | <p>Your reasoning is fine. GLIE - Greedy in the Limit with Infinite Exploration assumes that our agent does not act greedily all the time. As the number of samples approaches infinity all state-action pairs will be explored -> hence the policy will converge on a greedy policy. The emphasis is on "number of samples appr... | 173 |
reinforcement learning | What are the various problems RL is trying to solve? | https://ai.stackexchange.com/questions/28141/what-are-the-various-problems-rl-is-trying-to-solve | <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 grid environm... | <blockquote>
<p>The basic algorithms (MC control, Q-learning, or Dyna-Q) seemed to all be based on solving whichever specific maze the agent was trained on.</p>
</blockquote>
<p>All RL algorithms are based on creating solutions to a defined state and action space. If you limit your state space representation and traini... | 174 |
reinforcement learning | A3C fails to solve MountainCar-v0 enviroment (implementation by OpenAi gym) | https://ai.stackexchange.com/questions/12160/a3c-fails-to-solve-mountaincar-v0-enviroment-implementation-by-openai-gym | <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,which is a... | <p>I don't know about your first question, but I got a basic policy gradient approach with the kinetic energy as reward working on <code>MountainCar-v0</code>. </p>
<p>You can implement it based on <a href="https://medium.com/@ts1829/policy-gradient-reinforcement-learning-in-pytorch-df1383ea0baf" rel="nofollow norefe... | 175 |
reinforcement learning | Should I represent my reinforcement learning as an episodic or continuous task? | https://ai.stackexchange.com/questions/33941/should-i-represent-my-reinforcement-learning-as-an-episodic-or-continuous-task | <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 is to maxim... | 176 | |
reinforcement learning | How to normalize rewards in DQN? | https://ai.stackexchange.com/questions/33947/how-to-normalize-rewards-in-dqn | <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 clipping rewar... | 177 | |
reinforcement learning | Is there an analogy between client/server in web development and agent/environment in reinforcement learning? | https://ai.stackexchange.com/questions/6897/is-there-an-analogy-between-client-server-in-web-development-and-agent-environme | <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 "action", to... | <blockquote>
<p>Is there an analogy between client/server in web development and agent/environment in reinforcement learning?</p>
</blockquote>
<p>The answer is "not really". There is no useful analogy here that allows any insight into RL from web server knowledge or vice versa.</p>
<p>However, you <em>could<... | 178 |
reinforcement learning | Does reinforcement learning lend itself well to changes in the environment due to external factors? | https://ai.stackexchange.com/questions/34146/does-reinforcement-learning-lend-itself-well-to-changes-in-the-environment-due-t | <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 reward?</p>
<p... | <p>In the question, you are not describing the environment <em>changing</em>. Instead, there is a fixed 20% chance of a bad weather event each year. Such events can me modelled as a static environment with stochastic results.*</p>
<p>If nothing else happened in the year, it is easy to calculate the <em>expected</em> im... | 179 |
reinforcement learning | Confusion about state-action value function notation used in Sutton-Barto RL book | https://ai.stackexchange.com/questions/34514/confusion-about-state-action-value-function-notation-used-in-sutton-barto-rl-boo | <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> policy with res... | <p>The book presents a slight abuse of notation where <span class="math-container">$\pi'(s)$</span> is shorthand for a distribution of action values described by the more correct <span class="math-container">$\pi'(a|s)$</span>. At that point there is an implied function composition of <span class="math-container">$q_{\... | 180 |
reinforcement learning | Behaviour policy must be stochastic in states where it is not identical to the Optimal policy | https://ai.stackexchange.com/questions/34390/behaviour-policy-must-be-stochastic-in-states-where-it-is-not-identical-to-the-o | <p>In <a href="http://incompleteideas.net/book/RLbook2020trimmed.pdf" rel="nofollow noreferrer">Sutton & Barto Reinforcement learning book</a>, page 103 (chapter: off-policy learning
via importance sampling), the following statement is given:</p>
<p>"In order to use episodes from <span class="math-container">$... | <p>Say we are in state <span class="math-container">$s$</span>, and <span class="math-container">$b$</span> chooses <span class="math-container">$a'$</span> but <span class="math-container">$\pi$</span> chooses <span class="math-container">$a$</span>. Since <span class="math-container">$\pi$</span> chose <span class="m... | 181 |
reinforcement learning | Do you think this method of creating AI is valid? | https://ai.stackexchange.com/questions/34702/do-you-think-this-method-of-creating-ai-is-valid | <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 game winning ... | <p>What you are describing is a <a href="https://arxiv.org/pdf/1707.00183.pdf" rel="nofollow noreferrer">teacher-student framework</a> in which you have one agent (the teacher) who determines the complexity of the task that another agent (the student) must accomplish. If the task is too difficult for the student to acc... | 182 |
reinforcement learning | Confusing statement in Sutton-Barto's RL book in Section 8.5 ( Expected vs. Sample Updates) | https://ai.stackexchange.com/questions/34940/confusing-statement-in-sutton-bartos-rl-book-in-section-8-5-expected-vs-samp | <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 accurate sooner,... | <blockquote>
<p>If so, the results in Figure 8.7 for sample updates should be worse in real.</p>
</blockquote>
<p>Yes, the sample updates will perform worse than shown. The later paragraph is explaining that the results for expected updates may be even worse <em>relative</em> to sample updates. It is not claiming that ... | 183 |
reinforcement learning | In reinforcement learning, how to craft observation space when environment is made of multiple blocks? | https://ai.stackexchange.com/questions/35265/in-reinforcement-learning-how-to-craft-observation-space-when-environment-is-ma | <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>
<p>But if... | 184 | |
reinforcement learning | Play against your own RL-trained AI from gym retro | https://ai.stackexchange.com/questions/36398/play-against-your-own-rl-trained-ai-from-gym-retro | <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 this? Than... | <p>I dont understand why the post is downvoted.</p>
<ol>
<li>I understand that you can use gym-retro to build a reinforcement learning agent to play some particular game, lets say street fighter.</li>
<li>What I want to know is, is it possible to fight against that agent that you have trained, rather than watching a me... | 185 |
reinforcement learning | Reinforcement learning applicable to a scheduling problem? | https://ai.stackexchange.com/questions/28888/reinforcement-learning-applicable-to-a-scheduling-problem | <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 heat. So the ... | <p>Details matter, and it is possible that your problem is best solved using classic control (solving the state equations) or operations research style optimisation. However, RL is also a good choice because it can be made to learn a controller that is not brittle when things go wrong.</p>
<p>One thing you will have to... | 186 |
reinforcement learning | Is it required that taking an action updates the state? | https://ai.stackexchange.com/questions/21084/is-it-required-that-taking-an-action-updates-the-state | <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 as a resul... | <p>A very vague question. What's the objective?</p>
<p>Reinforcement Learning (RL) typically uses the Markov Decision Process framework, which is a sequential decision making framework. In this framework, actions influence the state transitions. In other words, RL deals with controlling (via actions) a Markov chain. T... | 187 |
reinforcement learning | What is Imagination Learning and Imagination machines? | https://ai.stackexchange.com/questions/5451/what-is-imagination-learning-and-imagination-machines | <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 the term ... | <p>The whole idea of Imagination Learning seems to be in its infancy. The author of the response you linked wrote a <a href="https://people.cs.umass.edu/~mahadeva/papers/aaai2018-imagination.pdf" rel="nofollow noreferrer">paper</a> on the subject, but as he notes the paper is more of an outline for "a new overarching c... | 188 |
reinforcement learning | What is the physics engine used by DeepMimic? | https://ai.stackexchange.com/questions/7958/what-is-the-physics-engine-used-by-deepmimic | <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 created, suc... | <p><a href="https://pybullet.org/wordpress/" rel="nofollow noreferrer">Bullet physics engine</a></p>
<p>Their <a href="https://arxiv.org/pdf/1804.02717.pdf" rel="nofollow noreferrer">paper</a> says</p>
<pre><code>Physics simulation is performed at 1.2kHz using the Bullet physics engine [Bullet 2015].
</code></pre>
| 189 |
reinforcement learning | How to design the reward for an action which is the only legal action at some state | https://ai.stackexchange.com/questions/8662/how-to-design-the-reward-for-an-action-which-is-the-only-legal-action-at-some-st | <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 (differen... | 190 | |
reinforcement learning | Intuition behind $\gamma$-discounted state frequency | https://ai.stackexchange.com/questions/11888/intuition-behind-gamma-discounted-state-frequency | <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-container">$... | <p><strong>Update: I rewrote the first part due to major mistake in the first version</strong></p>
<p>Notice: The notation <span class="math-container">$P^k$</span> from Eq.<span class="math-container">$(20)$</span> and <span class="math-container">$(21)$</span> in the paper does not mean the kth power of some <span c... | 191 |
reinforcement learning | Why do these reward functions give different training curves? | https://ai.stackexchange.com/questions/13785/why-do-these-reward-functions-give-different-training-curves | <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 not placed, ... | 192 | |
reinforcement learning | How does reinforcement learning with video data work? | https://ai.stackexchange.com/questions/17166/how-does-reinforcement-learning-with-video-data-work | <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 for furth... | <p>In reinforcement learning, to learn off policy control, you need data on the states, actions and rewards at each time step. If, in addition to a recorded video, you had a recording of controller inputs, and could add reward data by hand, then you could use a standard reinforcement learning method, e.g. DQN. Simply r... | 193 |
reinforcement learning | Where can I find short videos of examples of RL being used? | https://ai.stackexchange.com/questions/22951/where-can-i-find-short-videos-of-examples-of-rl-being-used | <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 based.</p>
<p... | <p>You can take some ideas from <a href="https://www.youtube.com/watch?v=JgvyzIkgxF0" rel="nofollow noreferrer">this</a> YouTube video .</p>
<p>In addition, you should consider <a href="http://karpathy.github.io/2016/05/31/rl/" rel="nofollow noreferrer">that</a> page which is about Deep Reinforcement Learning used in a... | 194 |
reinforcement learning | Train agent to surround a burning fire | https://ai.stackexchange.com/questions/26845/train-agent-to-surround-a-burning-fire | <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. When a no... | 195 | |
reinforcement learning | Is it possible to tell the Reinforcement Learning agent some rules directly without any constraints? | https://ai.stackexchange.com/questions/32042/is-it-possible-to-tell-the-reinforcement-learning-agent-some-rules-directly-with | <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-container">$x... | <p>I'm not an expert, but as far as I understand, you should use an off-policy algorithm, the difference between is:</p>
<p>On-Policy: The agent learns the value function according to the current action derived from current the policy being used.
Off-Policy: The agent learns the value function according to the action d... | 196 |
reinforcement learning | Is this simple game solvable with reinforcment learning? | https://ai.stackexchange.com/questions/36310/is-this-simple-game-solvable-with-reinforcment-learning | <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 predict if the n... | <p>This looks like a job for a multiclass classifier. You can build a classifier model to predict one of your three classes and train it on test data with known correct outputs very easily.</p>
<p>Although you can fit reinforcement learning (RL) to the problem, there is no real benefit to doing so, and learning will be... | 197 |
reinforcement learning | Why is $l$-step lookahead better in RL? | https://ai.stackexchange.com/questions/38920/why-is-l-step-lookahead-better-in-rl | <p>The following is from the book "Reinforcement learning and optimal control", by D. P. Bertsekas.</p>
<p>Chapter 2, page 52:</p>
<p>"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 require a less... | <p>Let's first start with the intuitive explanation. If you just use q-learning (or any other temporal difference method like SARSA) you usually just look ahead one step. The other extreme is a monte-carlo method where you don't rely on estimates of the state-value function at all (your policy might depend on an estima... | 198 |
reinforcement learning | How to train a logical XOR with reinforcement learning? | https://ai.stackexchange.com/questions/9838/how-to-train-a-logical-xor-with-reinforcement-learning | <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>But no mat... | <p>Reinforcement learning is used when we know the outcome we want, <em>but not how to get there</em> which is why you won't see a lot of people using it for classification (because we already know the optimal policy, which is just to output the class label). You knew that already, just getting it out of the way for fu... | 199 |
loss function | Non-Convex loss-surface although quadratic loss function | https://ai.stackexchange.com/questions/37039/non-convex-loss-surface-although-quadratic-loss-function | <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>Question: Why i... | <p>If I understood your question correctly - the quadratic loss function is not always convex. Its' convexity depends on the input it takes. For example, consider a very basic NN that takes some input <span class="math-container">$x$</span> and returns
<span class="math-container">\begin{equation}
f(x)=relu(w_1relu(w_0... | 200 |
loss function | Is Mean Squared Error Loss function a good loss function for continuous variables $0 < x < 1$ | https://ai.stackexchange.com/questions/20199/is-mean-squared-error-loss-function-a-good-loss-function-for-continuous-variable | <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 squared error of... | 201 | |
loss function | Loss Function In Units Of Bits? | https://ai.stackexchange.com/questions/22475/loss-function-in-units-of-bits | <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.&text=presumably%20has%20n... | 202 | |
loss function | How to update Loss Function parameter after compilation | https://ai.stackexchange.com/questions/14249/how-to-update-loss-function-parameter-after-compilation | <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 my discrim... | 203 | |
loss function | How could logistic loss be used as loss function for an ANN? | https://ai.stackexchange.com/questions/22786/how-could-logistic-loss-be-used-as-loss-function-for-an-ann | <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 noreferrer"><... | <p>I see why you might be confused. First, the logistic-loss or log-loss is technically called cross-entropy loss. This function is very simple:</p>
<p><span class="math-container">$CE = -[y \log(p) + (1 - y) \log(1 - p)]$</span></p>
<p>This tells basically if the predicted class <span class="math-container">$y$</span>... | 204 |
loss function | When can we call a loss function "adaptive"? | https://ai.stackexchange.com/questions/31523/when-can-we-call-a-loss-function-adaptive | <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 "adaptive loss function" in several research papers. For example: consider the following excerpt from the "Introduction" of the research paper titled <a href... | 205 | |
loss function | Loss Function not Decreasing | https://ai.stackexchange.com/questions/46593/loss-function-not-decreasing | <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 am pretty... | <p>Your problem type is more suited for classification than regression as you want to assign a class to the second largest number and not predict a value. Check out loss functions like CrossEntropyLoss rather than MSE to solve this type of problem.</p>
| 206 |
loss function | Custom Loss Function Traps Network in Local Optima | https://ai.stackexchange.com/questions/46523/custom-loss-function-traps-network-in-local-optima | <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 "guides" the network to the correct output in a different way. My... | <p>This is not meant as a complete answer to your question, but here are some things in your approach that arguably mess with model convergence.</p>
<p>Firstly, optimization is all about gradients, your loss function technically <em>guides</em> the model towards outputs of <span class="math-container">$-\infty$</span> ... | 207 |
loss function | Can't the loss function be used as a fitness function? | https://ai.stackexchange.com/questions/45740/cant-the-loss-function-be-used-as-a-fitness-function | <p>Can't the loss function used in backpropagation be used as a fitness function in an evolutionary algorithm?</p>
| <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 problems which are not differentiable. They tend to be computationally expensive if you already know a reasonable algorithm (backprop).</p>... | 208 |
loss function | Loss function on intermediate layers of the networks | https://ai.stackexchange.com/questions/47288/loss-function-on-intermediate-layers-of-the-networks | <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 function. ... | 209 | |
loss function | Transformer Loss Function for Music Generation | https://ai.stackexchange.com/questions/46306/transformer-loss-function-for-music-generation | <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 possibili... | 210 | |
loss function | Different methods of calculating gradients of cost function(loss function) | https://ai.stackexchange.com/questions/19895/different-methods-of-calculating-gradients-of-cost-functionloss-function | <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>
<p>I foun... | <p>I'm pretty sure they're the same thing. Both backpropagation and gradient descent's essential ideas are to calculate the partial derivative of the cost with respect to each weight, and subtract the partial derivative times the learning rate.</p>
| 211 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.