-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d0bab8
commit a148594
Showing
12 changed files
with
113 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
cl cpp/KNIRecodeFile.c %KNI_HOME%\lib\KhiopsNativeInterface64.lib -I %KNI_HOME%\include /link "/LIBPATH:%KNI_HOME%\bin" | ||
cl cpp/KNIRecodeMTFiles.c %KNI_HOME%\lib\KhiopsNativeInterface64.lib -I %KNI_HOME%\include /link "/LIBPATH:%KNI_HOME%\bin" | ||
cl cpp/KNIRecodeFile.c %KNI_HOME%\lib\KhiopsNativeInterface.lib ^ | ||
-I %KNI_HOME%\include /link "/LIBPATH:%KNI_HOME%\bin" | ||
cl cpp/KNIRecodeMTFiles.c %KNI_HOME%\lib\KhiopsNativeInterface.lib ^ | ||
-I %KNI_HOME%\include /link "/LIBPATH:%KNI_HOME%\bin" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
cd java | ||
javac -cp jna-5.13.0.jar KNIRecodeFile.java KNI.java | ||
jar cf kni.jar *.class | ||
javac -cp jna.jar java/KNIRecodeFile.java java/KNI.java | ||
jar cf kni.jar -C java KNI.class -C java KNIRecodeFile.class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
java -cp java/kni.jar:java/jna-5.13.0.jar KNIRecodeFile data/ModelingIris.kdic SNB_Iris data/Iris.txt R_Iris_java.txt 2>&1 | ||
java -cp kni.jar:jna.jar KNIRecodeFile data/ModelingIris.kdic SNB_Iris \ | ||
data/Iris.txt R_Iris_java.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
set path=%KNI_HOME%/bin;%path% | ||
java -cp kni.jar;jna.jar KNIRecodeFile data/ModelingIris.kdic ^ | ||
SNB_Iris data/Iris.txt R_Iris_java.txt |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,19 +3,16 @@ | |
|
||
This project provides all the basics to use the Khiops Native Interface (KNI): installation and examples. | ||
|
||
The purpose of KNI is to allow a deeper integration of Khiops in information systems, by mean of the C programming language, using a dynamic link library (DLL). This relates specially to the problem of model deployment, which otherwise requires the use of input and output data files when using directly the Khiops tool in batch mode. See Khiops Guide for an introduction to dictionary files, dictionaries, database files and deployment. | ||
The purpose of KNI is to allow a deeper integration of Khiops in information systems, by mean of the C programming language, using a shared library (`.dll` in Windows, `.so` in Linux). This relates specially to the problem of model deployment, which otherwise requires the use of input and output data files when using directly the Khiops tool in batch mode. See Khiops Guide for an introduction to dictionary files, dictionaries, database files and deployment. | ||
|
||
The Khiops deployment features are thus made public through an API with a DLL. Therefore, a Khiops model can be deployed directly from any programming language, such as C, C++, Java, Python, Matlab, etc. This enables real time model deployment without the overhead of temporary data files or launching executables. This is critical for certain applications in marketing or targeted advertising on the web. | ||
The Khiops deployment API is thus made public through a shared library. Therefore, a Khiops model can be deployed directly from any programming language, such as C, C++, Java, Python, Matlab, etc. This enables real time model deployment without the overhead of temporary data files or launching executables. This is critical for certain applications, such as marketing or targeted advertising on the web.. | ||
|
||
All KNI functions are C functions for easy use with other programming languages. They return a positive or null value in case of success, and a negative error code in case of failure. | ||
All KNI functions are C functions for easy use with other programming languages. They return a positive or zero value in case of success, and a negative error code in case of failure. | ||
|
||
See [KhiopsNativeInterface.h](include/KhiopsNativeInterface.h) for a detailed description of KNI functions. | ||
|
||
> [!CAUTION] | ||
> The functions are not reentrant (thread-safe): the DLL can be used simultaneously by several executables, but not simultaneously by several threads in the same executable. | ||
|
||
|
||
> The functions are not reentrant (thread-safe): the library can be used simultaneously by several executables, but not simultaneously by several threads in the same executable. | ||
# KNI installation | ||
|
||
|
@@ -25,7 +22,7 @@ Download [KNI-@[email protected]](https://github.com/KhiopsML/khiops/releases | |
|
||
## Linux | ||
|
||
On linux, go to the [release page](https://github.com/KhiopsML/khiops/releases/tag/@PROJECT_VERSION@/) and download the kni package. The name of the package begins with **kni** and ends with the **code name** of the OS. The code name is in the release file of the distribution (here, it is jammy): | ||
On Linux, go to the [release page](https://github.com/KhiopsML/khiops/releases/tag/@PROJECT_VERSION@/) and download the KNI package. The name of the package begins with **kni** and ends with the **code name** of the OS. The code name is in the release file of the distribution (here, it is "jammy"): | ||
```bash | ||
$ cat /etc/os-release | ||
PRETTY_NAME="Ubuntu 22.04.4 LTS" | ||
|
@@ -41,9 +38,9 @@ BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" | |
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" | ||
UBUNTU_CODENAME=jammy | ||
``` | ||
Download the package according to the code name of your OS and install it with dpkg or yum: | ||
- on debian-like distros: `sudo dpkg -i kni*.deb` | ||
- on fedora-like distros: `sudo yum localinstall kni*.rpm` | ||
Download the package according to the code name of your OS and install it with `dpkg` or `yum`: | ||
- on Debian-like distros: `sudo dpkg -i kni*.deb` | ||
- on Fedora-like distros: `sudo yum localinstall kni*.rpm` | ||
|
||
# Application examples | ||
|
||
|
@@ -56,7 +53,7 @@ KNIRecodeFile <Dictionary file> <Dictionary> <Input File> <Output File> [Error f | |
# The error file may be useful for debugging purposes. It is optional and may be empty. | ||
``` | ||
|
||
A more complex example (available only in C) is `KNIRecodeMTFiles`, it recodes a set of multi-tables input files to an output file. | ||
A more complex example (available only in C) is `KNIRecodeMTFiles`, it recodes the input files of multi-table dataset to a single output file. | ||
|
||
```bash | ||
KNIRecodeMTFiles | ||
|
@@ -76,31 +73,31 @@ The files are located in [cpp directory](cpp/). They allow to build `KNIRecodeFi | |
## Building the examples | ||
On linux: | ||
On Linux: | ||
```bash | ||
@BUILD_C_LINUX@ | ||
``` | ||
On windows, open a "Visual Studio Developer Console" and run: | ||
On Windows, open a "Visual Studio Developer Console" and run: | ||
```cmd | ||
@BUILD_C_WINDOWS@ | ||
``` | ||
## Launch | ||
Recode the iris dataset from the data directory using the SNB_Iris dictionary. | ||
Recode the "Iris" dataset from the data directory using the SNB_Iris dictionary. | ||
```bash | ||
KNIRecodeFile data/ModelingIris.kdic SNB_Iris data/Iris.txt R_Iris.txt | ||
``` | ||
Recode the splice junction multi-table dataset using the SNB_SpliceJunction dictionary. | ||
Recode the "Splice Junction" multi-table dataset using the `SNB_SpliceJunction` classifier dictionary. | ||
```bash | ||
KNIRecodeMTFiles -d data/ModelingSpliceJunction.kdic SNB_SpliceJunction -i .data/SpliceJunction.txt 1 \ | ||
-s DNA data/SpliceJunctionDNA.txt 1 -o R_SpliceJunction.txt | ||
KNIRecodeMTFiles -d data/ModelingSpliceJunction.kdic SNB_SpliceJunction \ | ||
-i .data/SpliceJunction.txt 1 -s DNA data/SpliceJunctionDNA.txt 1 -o R_SpliceJunction.txt | ||
``` | ||
# Example with Java | ||
|
@@ -109,15 +106,15 @@ The files are located in [java directory](java/). They allow to build `KNIRecode | |
## Building the examples | ||
To compile Java files and create kni.jar file: | ||
To compile Java files and create the `kni.jar` file: | ||
```bash | ||
@BUILD_JAVA@ | ||
``` | ||
## Launch | ||
Recodes the iris dataset from the data directory using the SNB_Iris dictionary. | ||
Recodes the "Iris" dataset from the data directory using the `SNB_Iris` classifier dictionary. | ||
On Linux: | ||
|
@@ -127,6 +124,6 @@ On Linux: | |
On Windows: | ||
```bash | ||
```cmd | ||
@RUN_JAVA_WINDOWS@ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters