10. Extras: GTModel

GTModel is an additional interface to pSeven Core GTApprox models available for the C and Java programming languages.

10.1. Introduction

In addition to Python tools, pSeven Core provides C and Java interfaces to GTApprox models. Supported features are:

  • Model evaluation.
  • Calculation of model gradients.
  • Accuracy evaluation (AE) and calculation of AE gradients.

Note that GTModel is intended only for evaluating existing models and does not support model training. To train models, a licensed pSeven Core installation is required. A trained model can be saved to a file, for example, with gtapprox.Model.save(), and then loaded in the GTModel interface for evaluation.

10.2. GTModel for C

GTModel library and headers are found in the package directory after installing pSeven Core:

  • Python_package_path/da/p7core_version/bin/platform/ contains the GTModel shared library for the platform where pSeven Core is installed.
  • Python_package_path/da/p7core_version/include/GTModel/ contains the GTModel headers.

To use GTModel in your C code, include GTApproxModel.h. See example_gtmodel.c for details.

10.3. GTModel for Java

GTModel for Java requires the GTModel Java archive and platform-specific shared libraries it depends on. These files are found in the Python_package_path/da/p7core_version/java/ directory after installing pSeven Core:

  • gtmodel.jar is a cross-platform Java archive containing the net.datadvance.gtmodel package.
  • libgtmodel_jni-version-platform.ext is the required shared library for the platform where pSeven Core is installed.

To use GTModel in your Java code, import the net.datadvance.gtmodel package. See the EvaluateGTModel.java example for details.

When compiling, set your class path to include the directory where gtmodel.jar and the shared library are located. Note that GTModel for Java uses JNI and a native library (libgtmodel_jni-version-platform.ext) for the current platform is required when running. By default, your installation includes only the library for the platform where pSeven Core is installed. If you compile and run on different platforms, you can download pSeven Core packages for other platforms and extract the needed libraries from there.