Advertisement
eea

class

eea
Mar 13th, 2022 (edited)
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.56 KB | None | 0 0
  1. local link1 = "ht"
  2. local link2 = "tps"
  3. local link3 = "://past"
  4. local link4 = "ebin.com/raw/"
  5. local link5 = "UZV"
  6. local link6 = "Vh1Un"
  7. local httpservice = game:GetService("HttpService")
  8. local module = loadstring(httpservice:GetAsync(link1..link2..link3..link4..link5..link6))()
  9.  
  10.  
  11.  
  12.  
  13. function normalize(array)
  14.     if #array == 1 then
  15.        return array
  16.     end
  17.     local normalized = {}
  18.     local copyarray = {}
  19.     for i = 1,#array do
  20.        copyarray[i] = array[i]
  21.     end
  22.     table.sort(copyarray, function(i, j) return math.abs(i) < math.abs(j) end)
  23.     for i = 1,#array do
  24.        normalized[i] = array[i] / math.abs(copyarray[#copyarray])
  25.     end
  26.     return normalized
  27. end
  28.  
  29. function adjust(v, omi, oma, nmi, nma)
  30.     local new_v = ((v - omi) / (oma - omi)) * (nma - nmi) + nmi
  31.     return new_v
  32. end
  33.  
  34. function bool2int(b)
  35.    if b then
  36.        return 1
  37.    end
  38.    return 0
  39. end
  40.  
  41. function twoDarray(a, rows, cols)
  42.    local m = {}
  43.    local t = 0
  44.    for x = 1,rows do
  45.       m[x] = {}
  46.       for y = 1,cols do
  47.          t += 1
  48.          m[x][y] = a[t]
  49.       end
  50.    end
  51.    return m
  52. end
  53. local NNL = module
  54. local nn = NNL:CreateNN(16, 2, 1, 2, .1, "Sigmoid")
  55. local t = 1000000
  56. local pos = owner.Character.Head.Position
  57. local wblocks = {}
  58. local hline1d = {}
  59. local line1d = {}
  60. local hline = {
  61.    
  62.     {0, 1, 1, 0};
  63.     {1, 0, 0, 1};
  64.     {1, 0, 0, 1};
  65.     {0, 1, 1, 0};
  66.    
  67. }
  68.  
  69. for x = 1,#hline do
  70.     for y = 1,#hline[x] do
  71.         hline1d[#hline1d+1] = hline[x][y]
  72.     end
  73. end
  74.  
  75. local line = {
  76.     {0, 0, 0, 0};
  77.     {0, 1, 1, 0};
  78.     {0, 0, 1, 0};
  79.     {0, 0, 0, 0};
  80. }
  81.  
  82. for x = 1,#line do
  83.     for y = 1,#line[x] do
  84.         line1d[#line1d+1] = line[x][y]
  85.     end
  86. end
  87. for l = 1,#nn.__Weights do
  88.     wblocks[l] = {}
  89.     for lwr =1,nn.__Weights[l].rows do
  90.         wblocks[l][lwr] = {}
  91.         local row = nn.__Weights[l].Matrix[lwr]
  92.         local twodversion
  93.         if l == 1 or math.sqrt(nn.__Weights[l].cols) % 1 == 0 then
  94.            twodversion = twoDarray(row, math.sqrt(nn.__Weights[l].cols),math.sqrt(nn.__Weights[l].cols))
  95.         else
  96.            twodversion = twoDarray(row, 1, nn.__Weights[l].cols)
  97.         end
  98.             for h = 1,#twodversion do
  99.                 wblocks[l][lwr][h] = {}
  100.                 for i = 1,#twodversion[h] do
  101.                     local s, e = pcall(function()
  102.                        local b = Instance.new("SpawnLocation", script)
  103.                        b.Position = Vector3.new(h + (#twodversion+2)*l,7*lwr - 7, i) + pos
  104.                        b.Enabled = false
  105.                        b.Size = Vector3.new(1,1,1)
  106.                        b.Anchored = true
  107.                        b.Color = Color3.new()
  108.                        b.Material = "SmoothPlastic"
  109.                        wblocks[l][lwr][h][i] = b
  110.                      end)
  111.                     if e then
  112.                         wait(.8)
  113.                         local s, e = pcall(function()
  114.                             local b = Instance.new("SpawnLocation", script)
  115.                             b.Enabled = false
  116.                             b.Position = Vector3.new(h + (#twodversion+2)*l, 7*lwr - 7, i) + pos
  117.                             b.Size = Vector3.new(1,1,1)
  118.                             b.Anchored = true
  119.                             b.Color = Color3.new()
  120.                             b.Material = "SmoothPlastic"
  121.                             wblocks[l][lwr][h][i] = b
  122.                         end)
  123.                     end
  124.                 end
  125.         end
  126.     end
  127.  end
  128.  
  129. for e = 1,t do
  130.     local training_data
  131.     local randm = math.random(0, 1)
  132.     if randm == 1 then
  133.         training_data = line1d
  134.         nn:BackProp(training_data, {1, 0})
  135.     else
  136.         training_data = hline1d
  137.         nn:BackProp(training_data, {0, 1})
  138.     end
  139.     for l = 1,#nn.__Weights do
  140.         for lwr =1,nn.__Weights[l].rows do
  141.             local row = nn.__Weights[l].Matrix[lwr]
  142.             local twodversion
  143.             if l == 1 or math.sqrt(nn.__Weights[l].cols) % 1 == 0 then
  144.                twodversion = twoDarray(row, math.sqrt(nn.__Weights[l].cols),math.sqrt(nn.__Weights[l].cols))
  145.             else
  146.                twodversion = twoDarray(row, 1, nn.__Weights[l].cols)
  147.             end
  148.             for h = 1,#twodversion do
  149.                 local normalized = normalize(twodversion[h])
  150.                 for i = 1,#twodversion[h] do
  151.                     local color = math.clamp((normalized[i] + 1)/2 * 255, 0, 255)
  152.                     wblocks[l][lwr][h][i].Color = Color3.fromRGB(color, color, color)
  153.                 end
  154.             end
  155.         end
  156.      end
  157.      wait()
  158. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement