Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Train

flatnet license

{Train}=require('flatnet')

Simple training function: Evaluate, Fitness, Save?, End?, Cycle, repeat

  • Train(net,data=[],targets=[],config=CONFIG)
  • data array:
    • Elements in the array can be any variable, they will be Flattened
    • Each element should contain all the inputs for a single step evaluation
  • targets array:
    • Elements in the array can be any variable
    • Elements are passed to the user supplied Fitness function
  • config object:
    • name
      • The name used for file saving and loading
      • Default name = 'model'
    • keep_ratio
      • The % of models that will survive removal, see Network.Cycle
      • Default keep_ratio = 0.25
    • mut_count
      • The number of times the model is mutated, see Network.Mutate
      • Default mut_count = 3
    • mut_ratio
      • The pivot point for deleting or adding actions in mutation, see Network.Mutate
      • Default mut_ratio = 0.4
    • logging
      • Console.log information during training
      • Default logging = false
    • Fitness
      • The fitness function used after evaluation
      • Default Fitness = Network._STDFITNESS, see Network._STDFITNESS
    • Save
      • This function is called after Eval & Fitness have completed, and before End and Cycle
      • To initiate a map save, must return a valid index position of a model in net.models[]
      • See Model.SaveMap
      • Default save:
         Save:func=(net)=>{
         	if(func.last>=net.scores.high)return;
         	func.last=net.scores.high;
         	return net.scores.h;
         }
        
    • End
      • The function to determine end of training
      • Is called after Save and before Cycle
      • Return === true to end
      • Default End = (net)=>false (infinite)