• 基于KPCA 和 STFT 非侵入式负荷监控(Matlab代码实现)


     👨‍🎓个人主页:研学社的博客 

    💥💥💞💞欢迎来到本博客❤️❤️💥💥

    🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。

    ⛳️座右铭:行百里者,半于九十。

    📋📋📋本文目录如下:🎁🎁🎁

    目录

    💥1 概述

    📚2 运行结果

    🎉3 参考文献

    🌈4 Matlab代码实现


    💥1 概述

    针对目前非侵入式负荷监测仅能识别单个家用电器、多种家用电器同时运行识别率低的问题,本文提出了一种提取电流波形特征以识别家用电器的方法。使用短时傅里叶变换(STFT)和核PCA技术来提取这些特征。定义特征后,分类器k-最近邻(kNN),支持向量机(SVM),线性判别分析(LDA),随机森林(RF)和极限学习机(ELM)用于设备(或设备组合)识别。

    📚2 运行结果

    部分代码:

    %% Classification
    %% KNN
    % Train
    start_time_train=cputime;
    KNN = fitcknn(Xtrainp,Ytrain,'NumNeighbors',5);
    end_time_train=cputime;
    TrainTime_knn=end_time_train-start_time_train

    % Test
    start_time_test=cputime;
    label_knn = predict(KNN,Xtestp);
    end_time_test=cputime;
    TestTime_knn=end_time_test-start_time_test
    AccRate_Knn = sum(Ytest' == label_knn)/length(Ytest)
            
    %% SVM
    % Train
    start_time_train=cputime;
    tSVM = templateSVM('Standardize',1,'KernelFunction','linear');
    SVM = fitcecoc(Xtrainp,Ytrain,'Learners',tSVM);
    end_time_train=cputime;
    TrainTime_svm=end_time_train-start_time_train

    % Test
    start_time_test=cputime;
    label_svm = predict(SVM,Xtestp);
    end_time_test=cputime;
    TestTime_svm=end_time_test-start_time_test
    AccRat_svm = sum(Ytest' == label_svm)/length(Ytest)

    %% LDA
    % Train
    start_time_train=cputime;
    LDA = fitcdiscr(Xtrainp,Ytrain);
    end_time_train=cputime;
    TrainTime_lda=end_time_train-start_time_train

    % Test
    start_time_test=cputime;
    label_lda = predict(LDA,Xtestp);
    end_time_test=cputime;
    TestTime_lda=end_time_test-start_time_test
    AccRate_lda = sum(Ytest' == label_lda)/length(Ytest)

    %% Decision tree
    % train
    start_time_train=cputime;
    TREE = TreeBagger(150,Xtrainp,Ytrain,'OOBPredictorImportance','on');
    end_time_train=cputime;
    TrainTime_tree=end_time_train-start_time_train

    % Test
    start_time_test=cputime;
    label_tree = str2double(predict(TREE,Xtestp));
    end_time_test=cputime;
    TestTime_tree=end_time_test-start_time_test
    AccRate_tree = sum(Ytest' == label_tree)/length(Ytest)

    %% ELM
    [TrainingTime, TestingTime, ~, AccRate_elm, label_elm] = elm_aece(Xtrainp',...
        Ytrain, Xtestp', Ytest, 1, 1500, 'sig');
    AccRate_elm

    %% Statistics
    C_svm = confusionmat(Ytest',label_svm);
    C_lda = confusionmat(Ytest',label_lda);
    C_knn = confusionmat(Ytest',label_knn);
    C_tree = confusionmat(Ytest',label_tree);
    C_elm = confusionmat(Ytest',label_elm);
    [result_svm,reference_svm]= getStatistical(C_svm);
    [result_knn,reference_knn]= getStatistical(C_knn);
    [result_lda,reference_lda]= getStatistical(C_lda);
    [result_tree,reference_tree]= getStatistical(C_tree);
    [result_elm,reference_elm]= getStatistical(C_elm);

    🎉3 参考文献

    部分理论来源于网络,如有侵权请联系删除。

    [1]李争,王泽,冯威,安国庆,王强,陈贺.基于CNN与K-means聚类的非侵入式电器负荷识别方法[J].河北科技大学学报,2022,43(04):365-373.

    [2]Daniel Cavalieri (2022). KPCA and STFT Non-intrusive Load Monitoring 

    🌈4 Matlab代码实现

  • 相关阅读:
    CSRF(跨站请求伪造)攻击和预防
    LuaRadio介绍
    【Spring】使用注解开发前提条件
    想知道对象有没有在外面搞暧昧?简单几步就能查清楚
    python在centos7.x下建立虚拟环境
    centos7安装MySQL—以MySQL5.7.30为例
    嵌入式-Linux基础操作
    数据呈现【PPT】
    input 表单元素
    C++继承(跑路人笔记)
  • 原文地址:https://blog.csdn.net/weixin_46039719/article/details/127912798