Wolfram ResearchPRODUCTSPURCHASEFOR USERSCOMPANYOUR SITES

 Documentation /  Neural Networks /  Feedforward Network /  Examples /

One Dimensional Function ApproximationTwo Dimensional Function Approximation

5.2.2 Function Approximation from One to Two Dimensions

In this example a function with one input and two outputs will be considered. The only difference from the previous example is that there are two outputs instead of one.

Read in the Neural Networks package and a standard add-on package.

In[1]:=

Load the data.

In[3]:=

The input is placed in x and the output in y.

Check the dimensions of the data.

In[4]:=

Out[4]=

Out[5]=

There are 20 data samples, one input, and two outputs.

Look at the data; some transformation is necessary.

In[6]:=

The plot shows the two outputs versus the input.

The origin of this data is artificial; however, you can imagine a problem setting like in Section 3.4.2, Function Approximation Example, with the change that two variables (the outputs) depend on the variable x (the input).

Initialize and train an FF network with two outputs to approximate the two-dimensional output. The number of inputs and outputs does not need to be specified, since this information is extracted from the dimensions of the supplied data matrices.

Initialize an FF network with four neurons.

In[9]:=

Out[9]=

Find some information about the network.

In[10]:=

Out[10]=

So far, the network has only been initialized. It can be interesting to look at the initialization before the training.

Look at the initialized FF network.

In[11]:=

Notice that already the initialization is quite good, something not too unusual for a default initialization. You can repeat the initialization setting RandomInitializationRuleTrue to see the difference.

Now train the initialized FF network.

Fit the network to the data.

In[12]:=

The FF network with two outputs can be evaluated on data in the same way as a network with only one output. The difference is that you obtain two output values now.

Evaluate the FF network on one input data sample.

In[13]:=

Out[13]=

Look at the result with the fitted FF network.

In[14]:=

One Dimensional Function ApproximationTwo Dimensional Function Approximation


Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information



 © 2009 Wolfram Research, Inc.  Terms of Use  Privacy Policy |
Sign up for our newsletter: