[R] how to change or copy to another the names of models

kees duineveld kees.duineveld at gmail.com
Fri Mar 2 14:52:42 CET 2012


Hi Waldir

I think this is easier via an lappy()

lapply(1:30, function(x)  mlp(...your settings here, including size=x...) )

Regards,
Kees

On Fri, Mar 2, 2012 at 2:36 PM, Waldir de Carvalho Junior
<waldircj at gmail.com> wrote:
> Hi help-list
> I try to better explain my problem.
> My problem is below. For each cycle of (n) I need to save the model
> (model.mlp), because the neuralnet is unique and when I had choose the best
> architecture of the neuralnet, and need the neuralnet (the model.mlp) that
> has already been trainned.
> I can´t train again, because the result will be not the same.
> I thought that I can put a line at the end of the cycles to copy the
> "model.mlp" to another name and save it as a model for each one of the
> cycle.
> I hope I have better explain my problem.
> thanks in advance
> ##############################
>
> # built a model  "mlp" (neuralnet) and training it changing the number of
> hidden neurons (1 a 30)
> for (n in 1:30) {
> print(n)
> model.mlp <-  mlp(padroes$inputsTrain, padroes$targetsTrain, size = n,
> initFunc="Randomize_Weights",
>              initFuncParams=c(-0.5, 0.5), learnFunc="Std_Backpropagation",
> learnFuncParams = c(0.2, 0.1),
>              updateFunc="Topological_Order", hiddenActFunc="Act_Logistic",
> shufflePatterns=TRUE, linOut=TRUE,
>              maxit = 3000, inputsTest = padroes$inputsTest, targetsTest =
> padroes$targetsTest)
> }
> ########################################
>
>
> 2012/3/1 Waldir de Carvalho Junior <waldircj at gmail.com>
>
>> Hi
>> I would like to know how I can change the name of a model for each
>> trainning cycle of a model.
>> I work with the RSNNS package and to build a neural network, I used :
>> for (i in 5:30) ....
>> model_ANN <- mlp(X, Y, size=n,....) # where size is the number of neurons
>> in the hidden layer
>> but I need to save each time that the model that is build (the end of each
>> cycle), e.g., when i = 5, I need to save the model with a especific name,
>> when i = 6, also I need to save the model with another name
>> How i am doing, i am saving only the last model with n = 30 and with the
>> name "model_ANN"
>> Question
>> how can I change the name of the model (model_ANN) at each end of cycle of
>> i values?
>> I have already tryied "copy, save, rename,.........." but unsuccessfully
>> thanks for any answer
>>
>
> --
> ________________________
> Waldir de Carvalho Junior
> Pedologia/Pedologue
> Pesquisador/Chercheur
> Embrapa Solos/INRA - UMR- LISAH
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list