/** * Check the return code of the JNI call. * * @throws XGBoostError if the call failed. */ static void checkCall(int ret) throws XGBoostError { if (ret != 0) { throw new XGBoostError(XGBGetLastError()); } }
/** * Shutdown the rabit engine in current working thread, equals to finalize. * @throws XGBoostError */ public static void shutdown() throws XGBoostError { checkCall(XGBoostJNI.RabitFinalize()); }
/** * get world size of current job. * @return the worldsize * @throws XGBoostError */ public static int getWorldSize() throws XGBoostError { int[] out = new int[1]; checkCall(XGBoostJNI.RabitGetWorldSize(out)); return out[0]; }
/** * Update the booster for one iteration. * * @param dtrain training data * @param iter current iteration number * @throws XGBoostError native error */ public void update(DMatrix dtrain, int iter) throws XGBoostError { XGBoostJNI.checkCall(XGBoostJNI.XGBoosterUpdateOneIter(handle, iter, dtrain.getHandle())); }
/** * Get version number of current stored model in the thread. * which means how many calls to CheckPoint we made so far. * @return version Number. * @throws XGBoostError */ public static int versionNumber() throws XGBoostError { int[] out = new int[1]; checkCall(XGBoostJNI.RabitVersionNumber(out)); return out[0]; }
/** * Print the message on rabit tracker. * @param msg * @throws XGBoostError */ public static void trackerPrint(String msg) throws XGBoostError { checkCall(XGBoostJNI.RabitTrackerPrint(msg)); }
/** * get rank of current thread. * @return the rank. * @throws XGBoostError */ public static int getRank() throws XGBoostError { int[] out = new int[1]; checkCall(XGBoostJNI.RabitGetRank(out)); return out[0]; }
public static synchronized void initXGBoost() throws IOException { if (!initialized) { // patch classloader class addNativeDir(nativePath); // initialize the Loader NativeLibLoaderService loaderService = NativeLibLoaderService.getInstance(); loader = loaderService.createLoader(); // load the native libs loader.loadNativeLibs(); initialized = true; } }
@Override public void compute2() { _boosterBytes = XGBoostUpdater.getUpdater(_modelKey).getBoosterBytes(); tryComplete(); } }
private static void checkCall(int ret) throws XGBoostError { if (ret != 0) { throw new XGBoostError(XGBoostJNI.XGBGetLastError()); } }
/** * get world size of current job. * @return the worldsize * @throws XGBoostError */ public static int getWorldSize() throws XGBoostError { int[] out = new int[1]; checkCall(XGBoostJNI.RabitGetWorldSize(out)); return out[0]; }
/** * Get version number of current stored model in the thread. * which means how many calls to CheckPoint we made so far. * @return version Number. * @throws XGBoostError */ public static int versionNumber() throws XGBoostError { int[] out = new int[1]; checkCall(XGBoostJNI.RabitVersionNumber(out)); return out[0]; }
/** * Print the message on rabit tracker. * @param msg * @throws XGBoostError */ public static void trackerPrint(String msg) throws XGBoostError { checkCall(XGBoostJNI.RabitTrackerPrint(msg)); }
/** * Shutdown the rabit engine in current working thread, equals to finalize. * @throws XGBoostError */ public static void shutdown() throws XGBoostError { checkCall(XGBoostJNI.RabitFinalize()); }
/** * get rank of current thread. * @return the rank. * @throws XGBoostError */ public static int getRank() throws XGBoostError { int[] out = new int[1]; checkCall(XGBoostJNI.RabitGetRank(out)); return out[0]; }
/** * Check the return code of the JNI call. * * @throws XGBoostError if the call failed. */ static void checkCall(int ret) throws XGBoostError { if (ret != 0) { throw new XGBoostError(XGBGetLastError()); } }
/** * get world size of current job. * @return the worldsize * @throws XGBoostError */ public static int getWorldSize() throws XGBoostError { int[] out = new int[1]; checkCall(XGBoostJNI.RabitGetWorldSize(out)); return out[0]; }
/** * Get version number of current stored model in the thread. * which means how many calls to CheckPoint we made so far. * @return version Number. * @throws XGBoostError */ public static int versionNumber() throws XGBoostError { int[] out = new int[1]; checkCall(XGBoostJNI.RabitVersionNumber(out)); return out[0]; }
/** * Print the message on rabit tracker. * @param msg * @throws XGBoostError */ public static void trackerPrint(String msg) throws XGBoostError { checkCall(XGBoostJNI.RabitTrackerPrint(msg)); }
private static void checkCall(int ret) throws XGBoostError { if (ret != 0) { throw new XGBoostError(XGBoostJNI.XGBGetLastError()); } }