欢迎来到得力文库 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
得力文库 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    2022年reliefF算法源码.pdf

    • 资源ID:12939002       资源大小:45.89KB        全文页数:10页
    • 资源格式: PDF        下载积分:4.3金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要4.3金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    2022年reliefF算法源码.pdf

    function W = reliefF(Dnolabel,Dlabel,Num,k,typeD,Topn)% % To achieve attribute ranking using reliefF % Dlabel is the array of the label for each record % The data in Dlabel should be format 1,2,3 and so on % Dnolabel is the array of each record without label % Num is loop time for randomly choose instance % k is the number of nearest hits and miss choosed % Weight is output and it is the ranking of each attribute % typeD is the type of Nolabel data, if it is numerical, typeD=0; % if it is nominal attributes, typeD=1;%y,x=size(Dnolabel); W = zeros(1,Topn);精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 1 页,共 10 页 - - - - - - - - - - %calculate the label probabilityLabelRange=max(Dlabel)-min(Dlabel)+1;LabelCount=zeros(1,LabelRange);LabelP=zeros(1,LabelRange);for i=1:y LabelCount(Dlabel(i)=LabelCount(Dlabel(i)+1; endfor j=1:LabelRange LabelP(j)=LabelCount(j)/y;endLabelP%*DistanceArray=zeros(y-1,2);精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 2 页,共 10 页 - - - - - - - - - - %Weight=zeros(1,x);Weight=zeros(x,2);Diff=0; for i=1:x dominoDiff(i) = max(Dnolabel(:,i)- min(Dnolabel(:,i);end%for each loop of random choose instance for NumN=1:Num NumN%randomly choose a instance InstanceId = round(y.*rand(1);while InstanceId=0, InstanceId = round(y.*rand(1);精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 3 页,共 10 页 - - - - - - - - - - end index = 1;%calculate the distance to the choosed instance for each other instance for i=1:yif (i=InstanceId)for j=1:xDistanceArray(index,1)=DistanceArray(index,1)+. (Dnolabel(i,j)-Dnolabel(InstanceId,j)2;endDistanceArray(index,1)=(DistanceArray(index,1)/x); DistanceArray(index,2)=i; index = index+1;end精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 4 页,共 10 页 - - - - - - - - - - end%sort distance ascending DistanceArray=sortrows(DistanceArray,1); Result=zeros(LabelRange,y); classSize = zeros(1,LabelRange);for i=1:y-1 class = Dlabel(DistanceArray(i,2); classSize(class) = classSize(class)+1; Result(class,classSize(class)=DistanceArray(i,2);end%for each attribute MissW=0; %the initial value for the part relative Miss in the weight HitW=0; %the initial value for the part relative Hit in the 精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 5 页,共 10 页 - - - - - - - - - - weightfor AttributeNum=1:x%calculate the difference of min-max value in this attribute diff = Weight(AttributeNum,1);if (dominoDiff(AttributeNum) Weight(AttributeNum,1)=0; Weight(AttributeNum,2)=AttributeNum;continue ;end%calculate the weight for each attribute for i=1:k %k is the number of nearest neighbours chosen by user idHit = Result(Dlabel(InstanceId),k );%for the Hits精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 6 页,共 10 页 - - - - - - - - - - if (round(typeD)=0) diff = diff - abs( Dnolabel(idHit, AttributeNum) -. Dnolabel(InstanceId, AttributeNum) ). /dominoDiff(AttributeNum)/k; elseif(round(Dnolabel(InstanceId,AttributeNum). =round(Dnolabel(idHit, AttributeNum) diff=diff-0;else diff=diff-1;endendend精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 7 页,共 10 页 - - - - - - - - - - for c=1:LabelRangeif (c=Dlabel(InstanceId)continue ;end P=LabelP(c)/(1-LabelP(Dlabel(InstanceId);for i=1:k idMiss = Result(c,i);%for the misses if (round(typeD)=0) diff = diff + P*abs( Dnolabel(idMiss, AttributeNum) -. Dnolabel(InstanceId, AttributeNum) ). /dominoDiff(AttributeNum)/k; 精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 8 页,共 10 页 - - - - - - - - - - elseif(round(Dnolabel(InstanceId,AttributeNum). =round(Dnolabel(idHit, AttributeNum) diff=diff;else diff=diff+1;endendendend % for m=1:LabelRange Weight(AttributeNum,1)=diff; Weight(AttributeNum,2)=AttributeNum;end % for AttributeNum=1:x精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 9 页,共 10 页 - - - - - - - - - - end % for NumN=1:Num Weight(AttributeNum,1)=diff/Num;Weight(AttributeNum,2)=AttributeNum; W1 = sortrows(Weight);for i = 1:Topn W(i) = W1(x-i+1,2);end精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 10 页,共 10 页 - - - - - - - - - -

    注意事项

    本文(2022年reliefF算法源码.pdf)为本站会员(Che****ry)主动上传,得力文库 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知得力文库 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于得利文库 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

    © 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

    黑龙江省互联网违法和不良信息举报
    举报电话:0468-3380021 邮箱:hgswwxb@163.com  

    收起
    展开