predepose.m

来自「生物柴油课题的神经网络方法处理」· M 代码 · 共 108 行

M
108
字号
%数据预处理,将各项输入参数进行打分,打分后各参数为0到1间数字
function newdata=predepose(P)
    p=[P(:,1:3),P(:,5:13)];
    [R,Q]=size(p);
    for i=1:R
        p(i,1)=(p(i,1)-0)/0.5;
        if p(i,1)>1
            p(i,1)=1;
        end
        if p(i,1)<0
            p(i,1)=0;
        end
     end
    for i=1:R
        p(i,2)=(p(i,2)-0)/500;
        if p(i,2)>1
            p(i,2)=1;
        end
        if p(i,2)<0
            p(i,2)=0;
        end
    end
    for i=1:R
        p(i,3)=-(p(i,3)-10)/50;
        if p(i,3)>1
            p(i,3)=1;
        end
        if p(i,3)<0
            p(i,3)=0;
        end
    end
    for i=1:R
        switch p(i,4)
            case 24
                p(i,4)=0.25;
            case 12
                p(i,4)=0.5;
            case 6
                p(i,4)=0.75;
            case 3
                p(i,4)=1;
        end
    end
    for i=1:R
        p(i,5)=1-(p(i,5)-100)/400;
        if p(i,5)>1
            p(i,5)=1;
        end
        if p(i,5)<0
            p(i,5)=0;
        end
    end
    for i=1:R
        p(i,6)=(p(i,6)-30)/20;
        if p(i,6)>1
            p(i,6)=1;
        end
        if p(i,6)<0
            p(i,6)=0;
        end
    end
    for i=1:R
        p(i,7)=abs((p(i,7)-0.85)/0.1);
        if p(i,7)>1
            p(i,7)=1;
        end
        if p(i,7)<0
            p(i,7)=0;
        end
    end
    for i=1:R
        p(i,8)=-(p(i,8)-5)/25;
        if p(i,8)>1
            p(i,8)=1;
        end
        if p(i,8)<0
            p(i,8)=0;
        end
    end
    for i=1:R
        p(i,9)=1-(p(i,9)-0.05)/0.05;
        if p(i,9)>1
            p(i,9)=1;
        end
        if p(i,9)<0
            p(i,9)=0;
        end
    end
    for i=1:R
        p(i,10)=abs((p(i,10)-200)/100);
        if p(i,10)>1
            p(i,10)=1;
        end
        if p(i,10)<0
            p(i,10)=0;
        end
    end
    for i=1:R
        p(i,11)=1-(p(i,11)-2)/8;
        if p(i,11)>1
            p(i,11)=1;
        end
        if p(i,11)<0
            p(i,11)=0;
        end
    end
    newdata=p;
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?