Advertisement
Trainlover08

README.md

May 15th, 2024 (edited)
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. ## Vex Neural Network
  2.  
  3. The Vex Neural Network library is designed to enable users to integrate Deep Q Learning into their robots. The code is also easily compatible with simulation software such as WeBots. It was written entirely from scratch to provide an educational insight into Neural Networks with the goal of being as lightweight as possible.
  4.  
  5. ### Requirements
  6.  
  7. The requirements for using the library are minimal:
  8. - Standard C Library
  9.  
  10. ### Recommended Modules
  11.  
  12. For optimal performance and compatibility, consider using:
  13. - Vex PROS extension (or VEX V5)
  14.  
  15. ### How to Use
  16.  
  17. #### Training
  18.  
  19. 1. **Initialize Class**: Before use, initialize a new instance of the "nn" class. Configure the following parameters:
  20. - File name: Specify the file path where .txt files will be saved.
  21. - Batch size: Determine the number of episodes to generate per epoch.
  22. - Selection amount: Set the number of episodes to select for reproduction.
  23. - Learning rate: Define the mutation rate of the network.
  24.  
  25. 2. **Create New Model**: To train the model, use the "new_model()" method and provide the following parameters:
  26. - Input Neurons Size
  27. - Hidden Neurons Per layer
  28. - Hidden Layers Amount
  29. - Output Neurons Size
  30.  
  31. 3. **Mutate Batch**: Call the "mutate()" method to mutate the created batches within the class.
  32.  
  33. 4. **Run Batch**: Use the "run()" method to obtain the output of the network for a given set of inputs:
  34. - Pass the outputs from "mutate()".
  35. - Ensure that the dimensions of the input data (std::vector<std::vector<std::vector<float>>>) match the input neurons of the model.
  36.  
  37. 5. **Selection**: Invoke the "selection()" method to select the best runs for reproduction in the next epoch:
  38. - Provide the batch that was run.
  39. - Pass the results (std::vector<std::vector<std::vector<float>>>) with the highest scores.
  40.  
  41. 6. **Write**: Call the "write()" method to write the selected networks to the files.
  42. - Pass the return value of "selection()".
  43.  
  44. 7. **Loop**: Repeat steps 3-6 for the desired number of epochs. Increment the "current_epoch" parameter by one for each iteration.
  45.  
  46. #### Implementation on Simulator or Robot
  47.  
  48. 1. **Initialize Class**:
  49. - Set the File Name to the file path of the final Neural Network.
  50. - Set Selection amount to 1.
  51.  
  52. 2. **Run**:
  53. - Call the "run()" method with the parameters "read()" and the set of input data.
  54. - It is recommended to call "read()" once after initialization and store it in memory for efficient usage.
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement