R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("AMORE-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('AMORE') > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "newff" > > ### * newff > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: newff > ### Title: Create a Multilayer Feedforward Neural Network > ### Aliases: newff > ### Keywords: neural > > ### ** Examples > > #Example 1 > > library(AMORE) > # P is the input vector > P <- matrix(sample(seq(-1,1,length=1000), 1000, replace=FALSE), ncol=1) > # The network will try to approximate the target P^2 > target <- P^2 > # We create a feedforward network, with two hidden layers. > # The first hidden layer has three neurons and the second has two neurons. > # The hidden layers have got Tansig activation functions and the output layer is Purelin. > net <- newff(n.neurons=c(1,3,2,1), learning.rate.global=1e-2, momentum.global=0.5, + error.criterium="LMS", Stao=NA, hidden.layer="tansig", + output.layer="purelin", method="ADAPTgdwm") > net <- train(net, P, target, n.epochs=150, error.criterium="LMS", report=TRUE, show.step=5 ) Epoch: 5 LMS 0.089352660205997 Epoch: 10 LMS 0.0893088992602254 Epoch: 15 LMS 0.0892971907264735 Epoch: 20 LMS 0.0892914466714754 Epoch: 25 LMS 0.0892877870126747 Epoch: 30 LMS 0.0892851283925426 Epoch: 35 LMS 0.089283005703193 Epoch: 40 LMS 0.0892811487349 Epoch: 45 LMS 0.0892793603178988 Epoch: 50 LMS 0.0892774659637763 Epoch: 55 LMS 0.0892752835996779 Epoch: 60 LMS 0.0892725970405252 Epoch: 65 LMS 0.0892691243462514 Epoch: 70 LMS 0.089264471589708 Epoch: 75 LMS 0.0892580559403127 Epoch: 80 LMS 0.0892489645965824 Epoch: 85 LMS 0.0892356724578837 Epoch: 90 LMS 0.0892154250816363 Epoch: 95 LMS 0.0891827490177229 Epoch: 100 LMS 0.089125362845532 Epoch: 105 LMS 0.0890106829476845 Epoch: 110 LMS 0.0887266877345177 Epoch: 115 LMS 0.0876640427944163 Epoch: 120 LMS 0.0755817997191597 Epoch: 125 LMS 0.00905938314338075 Epoch: 130 LMS 0.00513823840784522 Epoch: 135 LMS 0.00342310653371325 Epoch: 140 LMS 0.00252271578470017 Epoch: 145 LMS 0.00198061886945233 Epoch: 150 LMS 0.00162154245238247 > > > > ### *