I am working on a package of functions that complement the NeuralNetworks`
package that Wolfram provides. I am having a problem with the following code, which is essentially a wrapper for two commands that I run frequently:
runNetwork[data_,desc_,dlist_,{tlist_,vlist_}]:= Module[{fdfwd,m,r},
fdfwd = InitializeRBFNet[
desc[[tlist,dlist]],
data[[tlist]],
1,RandomInitialization->False];
{m,r} = NeuralFit[fdfwd,
desc[[tlist,dlist]],
data[[tlist]],
desc[[vlist,dlist]],
data[[vlist]],
100,Method->SteepestDescent,CriterionPlot->False];
{m,r}]
When I declare this function within my notebook, it runs as expected; however if I place it in a package (for instance, MyNeuralNetworks`
) then I get errors of the following type:
Set::shape: "Lists {SolarNeuralNetwork`Private`m\$2436,SolarNeuralNetwork`Private`r\$2436} and SolarNeuralNetwork`Private`NeuralFit[<<1>>] are not the same shape."
which suggests to me that the list fdfwd
that is returned by the first function is not being passed correctly to the second function. I have tried adding a Needs["NeuralNetworks`"]
line in both the Public and Private portions of the package as well as in the BeginPackage
line following this question and answer. I'm new to package writing, so there may be something obvious I'm missing. It's possible that the answer I'm looking for is hidden somewhere in this discussion but I don't know how to implement those suggestions in my context.