Esempio n. 1
0
        /// <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);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Prepare classifier
        /// </summary>
        public void prepare()
        {
            int res = MLModuleLibrary.prepare(input_json);

            if (res != (int)CustomExitCodes.STATUS_OK)
            {
                throw new BrainFlowException(res);
            }
        }
Esempio n. 3
0
        /// <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);
            }
        }
Esempio n. 4
0
        /// <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);
            }
        }
Esempio n. 5
0
        /// <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]);
        }
Esempio n. 6
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);
        }
Esempio n. 7
0
 /// <summary>
 /// enable ML logger with level TRACE
 /// </summary>
 public static void enable_dev_ml_logger()
 {
     MLModuleLibrary.set_log_level((int)LogLevels.LEVEL_TRACE);
 }
Esempio n. 8
0
 /// <summary>
 /// disable ML logger
 /// </summary>
 public static void disable_ml_logger()
 {
     MLModuleLibrary.set_log_level((int)LogLevels.LEVEL_OFF);
 }
Esempio n. 9
0
 /// <summary>
 /// enable BrainFlow's logger with level INFO
 /// </summary>
 public static void enable_board_logger()
 {
     MLModuleLibrary.set_log_level((int)LogLevels.LEVEL_INFO);
 }