乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      基于mnist手寫數(shù)字數(shù)據(jù)庫識別算法matlab仿真,對比SVM,LDA以及決策樹

       簡簡單單做算法 2023-07-23 發(fā)布于浙江

      1.算法理論概述

             基于MNIST手寫數(shù)字數(shù)據(jù)庫識別算法,對比SVM、LDA以及決策樹。首先,我們將介紹MNIST數(shù)據(jù)庫的基本信息和手寫數(shù)字識別的背景,然后分別介紹SVM、LDA和決策樹的基本原理和數(shù)學模型,并對比它們在手寫數(shù)字識別任務(wù)中的性能。

      1.1、MNIST手寫數(shù)字數(shù)據(jù)庫

             MNIST是一種經(jīng)典的手寫數(shù)字數(shù)據(jù)庫,包含60,000張訓練圖像和10,000張測試圖像。每張圖像的大小為28x28像素,包含一個手寫數(shù)字0~9。MNIST數(shù)據(jù)集被廣泛應(yīng)用于手寫數(shù)字識別任務(wù)中,是評估圖像識別算法性能的標準數(shù)據(jù)集之一。

        

        

      2.算法運行軟件版本

      MATLAB2022a

      3.     算法運行效果圖預(yù)覽

        

        

        

      4.部分核心程序

      [images, labels]           = func_mnist_read('MNIST\train-images.idx3-ubyte', 'MNIST\train-labels.idx1-ubyte');
      [test_images, test_labels] = func_mnist_read('MNIST\t10k-images.idx3-ubyte', 'MNIST\t10k-labels.idx1-ubyte');
      % 對數(shù)據(jù)進行預(yù)處理
      images                     = im2double(images);
      [m,n,k]                    = size(images);
       
      for i = 1:k
          rawData(:,i) = reshape(images(:,:,i), m*n,1);
      end 
       
      test_images = im2double(test_images);
      [m,n,k]     = size(test_images);
       
      for i = 1:k
          testData(:,i) = reshape(test_images(:,:,i), m*n,1);
      end 
       
      % PCA Projection
       % 對數(shù)據(jù)進行中心化處理
       
      [m,n]   = size(rawData);
      mn      = mean(rawData, 2);
      X       = rawData - repmat(mn, 1, n);
      A       = X/sqrt(n-1);
      % 對數(shù)據(jù)進行奇異值分解,降維
      [U,S,V] = svd(A,'econ');
       
      projection_training = U(:, 1:154)'*X;
      projection_training = projection_training./max(S(:));
      [m, n] = size(testData);
      test_avg = testData - repmat(mn, 1, n);
      projection_test = U(:, 1:154)'*test_avg;
      projection_test = projection_test./max(S(:));
       
      % 將數(shù)據(jù)和標簽轉(zhuǎn)換成合適的格式
      xtrain     = projection_training;
      label      = labels';
      %% SVM分類器訓練和分類
      proj_test  = projection_test;
      true_label = test_labels;
      % 訓練SVM分類器
      Mdl = fitcecoc(xtrain',label);
       
      % 對測試數(shù)據(jù)進行分類,并評估分類結(jié)果
      testlabels = predict(Mdl,proj_test');
      testNum = size(testlabels,1);
      err = abs(testlabels - true_label);
      err = err > 0;
      errNum = sum(err);
      sucRate = 1 - errNum/testNum
      % 顯示混淆矩陣
      confusionchart(true_label, testlabels);
      title(["SVM分類結(jié)果混淆矩陣評價",'識別準確率:',num2str(sucRate)]);

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多