Messing around with Brain.js
-
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:
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.
-
@jeffreyrb03-gmail Update: LOLOLOLLOLLOLOLLOL
'Greland is an island is an island is an island …"
I think I need to give it more iterations and/or more training data. I genuinely wonder how it got stuck there. I know it meant “secrets” by heecrets, and “Ireland” by Greland, since my training data used those two things, but just “is an island” repeating lol. I wish I could test this faster and see what’s up.
-
@jeffreyrb03-gmail now its weirdly hallucinating because I trained it with Hatsune Miku being 16 years old (and some new stuff):
-
@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.
-
@mod-squadacademy For the python, what NLP/ML library is used in the generated code? Also i got a funny update:
-
@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.
-
@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-squadacademy ah ok
-
@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. -
@jeffreyrb03-gmail Given everything else it said, there’s no way of knowing if it actually called you that.
-
@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
-
@jeffreyrb03-gmail how much training data are you using? I might try brain js for some stuff if it isn’t that computationally heavy
-
@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