コード例 #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);
            }
        }
コード例 #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);
            }
        }
コード例 #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);
            }
        }
コード例 #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);
            }
        }
コード例 #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]);
        }
コード例 #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);
        }
コード例 #7
0
ファイル: ml_model.cs プロジェクト: ywdxll/brainflow
 /// <summary>
 /// enable ML logger with level TRACE
 /// </summary>
 public static void enable_dev_ml_logger()
 {
     MLModuleLibrary.set_log_level((int)LogLevels.LEVEL_TRACE);
 }
コード例 #8
0
ファイル: ml_model.cs プロジェクト: ywdxll/brainflow
 /// <summary>
 /// disable ML logger
 /// </summary>
 public static void disable_ml_logger()
 {
     MLModuleLibrary.set_log_level((int)LogLevels.LEVEL_OFF);
 }
コード例 #9
0
ファイル: ml_model.cs プロジェクト: shuawest/brainflow
 /// <summary>
 /// enable BrainFlow's logger with level INFO
 /// </summary>
 public static void enable_board_logger()
 {
     MLModuleLibrary.set_log_level((int)LogLevels.LEVEL_INFO);
 }