public static void AllCases() { global::Keras.Keras.DisablePySysConsoleLog = true; //ConsoleUtility.WriteLine(ConsoleColor.Cyan, "[TicTacToe] Load Value Network And Test"); //LoadValueNetworkAndTestOnAllStates(); //ConsoleUtility.WriteLine(ConsoleColor.Cyan, "[TicTacToe] Train Value Network And Test"); //TrainValueNetworkFromScratchAndTestOnAllStates(100); //ConsoleUtility.WriteLine(ConsoleColor.Cyan, "[TicTacToe] Train Policy Network And Test"); //TrainPolicyNetworkFromScratchAndTestOnAllStates(100); ConsoleUtility.WriteLine(ConsoleColor.Cyan, "[TicTacToe] Train Unsupervised Policy-Value Network"); //TrainModelFromScratchWithMonteCarloAndTest(); }
public void Train(IEnumerable <PVNetworkBasedMCTreeSearchNode <TState, TAction> > finalNodes, int epoches) { List <double[]> inputs = new List <double[]>(); List <double[]> outputs = new List <double[]>(); foreach (var finalNode in finalNodes) { PVNetworkBasedMCTreeSearchNode <TState, TAction> node = finalNode; while (node != null) { double[] trainingOutput = GetTrainingOutput(node, finalNode); ConsoleUtility.WriteLine(node, trainingOutput); Console.ReadLine(); inputs.Add(TransformInput(node.State)); outputs.Add(trainingOutput); node = node.Parent; } } Model.Train(inputs.ToArray(), outputs.ToArray(), epoches); }