function feature=getfeature(net,x,type)
%根据训练得到的net,取出中间隐层映射得到的特征
%x是n*p,w1是hid*p,b1是hid*1,w2是p*hid,b2是p*1
%type是训练时采用类型1:tansig+purelin
%2:logsig+purelin
%3:tansig+logsig
%4:logsig+tansig
w1=net.IW{1,1};
b1=net.b{1};
%w2=net.LW{2,1};
%b2=net.b{2};
n=size(x,1);
hid=length(b1);
netx=zeros(n,hid);
for i=1:n
xx=x(i,:);
for j=1:hid
ww=w1(j,:);
he=sum(xx.*ww)+b1(j);
if type==1
netx(i,j)=tansig(he);%这里不同情况不同
end
if type==2
netx(i,j)=logsig(he);%这里不同情况不同
end
if type==3
netx(i,j)=tansig(he);%这里不同情况不同
end
if type==4
netx(i,j)=logsig(he);%这里不同情况不同
end
end
end
feature=netx;
end
深度学习autocode代码
4星 · 超过85%的资源 需积分: 15 108 浏览量
2013-11-24
11:39:42
上传
评论 2
收藏 92KB ZIP 举报
heyMrgu
- 粉丝: 1
- 资源: 3
最新资源
- C语言基础-C语言编程基础之Leetcode编程题解之第39题组合总和.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第38题外观数列.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第37题解数独.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第36题有效的数独.zip
- C语言基础-C语言编程基础之Leetcode编程题解之第35题搜索插入位置.zip
- index.wxml
- C语言基础-C语言编程基础之Leetcode编程题解之第33题搜索旋转排序数组.zip
- 基于Python实现的手写数字识别系统源码.zip
- 从网页提取禁止转载的文字
- C语言基础-C语言编程基础之Leetcode编程题解之第32题最长有效括号.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
前往页