X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=octave_packages%2Fnnet-0.1.13%2FsaveMLPStruct.m;fp=octave_packages%2Fnnet-0.1.13%2FsaveMLPStruct.m;h=0f661f96c0b47008b12aa4c0d4a7f57b9853e9e3;hb=f5f7a74bd8a4900f0b797da6783be80e11a68d86;hp=0000000000000000000000000000000000000000;hpb=1705066eceaaea976f010f669ce8e972f3734b05;p=CreaPhase.git diff --git a/octave_packages/nnet-0.1.13/saveMLPStruct.m b/octave_packages/nnet-0.1.13/saveMLPStruct.m new file mode 100644 index 0000000..0f661f9 --- /dev/null +++ b/octave_packages/nnet-0.1.13/saveMLPStruct.m @@ -0,0 +1,187 @@ +## Copyright (C) 2005 Michel D. Schmid +## +## +## This program is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; see the file COPYING. If not, see +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {} saveMLPStruct (@var{net},@var{strFileName}) +## @code{saveStruct} saves a neural network structure to *.txt files +## @end deftypefn + +## Author: Michel D. Schmid + +function saveMLPStruct(net,strFileName) + + ## the variable net holds the neural network structure.. + # check if "net" is a structure type + if !__checknetstruct(net) + error("Structure doesn't seem to be a neural network") + endif + + # open the first level file + fid1 = fopen(strFileName,"w+t","ieee-le"); + + if (fid1 < 0) + error ("Can not open %s", strFileName); + endif + + ## print header +# try ## wird nicht mehr benötigt.. + __printMLPHeader(fid1); +# catch +# ## Add saveMLPStructure directory to the path and try again +# addpath ([fileparts(mfilename()),"/saveMLPStructure"]); +# __printMLPHeader(fid1); +# end_try_catch + + ## check for field "networkType" + __printNetworkType(fid1,net); + + ## check for field "numInputs" + __printNumInputs(fid1,net); + + ## check for field "numLayers" + __printNumLayers(fid1,net) + + ## check for field "biasConnect" + __printBiasConnect(fid1,net) + + ## check for field "inputConnect" + __printInputConnect(fid1,net) + + ## check for field "layerConnect" + __printLayerConnect(fid1,net) + + ## check for field "outputConnect" + __printOutputConnect(fid1,net) + + ## check for field "targetConnect" + __printTargetConnect(fid1,net) + + ## print one empty line + fprintf(fid1,"\n"); + + ## check for numOutputs + __printNumOutputs(fid1,net); + + ## check for numTargets + __printNumTargets(fid1,net); + + ## check for numInputDelays + __printNumInputDelays(fid1,net); + + ## check for numLayerDelays + __printNumLayerDelays(fid1,net); + + ## print one empty line + fprintf(fid1,"\n"); + + ## print subobject structures: + fprintf(fid1," subobject structures:\n"); + + ## print one empty line + fprintf(fid1,"\n"); + + ## print inputs + __printInputs(fid1,net); + + ## print layers + __printLayers(fid1,net); + + ## print outputs + __printOutputs(fid1,net); + + ## print targets + __printTargets(fid1,net); + + ## print biases + __printBiases(fid1,net); + + ## print inputweights + __printInputWeights(fid1,net); + + ## print layerweights + __printLayerWeights(fid1,net); + + ## print one empty line + fprintf(fid1,"\n"); + + ## print subobject structures: + fprintf(fid1," functions:\n"); + + ## print one empty line + fprintf(fid1,"\n"); + + ## print adaptFcn + __printAdaptFcn(fid1,net); + + ## print initFcn + __printInitFcn(fid1,net); + + ## print performFcn + __printPerformFcn(fid1,net); + + ## print performFcn + __printTrainFcn(fid1,net); + + ## print one empty line + fprintf(fid1,"\n"); + + ## print subobject structures: + fprintf(fid1," parameters:\n"); + + ## print one empty line + fprintf(fid1,"\n"); + + ## print adaptParam + __printAdaptParam(fid1,net); + + ## print initParam + __printInitParam(fid1,net); + + ## print performParam + __printPerformParam(fid1,net); + + ## print trainParam + __printTrainParam(fid1,net); + + ## print one empty line + fprintf(fid1,"\n"); + + ## print subobject structures: + fprintf(fid1," weight & bias values:\n"); + + ## print one empty line + fprintf(fid1,"\n"); + + ## print IW + __printIW(fid1,net); + + ## print LW + __printLW(fid1,net); + + ## print b + __printB(fid1,net); + + ## print one empty line + fprintf(fid1,"\n"); + + ## print subobject structures: + fprintf(fid1," other:\n"); + + + fclose(fid1); + +endfunction