Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. General Discussion
  3. Messing around with Brain.js

Messing around with Brain.js

Scheduled Pinned Locked Moved General Discussion
14 Posts 3 Posters 2.9k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • JaecadeJnightJ JaecadeJnight

    Brain.js is really interesting for machine learning, it’s a JS library that allows you to do stuff with AI right in the browser! It takes up so much time to load though, but it’s worth it to get these results:
    772b483e-6b26-4cb3-82f9-e63626f3978f-image.png

    It barely knows English but does well with the training data I give it somewhat. I really like it though but I know the more training data I give it, the harder it’ll be for me to actually use it and run it (as it’ll take forever to load). I’m considering using the NodeJS version, making an API, and a front-end chatting interface that just sends requests to that API and all. With the NodeJS version, I think it might be able to use more processing power as it’s on the cloud.

    Here’s the training data I gave it so far (I gave credit to my sources in order to be ethical):

     const tData = [
      // I made the next three strings
      'Hi, how are you doing today?', 
      'I\'m doing well, how are you?', 
      'John Cena said to never give up!',
      // https://en.wikipedia.org/wiki/Pizza
      'Pizza is an Italian dish that consists of a flat base of leavened wheat-based dough topped with tomato, cheese, and other ingredients, baked at a high temperature, usually in a wood-fired oven.',
      // made by me
      'Notch is the guy who made Minecraft!! He is awesome!!',
      // https://en.wikipedia.org/wiki/Hatsune_Miku (modified by me)
      'Hatsune Miku is a 16 year old Vocaloid girl with long blue hair.',
      // http://www.creatingmycambridge.com/history-stories/newtons-apple-tree/ (modified by me)
      'Isaac Newton was sitting under an apple tree, thinking about the mysterious universe when suddenly an apple hit him on the head lol',
      // https://simple.wikipedia.org/wiki/Apple_pie
      'An apple pie is a common pie or tart filled with apples. Sometimes it has whipped cream or ice cream on top.',
      // https://tatoeba.org/en/sentences/show/10098194
      'I\'d rather live in a world full of secrets than one so small that I\'m able to understand it.',
      // https://en.wikipedia.org/wiki/Ireland
      'Ireland is an island in the North Atlantic Ocean, in Northwestern Europe. It is separated from Great Britain to its east by the North Channel, the Irish Sea, and St George\'s Channel. Ireland is the second-largest island of the British Isles, the third-largest in Europe, and the twentieth-largest in the world.'
    ];
    

    I find that for good training data, I can always just use Wikipedia and Creative-Commons licensed internet stuff. I mean ChatGPT did that too so it’s not a bad thing ig. It’s also a good (but time consuming) option to make your own training data.

    JaecadeJnightJ Offline
    JaecadeJnightJ Offline
    JaecadeJnight
    Mod Helper
    wrote on last edited by
    #3

    @jeffreyrb03-gmail now its weirdly hallucinating because I trained it with Hatsune Miku being 16 years old (and some new stuff):
    22f70ce4-2ab4-490d-ba4b-df10bdf71619-image.png

    #LLJW
    <span style="color:white;background-image:linear-gradient(to right, lightblue, navy)">My name is Jeff</span>

    Mod. Squad TrainerM 1 Reply Last reply
    0
    • JaecadeJnightJ JaecadeJnight

      @jeffreyrb03-gmail now its weirdly hallucinating because I trained it with Hatsune Miku being 16 years old (and some new stuff):
      22f70ce4-2ab4-490d-ba4b-df10bdf71619-image.png

      Mod. Squad TrainerM Offline
      Mod. Squad TrainerM Offline
      Mod. Squad Trainer
      wrote on last edited by
      #4

      @jeffreyrb03-gmail Did you know Gandi IDE has something similar to this? Instead of JavaScript though, it generates python, which can be turned into blocks.

      JaecadeJnightJ 1 Reply Last reply
      1
      • Mod. Squad TrainerM Mod. Squad Trainer

        @jeffreyrb03-gmail Did you know Gandi IDE has something similar to this? Instead of JavaScript though, it generates python, which can be turned into blocks.

        JaecadeJnightJ Offline
        JaecadeJnightJ Offline
        JaecadeJnight
        Mod Helper
        wrote on last edited by
        #5

        @mod-squadacademy For the python, what NLP/ML library is used in the generated code? Also i got a funny update:
        e002ca88-3145-4a90-bbff-d0b531d124c9-image.png

        #LLJW
        <span style="color:white;background-image:linear-gradient(to right, lightblue, navy)">My name is Jeff</span>

        Mod. Squad TrainerM 1 Reply Last reply
        0
        • JaecadeJnightJ JaecadeJnight

          @mod-squadacademy For the python, what NLP/ML library is used in the generated code? Also i got a funny update:
          e002ca88-3145-4a90-bbff-d0b531d124c9-image.png

          Mod. Squad TrainerM Offline
          Mod. Squad TrainerM Offline
          Mod. Squad Trainer
          wrote on last edited by
          #6

          @jeffreyrb03-gmail Not entirely sure. I do know that you can tell it what you want, and it will generate the python for you.

          The annoying thing about Gandi IDE’s extensions is that there’s no way that I know of to get much information on how they work.

          JaecadeJnightJ 1 Reply Last reply
          1
          • Mod. Squad TrainerM Mod. Squad Trainer

            @jeffreyrb03-gmail Not entirely sure. I do know that you can tell it what you want, and it will generate the python for you.

            The annoying thing about Gandi IDE’s extensions is that there’s no way that I know of to get much information on how they work.

            JaecadeJnightJ Offline
            JaecadeJnightJ Offline
            JaecadeJnight
            Mod Helper
            wrote on last edited by
            #7

            @mod-squadacademy In Python, you’ll know what libraries are used by looking at the top of a document,
            for example “import math” is used so you can use math stuff:

            import math
            
            radius = float(input("Enter the radius: "))
            area = math.pi * radius ** 2
            print(f"Area: {area:.2f}, Square root of area: {math.sqrt(area):.2f}")
            
            

            python needs a module/library for everything.

            For extensions in Gandi IDE, have you tried looking at their documentation/source code? Knowing a lot of JS can help

            #LLJW
            <span style="color:white;background-image:linear-gradient(to right, lightblue, navy)">My name is Jeff</span>

            Mod. Squad TrainerM 1 Reply Last reply
            0
            • JaecadeJnightJ JaecadeJnight

              @mod-squadacademy In Python, you’ll know what libraries are used by looking at the top of a document,
              for example “import math” is used so you can use math stuff:

              import math
              
              radius = float(input("Enter the radius: "))
              area = math.pi * radius ** 2
              print(f"Area: {area:.2f}, Square root of area: {math.sqrt(area):.2f}")
              
              

              python needs a module/library for everything.

              For extensions in Gandi IDE, have you tried looking at their documentation/source code? Knowing a lot of JS can help

              Mod. Squad TrainerM Offline
              Mod. Squad TrainerM Offline
              Mod. Squad Trainer
              wrote on last edited by
              #8

              @jeffreyrb03-gmail f3d5a3e9-fcff-4675-aa4e-8b56fd97d933-image.png
              f817413e-b24d-4fdd-a803-ff4d3fadae42-image.png

              JaecadeJnightJ 2 Replies Last reply
              1
              • Mod. Squad TrainerM Mod. Squad Trainer

                @jeffreyrb03-gmail f3d5a3e9-fcff-4675-aa4e-8b56fd97d933-image.png
                f817413e-b24d-4fdd-a803-ff4d3fadae42-image.png

                JaecadeJnightJ Offline
                JaecadeJnightJ Offline
                JaecadeJnight
                Mod Helper
                wrote on last edited by
                #9

                @mod-squadacademy ah ok

                #LLJW
                <span style="color:white;background-image:linear-gradient(to right, lightblue, navy)">My name is Jeff</span>

                1 Reply Last reply
                0
                • Mod. Squad TrainerM Mod. Squad Trainer

                  @jeffreyrb03-gmail f3d5a3e9-fcff-4675-aa4e-8b56fd97d933-image.png
                  f817413e-b24d-4fdd-a803-ff4d3fadae42-image.png

                  JaecadeJnightJ Offline
                  JaecadeJnightJ Offline
                  JaecadeJnight
                  Mod Helper
                  wrote on last edited by
                  #10

                  @mod-squadacademy my AI just called me a “cood”, heres the full message:
                  AI: Na a cout B C N R S T c Xeean, purrlentime are you doing tods?A cood.

                  #LLJW
                  <span style="color:white;background-image:linear-gradient(to right, lightblue, navy)">My name is Jeff</span>

                  Mod. Squad TrainerM 1 Reply Last reply
                  0
                  • JaecadeJnightJ JaecadeJnight

                    @mod-squadacademy my AI just called me a “cood”, heres the full message:
                    AI: Na a cout B C N R S T c Xeean, purrlentime are you doing tods?A cood.

                    Mod. Squad TrainerM Offline
                    Mod. Squad TrainerM Offline
                    Mod. Squad Trainer
                    wrote on last edited by
                    #11

                    @jeffreyrb03-gmail Given everything else it said, there’s no way of knowing if it actually called you that.

                    JaecadeJnightJ 1 Reply Last reply
                    1
                    • Mod. Squad TrainerM Mod. Squad Trainer

                      @jeffreyrb03-gmail Given everything else it said, there’s no way of knowing if it actually called you that.

                      JaecadeJnightJ Offline
                      JaecadeJnightJ Offline
                      JaecadeJnight
                      Mod Helper
                      wrote on last edited by
                      #12

                      @mod-squadacademy Prolly lol. I’m trying to fix this thing and it’s so hard to debug. Then one change makes it start to spit more gibberish out

                      #LLJW
                      <span style="color:white;background-image:linear-gradient(to right, lightblue, navy)">My name is Jeff</span>

                      Tyller_T 1 Reply Last reply
                      0
                      • JaecadeJnightJ JaecadeJnight

                        @mod-squadacademy Prolly lol. I’m trying to fix this thing and it’s so hard to debug. Then one change makes it start to spit more gibberish out

                        Tyller_T Offline
                        Tyller_T Offline
                        Tyller_
                        trusted helpers
                        wrote on last edited by
                        #13

                        @jeffreyrb03-gmail how much training data are you using? I might try brain js for some stuff if it isn’t that computationally heavy

                        <div component="post/signature" data-uid="255" class="post-signature">Check out my chat room project so you ppl can not use forums as chat rooms! https://play.creaticode.com/projects/66f2e1dcd1be43d82b886fbd?version=1 <p dir="auto">
                        </div>

                        JaecadeJnightJ 1 Reply Last reply
                        0
                        • Tyller_T Tyller_

                          @jeffreyrb03-gmail how much training data are you using? I might try brain js for some stuff if it isn’t that computationally heavy

                          JaecadeJnightJ Offline
                          JaecadeJnightJ Offline
                          JaecadeJnight
                          Mod Helper
                          wrote on last edited by
                          #14

                          @tyller_ It doesnt use GPU acceleration like TensorFlow so it kinda sucks on that part as you have to make up methods to make it go faster and all that are kinda annoying.

                          For training data, it’s just a lot of sentences and all on random topics from wikipedia

                          #LLJW
                          <span style="color:white;background-image:linear-gradient(to right, lightblue, navy)">My name is Jeff</span>

                          1 Reply Last reply
                          0

                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                          With your input, this post could be even better 💗

                          Register Login
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • CreatiCode