1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Deep Skript

Discussion in 'Scripts' started by ThatOneLilypad, Jan 24, 2021.

  1. ThatOneLilypad

    Supporter

    Joined:
    Jan 16, 2021
    Messages:
    1
    Likes Received:
    2
    What?
    This script aims to introduce basic AI into Skript using deep learning (deep neural networks). Training the network currently does not fully work (will fix hopefully soon). (I'll probably rewrite this later on as the code is pretty ugly and messy)

    Requirements
    None, this is all in vanilla Skript.

    How does it work?
    This script allows you to train and run a simple network based on your predefined settings.

    How fast is it?
    Pretty slow (running is pretty decent, training is slowwww).

    Features
    A lot of stuff is configurable such as:
    • Input neuron count
    • Hidden layer count
    • Neuron count per layer
    • Output neuron count
    • How many epochs to train for
    This script only supports numerical inputs and outputs but you can add support for text yourself by creating a bag of words and tokenizing.

    What is planned on being added?
    Fixing the network training is the main thing, but besides that...
    • More customization options (ie. custom activation functions, different network types)
    • Support for text input/output by default
    • Hopefully make it faster

    Alright how do I use this then?
    For a basic example, lets say you want to teach the network how to do XOR operations

    Code (Text):
    1. command /xor <int> <int>:
    2.     trigger:
    3.         DSCreateNetwork(2, 2, 2, 1)
    4.  
    5.         DSPumpTraining((0, 0), (0))
    6.         DSPumpTraining((1, 0), (1))
    7.         DSPumpTraining((0, 1), (1))
    8.         DSPumpTraining((1, 1), (0))
    9.  
    10.         DSTrainNetwork(5, .1)
    11.  
    12.         send "%DSRunNetwork((arg-1, arg-2))%"
    So if we break that down, first we define the network size:
    Code (Text):
    1. DSCreateNetwork(inputs, layers, neurons-per-layer, outputs)
    And if we were to draw out the example network, it would look something like this:

    [​IMG]

    Next, we need to give it data to train on (and we do this for the combinations of XOR we want it to learn off of):
    Code (Text):
    1. DSPumpTraining(inputs, outputs)
    Once we give it stuff to train off of, we finally train the network:
    Code (Text):
    1. DSTrainNetwork(epochs, learning-rate)
    Finally, we run the network which will return a list of the output neuron values:
    Code (Text):
    1. DSRunNetwork(inputs)
    This script is not intended to serve a practical use, it was written just for fun and to do stuff not previously thought of or done in Skript before.
     

Share This Page

Loading...