1
0
mirror of https://github.com/lxsang/antd-lua-plugin synced 2024-12-29 10:48:21 +01:00
antd-lua-plugin/lib/ann/examples/rpg/train.lua
2018-09-19 15:08:49 +02:00

25 lines
654 B
Lua
Executable File

#! /usr/bin/env lua
--[[
This example classifies a RPG character in classes, according to its
attributes (strength, dexterity, constitution, intelligence, wisdom and
charisma).
--]]
require("lfann")
local net = fann.Net.create_standard{6, 18, 18, 9}
-- Configure the activation function
net:set_activation_function_hidden(fann.SIGMOID_SYMMETRIC)
net:set_activation_function_output(fann.SIGMOID_SYMMETRIC)
-- Configure other parameters
net:set_training_algorithm(fann.TRAIN_RPROP)
-- Train the net from a file
net:train_on_file("train.data", 100000, 50, 0.001)
-- Save the net to a file for a latter execution
net:save("rpg.net");