Answers.Body: <p>Funny, DL could stand for Damareu-Levenshtein method or deep learning (I’m assuming you meant the second). In short, yes, both are technically possible using deep learning. Now, how you execute this depends on the specific game you are trying to automate. Since you mention a battle game, the execution will be a little bit complicated in terms of how much you can do without access to lots of compute resources. However, it is doable using reinforcement learning.</p>
  <p>I’ve seen work on similar ideas for popular PvP battle games, using something called NEAT. This is a good intro to the principle: <a href="https://macwha.medium.com/evolving-ais-using-a-neat-algorithm-2d154c623828" rel="nofollow noreferrer">https://macwha.medium.com/evolving-ais-using-a-neat-algorithm-2d154c623828</a></p>
  <p>The way NEAT works for your use case is that given the game controls and some other information from the player angle, NEAT will generate several unique models and make them randomly interact with the given information. How you control it to do what you want is set rewards for doing something right in the game and add punishments for doing something bad. For every iteration NEAT works, models that earn the most rewards improve and continue, while the other “species” die. This way, the initially naive and random models slowly get more and more skilled through “natural selection”. Note: This is a very simplified explanation.</p>
  <p>However, here is the issue: training. If you look to train it with videos of gameplay, it will take hundreds or thousands of videos at a very optimistic minimum, much more if the game is very complicated. Additionally, to train with NEAT with this much data to achieve a successful species, it will most likely take lots of time and a lot of your CPU / GPU’s resources. Again, it’s hard to give specific estimates. Note that you’ll have to encode the “rules” of the game well and figure out a way to break down what is going on in the video into specific components that the model can see and control. That falls more into how to apply NEAT for the task, but in theory, game automation can be done using it. The model can pick up the state that a game is in and (after a lot of training and trial and error) will ultimately be able to react to states with actions.</p>
  <p>Why I suggest NEAT is that I’ve seen a project where, given the models an input of game controls (up-down and left-right) and vision of walls and opponents with ray tracing, a model was made that could play the online platformer PvP game “Tag”, where players jump on platforms to try and catch each other.</p>
  <p>You were mentioning OCR a lot, so that makes me wonder: is the game easily playable based on text shown on the screen? Because if so, there is a much easier way to achieve what you are trying to do based solely on text. If you were to use text, you wouldn’t even need to train a model on game footage. You could hard-encode certain keywords to actions, or if the keywords differ each time, you could use a language model to get the idea of the text and convert it into an action. Hope this helps!</p>
  <p>Edit: If I have understood correctly, ideally, you would have a highly accurate OCR reading of the text from the screen, with correction methods to retrieve the intended text with high accuracy. After reliably extracting the keywords, you would associate them to unique &quot;states&quot;, which are associated with &quot;actions&quot;. At this point, you could either use machine learning for classification, given input keyword and output state. Or you could hard-code keywords to states and states to actions using a dictionary.</p>
  <p>I would recommend you hard-code them, because either way you will have to yourself decide what keywords mean what state and then tell the computer program this. It's a common misconception that results will be &quot;better&quot; or &quot;smarter&quot; in any way when using machine learning for tasks like this. Think of it this way: if you hard-code keywords to states, you're directly telling the computer what the correct thing to do is, which is always going to be faster. If you choose to use some form of machine learning or reinforcement learning, you're still having to hard-code keywords to states in the form of a dataset, but even after that effort, you also have to wait for your model to learn the patterns and associations that you want it to. Remember, for simple tasks such as connecting a keyword to an output, AI is simply a glorified search algorithm for its &quot;learned&quot; database. Both methods work, but it's up to you whether you choose the faster method or the more time-consuming one. Training an AI model takes a decent amount of data, and while it's nothing impossible to do, you could also spend that time just directly hard-coding instead of trying to teach an algorithm the pattern that you already understand exists. In short, from what I have understood, using AI for this task would be redundant and unnecessary.</p>
  <p>Now, if you say that the OCR model itself is struggling to pick up the keywords reliably, and that is the step you want to implement AI, then you could potentially have a valid use case. Otherwise, hard-coding is the way to go (at least in my mind).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-22T10:36:05.390Z
Answers.Text: Thanks for the reply. Yes, the game is easily playable based on text shown on the screen. As a matter of fact, the approach of keywords to actions is exactly what I was doing but the downside is that keywords for each state of the game were chosen by me. Maybe what I could do is trying to automate keyword identification? If so, any suggestion?
Answers.UserDisplayName: zaxunobi
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-22T16:14:34.533Z
Answers.Text: Are the keywords always the same for each state of the game? Because if so, even though you could achieve your goal using deep learning, it’d be a bit redundant, and it’d be much easier/faster to use hard-encoding. If you can’t hard-encode them, you can fine tune a large language model using a custom dataset. Create a small dataset with the keywords of your game as the input feature and  their corresponding actions as the output feature. Fine tuning language models is much more doable using HuggingFace. I’m a little confused as to your use case. Can you edit your question with more specifics?
Answers.UserDisplayName: otpidusmatar
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-24T06:23:10.383Z
Answers.Text: Yes, the keywords are the same for each state. If I create a small dataset of basically keywords as input feature and actions as output feature it means that I can also hard-encode them since keywords are already known, right? What am I missing? Maybe a LLM would be beneficial for better OCR recognition.
  Yes, I will update my question.
Answers.UserDisplayName: zaxunobi
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-24T07:36:06.790Z
Answers.Text: I edited my above response with 3 more paragraphs (sorry!). Take a look at it and see if it helps. I'm open to any further queries!
Answers.UserDisplayName: otpidusmatar
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-21T16:27:38.010Z
Answers.LastActivityDate: 2024-06-24T07:34:47.500Z
Answers.LastEditDate: 2024-06-24T07:34:47.500Z
Answers.UserDisplayName: otpidusmatar
Body: <p>newbie here. I have developed an app that basically does:</p>
  <ul>
  <li>Perform OCR, check if words are contained in the resulting text and then perform an action.</li>
  <li>If no words are detected from the given list, then use string similarity algorithms such as Levenshtein to check if there might be similar words.</li>
  </ul>
  <p>In reality, I am already using DL since the OCR engine uses LSTM.</p>
  <p>Since I would rather avoid developer supervision (checking for words and and specify the action based on the detected words), I was wondering if DL would be suitable in this case scenario.
  Let's say we want to automate the battle in a videogame.
  The dataset would be basically either images/videos of basically the user playing.
  So we would have STATES and ACTIONS.</p>
  <p>More specifically I would like to ask you if DL could help in:</p>
  <ul>
  <li>Learning in which STATE the app is.</li>
  <li>Learn what ACTION to perform without the developer creating an association of STATE -&gt; ACTION.</li>
  </ul>
  <p>But I think the last one might be a stretch, meaning I would still need to specify what action follows a certain STATE.</p>
  <p>If what I've described is suitable, what amount of data would be required?
  Because I've been told with DL the dataset would need to be huge, so If I would need milions of screenshots/videos I guess I'll just keep the current architecture.</p>
  
Tags: <reinforcement-learning><deep-learning><deep-neural-networks><unsupervised-learning><optical-character-recognition>
Title: Is deep learning suitable/preferable for string similarity detection and application automation? If so, which type?
UserDisplayName: zaxunobi
ThreadText: # Is deep learning suitable/preferable for string similarity detection and application automation? If so, which type?
  
  (Asked by: username_0 on 2024-06-20)
  
  newbie here. I have developed an app that basically does:
  
  * Perform OCR, check if words are contained in the resulting text and then perform an action.
  * If no words are detected from the given list, then use string similarity algorithms such as Levenshtein to check if there might be similar words.
  
  In reality, I am already using DL since the OCR engine uses LSTM.
  
  Since I would rather avoid developer supervision (checking for words and and specify the action based on the detected words), I was wondering if DL would be suitable in this case scenario.
  Let's say we want to automate the battle in a videogame.
  The dataset would be basically either images/videos of basically the user playing.
  So we would have STATES and ACTIONS.
  
  More specifically I would like to ask you if DL could help in:
  
  * Learning in which STATE the app is.
  * Learn what ACTION to perform without the developer creating an association of STATE -> ACTION.
  
  But I think the last one might be a stretch, meaning I would still need to specify what action follows a certain STATE.
  
  If what I've described is suitable, what amount of data would be required?
  Because I've been told with DL the dataset would need to be huge, so If I would need milions of screenshots/videos I guess I'll just keep the current architecture.
  
  **Tags:** reinforcement-learning, deep-learning, deep-neural-networks, unsupervised-learning, optical-character-recognition
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-06-21. Score: 0
  
  Funny, DL could stand for Damareu-Levenshtein method or deep learning (I’m assuming you meant the second). In short, yes, both are technically possible using deep learning. Now, how you execute this depends on the specific game you are trying to automate. Since you mention a battle game, the execution will be a little bit complicated in terms of how much you can do without access to lots of compute resources. However, it is doable using reinforcement learning.
  
  I’ve seen work on similar ideas for popular PvP battle games, using something called NEAT. This is a good intro to the principle: <https://macwha.medium.com/evolving-ais-using-a-neat-algorithm-2d154c623828>
  
  The way NEAT works for your use case is that given the game controls and some other information from the player angle, NEAT will generate several unique models and make them randomly interact with the given information. How you control it to do what you want is set rewards for doing something right in the game and add punishments for doing something bad. For every iteration NEAT works, models that earn the most rewards improve and continue, while the other “species” die. This way, the initially naive and random models slowly get more and more skilled through “natural selection”. Note: This is a very simplified explanation.
  
  However, here is the issue: training. If you look to train it with videos of gameplay, it will take hundreds or thousands of videos at a very optimistic minimum, much more if the game is very complicated. Additionally, to train with NEAT with this much data to achieve a successful species, it will most likely take lots of time and a lot of your CPU / GPU’s resources. Again, it’s hard to give specific estimates. Note that you’ll have to encode the “rules” of the game well and figure out a way to break down what is going on in the video into specific components that the model can see and control. That falls more into how to apply NEAT for the task, but in theory, game automation can be done using it. The model can pick up the state that a game is in and (after a lot of training and trial and error) will ultimately be able to react to states with actions.
  
  Why I suggest NEAT is that I’ve seen a project where, given the models an input of game controls (up-down and left-right) and vision of walls and opponents with ray tracing, a model was made that could play the online platformer PvP game “Tag”, where players jump on platforms to try and catch each other.
  
  You were mentioning OCR a lot, so that makes me wonder: is the game easily playable based on text shown on the screen? Because if so, there is a much easier way to achieve what you are trying to do based solely on text. If you were to use text, you wouldn’t even need to train a model on game footage. You could hard-encode certain keywords to actions, or if the keywords differ each time, you could use a language model to get the idea of the text and convert it into an action. Hope this helps!
  
  Edit: If I have understood correctly, ideally, you would have a highly accurate OCR reading of the text from the screen, with correction methods to retrieve the intended text with high accuracy. After reliably extracting the keywords, you would associate them to unique "states", which are associated with "actions". At this point, you could either use machine learning for classification, given input keyword and output state. Or you could hard-code keywords to states and states to actions using a dictionary.
  
  I would recommend you hard-code them, because either way you will have to yourself decide what keywords mean what state and then tell the computer program this. It's a common misconception that results will be "better" or "smarter" in any way when using machine learning for tasks like this. Think of it this way: if you hard-code keywords to states, you're directly telling the computer what the correct thing to do is, which is always going to be faster. If you choose to use some form of machine learning or reinforcement learning, you're still having to hard-code keywords to states in the form of a dataset, but even after that effort, you also have to wait for your model to learn the patterns and associations that you want it to. Remember, for simple tasks such as connecting a keyword to an output, AI is simply a glorified search algorithm for its "learned" database. Both methods work, but it's up to you whether you choose the faster method or the more time-consuming one. Training an AI model takes a decent amount of data, and while it's nothing impossible to do, you could also spend that time just directly hard-coding instead of trying to teach an algorithm the pattern that you already understand exists. In short, from what I have understood, using AI for this task would be redundant and unnecessary.
  
  Now, if you say that the OCR model itself is struggling to pick up the keywords reliably, and that is the step you want to implement AI, then you could potentially have a valid use case. Otherwise, hard-coding is the way to go (at least in my mind).
  
  > **Comments:**
  > **username_0**: Thanks for the reply. Yes, the game is easily playable based on text shown on the screen. As a matter of fact, the approach of keywords to actions is exactly what I was doing but the downside is that keywords for each state of the game were chosen by me. Maybe what I could do is trying to automate keyword identification? If so, any suggestion?  
  > **username_1**: Are the keywords always the same for each state of the game? Because if so, even though you could achieve your goal using deep learning, it’d be a bit redundant, and it’d be much easier/faster to use hard-encoding. If you can’t hard-encode them, you can fine tune a large language model using a custom dataset. Create a small dataset with the keywords of your game as the input feature and  their corresponding actions as the output feature. Fine tuning language models is much more doable using HuggingFace. I’m a little confused as to your use case. Can you edit your question with more specifics?  
  > **username_0**: Yes, the keywords are the same for each state. If I create a small dataset of basically keywords as input feature and actions as output feature it means that I can also hard-encode them since keywords are already known, right? What am I missing? Maybe a LLM would be beneficial for better OCR recognition. Yes, I will update my question.  
  > **username_1**: I edited my above response with 3 more paragraphs (sorry!). Take a look at it and see if it helps. I'm open to any further queries!  
  
  ---
  
  