I watched this video and later convert to Lua
I wondering is that count as neural network ?
local module = require(game.ServerScriptService.ModuleScript)
function Think(times)
inputs = {
workspace.Main.CFrame.X,
workspace.Main.CFrame.Y,
workspace.Main.CFrame.Z
}
local cframe = CFrame.new(workspace.Main.Position,workspace.Target.Position)
Y= {}
local Target = Instance.new("Part",workspace)
Target.Size = Vector3.new(8,.1,.1)
Target.Color = Color3.fromHSV(0, 1, 1)
Target.CFrame = CFrame.new(workspace.Main.Position,workspace.Main.Position+cframe.LookVector) * CFrame.Angles(0,math.rad(90),0) + (cframe.LookVector * Target.Size.X/2)
if cframe.LookVector.X < 0 then
table.insert(Y,{-cframe.LookVector.X,true})
elseif cframe.LookVector.X >= 0 then
table.insert(Y,{cframe.LookVector.X,false})
end
if cframe.LookVector.Y < 0 then
table.insert(Y,{-cframe.LookVector.Y,true})
elseif cframe.LookVector.Y >= 0 then
table.insert(Y,{cframe.LookVector.Y,false})
end
if cframe.LookVector.Z < 0 then
table.insert(Y,{-cframe.LookVector.Z,true})
elseif cframe.LookVector.Z >= 0 then
table.insert(Y,{cframe.LookVector.Z,false})
end
function activator(x)
return module.Sigmoid(x)
end
syn0 = {
module.RandomWeight(),module.RandomWeight(),module.RandomWeight()
}
syn1 = {
module.RandomWeight(),module.RandomWeight(),module.RandomWeight()
}
for i =1,times do
l0 = inputs
l1 = {
activator(l0[1]*syn0[1]),
activator(l0[2]*syn0[2]),
activator(l0[3]*syn0[3])
}
l2 = {
activator(l1[1]*syn1[1]),
activator(l1[2]*syn1[2]),
activator(l1[3]*syn1[3])
}
l2_error = {
Y[1][1]-l2[1],
Y[2][1]-l2[2],
Y[3][1]-l2[3]
}
l2_delta = {
l2_error[1]*l2[1],
l2_error[2]*l2[2],
l2_error[3]*l2[3]
}
l1_error = {
l2_delta[1]*syn1[1],
l2_delta[2]*syn1[2],
l2_delta[3]*syn1[3]
}
l1_delta = {
l1_error[1] * l1[1],
l1_error[2] * l1[2],
l1_error[3] * l1[3]
}
syn1 = {
syn1[1]+(l1[1]*l2_delta[1]),
syn1[2]+(l1[2]*l2_delta[2]),
syn1[3]+(l1[3]*l2_delta[3])
}
syn0 = {
syn0[1]+(l0[1]*l1_delta[1]),
syn0[2]+(l0[2]*l1_delta[2]),
syn0[3]+(l0[3]*l1_delta[3])
}
OutputTable = {["X"] = l2[1],["Y"] = l2[2],["Z"] = l2[3]}
if Y[1][2] == true then
OutputTable.X = -l2[1]
end
if Y[2][2] == true then
OutputTable.Y = -l2[2]
end
if Y[3][2] == true then
OutputTable.Z = -l2[3]
end
end
Values = OutputTable
local part = Instance.new("Part",workspace)
part.Size = Vector3.new(8,.1,.1)
part.Color = Color3.fromHSV(0.5, 1, 1)
part.CFrame = CFrame.new(workspace.Main.Position,workspace.Main.Position+Vector3.new(Values.X,Values.Y,Values.Z)) * CFrame.Angles(0,math.rad(90),0) + (Vector3.new(Values.X,Values.Y,Values.Z) * part.Size.X/2)
game.Debris:AddItem(part,5)
game.Debris:AddItem(Target,5)
return OutputTable
end
Think(5000)