Neural Network Library 2.0

I know. I am always trying to find new ways to get myself more educated about Luau.

1 Like

I am very confused with the API though for this system.

1 Like

How would I go about this. I understand most of how it works but there is one issue, I do not know how to get a Vector3 from the output. I tried @apenzijncoolenleuk1’s approach with the cars except it only returns one value. Any help would be appreciated

have multiple output nodes which represent the axis’s?

Awesome library, but it is super confusing. Even with the example code, I don’t get the terms used or how to apply it to what I want to do?

2 Likes

Is it possible to give the neural network questions or give it information? Like for example, asking it if something is true or false and knowing the answer of the ai using outputs… is that possible? And how?

Hi there,

Your library looks awesome.
I am using it in a Autonomous Driving project (it is a project reserach for my MSc).

I am wondering if Torch is available to Roblox. If so, do you have a link of any module related to it?

Thanks in advance

If you’re referring to the machine learning library for the language Python, then no. You’ll need to do this with this library I guess

1 Like

I recommend watching some beginner Machine Learning and Neural Network videos. You will give a neural network input, and it will do some math calculations(don’t wanna overcomplicate it). This article is very good: First neural network for beginners explained (with code) | by Arthur Arnx | Towards Data Science

2 Likes

While Torch could theoretically be ported to Luau, all of it’s benefits like GPU support and various optimizations cannot. This library is actually very basic and poorly written by my current standards, so while it is a good baseline, I would encourage others to make a better library that outperforms this one in every way.

2 Likes

I am referring to the one based in Lua.
You can find its github at this link: Torch7

But is there any other way to use your Neural Network library to emulate an autonomous driver in a car?

I am asking it because there are lot of examples using Neural Networks wwith Reinforcement Learning (Deep Q-Learning) in python and that’s they say it is recommended for autonomous driving.
I am wordering if it would be possible to use the same here.
If not, which approach do you recommend?

It could work, you could copy the codebase and make some changes on it, but would take a lot of time

1 Like

I guess you would create the reinforcement learning algorithm with the neural network you created using the library. Maybe you would need to make adjustments to the library too

edit: LSTM neural network also does the job

1 Like

I’ve a question. Can I train a neural network on datasets using this library? I know I’ll need to prepare it but can I even train it using that dataset?

2 Likes

Yes, you can use datasets to train networks with backpropagation or genetic algorithms.

1 Like

Thank you so much! I will probably be researching dataset creation for the next week or two

Edit: Do you have any tips for dataset preparation?

Uh how do i make the ai try to change number to match a number by mathematical function

Are saved networks fit to continue training from where they left off? I have AI planes navigating an obstacle course successfully, and I save the best network after each generation. Attempting to train using the saved best network seems to revert them back to random inputs. The only noticeable difference I can tell is that the network takes a smaller number of generations to reach where it was before.

Here’s how i’m currently saving the network

local save
function AI.Process()
    geneticAlgo:ProcessGeneration(scoreTable)
	save = geneticAlgo:GetBestNetwork():Save()
	print((string.len(save) / 4000000).."% (AI)")
end

game:BindToClose(function()
	if save then
		local success, err = pcall(function()
			experienceStore:SetAsync("AI_TREE_v"..AI_KEY_VERSION, save)
			print("Saved")
		end)
		if not success then
			warn(err)
			print(save)
		end
	end
end)

and how i’m loading them in

local currentAISave = experienceStore:GetAsync("AI_TREE_v"..AI_KEY_VERSION)

local baseNetwork = currentAISave ~= nil and feedForwardNetwork.newFromSave(currentAISave) or feedForwardNetwork.new(const.DEEP_COPY_TABLE(serverConst.AI_INPUT_ARRAY), 2, 14, const.DEEP_COPY_TABLE(serverConst.AI_OUTPUT), feedForwardSettings)

local populationSize = 100
local geneticAlgo = paramEvo.new(baseNetwork, populationSize, geneticSetting)
1 Like

Sorry for the late reply; not really active on the forums anymore.

The reason why it doesn’t load properly is that I forgot to officially implement a loading function to the genetic algorithm class. When you’re using the saved best network as a template, you’re not using any of its parameters; only its structure (number of nodes, nodes per layer, etc).

This library is 2 years old now, is written in ways I do not approve anymore, and is generally a mess for me to go through, but I quickly patched in the same functions that networks have to genetic algorithms, namely, :Save() and .newFromSave().
I’ll warn you, though: it may take a while to save and load. It is essentially saving every single network in the population.

3 Likes