/// <summary> /// redirect BrainFlow's logger from stderr to file /// </summary> /// <param name="log_file"></param> public static void set_log_file(string log_file) { int res = MLModuleLibrary.set_log_file_ml_module(log_file); if (res != (int)CustomExitCodes.STATUS_OK) { throw new BrainFlowException(res); } }
/// <summary> /// Prepare classifier /// </summary> public void prepare() { int res = MLModuleLibrary.prepare(input_json); if (res != (int)CustomExitCodes.STATUS_OK) { throw new BrainFlowException(res); } }
/// <summary> /// release all classifiers /// </summary> public static void release_all() { int res = MLModuleLibrary.release_all(); if (res != (int)CustomExitCodes.STATUS_OK) { throw new BrainFlowException(res); } }
/// <summary> /// set log level, logger is disabled by default /// </summary> /// <param name="log_level"></param> private static void set_log_level(int log_level) { int res = MLModuleLibrary.set_log_level_ml_module(log_level); if (res != (int)CustomExitCodes.STATUS_OK) { throw new BrainFlowException(res); } }
/// <summary> /// Get score of classifier /// </summary> public double predict(double[] data) { double[] val = new double[1]; int res = MLModuleLibrary.predict(data, data.Length, val, input_json); if (res != (int)CustomExitCodes.STATUS_OK) { throw new BrainFlowException(res); } return(val[0]); }
/// <summary> /// get version /// </summary> /// <returns>version</returns> /// <exception cref="BrainFlowException"></exception> public static string get_version() { int[] len = new int[1]; byte[] str = new byte[64]; int res = MLModuleLibrary.get_version_ml_module(str, len, 64); if (res != (int)CustomExitCodes.STATUS_OK) { throw new BrainFlowException(res); } string version = System.Text.Encoding.UTF8.GetString(str, 0, len[0]); return(version); }
/// <summary> /// enable ML logger with level TRACE /// </summary> public static void enable_dev_ml_logger() { MLModuleLibrary.set_log_level((int)LogLevels.LEVEL_TRACE); }
/// <summary> /// disable ML logger /// </summary> public static void disable_ml_logger() { MLModuleLibrary.set_log_level((int)LogLevels.LEVEL_OFF); }
/// <summary> /// enable BrainFlow's logger with level INFO /// </summary> public static void enable_board_logger() { MLModuleLibrary.set_log_level((int)LogLevels.LEVEL_INFO); }