Exemple #1
0
        static void Cmacc_mqtt()
        {
            FeatureManager featureManager = new FeatureManager();
            var            Classifier     = new DecisionTreeClassifier(FusionFramework.Classifiers.DecisionTreeLearningAlgorithms.C45Learning);

            Classifier.Load("C:\\Users\\riz\\Desktop\\WISDM\\WisdnDT");
            var dataReader = new MQTTReader <double[]>("/i5/mobileMotion/accelerometer", (dynamic output) =>
            {
                var FeaturSpace = FeatureManager.Generate(output, new List <IFeature>()
                {
                    new Mean(),
                    new StandardDeviation(),
                    new MeanAbsoluteDeviation(),
                    new ResultantAcceleration(),
                    new BinDistribution(10),

                    new Variance(),
                    new Median(),
                    new Range(),
                    new Min(),
                    new Max(),
                    new RootMeanSquare()
                });

                Console.WriteLine("HAR(" + Classifier.Classify(FeaturSpace) + ")");
            });

            dataReader.Add(new SlidingWindow <double[]>(200, 0));
            dataReader.Start();
        }
Exemple #2
0
        static void MyoGym_no_acc()
        {
            FeatureManager featureManager = new FeatureManager();
            var            Classifier     = new MulticlassSupportVectorMachineClassifier();

            Classifier.Load("C:\\Users\\riz\\Desktop\\MyoGYm\\MyoGym_NOEMG_SVM");
            var dataReader = new MQTTReader <double[]>("/i5/myo/full", (dynamic output) =>
            {
                var FeaturSpace = FeatureManager.Generate(output, new List <IFeature>()
                {
                    new HjorthParameters(0, 1, 2),
                    new StandardDeviation(0, 1, 2),
                    new Mean(0, 1, 2),
                    new Max(0, 1, 2),
                    new Min(0, 1, 2),
                    new Percentile(5, 0, 1, 2),
                    new Percentile(10, 0, 1, 2),
                    new Percentile(25, 0, 1, 2),
                    new Percentile(50, 0, 1, 2),
                    new Percentile(75, 0, 1, 2),
                    new Percentile(90, 0, 1, 2),
                    new Percentile(95, 0, 1, 2),
                    new ZeroCrossing(0, 1, 2),
                    new MeanCrossing(0, 1, 2),
                    new Entropy(0, 1, 2),
                    new Correlation(0, 1),
                    new Correlation(0, 2),
                    new Correlation(1, 2),

                    new HjorthParameters(3, 4, 5),
                    new StandardDeviation(3, 4, 5),
                    new Mean(3, 4, 5),
                    new Max(3, 4, 5),
                    new Min(3, 4, 5),
                    new Percentile(5, 3, 4, 5),
                    new Percentile(10, 3, 4, 5),
                    new Percentile(25, 3, 4, 5),
                    new Percentile(50, 3, 4, 5),
                    new Percentile(75, 3, 4, 5),
                    new Percentile(90, 3, 4, 5),
                    new Percentile(95, 3, 4, 5),
                    new ZeroCrossing(3, 4, 5),
                    new MeanCrossing(3, 4, 5),
                    new Entropy(3, 4, 5)
                });

                Console.WriteLine(Classifier.Classify(FeaturSpace));
            });

            dataReader.Add(new SlidingWindow <double[]>(200, 0));
            dataReader.Start();
        }
Exemple #3
0
        static void CMacc()
        {
            FeatureManager featureManager = new FeatureManager();
            var            Classifier     = new DecisionTreeClassifier(FusionFramework.Classifiers.DecisionTreeLearningAlgorithms.C45Learning);

            Classifier.Load("C:\\Users\\riz\\Desktop\\MyoGymDT");
            var dataReader = new MQTTReader <double[]>("/i5/myo/full", (dynamic output) =>
            {
                var FeaturSpace = FeatureManager.Generate(output, new List <IFeature>()
                {
                    new HjorthParameters(8, 9, 10),
                    new StandardDeviation(8, 9, 10),
                    new Mean(8, 9, 10),
                    new Max(8, 9, 10),
                    new Min(8, 9, 10),
                    new Percentile(5, 8, 9, 10),
                    new Percentile(10, 8, 9, 10),
                    new Percentile(25, 8, 9, 10),
                    new Percentile(50, 8, 9, 10),
                    new Percentile(75, 8, 9, 10),
                    new Percentile(90, 8, 9, 10),
                    new Percentile(95, 8, 9, 10),
                    new ZeroCrossing(8, 9, 10),
                    new MeanCrossing(8, 9, 10),
                    new Entropy(9, 10, 11),
                    new Correlation(9, 10),
                    new Correlation(9, 11),
                    new Correlation(10, 11),

                    new HjorthParameters(11, 12, 13),
                    new StandardDeviation(11, 12, 13),
                    new Mean(11, 12, 13),
                    new Max(11, 12, 13),
                    new Min(11, 12, 13),
                    new Percentile(5, 11, 12, 13),
                    new Percentile(10, 11, 12, 13),
                    new Percentile(25, 11, 12, 13),
                    new Percentile(50, 11, 12, 13),
                    new Percentile(75, 11, 12, 13),
                    new Percentile(90, 11, 12, 13),
                    new Percentile(95, 11, 12, 13),
                    new ZeroCrossing(11, 12, 13),
                    new MeanCrossing(11, 12, 13),
                    new Entropy(11, 12, 13),

                    new StandardDeviation(0, 1, 2, 3, 4, 5, 6, 7),
                    new Mean(0, 1, 2, 3, 4, 5, 6, 7),
                    new Max(0, 1, 2, 3, 4, 5, 6, 7),
                    new Min(0, 1, 2, 3, 4, 5, 6, 7),
                    new Percentile(5, 0, 1, 2, 3, 4, 5, 6, 7),
                    new Percentile(10, 0, 1, 2, 3, 4, 5, 6, 7),
                    new Percentile(25, 0, 1, 2, 3, 4, 5, 6, 7),
                    new Percentile(50, 0, 1, 2, 3, 4, 5, 6, 7),
                    new Percentile(75, 0, 1, 2, 3, 4, 5, 6, 7),
                    new Percentile(90, 0, 1, 2, 3, 4, 5, 6, 7),
                    new Percentile(95, 0, 1, 2, 3, 4, 5, 6, 7),

                    new SumLargerThan(25, 0, 1, 2, 3, 4, 5, 6, 7),
                    new SumLargerThan(50, 0, 1, 2, 3, 4, 5, 6, 7),
                    new SumLargerThan(100, 0, 1, 2, 3, 4, 5, 6, 7)
                });

                Console.WriteLine(Classifier.Classify(FeaturSpace));
            });

            dataReader.Add(new SlidingWindow <double[]>(200, 0));
            dataReader.Start();
        }
Exemple #4
0
        static void MyoGym()
        {
            FeatureManager featureManager = new FeatureManager();
            var            Classifier     = new MulticlassSupportVectorMachineClassifier();

            Classifier.Load("C:\\Users\\riz\\Desktop\\MyoGYm\\MyoGym_SVM");
            var dataReader = new MQTTReader <double[]>("/i5/myo/full", (dynamic output) =>
            {
                var FeaturSpace = FeatureManager.Generate(output, new List <IFeature>()
                {
                    new HjorthParameters(8, 9, 10),
                    new StandardDeviation(8, 9, 10),
                    new Mean(8, 9, 10),
                    new Max(8, 9, 10),
                    new Min(8, 9, 10),
                    new Percentile(5, 8, 9, 10),
                    new Percentile(10, 8, 9, 10),
                    new Percentile(25, 8, 9, 10),
                    new Percentile(50, 8, 9, 10),
                    new Percentile(75, 8, 9, 10),
                    new Percentile(90, 8, 9, 10),
                    new Percentile(95, 8, 9, 10),
                    new ZeroCrossing(8, 9, 10),
                    new MeanCrossing(8, 9, 10),
                    new Entropy(8, 9, 10),
                    new Correlation(9, 10),
                    new Correlation(9, 11),
                    new Correlation(10, 11),

                    new HjorthParameters(11, 12, 13),
                    new StandardDeviation(11, 12, 13),
                    new Mean(11, 12, 13),
                    new Max(11, 12, 13),
                    new Min(11, 12, 13),
                    new Percentile(5, 11, 12, 13),
                    new Percentile(10, 11, 12, 13),
                    new Percentile(25, 11, 12, 13),
                    new Percentile(50, 11, 12, 13),
                    new Percentile(75, 11, 12, 13),
                    new Percentile(90, 11, 12, 13),
                    new Percentile(95, 11, 12, 13),
                    new ZeroCrossing(11, 12, 13),
                    new MeanCrossing(11, 12, 13),
                    new Entropy(11, 12, 13),

                    new StandardDeviation(0, 1, 2, 3, 4, 5, 6, 7),
                    new Mean(0, 1, 2, 3, 4, 5, 6, 7),
                    new Max(0, 1, 2, 3, 4, 5, 6, 7),
                    new Min(0, 1, 2, 3, 4, 5, 6, 7),
                    new Percentile(5, 0, 1, 2, 3, 4, 5, 6, 7),
                    new Percentile(10, 0, 1, 2, 3, 4, 5, 6, 7),
                    new Percentile(25, 0, 1, 2, 3, 4, 5, 6, 7),
                    new Percentile(50, 0, 1, 2, 3, 4, 5, 6, 7),
                    new Percentile(75, 0, 1, 2, 3, 4, 5, 6, 7),
                    new Percentile(90, 0, 1, 2, 3, 4, 5, 6, 7),
                    new Percentile(95, 0, 1, 2, 3, 4, 5, 6, 7),

                    new SumLargerThan(25, 0, 1, 2, 3, 4, 5, 6, 7),
                    new SumLargerThan(50, 0, 1, 2, 3, 4, 5, 6, 7),
                    new SumLargerThan(100, 0, 1, 2, 3, 4, 5, 6, 7)
                });

                Console.WriteLine("HGR(" + Classifier.Classify(FeaturSpace) + ")");
            });

            dataReader.Add(new SlidingWindow <double[]>(200, 0));
            dataReader.Start();
        }