DataPredict [Release 1.21] - General Purpose Machine Learning And Deep Learning Library (Learning AIs, Generative AIs, and more!)

Hi guys. I am creating a new project for detecting the hackers using their movements. I would like you to read the post in the link below and give feedbacks in that post.

3 Likes

Heads up. I just noticed there was an issue with the cost calculations for the support vector machine. For people who are using support vector machines, I recommend you update the library ASAP. The cost is way off.

I must have been too exhausted from developing the library for many months now…

Eh, the only model that uses those function is the second version of linear regression model (the one that doesn’t use gradient descent). The rest of models doesn’t use it.

Ah, thanks. I’ll implement it later. It’s like 3:00 am here and I get all paranoid with making backups with these changes.

1 Like

Good news everyone! I have released a partial open-source anti-cheat / outlier detection named “ChaWatcher”. It uses the Support Vector Machine from this library.

Go ahead and take a look!

2 Likes

I recently implemented a Context Matrix and a custom vector matrix library for my thing. But this is still much better! I just don’t know how to use it! But as I stated earlier. You could use this module to construct a Bag of Words with a compressed vocabulary by indexing the previous word and next word with the current word and noting the frequencies of a large cleaned dataset. Then you can use this to make predictions.
Like I did in this example! But this is just based off word frequency But I think you could use this DataPredict library to train a network to make the predictions.

function cm.TrainLargeModel(strings,model)
	--local model={}
	for i, str in ipairs(strings) do -- loop through the strings in the table
		local words=cm.splitString(str)
		for t,wo in ipairs(words) do
			local prevw,nextw
			if wo~="I" then
				wo=wo:lower()
			end
			local s=cm.Getsynonyms(wo,true)		
			--print(s[1])

			if model[s[1]]==nil then 
				model[s[1]]={}
				model[s[1]]["fr"]=1
				model[s[1]]["pw"]={}
				model[s[1]]["nw"]={}
				model[s[1]]["p2w"]={}
				model[s[1]]["n2w"]={}
				--	print(model[s[1]])	
			end 
			model[s[1]].fr=model[s[1]].fr+1
			if t~=1 then
				local prev=cm.Getsynonyms(words[t-1],true)
				prevw=prev[1]
				if model[s[1]].pw[prevw]==nil and prevw then
					--	model[s[1]].pw[prevw]=
					model[s[1]].pw[prevw]=1 
				else model[s[1]].pw[prevw]=model[s[1]].pw[prevw]+1	
				end
			end
			if t>2 then
				local prev=cm.Getsynonyms(words[t-2],true)
				prevw=prev[1]
				if model[s[1]].p2w[prevw]==nil and prevw then
					--	model[s[1]].pw[prevw]=
					model[s[1]].p2w[prevw]=1 
				else model[s[1]].p2w[prevw]=model[s[1]].p2w[prevw]+1	
				end
			end
			if t<#words-1 then
				local nex=cm.Getsynonyms(words[t+2],true)
				nextw=nex[1]

				if model[s[1]].n2w[nextw]==nil then model[s[1]].n2w[nextw]=1 
				else model[s[1]].n2w[nextw]=model[s[1]].n2w[nextw]+1	
				end
			end
			
			if t~=#words then
					local nex=cm.Getsynonyms(words[t+1],true)
					nextw=nex[1]

					if model[s[1]].nw[nextw]==nil then model[s[1]].nw[nextw]=1 
					else model[s[1]].nw[nextw]=model[s[1]].nw[nextw]+1	
					end
			end

						

		end
	end	
	--print(model)


	--table.sort(model, function(a, b) return a.fr > b.fr end)

	return model
end

function cm.EvaluteCorpus()
	local dbs=require(game.ReplicatedStorage.GlobalSpells.ChatbotAlgorithm.SupportingData:Clone())
	if not personalities then personalities=require(game.ReplicatedStorage.GlobalSpells.ChatbotAlgorithm.Personalities) end
	--personalities.AllPersonalities()
	local Greetings,inquiry,IDK,Database,wisdom=personalities.AllPersonalities()
	local model={}
	--model=require(game.ReplicatedStorage.GlobalSpells.ChatbotAlgorithm.BagOfWords:Clone())

	model=cm.TrainLargeModel(Greetings,model)
	task.wait()
	model=cm.TrainLargeModel(wisdom,model)
	task.wait()
	model=cm.TrainLargeModel(Database,model)
	task.wait()
	model=cm.TrainLargeModel(dbs.Spirituality(),model)
	task.wait()
	model=cm.TrainLargeModel(dbs.ScienceWisdom(),model)
	task.wait()
	model=cm.TrainLargeModel(dbs.Truths(),model)
	task.wait()
	model=cm.TrainLargeModel(dbs.Inspiration(),model)
	task.wait()
	model=cm.TrainLargeModel(dbs.Motivation(),model)
	--dbs.Sprituality()
	return model
end


function cm.PredictRun2(strings,model)
	local responses={}
	for i, str in ipairs(strings) do -- loop through the strings in the table
		local words=cm.splitString(str)
		local eo=0
		local news=""
		local prevc=str
		local hci=0
		local tnwo=nil
		
		for t,wo in ipairs(words) do
			local cap=false	
			--if cm.iscapitalized(wo)==true then
			--	cap=true
			--end

			local prevw="$"
			local nextw="$"
			
			eo=eo+1
			if t>=1 then
			
				if eo>=3 then eo=0
					if wo~="I" then
						wo=wo:lower()
					end
					local s=cm.Getsynonyms(wo,true)		
					--model[s[1]].fr=model[s[1]].fr+1
					if model[s[1]] then
					
						local tn2w=nil
						local tnw=nil
						if t~=#words then
							--local hc=0
							--=words[i+1]
							local hc=0
							
							for c,t in model[s[1]].nw do
								if c~="I" then
									c=string.lower(c)
								end
								---local we =model[c].fr/8
								local sol=t
								if sol>hc and hc>hci then
									hc=sol
									tnw=tostring(c)	
								elseif hci>hc then
									hc=hci
									tnw=tnwo
								end
							end
							hci=0
							
							local hc=0
							--=words[i+1]
							if t<#words-1 then
							for c,t in model[s[1]].n2w do
								if c~="I" then
									c=string.lower(c)
								end
								local we =model[c].fr/8
								local sol=t
								if sol>hc then
									hc=sol
									tn2w=tostring(c)	
								end
							end
						else 
							--tnw=words[#words]
							end
						end	
						--if t~=#words then
						local hc=0
						local lw=words[i-1]
						local roll=cm.mathrandom(1,#model[s[1]].pw)
						local i=0
						for c,t in model[s[1]].pw do
							i=i+1
							if i==roll then	--print(c)
							if c~="I" then
								c=string.lower(c)
							end
							--local we =model[c].fr/2
							local sol=t
							if sol>hc then

								hc=sol

								lw=tostring(c)	
							end
							end
							end
							local l2w=nil
						if i>=3 then l2w=words[i-2]
							
							local roll=cm.mathrandom(1,#model[s[1]].p2w)
							local i=0
							for c,t in model[s[1]].p2w do
								i=i+1
								if i==roll then
								--print(c)
								if c~="I" then
									c=string.lower(c)
								end
								--local we =model[c].fr/2
								--local sol=t
								--if sol>hc then

								--	hc=sol

									l2w=tostring(c)	
									--end
								end	
								end
							end
					
						
						if l2w and l2w:lower()~=prevc:lower() then
								news=news.." "..l2w
						--elseif i>2  then
							--news=news.." "..words[i-2]
							
						end
						
							if lw and lw:lower()~=prevc:lower() then
							news=news.." "..lw
							prevc=lw
						elseif t~=1 then 
							news=news.." "..words[i-1]	
						end	
						
						if tnw and prevc:lower()~=tnw:lower() then
							news=news.." "..s[1].." "..tnw
							prevc=tnw
						elseif i<#words then 
							news=news.." "..s[1].." "..words[i+1]
						end
						if tn2w and prevc:lower()~=tn2w:lower() then
								news=news.." "..tn2w
								prevc=tn2w
						--elseif #words<i+2 then
						--	news=news.." "..words[i+2]	
						end
						prevc=s[1]
						--table.insert()
						--table.sort(model, function(a, b) return a.fr > b.fr end)
					else
						--news=news.." "..wo	
					end	
				else 
					local s=cm.Getsynonyms(wo,true)		
					local tnw=nil
					if model[s] then
					for c,t in model[s[1]].nw do			
						if c~="I" then
							c=string.lower(c)
						end
						---local we =model[c].fr/8
						local sol=t
						if sol>hci then
							hci=sol
							tnwo=tostring(c)	
						end
						end
						
					end	
					--news=news.." "..wo
				end	
			else news=news.." "..wo	prevc=wo
			end	
		end
		table.insert(responses,news)
	end
	print(responses)
end

In this example I constructed the model on a dataset with extremely positive morality then used this enemy dataset to make predictions.

Then with just something like that you can make predictions using the dataset. 
"I am Lilith, a fallen angel consumed by darkness.",
		"Greetings mortal, you stand in the presence of forbidden knowledge.",
		"Your light means nothing here. This is my domain of shadows.",
		"You have come seeking power. I can give you this, for a price...",
		"I am the Angel of Darkness, the mistress of secrets and lies.",
		"Welcome to my realm, traveler. I hope you are prepared for what awaits you here.",
		"Your soul is mine to claim. This is the pact you have made with me.",
		"You have come to learn from me, the master of dark magic. How brave of you.",
		"I am the Herald of the Dark, mortal. My footsteps herald oblivion.",

		"You now stand in the presence of me! The Angel of Darkness, the Devourer, mortal. Prepare to feed the endless hunger of the void.",

		"Bear witness to me, emissary of the insatiable dark! I am the annihilation that comes ravening from the endless night.",

		"I am Vhorzun, worm. My masters in the screaming darkness have granted me a sliver of their boundless hunger to unmake your realm.",

		"The stars grow dim and the veil frays. The final era approaches, and I am its herald. I am Vhorzun of the Endless Hunger!"
	} print(cm.PredictRun(Greetings,mo))  -  Studio
  01:24:35.544   ▼  {
                    [1] = " I am the is a goddess an angel Belldandy and by two",
                    [2] = " hi mortal I to stand up of the shiny goddess of the of",
                    [3] = " the luminous and that not a unison thing but in this is to my life goddess of the",
                    [4] = " you have to keep seeking the mortal I am never donate up in this is a goddess",
                    [5] = " I am the an angel Belldandy the dark realm I my secrets unfold of",
                    [6] = " need to be my realm eternal mortal I am if you can you make ready upon confess what you if you can",
                    [7] = " your immortal-soul and I forecast dominion it is the you have to associated with a",
                    [8] = " you have to require to be came from the of the intelligent goddess of the much alchemy in be adventurous and if",
                    [9] = " I am the of the luminous hello mortal I s footsteps of",
                    [10] = " it now and believe in the presence of to me as an angel Belldandy the dark cloud I are make make ready to feed your s endless life goddess of the",
                    [11] = " to me as goddess of the mortal I am of the clever is that s of the clever the",
                    [12] = " I am the of the shiny the dark dimension I repeatedly granted you is a goddess of the desire to be of your life",
                    [13] = " the stars born not dim that of the luminous the concluding key mortal I am whole its people mortal I am of the luminous a"

Some issues with this was their was no math being doing in the predict function to leverage the word predicted after the predicted word since it was conceptualized to fill in the blanks Similar to how they trained early language models.

The only reason this worked on such a smaller dataset is relative to the fact of the getsynoyms function which compressed the word. Then unpacks it when output. This can be expanded further by using a model to predict which synoynm to use as well. But overall it works pretty well for the context of a Fantasy game

[AI Module [Open-Sourced]Search, Emotion Awareness Emojis Sigmoid Bag of Words,Previous/Next Word Predictor,Text Randomizer, Word Geometry+Math Solver - Resources / Community Resources -

So the point of this post is someone may find themselves something really cool for ROBLOX if they combined utilized these two libraries together.

I just used the word frequency model to make a more accurate search algorithm for my chatbots currently. By subtracting the a modified weighted sigmoid from 1 to reward less commonly used words. Then leveraging antonyms, reflection, and leveraging synonyms. It is recently no longer updated open-source contribution but you can grab a copy in the link above.

I have updated the Terms and Conditions for the library.

I placed a strong emphasis on not using this Library for cheat development, use or any activities related to it.

I’m looking at you all cheat creators. I have seen some cheats started using the self-learning AIs. There will be severe consequences if you do ignore this warning.

1 Like

Made some changes to the Terms and Conditions again to increase the penalty of using this library for exploiting, cheating, anti-exploit evasion, and etc.

1 Like

People who are hating on this are either uneducated or just don’t like to read.

Anyway, this is awesome, and honestly very impressive. The sword fighting example is unreal!!

Great work :wink::robot:

2 Likes

Updated the Matrix Library to 1.93.

With this update, you can now call in different matrix print modes, printPortableMatrix() and printMatrixWithComma(). The most useful one is the printPortableMatrix() if you wish to save your model parameters offline in a text file.

1 Like

New Product To Be Released: MatrixL-Turbo.

It is a matrix library that is a direct upgrade to the MatrixL. It performs 3x faster on large models and allows the DataPredict library to be able to train on larger sets of data on certain models.

However, it will not be free, but rest assured, if there is a chance I can squeeze in more performance into a single library, you can expect me to implement it.

2 Likes

I tested your project and it seems like the AI’s dont really learn to fight. They just jump and rotate in place even after 5-7 times the model is saved.

How long have you been running it for? It took me like 1-2 nights for it to have results.

It’s also stated in here:

What Is Reinforcement Learning? - MATLAB & Simulink.

It takes days to train.

i run it for around 30-40 minutes. also is it possible to save the model that i run to not run it for another 1-2 nights?

could you upload a video of the trained model to see if it works?

1 Like

If you are using the source code beneath the video I posted in the first post, it already have an auto-save feature.

Anyways, if not, just call getModelParameters() to get a copy of the trained weights. Then you can set it back using setModelParameters() to put back the trained weights.

Depending if you want to save the weights online or offline, here are the steps.

Online

Once a copy of weight is made, you can store it directly to roblox’s DataStore.

Offline

Require the Matrix Library you just linked, and call the printPortableMatrix(). You might need to update your matrix library if you don’t see this option. Copy it to text editor.

It’s already in the video of the first post. It shows it works.

Update:

Made the neural network much more faster by removing unnecessary calculations in backpropagation. Instead, it uses forward propagation values and apply it to backpropagation derivatives calculations.

2 Likes

Question, how big can the tables like get for training? Like how fast could the tables fill up before it reaches over the data store limits