当前位置: 首页>>代码示例>>C#>>正文


C# IFeature.Compute方法代码示例

本文整理汇总了C#中IFeature.Compute方法的典型用法代码示例。如果您正苦于以下问题:C# IFeature.Compute方法的具体用法?C# IFeature.Compute怎么用?C# IFeature.Compute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IFeature的用法示例。


在下文中一共展示了IFeature.Compute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExecuteTest

        /// <summary>
        /// Test metoda. Potrebne su dvije ulazne datoteke datoteke, InputFile i OutputFile. U jednoj su
        /// ulazni podatci za značajku, a u drugoj referentni podatci (izlaz iz Matlaba).
        /// Ulazni podatci i izlaz i matlaba se spremaju koristeći sljedeću sintaksu:
        /// save('ime_datoteke.txt','varijabla','-ascii','-double','-tabs');
        /// </summary>
        /// <param name="InputFile">Datoteka s ulaznim podatcima</param>
        /// <param name="OutputFile">Datoteka s izlaznim podatcima</param>
        /// <param name="DataProvider">DataProvider za IFeature</param>
        /// <param name="Feature">Značajka</param>
        /// <param name="SubWindowLength">Dužina prozora u uzorcima</param>
        /// <param name="SubWindowShift">Dužina pomaka u uzorcima</param>
        /// <returns></returns>
        public static TestResult ExecuteTest(string InputFile, string OutputFile, IDataProvider DataProvider, IFeature Feature, int SubWindowLength, int SubWindowShift)
        {
            List<double> InputData = ReadFromFile(InputFile);
            List<double> OutputData = ReadFromFile(OutputFile);

            FastQueue<double> Data = new FastQueue<double>(100000);
            List<double> Result = new List<double>();

            Data.Enqueue(InputData.ToArray());

            while (Data.Count > SubWindowLength)
            {
                List<double> CurrentData;

                CurrentData = Data.Peek(SubWindowLength);
                Data.Delete(SubWindowShift);
                DataProvider.Data = CurrentData;

                Feature.Compute();
                Result.Add(Feature.Feature);

            }

            double absdiff = 0;
            for (int i = 0; i < Result.Count || i < OutputData.Count; i++)
            {
                absdiff += Math.Abs(Result[i] - OutputData[i]);
            }

            TestResult tr = new TestResult();
            tr.AbsoluteDifference = absdiff;
            if (absdiff < 100)
                tr.Success = true;
            else
                tr.Success = false;

            return tr;
        }
开发者ID:tdav,项目名称:emocije,代码行数:51,代码来源:TestManager.cs


注:本文中的IFeature.Compute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。