# Export GPdotNET Model in to Mathematica

The next version of GPdotNET will be able to export training and testing data, as well as GP Model in to Mathematica. I found this feature very useful while I was modelling and trying to plot GP models in to Mathematica.

This blog post will demonstrate how to export GP Model in to Mathematica, and perform further operations in order to get more information from your model.

Before exporting to Mathematica, you need to calculate GP model. Suppose we have calculated the model and want to export it to Mathematica, see picture below. The bottom text box from the picture above shows GP model in analytic form. This is pretty much terms and operations. Actually the analytic term of GP Model will be converted in to Mathematica syntax, and exported to txt file. On this way you can copy exported text and paste to Mathematica.

From the Export GP Result group controls choose GP Model button, select Mathematica, click OK, name the txt file and press OK button. All operations are showed on picture below. Now we have Training data set and GP model in Mathematica language, so we can copy them and paste in to Mathematica notebook.

Open saved txt file and  you will see something similar showed on the picture below. The file contain two things:

• Training data model represented as Mathematica list collection, and
• GP Model translated in to Mathematica notation.

Copy the first group of text and paste it to Mathematica notebook, then copy the second text group and paste to Mathematica below the first one. The flowing picture shows training data set and GP model in Mathematica. Now that we have GP model in Mathematica, we can do lot of things.

Simplifying GP analytic model:  By typing Simplify[gpmodel], Mathematica will try to simplify your model as simple as possible.

Look what happens when we execute Simplify[gpmodel] against the model we are currently dealing: This is awesome, and nobody can simplify such a complex term better than Mathematica.

If your model contains 3 or less independent variables you can plot it. For example execute this command:

funpl = Plot[{gpmodel}, {X1, -40, 20}, PlotRange -> {{-45, 25}, {35, 220}}, Frame -> True , PlotLegends -> Placed[{“GP Model”}, Above]]

The picture below shows the result from the command above: That was just a few options you can execute against GP model when you export it to Mathematica.

## 2 thoughts on “Export GPdotNET Model in to Mathematica”

1. SoftwareCorner on said:

Welcome to SoftwareCorner, your source for pecialized software, development and training Mathematica