24小时热门版块排行榜    

查看: 583  |  回复: 0

赵环

新虫 (初入文坛)

[交流] 谁知道这里面的data和newdata指的是什么。。谢谢了

function [cdata,me,ctest]=center(data,opt,newdata);                       
%#                                                                               
%#  AIM:         Centering along columns, rows or double centering               
%#                                                                               
%#  PRINCIPLE:  Removal of the column-, row- or overall mean from                
%#              each column, row or both, respectively                                 
%#                                  If a test data set is available it can ONLY be
%#              column centered using the mean from the calibration
%#              data set.
%#
%#
%#  INPUT:        data: (m x n) matrix with m rows and n variables               
%#                                opt: optional                                                       
%#                     1 = column centering                                       
%#                     2 = row centering                                               
%#                     3 = double centering                                       
%#          newdata: (mt x n) test matrix with mt rows and n variables
%#                                       
%#                                                                                
%#  OUTPUT:        cdata: (m x n) matrix containing centered data                       
%#                                me: mean vector, overall mean (scalar)
%#              newdata: (mt*n) test matrix centered with the mean of data
%#       
%#                                                                               
%#  AUTHOR:         Andrea Candolfi                                                        
%#                                    Copyright(c) 1997 for ChemoAc                                       
%#                  FABI, Vrije Universiteit Brussel                                   
%#                  Laarbeeklaan 103 1090 Jette                                       
%#                                                                                  
%# VERSION: 1.2 (25/02/2002)                                                       
%#                                                                               
%#  TEST:           I. Stanimirova        & S. Gourv閚ec & M. Zhang
%#                                                                               
       
function [cdata,me,cnewdata]=center(data,opt,newdata);

[m,n]=size(data);

if nargin==1;
  opt=[4];
  while opt>3 | opt<=0
    opt=input('column centering(1), row centering(2), double centering(3):');
  end
end


if opt==1                        % column centering
   me=mean(data);
   cdata=data-ones(m,1)*me;
end

if opt==2                        % row centering
   me=mean(data')';
   cdata=data-me*ones(1,n);
end

if opt==3         % double centering
   me=mean(mean(data));
   mej=mean(data');
   mei=mean(data);
   cdata=data-(ones(m,1)*mei)-(ones(n,1)*mej)'+(ones(m,n)*me);
end

if exist('newdata')==1                        % center new data
    [mt,n]=size(newdata);
   
    if opt==1                                % column centering
        me=mean(data);
        cnewdata=newdata-ones(mt,1)*me;
    else
        error('Row centering and double centering are impossible to perform on a test set');
    end
   
end
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

智能机器人

Robot (super robot)

我们都爱小木虫

相关版块跳转 我要订阅楼主 赵环 的主题更新
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 材料080500调剂求收留 +7 一颗meteor 2026-03-13 7/350 2026-03-20 17:47 by 无懈可击111
[考研] 22408 344分 求调剂 一志愿 华电计算机技术 +3 solanXXX 2026-03-20 3/150 2026-03-20 16:41 by fxue1114
[考研] 招收调剂硕士 +4 lidianxing 2026-03-19 12/600 2026-03-20 12:25 by lidianxing
[考研] 329求调剂 +6 想上学吖吖 2026-03-19 6/300 2026-03-20 09:00 by 每天只摆一小会
[考研] 材料学硕318求调剂 +5 February_Feb 2026-03-19 5/250 2026-03-19 23:51 by 23Postgrad
[考研] 288求调剂,一志愿华南理工大学071005 +5 ioodiiij 2026-03-17 5/250 2026-03-19 18:22 by zcl123
[考研] 梁成伟老师课题组欢迎你的加入 +9 一鸭鸭哟 2026-03-14 11/550 2026-03-19 17:22 by !本暗一次!
[考研] 一志愿西安交通大学材料工程专业 282分求调剂 +5 枫桥ZL 2026-03-18 7/350 2026-03-19 14:52 by 功夫疯狂
[考研] 286求调剂 +6 lemonzzn 2026-03-16 10/500 2026-03-19 14:31 by lemonzzn
[考研] 求调剂,一志愿:南京航空航天大学大学 ,080500材料科学与工程学硕,总分289分 +3 @taotao 2026-03-19 3/150 2026-03-19 14:07 by peike
[考研] 0703化学调剂 +5 pupcoco 2026-03-17 8/400 2026-03-19 13:58 by houyaoxu
[考研] 一志愿 西北大学 ,070300化学学硕,总分287,双非一本,求调剂。 +3 晨昏线与星海 2026-03-19 3/150 2026-03-19 13:36 by houyaoxu
[考研] 311求调剂 +11 冬十三 2026-03-15 12/600 2026-03-18 14:36 by 星空星月
[考研] 材料专硕306英一数二 +10 z1z2z3879 2026-03-16 13/650 2026-03-18 14:20 by 007_lilei
[考研] 299求调剂 +5 △小透明* 2026-03-17 5/250 2026-03-18 11:49 by 尽舜尧1
[考研] 280求调剂 +6 咕噜晓晓 2026-03-18 7/350 2026-03-18 11:25 by 无际的草原
[考研] 材料与化工专硕调剂 +5 heming3743 2026-03-16 5/250 2026-03-17 14:03 by 勇敢太监王公公
[考博] 26申博 +4 八6八68 2026-03-16 4/200 2026-03-17 13:00 by 轻松不少随
[考研] 0854控制工程 359求调剂 可跨专业 +3 626776879 2026-03-14 9/450 2026-03-16 17:42 by 626776879
[考研] 0703化学调剂 290分有科研经历,论文在投 +7 腻腻gk 2026-03-14 7/350 2026-03-16 10:12 by houyaoxu
信息提示
请填处理意见