Icon representing a recipe

Recipe: neuroNet104findAminosOnly3PUBG2.Lua

created by zo3xiaJonWeinberg

Profile


Name
neuroNet104findAminosOnly3PUBG2.Lua
ID
105130
Shared with
Public
Parent
None
Children
Created on
August 22, 2021 at 19:33 PM UTC
Updated on
August 22, 2021 at 19:33 PM UTC
Description

Login to Fold.it to download.
Weile fang zai ni de mingdan,
xian denglu zai fold.it .

If you see Error: Can't find specified
recipe, then it is currently unshared.
But you can ask for it.

click Show Output terminal
button.
open Behavior tab see fitness
rising and
Check Recipe Score Modding.
keep info width within 1 line
for hover info.
This neural network A.i. is a work
in progress.
Welcome to rate or expand the
hidden layers or add inputs,
outputs like parameters
or teach it to count.
An earlier ReLU version already
did somewhat OK
on the XOR problem, though it just
converged its output from 80 to 0
for both true 1 and false 0..
Maybe try ReLU for hiddens only.
Best for new puzzles like Linker
people are unfamiliar with,
or simple pred. puzzles.
Works for multistart arabidopsis.

mar 12 public neuroNet41-
differentiateNegatives
I ought to write these
updates in chronological
order (instead of
the top being
the newest).

mar6 accidentally modified old version, had to merge edits
feb.26 alphago likes the "kicks".
count the double kicks.

feb 23. this NN finally got a higher
score than AFK3 on beg. cov.
but it had 23 cuts.
shifu:
layer , neuron:
dendrites: -0.1, -0.9, 0.4, 0.1, ,
bias: 0.6,
neuron:
dendrites: 0.2, -1, -0.4, 0.3, ,
bias: 1
layer , neuron:
dendrites: 0.2, 0.9, , bias: -0.9

So now that the NN's are proven
ready, I'm making it harder
by making cuts or filters disabled
only give half or 0 points.

Feb. 9, more comments,
and save shifu NN as note
which can be copied by user.
example:
shifu:
layer , neuron:
dendrites: -0.1, -0.9, 0.4, 0.1, ,
bias: 0.6,
neuron:
dendrites: 0.2, -1, -0.4, 0.3, ,
bias: 1
layer , neuron:
dendrites: 0.2, 0.9, , bias: -0.9

publishing.
quick fix of bug where pokemon 1
could not be recorded as strongest
or 2nd strongest.
Feb. 7. noticed a.i. using time
consuming action MSG All
perhaps to bide time
because I did deduct negative
score somewhat (alpha=0.1)
but divided it by time.
Update feb. 2021, fixed index out
of bounds for insert.

Jan. 2021
Fixed Design bug del. res
out of bounds (del. 2x).
Still has out of bounds insert bug.
Discarding update ideal14's
advanced evolution in favor of
"disciple exceeds master".
Also trying out muta worst seg.

2020
It likes Rebuild worst for prediction.
Fixed choosing best scorer
subtle bug.
Had been assigning non-weakest
as strongest, so last critter tended
to be "strongest".
Also added runner-up.
now without creditbest.
and, or?
greyscale and teacher
w/o random, outputs converge to 1
after waking from a 9 hour sleep
Now with random inputs.
W/ random inputs,
convergence after 1 hour (hora)
realized the xor function was bugged
fixed xor, changed stuff
converges to 98.5% fitness
after 10 min.
"Code 871".
now IRL problem, clash.
middle ground 0.9 after 5 mins

2021-04-02
"I don't always mutate the dendrite,
but when I do, it's by up to 0.5"

4-24
3b->4

2021-4-24 9AM Data balance
because stochastic
gradient descent
is more complicated

'21-5-21
Bifurcated axon for more
realistic simulation of neurons.
And re-added a hidden layer.
But these make solving XOR slower.
Check previous versions for
a good XOR demo.

road less traveled test for forked
axons, which depend on
neighboring electrical activity.
--_-
__-_

Jun 11.
Could I draw a NN by hand that
tries every number within a range
an equal number of times?
Could it count? If the input was not
run through a function, maybe
I could. If it was squeezed with
tanh, I doubt it.
So it seems only fair to give the
unsqueezed input to the A.i.

V.87: Regret retractive braces

June 2X: Summer, don't wanna
run it myself. Too dry.

Jul. 16:
Peanut and [Western only]
eggplant are shaped like oxalate,
and olivetol is shaped
like the "green stuff"
(and some lichen leaves too,
I guess),
and this neural network is
shaped more like gnocchi now,
because I dreamt of gnocchi
and it's the NN beginner shape.

Aug. 22
I was having trouble restricting
the NN outputs to the range
of acceptable "moves",
so I made a penalty proportionate
to the distance out of bounds,
hence the PUBG ring of
fire mechanic.
Like, you can't set an amino acid to
be DNA or vinegar, so the NN
needs to be punished.
Hotfix to stop NN from being
recurrent,
as I'm probably doing it wrong.
Noon hotfix 2 to further avoid
recurrence by ignoring last
action paramater.

Best for


Code


--keep blank line at top 4 debug help() --Fn Down or Up to jump, but creates "," at top humble=true --humble=no clover axon testXor=true hiddenLayers=3 yellowWood=1 --math.random( chooseAminos=true--false-- debugActions=false askXor=dialog.CreateDialog("Test XOR function?") askXor.l1=dialog.AddLabel("Exclusive Or function") askXor.l2=dialog.AddLabel("Is Bella in an exclusive ") askXor.l3=dialog.AddLabel("relationship with Edward or Jacob ") askXor.l4=dialog.AddLabel("but not both?") askXor.play=dialog.AddButton("PlayFoldit",0) askXor.test=dialog.AddButton("TestXOR",1) resAskXor=dialog.Show(askXor) if resAskXor==0 then testXor=false --Josh fuse snippet behavior.SetHidingImportance(0.5) five=behavior.GetHidingImportance() behavior.SetHidingImportance(0.6) six=behavior.GetHidingImportance() if five==six then local ask = dialog.CreateDialog("Recipe modding is disabled") ask.l1=dialog.AddLabel("You may want to")-- cancel,") ask.l2=dialog.AddLabel(" open(dakai) the Behavior/Comporte tab,") ask.l3=dialog.AddLabel(" and click Recipe Score Modding.")--, then re-run") ask.l4=dialog.AddLabel("You don't need to cancel") ask.l5=dialog.AddLabel("buyong quxiao") ask.OK = dialog.AddButton("OK/Haode",1) --Wo bu guan", 1) ask.Cancel = dialog.AddButton("Cancel/quxiao", 0) res=dialog.Show(ask) if res==0 then exitexitexit() end end end function resetBehavior() behavior.SetClashImportance ( 1.0 ) behavior.SetSidechainHBondImportance ( 1.0 ) behavior.SetBackboneHBondImportance ( 1.0 ) behavior.SetPackingImportance ( 1.0 ) behavior.SetHidingImportance ( 1.0 ) behavior.SetPairwiseImportance ( 1.0 ) behavior.SetDensityImportance ( 1.0 )--jon end --end Josh's Fuse snippet worstPossible=-999999.99999 multiStart=false HASMUTABLE=false descrTxt=puzzle.GetDescription() if #descrTxt>0 and (descrTxt:find("design") or descrTxt:find("designs")) then HASMUTABLE=true IDEALCHECK=true HANDFOLD=true end --copied from AFK3.1.1 using new foldit editor if #descrTxt>0 and (descrTxt:find("multi-start") or descrTxt:find("start positions")) then multiStart=true end --if HASMUTABLE then environInput1=1 else environInput1=0 end print("muta ") print(HASMUTABLE) --can't cat ----- --So I cut and pasted these functions from BWP here for AFK. NonLockedSegList={} function segCnt() return structure.GetCount() end --jon function IsUnlockedSeg( seg1 ) return not structure.IsLocked( seg1 ) end function FindAllMovableSegs( ) --segCnt=structure.GetCount() --jon lazy NonLockedSegList={} --jon reinit in case deleting res. for i=1, structure.GetCount() do --jon if structure.IsLocked( i ) then PuzzleHasLockedSegs = true else NonLockedSegList[ #NonLockedSegList + 1] = i end end if PuzzleHasLockedSegs then for i=1, structure.GetCount() do --jon if IsUnlockedSeg( i ) then MinUnlockedSeg = i break end end for i=segCnt(), 1, -1 do if IsUnlockedSeg( i ) then MaxUnlockedSeg = i break end end end return false end FindAllMovableSegs() ------ param=099 squeezeToInt=function(max) --param anything like -99.8 -- tanh -> -1 to 1 -- 0 to 2 -- 0 to 1 -- 0 to max-1 -- 1 to max+.99 for rounding fairness --choice=math.floor((math.tanh(param)+1)/2*(max-1)+1.99) min=1 choice=math.floor(param%(max-min)+min) --Lua makes squeezing into range lil. complicated because lists start at 1 return choice end squeezeFloat=function(min,max) --bug where output constant value at max --param anything like -99.8 -- tanh -> -1 to 1 -- 0 to 2 -- 0 to 1 -- 0 to max-1 -- 1 to max+.99 for rounding fairness --choice=((math.tanh(param)+1)/2*((max-min)-1)+1)+min --Lua makes squeezing into range lil. complicated because lists start at 1 --choice=eulerAct(param)*(max-min)+min choice=param%(max-min)+min print("choice is "..choice) return choice end eulerAct=function(a) --from xviniette's AsteroidsLearning Neuroevolution.js on Github --activation:function(a){ ap = (-a)/1 return (1/(1 + math.exp(ap))) --like tanh but from 0 to 1 instead of -1 to 1 --exp(x) is Euler's constant e^x end print("euler "..eulerAct(-4.5)) ------------A.i. learns v7 filters performAction={} actionDescription={} function printTimeAndScore(startTime, scoreGain, currentStateString) local ss = (os.time() - startTime) % 60 local mm = (((os.time() - startTime - ss) % 3600) / 60) local hh = (os.time() - startTime - mm*60 - ss) / 3600 print("Time: " .. string.format("%02d", hh) .. ":" .. string.format("%02d", mm) .. ":" .. string.format("%02d", ss) .. ". " .. currentStateString) print(" Score: " .. current.GetEnergyScore() .. ", Total: +" .. scoreGain) end bookmark=0 function initializeActions() performAction = {} actionDescription = {} -- performAction[0] = function() local ss=math.random(1,structure.GetCount()-3) selection.SelectRange(ss,ss+3) structure.MutateSidechainsSelected(1) --All(1) end actionDescription[0] = "Mutate(1)" -- table.insert(performAction,function() lastOutput=0 --brainOutput=1 param=0 end) actionDescription[1] = "Reset prev. brainOutput to not spin out of control" --keep this at first action, because Lua makes 3.56e+89 % 5 or % 6 to 1 I mean 0 performAction[2] = function() local startSegmentNumber = math.random(1, structure.GetCount() - 9) local endSegmentNumber = math.random(startSegmentNumber + 8, structure.GetCount()) local b=band.AddBetweenSegments(startSegmentNumber, endSegmentNumber) band.SetStrength(b, 10) --jon b band.SetGoalLength(b, structure.GetDistance(startSegmentNumber, endSegmentNumber) * 0.9) end actionDescription[2] = "Add random band" performAction[3] = function() band.DeleteAll() end actionDescription[3] = "Delete all bands" recentbest.Save() --overwrite it first performAction[4] = function() recentbest.Restore() --still somehow accessing FindAllMovableSegs() --print("banned") end actionDescription[4] = "Restore recent best" performAction[5] = function() local startSegmentNumber = math.random(1,structure.GetCount() - 3) selection.DeselectAll() selection.SelectRange(startSegmentNumber, startSegmentNumber + 3) structure.RebuildSelected(2) selection.DeselectAll() end actionDescription[5] = "Rebuild random segment" performAction[6] = function() behavior.SetClashImportance(1) end actionDescription[6] = "Set clash importance to 1" performAction[7] = function() behavior.SetClashImportance(0.5) end actionDescription[7] = "Set clash importance to 0.5" performAction[8] = function() behavior.SetClashImportance(0.02) end actionDescription[8] = "Set clash importance to 0.02" performAction[9] = function() local startSegmentNumber = math.random(1, structure.GetCount() - 3) selection.DeselectAll() selection.SelectRange(startSegmentNumber, startSegmentNumber + 3) structure.IdealizeSelected() selection.DeselectAll() end table.insert(actionDescription,"Idealize random segment") performAction[10] = function() FindAllMovableSegs() cut=(NonLockedSegList[math.random(#NonLockedSegList) ]) structure.InsertCut(cut) structure.WiggleAll(1) structure.DeleteCut(cut) end actionDescription[10] = "Wiggle(1 band safe 2 sided interf." --interface --no red lines --table.insert(performAction,function() structure.MutateSidechainsAll(1) end) --table.insert(actionDescription,"mutate1 moved from action 0") function ParseError ( errmsg ) local reason local start, stop, line, msg start, stop, line, msg = errmsg:find ( ":(%d+):%s()" ) if msg ~= nil then errmsg = errmsg:sub ( msg, #errmsg ) end return errmsg end -- -- SafeSnap uses the Lua protected call function, pcall, -- to call rotamer.SetRotamer -- -- SafeSnap returns a numeric return code and an error message. -- -- The return codes are: -- -- 0 - successful, error message is nil -- -1 - bad rotamer index -- -- Errors other than a bad rotamer index are rethrown using -- the Lua function error(). -- function SafeSnap ( segIdx, rotIdx ) -- -- error message when attempting to snap to an invalid rotamer -- local BADSNAP = "(snap index out of bounds)" -- -- don't allow a bad rotamer to stop us -- local good, errmsg = pcall ( rotamer.SetRotamer, segIdx, rotIdx ) if good then return 0, nil else local err2 = ParseError ( errmsg ) local errp = err2:find ( BADSNAP ) if errp ~= nil then return -1, err2 end error ( errmsg, 0 ) end end table.insert(performAction, function() SafeSnap(math.random(structure.GetCount()), param) end) table.insert(actionDescription,"pcall rotamer for ligand or res") table.insert(performAction,function() local segmentIndex1=math.random(structure.GetCount()) local segmentIndex2=math.random(structure.GetCount()) local atomIndex1=math.random(structure.GetAtomCount(segmentIndex1)) local atomIndex2=math.random(structure.GetAtomCount(segmentIndex2)) local symnr2=math.random(0,structure.GetSymCount()) return band.AddBetweenSegments(segmentIndex1,segmentIndex2,atomIndex1,atomIndex2,symnr2) end) table.insert(actionDescription, "Add a band between the two segments. By default bands to the backbone. Specify an atom number from 0 to structure.GetAtomCount() to band to a different atom. (0 for the default backbone atom) Returns band number. Specify an symnr from 0 t") table.insert(performAction,function() local lengthOfSegment = math.random(1, 3) local segmentInformation = {} local workSegmentNumber = math.random(1, 3) local function sortSegments(segmentInformation) for i = 1, #segmentInformation - 1 do for j = i + 1, #segmentInformation do if segmentInformation[i][3] > segmentInformation[j][3] then segmentInformation[i], segmentInformation[j] = segmentInformation[j], segmentInformation[i] end end end return segmentInformation end for i = 1, structure.GetCount() - lengthOfSegment + 1 do segmentInformation[i] = {i, i + lengthOfSegment - 1, current.GetSegmentEnergyScore(i) } for j = 2, lengthOfSegment do segmentInformation[i][3] = segmentInformation[i][3] + current.GetSegmentEnergyScore(i + j - 1) end end segmentInformation = sortSegments(segmentInformation) selection.DeselectAll() selection.SelectRange(math.max(segmentInformation[workSegmentNumber][1] - 1, 1), math.min(segmentInformation[workSegmentNumber][2] + 1, structure.GetCount())) structure.RebuildSelected(2) selection.DeselectAll() end) table.insert(actionDescription,"Rebuild worst segment") table.insert(performAction,function() local startSegmentNumber = math.random(1, structure.GetCount() - 9) local endSegmentNumber = math.random(startSegmentNumber + 8, structure.GetCount()) local b=band.AddBetweenSegments(startSegmentNumber, endSegmentNumber) band.SetStrength(b, 10) band.SetGoalLength(b, structure.GetDistance(startSegmentNumber, endSegmentNumber) * 1.1) end) table.insert(actionDescription,"expand band") table.insert(performAction,function() copier=math.random(1,structure.GetCount()) structure.SetSecondaryStructure(copier,structure.GetSecondaryStructure( math.max(math.min(copier+math.random(0,1)*2-1,1),structure.GetCount()) ) ) end) table.insert(actionDescription,"extend ss") table.insert(performAction,function() freeze.Freeze(math.random(1,structure.GetCount()),false,true) --bb --sc end) table.insert(actionDescription,"freeze sc") table.insert(performAction,function() freeze.Freeze(math.random(1,structure.GetCount()),true,false) --bb --sc end) table.insert(actionDescription,"freeze bb") table.insert(performAction,function() freeze.Freeze(math.random(1,structure.GetCount()),true,true) --bb --sc end) table.insert(actionDescription,"freeze bb sc") --threoretically could freeze neither for testing table.insert(performAction,function() freeze.Unfreeze(math.random(1,structure.GetCount()),false,true) --bb --sc end) table.insert(actionDescription,"unfreeze sc") table.insert(performAction,function() freeze.Unfreeze(math.random(1,structure.GetCount()),true,false) --bb --sc end) table.insert(actionDescription,"unfreeze bb") act="freeze.Unfreeze(math.random(1,structure.GetCount()),true,true) --bb --sc" table.insert(performAction,function() pcall(act) print(act) end) table.insert(actionDescription,act)--"unfreeze bb") act="kokokokok" --still works, at least in Lua table.insert(performAction,function() freeze.UnfreezeAll() --bb --sc end) table.insert(actionDescription,"unfreeze all") table.insert(performAction,function() freeze.FreezeAll() --bb --sc end) table.insert(actionDescription,"freeze all") table.insert(performAction,function() behavior.SetBackboneHBondImportance(math.random(0,300)/100) end) table.insert(actionDescription,"behavior.SetBackboneHBondImportance (rand)") table.insert(performAction,function() behavior.SetBackboneHBondImportance(1) end) table.insert(actionDescription,"behavior.SetBackboneHBondImportance(1)") table.insert(performAction,function() resetBehavior() end) table.insert(actionDescription,"resetBehavior") table.insert(performAction,function() behavior.SetFiltersDisabled(true) end) table.insert(actionDescription,"disable filters") table.insert(performAction,function() behavior.SetFiltersDisabled(false) end) table.insert(actionDescription,"enable filters") table.insert(performAction,function() behavior.SetDensityImportance(squeezeFloat(0,3)) end) table.insert(actionDescription,"density, enable recipe score modding first") table.insert(performAction,function() behavior.SetDensityImportance(1) end) table.insert(actionDescription,"density1, enable recipe score modding first") table.insert(performAction,function() options={"l","m","a"} if behavior.HighPowerAllowed() then table.insert(options,"h") end behavior.SetWigglePower(options[squeezeToInt(#options)]) --old buggy algo: math.floor(#options/2*(math.tanh(param)+1)) end) table.insert(actionDescription,"power param") table.insert(performAction,function() options={"l","m","a"} if behavior.HighPowerAllowed() then table.insert(options,"h") end behavior.SetWigglePower("a") end) table.insert(actionDescription,"power auto") table.insert(performAction,function() options={"l","m","a"} if behavior.HighPowerAllowed() then table.insert(options,"h") end behavior.SetWigglePower(options[math.random(#options)]) end) table.insert(actionDescription,"power rand") table.insert(performAction,function() FindAllMovableSegs() cut=NonLockedSegList[math.random(#NonLockedSegList)] --plz only unlocked structure.InsertCut(cut) behavior.UseCutBands(false) seg=NonLockedSegList[math.random(#NonLockedSegList)] --plz not the cut options={"h","l","e","a"} ss=options[math.random(4)] structure.SetSecondaryStructure(seg,ss) selection.DeselectAll() selection.Select(seg) structure.IdealSSSelected() --need cut beforehand in linker behavior.UseCutBands(true) behavior.SetClashImportance(1) structure.WiggleAll(1) structure.DeleteCut(cut) end) table.insert(actionDescription,"random SS, idealSS") table.insert(performAction,function() structure.LocalWiggleAll(1) end) table.insert(actionDescription,"LwA") table.insert(performAction,function() FindAllMovableSegs() structure.InsertResidue(NonLockedSegList[math.random(#NonLockedSegList) ]) FindAllMovableSegs() --structure.WiggleAll(1) --debug end) table.insert(actionDescription,"ins") table.insert(performAction,function() FindAllMovableSegs() structure.DeleteResidue(NonLockedSegList[math.random(#NonLockedSegList) ]) FindAllMovableSegs() --structure.WiggleAll(1) --debug end) table.insert(actionDescription,"del. seg, may cause band glitch") table.insert(performAction,function() FindAllMovableSegs() cut=(NonLockedSegList[math.random(#NonLockedSegList) ]) structure.InsertCut(cut) table.remove(NonLockedSegList,cut) --temporary if #NonLockedSegList>0 then structure.DeleteResidue(NonLockedSegList[math.random(#NonLockedSegList) ]) --hopefully diff. end --structure.DeleteCut(cut) --can be out of range FindAllMovableSegs() delCuts() --defined below end) table.insert(actionDescription,"cut and del. seg") --for 2 sided interface table.insert(performAction,function() puzzle.StartOver() FindAllMovableSegs() end) table.insert(actionDescription,"reset puzzle. maybe necessary for multi-start puzzles.".. "\n, doesn't exit evolver mode like manual reset does. ") --multi table.insert(performAction,function() if multiStart or current.GetEnergyScore()>10000 then puzzle.StartOver() FindAllMovableSegs() end end) table.insert(actionDescription,"reset puzzle if>10000. for multi-entries contest.".. "\n, doesn't exit evolver mode like manual reset does. ") --multi table.insert(performAction,function() save.Quicksave(3) end) table.insert(actionDescription,"save3") table.insert(performAction,function() save.Quickload(3) FindAllMovableSegs() end) table.insert(actionDescription,"load3") table.insert(performAction,function() save.Quickload(9) FindAllMovableSegs() end) table.insert(actionDescription,"load9") table.insert(performAction,function() creditbest.Restore() FindAllMovableSegs() end) table.insert(actionDescription,"credit") table.insert(performAction,function() absolutebest.Restore() FindAllMovableSegs() end) table.insert(actionDescription,"abs best") table.insert(performAction,function() local ss=math.random(1,structure.GetCount()-3) selection.SelectRange(ss,ss+3) structure.ShakeSidechainsSelected(1) --All(1) end) table.insert(actionDescription,"shake(1)") function selectWorstSeg() local lengthOfSegment = math.random(1, 3) local segmentInformation = {} local workSegmentNumber = math.random(1, 3) --jon asks if Quicksort local function sortSegments(segmentInformation) for i = 1, #segmentInformation - 1 do for j = i + 1, #segmentInformation do if segmentInformation[i][3] > segmentInformation[j][3] then segmentInformation[i], segmentInformation[j] = segmentInformation[j], segmentInformation[i] end end end return segmentInformation end for i = 1, structure.GetCount() - lengthOfSegment + 1 do segmentInformation[i] = {i, i + lengthOfSegment - 1, current.GetSegmentEnergyScore(i) } for j = 2, lengthOfSegment do segmentInformation[i][3] = segmentInformation[i][3] + current.GetSegmentEnergyScore(i + j - 1) end end segmentInformation = sortSegments(segmentInformation) selection.DeselectAll() selection.SelectRange(math.max( segmentInformation[workSegmentNumber][1] - 1, 1), math.min(segmentInformation[workSegmentNumber][2] + 1, structure.GetCount())) end table.insert(performAction,function() selectWorstSeg() structure.MutateSidechainsSelected(1) selection.DeselectAll() end) table.insert(actionDescription,"muta worst segment") table.insert(performAction,function() selectWorstSeg() structure.WiggleSelected(2,true,true) selection.DeselectAll() end) table.insert(actionDescription,"wig bb sc worst segment") table.insert(performAction, function() i=math.random(1,structure.GetCount()) -- do --abridged for debugging structure.SetAminoAcid(i,"e") --e for msg --acids arndceqghilkmfpstwyv --g for glycine --v for valine, suggested by Enzyme for 1947 --end end) table.insert(actionDescription,"set amino msg") table.insert(performAction, function() bookmark=(bookmark)%structure.GetCount()+1 --7%5=2 ... i=bookmark --do --abridged for debugging structure.SetAminoAcid(i,"e") --e for msg --acids arndceqghilkmfpstwyv --g for glycine --v for valine, suggested by Enzyme for 1947 --end end) table.insert(actionDescription,"set amino msg bookmark") table.insert(performAction, function() i=math.random(1,structure.GetCount()) -- do --abridged for debugging structure.SetAminoAcid(i,"v") --e for msg --acids arndceqghilkmfpstwyv --g for glycine --v for valine, suggested by Enzyme for 1947 --end end) table.insert(actionDescription,"set amino val") table.insert(performAction, function() i=math.random(1,structure.GetCount()) -- do --abridged for debugging structure.SetAminoAcid(i,"g") structure.SetSecondaryStructure(i,"l") --e for msg --acids arndceqghilkmfpstwyv --g for glycine --v for valine, suggested by Enzyme for 1947 --end end) table.insert(actionDescription,"set amino gly for blueprint") table.insert(performAction, function() i=math.random(structure.GetCount()) aminos="arndceqghilkmfpstwyv" choice=math.random(#aminos) local char = aminos:sub(choice,choice) structure.SetAminoAcid(i,char) --e for msg --g for glycine --v for valine, suggested by Enzyme for 1947 end) table.insert(actionDescription,"set amino rand") table.insert(performAction, function() i=math.random(structure.GetCount()) aminos="arndceqghilkmfpstwyv" choice=squeezeToInt(#aminos) local char = aminos:sub(choice,choice) structure.SetAminoAcid(i,char) --e for MSG, q for glutamine --g for glycine --v for valine, suggested by Enzyme for 1947 end) table.insert(actionDescription,"set amino param") table.insert(performAction, function() aminos="arndceqghilkmfpstwyv" i=math.random(#aminos) choice=squeezeToInt(structure.GetCount()) print("choice"..choice) local char = aminos:sub(i,i) structure.SetAminoAcid(choice,char) --e for MSG, q for glutamine --g for glycine --v for valine, suggested by Enzyme for 1947 end) table.insert(actionDescription,"set amino by param") --imported from AiLearns22 table.insert(performAction,function() --Bands in Space local s1=math.random(structure.GetCount()) local str=math.random(0.1,1) local len=math.random(1,20) --jon: 1-1000 local theta = math.acos(math.random()) --jon: arccosine local phi = 2 * math.pi * math.random() local segmentXAxis=0 local segmentYAxis=0 while true do --all 3 must be different segmentXAxis = math.random(structure.GetCount())--segCnt) --jon segmentYAxis = math.random(structure.GetCount())--segCnt) --jon if segmentXAxis~=s1 and segmentYAxis~=s1 and segmentXAxis~=segmentYAxis then break end end --{segmentOrigin, segmentXAxis, segmentYAxis, rho, theta, phi} band.Add(s1, segmentXAxis, segmentYAxis, len, theta, phi, str) --bands.AddBand(b) --puzzle.StartOver() end) table.insert(actionDescription,"band in space") table.insert(performAction,function() --Bands in Space local s1=math.random(structure.GetCount()) local str=math.random(0.1,1) local len=3.5 --angstroms local theta = math.acos(math.random()) --jon: arccosine local phi = 2 * math.pi * math.random() local segmentXAxis=0 local segmentYAxis=0 while true do --all 3 must be different segmentXAxis = math.random(structure.GetCount())--segCnt) --jon segmentYAxis = math.random(structure.GetCount())--segCnt) --jon if segmentXAxis~=s1 and segmentYAxis~=s1 and segmentXAxis~=segmentYAxis then break end end --{segmentOrigin, segmentXAxis, segmentYAxis, rho, theta, phi} band.Add(s1, segmentXAxis, segmentYAxis, len, theta, phi, str) --bands.AddBand(b) --puzzle.StartOver() end) table.insert(actionDescription,"band in space default length") act="ends" --print("act") table.insert(actionDescription,act) table.insert(performAction, function() if band.GetCount() ~= 0 then local band1 = math.random(band.GetCount()) band.AddToBandEndpoint ( math.random(structure.GetCount()), band1 ) end end) act="for ii = 1, band.GetCount () do band.SetGoalLength ( ii, math.random(0,23.5)) end" table.insert(actionDescription,act) table.insert(performAction, function() pcall(act) end) table.insert(performAction, function() structure.WiggleAll(1) end) table.insert(actionDescription, "Wiggle all, ".. "\n moved from action 0 because Lua starts at 1") table.insert(performAction, function() structure.LocalWiggleAll(1) end ) table.insert(actionDescription, "local wiggle all inspired by BWP") table.insert(performAction, function() selection.DeselectAll() local seg=math.random(structure.GetCount()) selection.SelectRange(seg,math.max(seg,math.random(structure.GetCount()))) --could use seg+1 structure.LocalWiggleSelected(1) selection.DeselectAll() end) table.insert(actionDescription, "Local Wiggle Selected inspired by BWP") table.insert(performAction, function() selection.DeselectAll() local seg=math.random(structure.GetCount()-1) selection.SelectRange(seg,seg+1) structure.LocalWiggleSelected(1) selection.DeselectAll() end) table.insert(actionDescription, "Local Wiggle 2 segment inspired by BWP") table.insert(performAction, function() selection.DeselectAll() local seg=math.random(structure.GetCount()) selection.SelectRange(seg,seg) structure.LocalWiggleSelected(1) selection.DeselectAll() end) table.insert(actionDescription, "Local Wiggle 1 segment inspired by Daoism") table.insert( performAction, function() for i=1,30 do if structure.InsertResidue( math.random(1,structure.GetCount()) --start at 1 for del. --I think the wiki is outdated; -- insert residue gives an error with index 0 (and count+1) now ) then break end end end ) table.insert(actionDescription, "Try Insert residue/segment. Only works in Design puzzles.") table.insert( performAction, function() structure.DeleteCut(math.random(structure.GetCount())) end ) table.insert(actionDescription, "del. cut") table.insert( performAction,function() structure.InsertCut(math.random(structure.GetCount())) end ) table.insert(actionDescription, "insert cut") table.insert( performAction, function() structure.DeleteResidue(math.random(2,structure.GetCount()-1)) FindAllMovableSegs() end ) table.insert(actionDescription, "delete residue. may cause Foldit crash in combination with GAB") table.insert(performAction,function() ui.CenterViewport() end) table.insert(actionDescription, "center view") performAction[#performAction+1]=function() selection.SelectAll() structure.SetSecondaryStructureSelected("a") --auto selection.DeselectAll() end actionDescription[#actionDescription+1]="auto secondary structure.".. "\n won't affect score until idealSS" performAction[#actionDescription+1]=function() --interchangeable here -- Set segments secondary structure. Valid values are e=sheet, h=helix, l=loop, m=molecule, a=auto. local struct={[1]="e",[2]="h",[3]="l",[4]="m"} structure.SetSecondaryStructure(math.random(1,structure.GetCount()), struct[math.random(1,#struct)]) end actionDescription[#actionDescription+1]="random secondary structure" --won't affect score until idealSS --end import table.insert(performAction,function() behavior.SetClashImportance(math.random(0,100)/100) end) table.insert(actionDescription,"random C.i.") --based on AFK3 --May need to manually checkmark Enable Recipe Modding in Behavior table.insert(performAction,function() behavior.SetSidechainHBondImportance(math.random(0,300)/100) end) table.insert(actionDescription,"side hbond i. 0-3") table.insert(performAction,function() behavior.SetSidechainHBondImportance(1) end) table.insert(actionDescription,"side hbond i. 1") table.insert(performAction,function() behavior.SetPairwiseImportance(math.random(0,300)/100) end) table.insert(actionDescription,"set pair i. 0-3") table.insert(performAction,function() behavior.SetPairwiseImportance(1) end) table.insert(actionDescription,"set pair i. 1") table.insert(performAction,function() behavior.SetPackingImportance(math.random(0,300)/100) end) table.insert(actionDescription,"set pack i. 0-3") table.insert(performAction,function() behavior.SetPackingImportance(1) end) table.insert(actionDescription,"set pack i. 1") table.insert(performAction,function() behavior.SetHidingImportance(math.random(0,300)/100) end) table.insert(actionDescription,"set hiding i. 0-3") table.insert(performAction,function() behavior.SetHidingImportance(1) end) table.insert(actionDescription,"set hiding i. 1") table.insert(performAction,function() lastOutputTan=(math.tanh(#structure.GetNote(1))+1)/2 end) table.insert(actionDescription,"getnote") table.insert(performAction,function() lastOutput=#structure.GetNote(2)/10 end) table.insert(actionDescription,"getnote2") table.insert(performAction,function() string="" for i=0,math.ceil(lastOutputTan*100) do string=string.."i" end structure.SetNote(2,string) --pcall(exit()) end) table.insert(actionDescription,"setnote") table.insert(performAction,function() behavior.UseCutBands(squeezeToInt(param,2)==2) --not enable end) table.insert(actionDescription,"usecutbands param") --insert actions you want included by default above this line --------- --insert new actions here before counting them --jon ------old actions don't want to spend debug time below delCuts=function() cuts=structure.GetCuts() for i=1,#cuts do structure.DeleteCut(cuts[i]) end end table.insert(performAction,delCuts) table.insert(actionDescription,"del. cuts") table.insert(performAction,function() absolutebest.Restore() delCuts() behavior.SetFiltersDisabled(false) end) table.insert(actionDescription,"get credit for abs") table.insert(performAction,function() behavior.SetClashImportance(1) --needed? behavior.UseCutBands(true) --not enable structure.WiggleAll(1) cuts=structure.GetCuts() for i=1,#cuts do --structure.WiggleAll(1) structure.DeleteCut(cuts[i]) end end) table.insert(actionDescription,"del. cuts2") ------------------- NumberOfActions=#performAction+1 --jon save.Quicksave(9) if not testXor and debugActions then for iParam=1,1 do param=math.random(-100,100)/10 print("debug actions, param "..param) for i=1,#performAction-1 do --i=1 to skip mutate --save.Quickload(9) --komi may help starttime=os.clock() startscore=current.GetEnergyScore() print("debug action "..i..", "..actionDescription[i]) performAction[i]() print("yield per sec "..(current.GetEnergyScore()-startscore)/(os.clock()-starttime+1)) end --structure.WiggleAll(4) --lag for debug end end end initializeActions() ---------------- pokemons={} --perhaps bias (threshold) is unfortunately named that way --https://stackoverflow.com/questions/2480650/what-is-the-role-of-the-bias-in-neural-networks --it means shifting a value to one side in algebra --originally from French: --https://www.etymonline.com/word/bias numInputs=10 --must be exactly the same as number of inputs below for i=1,4 do --*2 do --ought to be derivative of (numDendrites+1 [for bias])*numNeurons local pokemon={layers={},score=0} --"ogres are made of layers" function newNeuron(--[[optional]]numDendrites) newDendrites={} numDendrites=numDendrites or numInputs+1 --at least size of biggest layer --https://forum.defold.com/t/lua-defining-a-function-with-optional-parameters-solved/3340 for iDendrite=1,numDendrites do --maybe extra for now? table.insert(newDendrites,math.random(-10,10)/10) end local neuron={ dendrites=newDendrites --weights (dentrites getting inputs from prev. neurons) -- are factors to have a weighted importance --for instance, if you're guessing the total weight of 2 elephants and 2 insects --the number of elephants will be far more important , bias=math.random(-10,10)/10--can exceed --bias in this case is like a T/F threshold. <50% on exam = F, you don't pass at all. --some professors curve grades based on overall class grades , axon={0,1} --called neuron Value by techies. means neuron output } --print("neuron axon "..neuron.axon) return neuron end layer={} --input layer, true, false for i=1,numInputs do table.insert(layer,{axon={0,1}}) end print("input neuron axon "..layer[1].axon[1]) table.insert(pokemon.layers,layer) for iHiddenLayer=1,hiddenLayers do layer={} --new layer --a Hidden Layer --for XOR problem, set #neurons to 2 -- https://miro.medium.com/max/1346/1*bRoaMcjiD4yRjgfr2QGZcA.jpeg for i=1,#pokemon.layers[1]+1 do --3 do --2 do local neuron=newNeuron() --print("my neuron "..neuron) table.insert(layer,neuron) end print("done inserting neurons into hidden layer") table.insert(pokemon.layers,layer) end layer={} --new layer --output layer for i=1,2 do local neuron=newNeuron() table.insert(layer,neuron) end table.insert(pokemon.layers,layer) table.insert(pokemons,pokemon) end gen=0 lastOutputTan=.2 --forgot this lastOutput=0 weakest=1 print("initializing velocity") mutantLayer=math.random(#pokemons[1].layers-1)+1 mutantNeuron=math.random(#pokemons[1].layers[mutantLayer]) mutantDendrite=math.random(#pokemons[1].layers[mutantLayer][mutantNeuron].dendrites) dendriteMutation=math.random(-50,50)/100 --Mozi's precision philosophy biasMutation=math.random(-50,50)/100 --Mozi's precision philosophy while true do --88% cpu no recipe running --100% cpu just checking hour --140% cpu active Neural Net print("sleeping") repeat hour=(os.date("%H")) --hour="00" --hour="23" day=(tostring(11)<hour and hour<tostring(19)) until true or not day gen=gen+1 print("new gen "..gen) path=1 for i=1,#pokemons do starttime=os.clock() --creditbest.Restore() --band.DeleteAll() --behavior.SetFiltersDisabled(false) startscore=current.GetEnergyScore() if not current.AreConditionsMet then startscore=worstPossible --0 end --puzzle.StartOver() --puzzle.StartOver() --if multistart diversity=0 pokemons[i].score=worstPossible --0 --for xor. for foldit, set to worst, get highscore? if testXor then pokemons[i].score=0 end attacks=4 --try even number for xor/not iAttack=1 while iAttack<=attacks do --9 do path=1--math.random(1,2) --set for input selection.DeselectAll() --selection.SelectAll() selection.SelectRange(math.random(structure.GetCount()-3),math.random(structure.GetCount())) --hopefully ends mutable if design but sadly not linker --randomize inputs to test XOR pokemons[i].layers[1][1].axon[path]=(iAttack-1)%2 --math.random(0,1) pokemons[i].layers[1][2].axon[path]=math.floor((iAttack-1)/2) --math.random(0,1) pokemons[i].layers[1][3].axon[path]=behavior.GetClashImportance() --math.random(0,1) pokemons[i].layers[1][4].axon[path]=0--param --lastOutputTan pokemons[i].layers[1][5].axon[path]=iAttack --algoStep) pokemons[i].layers[1][6].axon[path]=0 -- if #structure.GetCuts()>0 then pokemons[i].layers[1][6].axon[path]=1 end pokemons[i].layers[1][7].axon[path]=(scoreboard.GetRank()) --shame,accurate endgame detection pokemons[i].layers[1][8].axon[path]=0 --overkill updating if HASMUTABLES then pokemons[i].layers[1][8].axon[path]=1 end pokemons[i].layers[1][9].axon[path]=((1+current.GetEnergyScore())/2) -- pokemons[i].layers[1][10].axon[path]=0--lastOutput if testXor then for iAxon=3,#pokemons[i].layers[1] do pokemons[i].layers[1][iAxon].axon[path]=0 end end --we don't really understand bifurcated axons, so we generally don't simulate them path=math.random(1,2) --randomize for road less traveled if even amount of neurons if humble then path=1 end --skip activation of first layer (input layer) for iLayer=2,#pokemons[i].layers do print("gen "..gen..", pokemon #"..i..", layer "..iLayer..",iA"..iAttack) --print("layers is "..pokemons[i].layers) print("layer length "..#pokemons[i].layers[iLayer]) for iNeuron=1,#pokemons[i].layers[iLayer] do --"inputs go in times weights, summate, add a bias activate" --s. raval sum=0 for iPrevNeuron=1,#pokemons[i].layers[iLayer-1] do --previous neurons if iLayer>2 and not humble then path=3-path --road less traveled end local input=pokemons[i].layers[iLayer-1][iPrevNeuron].axon[path] local dendrite=pokemons[i].layers[iLayer][iNeuron].dendrites[iPrevNeuron] --print("input "..input..", neuron weight "..dendrite) sum=sum+input*dendrite --input times weight of connection end print("sum "..sum) --"inputs go in times weights, get sums" -s. raval print("neuron bias "..pokemons[i].layers[iLayer][iNeuron].bias) local axon={0,0} axon[path]=sum+pokemons[i].layers[iLayer][iNeuron].bias --most people add bias instead of subtract bias but maybe it's easier visualizing -- subtracting bias, so you can view the bias as a threshold, then you can write -- if axon<=bias instead of axon<=.5 -- or something like axon<=threshold --"pass that **** [stuff] to my sigmoid function" -s. raval --axon=math.tanh(axon) -- [[ if iLayer<#pokemons[i].layers then --allow output to be negative --ReLU activation function, not really a sigmoid function like tangent if axon[path] <=0 then --.5 then --axon[path]=0 --ReLU, rectified linear unit. dying ReLU -- graph: __/ aloha=0.5 --alpha axon[path]=aloha*axon[path] --leaky relu end end --]]-- --MIT OpenCourseWare video of training a NN to output the same as the input -- on MIT's site --bifurcated axons sometimes --more like chopsticks/kuazi than a fork, because not as branched as dentritic tree pokemons[i].layers[iLayer][iNeuron].axon[path]=axon[path] pokemons[i].layers[iLayer][iNeuron].axon[1-path]=0 end end local brainOutput=pokemons[i].layers[#pokemons[i].layers][1].axon[path] lastOutput=brainOutput --not sure if nn can handle inputs>1,<0,<-1 print("gen"..gen..",brainOutput: \n"..brainOutput..",\n param "..param) newTan=(math.tanh(brainOutput)+1)/2 --0 to 1 diversity=diversity+math.abs(lastOutputTan-newTan) --print(#performAction) lastOutputTan=newTan print("output tan "..lastOutputTan) choice=math.floor(brainOutput%#performAction)+1 --pemdas --big out of bounds fix... and now maybe fixed for too negative for float too --skip action 0 for now (mutate all), simplify math --originally --choice=math.floor((brainOutput*(1+#performAction))%(1+#performAction))--+.49)*lastOutputTan) --causes crash when brainOuput is 2.58e+306, guessing because it wraps to negative print("choice"..choice..", #actionDescription"..#actionDescription) if chooseAminos and not testXor then param=pokemons[i].layers[#pokemons[i].layers][2].axon[path] --inspired by PUBG if param>10000 or param<0 then startscore = startscore+math.abs(param) param=0 end if brainOutput>10000 or brainOutput<0 then startscore=startscore+math.abs(brainOutput) brainOutput=0 end aminos="arndceqghilkmfpstwyv" local myAmino=math.floor(brainOutput%#aminos)+1 print("my amino is "..myAmino) seg=math.floor(param%structure.GetCount())+1 local char = aminos:sub(myAmino,myAmino) print("char is "..char) structure.SetAminoAcid(seg,char) print("set amino succ") --e for MSG, q for glutamine --g for glycine --v for valine, suggested by Enzyme for 1947 --attacks=attacks+1 else print(actionDescription[choice]) if (not testXor) and 0<choice and choice<=#actionDescription then param=pokemons[i].layers[#pokemons[i].layers][2].axon[path] performAction[choice]() --paused for xor debug if param==1 and math.random(90)>1 --arcade coins continue? then attacks=attacks+1 end --jiexu end end komi=i--*6.5 --komidashi for playing 2nd improv=(current.GetEnergyScore()-startscore)/(os.clock()-starttime+1)--+diversity+komi if not current.AreConditionsMet() or #structure.GetCuts()>0 or behavior.GetFiltersDisabled() then improv=improv*0.0 --7 --0 --*0.7 --shifu: --layer , neuron: dendrites: -1.642, 1.74, -2.005, -4.18, , bias: 3.048, --neuron: dendrites: -5.839, 3.608, 1.621, -2.22, , bias: 3.683 --layer , neuron: dendrites: -0.023000000000014, 0.67800000000008, , bias: -1.7139999999999 end function orFunc(a,b) return math.min(1,a+b) end function andFunc(a,b) return a*b end function notFunc(a) return 1-a end -- https://miro.medium.com/max/1346/1*bRoaMcjiD4yRjgfr2QGZcA.jpeg xorFunc= function(in1,in2) return andFunc( notFunc(andFunc(in1, in2)), orFunc(in1, in2) ) end --real vs predict path=1 --for xor print("xor func "..xorFunc(0,0)..xorFunc(0,1)..xorFunc(1,0)..xorFunc(1,1)) print("pokemons[i].layers[1][1].axon[path]"..pokemons[i].layers[1][1].axon[path]) print("pokemons[i].layers[1][2].axon[path]"..pokemons[i].layers[1][2].axon[path]) xorReal=xorFunc(pokemons[i].layers[1][1].axon[path],pokemons[i].layers[1][2].axon[path]) print("xorReal success") xorPred=pokemons[i].layers[#pokemons[i].layers][1].axon[path] error=xorPred-xorReal realNot=notFunc(pokemons[i].layers[1][2].axon[path]) predNot=pokemons[i].layers[#pokemons[i].layers][2].axon[path] --print(""..notFunc(0)..notFunc(1)) --error=predNot-realNot if testXor then pokemons[i].score=pokemons[i].score -math.pow(error,2)/2/attacks behavior.SetClashImportance( --math.min(1,math.max(0,(pokemons[i].score+10)/10)) --for visual --squeezeFloat(0,1) eulerAct(pokemons[i].score+1) ) else --alpha for score rectifying, eg. 0.1 pokemons[i].score= math.max(pokemons[i].score,math.max(0.0*improv,improv))--+komi -- end print("xorPred "..xorPred) print(",xorReal "..xorReal) print("predNot "..predNot) print("realNot "..realNot) --structure.WiggleAll(1) --debug iAttack=iAttack+1 end --iAttack print("score "..pokemons[i].score..", 0 is best") --structure.WiggleAll(1) --lag for debug end strongest=1 for i=2,#pokemons do if pokemons[i].score>pokemons[strongest].score then strongest=i end if pokemons[i].score==pokemons[strongest].score and math.random(2)>1 then strongest=i end end print("strongest "..strongest..", score "..pokemons[strongest].score) if weakest==strongest then print("gen"..gen..",carp evolved to dragon success") dendriteMutation=dendriteMutation*1.2 biasMutation=biasMutation*1.2 if testXor then timer=os.clock()+5 while (os.clock()<timer) do structure.WiggleAll(1) --debug end end else if true or math.random(2)>1 then --chance of tripping, chance of carrying momentum downhill on mutantDendrite=mutantDendrite+1 --math.random(#pokemons[1].layers[mutantLayer][mutantNeuron].dendrites) print("if you give a mouse a cookie") if mutantDendrite>#pokemons[1].layers[mutantLayer][mutantNeuron].dendrites then print("it's gonna wanna layer") mutantNeuron=mutantNeuron+1 --math.random(#pokemons[1].layers[mutantLayer]) mutantDendrite=0 if mutantNeuron>#pokemons[1].layers[mutantLayer] then mutantNeuron=1 mutantLayer=mutantLayer+1 print("if you give a mouse a wafer") if mutantLayer>#pokemons[1].layers then mutantLayer=2 --back to first hidden layer yellowWood=-yellowWood --Road Less Traveled end end end dendriteMutation=0 biasMutation=0 if mutantDendrite>=1 then dendriteMutation=yellowWood*math.random(50)/100 --Mozi's precision philosophy else biasMutation=yellowWood*math.random(50)/100 --Mozi's precision philosophy end end end weakest=1 for i=2,#pokemons do if pokemons[i].score<=pokemons[weakest].score then weakest=i end end runnerup=weakest --2nd best secondWeakest=strongest for i=1,#pokemons do if i~=strongest and pokemons[i].score>=runnerup then runnerup=i end if i~=weakest and pokemons[i].score<=secondWeakest then secondWeakest=i end end print("weakest "..weakest..", evolving weakest carp to dragon") for w=1,1 do --2 do --only 1 for gradient simplicity for now i=weakest if w>1 then i=secondWeakest end shifu=strongest --in Kung Fu Panda, Shifu is the 2nd wisest --shifu meant tutor; now it means driver/chef shifustring="shifu: " --skip copying of first layer (input layer) for iLayer=2,#pokemons[i].layers do print("pokemon #"..i..", layer "..iLayer) --print("layers is "..pokemons[i].layers) --print("layer length "..#pokemons[i].layers[iLayer]) shifustring=shifustring.."\n layer " for iNeuron=1,#pokemons[i].layers[iLayer] do --shifu can be female, shimu means tutor's wife but gender is a hassle to code --plus most CandyCrush pros are female --shizhang can mean tutor's husband local shifuNeuron=pokemons[shifu].layers[iLayer][iNeuron] local shimuNeuron=pokemons[runnerup].layers[iLayer][iNeuron] noob=pokemons[i].layers[iLayer][iNeuron] shifustring=shifustring..", neuron: dendrites: " --we could do backpropagation, involves finding the policy gradient/slope for iPrevNeuron=1,#pokemons[i].layers[iLayer-1] do --previous neurons local shifuDendrite=shifuNeuron.dendrites[iPrevNeuron] local shimuDendrite=shimuNeuron.dendrites[iPrevNeuron] print("shifuDendrite weight "..shifuDendrite) shifustring=shifustring..shifuDendrite..", " if math.random(2)>1 then allele=shifuDendrite else allele=shimuDendrite end --gradient descent mutation=0 if iLayer==mutantLayer and iNeuron==mutantNeuron and iPrevNeuron==mutantDendrite then mutation=dendriteMutation end pokemons[i].layers[iLayer][iNeuron].dendrites[iPrevNeuron]= --tryhard disciple method --noob.dendrites[iPrevNeuron]+(shifuDendrite-noob.dendrites[iPrevNeuron])*2 --pro vs pro --shimuNeuron.dendrites[iPrevNeuron] -- +(shifuDendrite-shimuNeuron.dendrites[iPrevNeuron])*2 --valentine method --(shifuDendrite+shimuDendrite)/2 --other half method --allele --unpressured aphid method shifuDendrite +mutation end print("shifu's orig bias "..shifuNeuron.bias) --shifu not biased against MSG shifustring=shifustring..", bias: "..shifuNeuron.bias local allele if math.random(2)>1 then allele=shifuNeuron.bias else allele=shimuNeuron.bias end mutation=0 if iLayer==mutantLayer and iNeuron==mutantNeuron then mutation=biasMutation end pokemons[i].layers[iLayer][iNeuron].bias= --tryhard disciple method, kinda velocity gradient descent --noob.bias+(shifuNeuron.bias-noob.bias)*2 --Tutor says to chop a log, chop 2 logs --tryhard pro method, note that I don't mean tryhard in the derogutory sense -- but rather that imitation is a fast (albeit not as great as AlphaZero) method --After all, I guess it's why stories unrealistically have happy endings --(shimuNeuron.bias+(shifuNeuron.bias-shimuNeuron.bias)*2) --Eg. What can Starcraft pro Scarlett do to play like #1 Serral but better? --Double Evo chamber or more creep tumors? --This method finally got the a.i. to set clash 1 --valentine method, but kinda a social bubble stagnation --"2 roads diverged in a yellow wood and the a.i. car barged down the middle" -GeoHot --(shifuNeuron.bias+shimuNeuron.bias)/2 --half of genes method --allele --aphid method shifuNeuron.bias +mutation end end --backpropagation recurses from the output to the input neurons, -- updating them according to how responsible they are for the error -- siraj r. shifustring=shifustring.."\n " --easier selecting text structure.SetNote(1,shifustring) --middle for 2 sided interface? --1 --max locked seg for 2 sided? stays on even if a res is del. --2 sided --shifu: --layer , neuron: dendrites: 0.17, 0.578, 0.282, 0.374, , bias: 0.068, --neuron: dendrites: 0.711, 0.286, 0.947, 0.777, , bias: -0.51 --layer , neuron: dendrites: -0.91, 0.214, , bias: 0.376 --1951 cov linker --shifu: --layer , neuron: dendrites: 0.812, 0.855, 0.526, , bias: -0.253, neuron: dendrites: -0.325, -0.97, 0.955, , bias: 0.627 --layer , neuron: dendrites: 0.694, 0.905, , bias: -0.826 end --print("end carp to dragon?") --sometimes get bias of -0 negative zero. but -0==0 in lua. end --------

Comments