99999久久久久久亚洲,欧美人与禽猛交狂配,高清日韩av在线影院,一个人在线高清免费观看,啦啦啦在线视频免费观看www

熱線電話:13121318867

登錄
首頁精彩閱讀數(shù)據(jù)挖掘系列使用mahout做海量數(shù)據(jù)關(guān)聯(lián)規(guī)則挖掘
數(shù)據(jù)挖掘系列使用mahout做海量數(shù)據(jù)關(guān)聯(lián)規(guī)則挖掘
2016-08-15
收藏

數(shù)據(jù)挖掘系列使用mahout做海量數(shù)據(jù)關(guān)聯(lián)規(guī)則挖掘

上一篇介紹了用開源數(shù)據(jù)挖掘軟件weka做關(guān)聯(lián)規(guī)則挖掘,weka方便實(shí)用,但不能處理大數(shù)據(jù)集,因?yàn)閮?nèi)存放不下,給它再多的時間也是無用,因此需要進(jìn)行分布式計算,mahout是一個基于hadoop的分布式數(shù)據(jù)挖掘開源項(xiàng)目(mahout本來是指一個騎在大象上的人)。掌握了關(guān)聯(lián)規(guī)則的基本算法和使用,加上分布式關(guān)聯(lián)規(guī)則挖掘后,就可以處理基本的關(guān)聯(lián)規(guī)則挖掘工作了,實(shí)踐中只需要把握業(yè)務(wù),理解數(shù)據(jù)便可游刃有余。

安裝mahout

騎在大象上的俠士必然需要一頭雄糾糾的大象,不過本文不解紹大象hadoop,所以我假定已經(jīng)安裝好了hadoop,關(guān)于hadoop的安裝,請google。

到Apache官網(wǎng)下載mahout8.0

解壓

tar -zxvf mahout-distribution-0.8.tar.gz

移動

sudo mv tar mahout-distribution-0.8/usr/local/mahout-8

配置

sudo gedit /etc/profile

輸入以下內(nèi)容:

退出用戶重新登錄,使配置文件生效。輸入mahout -version測試是否安裝成功。

數(shù)據(jù)準(zhǔn)備

到http://fimi.ua.ac.be/data/下載一個購物籃數(shù)據(jù)retail.dat。

上傳到hadoop文件系統(tǒng)  

調(diào)用FpGrowth算法

mahout fpg -i /user/hadoop/mahoutData/retail.dat -o patterns -method mapreduce -s1000-regex'[\ ]'

-i表示input,-o表示-output,-s表示最小支持度,'[\ ]'表示以行內(nèi)的數(shù)據(jù)以空格分開。

一兩分鐘后執(zhí)行完畢,生成的文件被序列化了,直接查看會是亂碼,因此需要用mahout還原回來:

mahout seqdumper -i /user/hadoop/patterns/fpgrowth/part-r-00000-o ~/data/patterns.txt

輸出結(jié)果:  

Key: 39: Value: ([39],50675)
Key: 48: Value: ([48],42135), ([39, 48],29142)
Key: 38: Value: ([38],15596), ([39, 38],10345), ([48, 38],7944), ([39, 48, 38],6102)
Key: 32: Value: ([32],15167), ([39, 32],8455), ([48, 32],8034), ([39, 48, 32],5402), ([38, 32],2833), ([39, 38, 32],1840), ([48, 38, 32],1646), ([39, 48, 38, 32],1236)
Key: 41: Value: ([41],14945), ([39, 41],11414), ([48, 41],9018), ([39, 48, 41],7366), ([38, 41],3897), ([32, 41],3196), ([39, 38, 41],3051), ([48, 38, 41],2374), ([39, 32, 41],2359), ([48, 32, 41],2063), ([39, 48, 38, 41],1991), ([39, 48, 32, 41],1646)
Key: 65: Value: ([65],4472), ([39, 65],2787), ([48, 65],2529), ([39, 48, 65],1797)
Key: 89: Value: ([89],3837), ([48, 89],2798), ([39, 89],2749), ([39, 48, 89],2125)
Key: 225: Value: ([225],3257), ([39, 225],2351), ([48, 225],1736), ([39, 48, 225],1400)

這里輸出的只是頻繁項(xiàng)集,但在此基礎(chǔ)上提取關(guān)聯(lián)規(guī)則已經(jīng)不是難事。


數(shù)據(jù)分析咨詢請掃描二維碼

若不方便掃碼,搜微信號:CDAshujufenxi

數(shù)據(jù)分析師資訊
更多

OK
客服在線
立即咨詢
客服在線
立即咨詢
') } function initGt() { var handler = function (captchaObj) { captchaObj.appendTo('#captcha'); captchaObj.onReady(function () { $("#wait").hide(); }).onSuccess(function(){ $('.getcheckcode').removeClass('dis'); $('.getcheckcode').trigger('click'); }); window.captchaObj = captchaObj; }; $('#captcha').show(); $.ajax({ url: "/login/gtstart?t=" + (new Date()).getTime(), // 加隨機(jī)數(shù)防止緩存 type: "get", dataType: "json", success: function (data) { $('#text').hide(); $('#wait').show(); // 調(diào)用 initGeetest 進(jìn)行初始化 // 參數(shù)1:配置參數(shù) // 參數(shù)2:回調(diào),回調(diào)的第一個參數(shù)驗(yàn)證碼對象,之后可以使用它調(diào)用相應(yīng)的接口 initGeetest({ // 以下 4 個配置參數(shù)為必須,不能缺少 gt: data.gt, challenge: data.challenge, offline: !data.success, // 表示用戶后臺檢測極驗(yàn)服務(wù)器是否宕機(jī) new_captcha: data.new_captcha, // 用于宕機(jī)時表示是新驗(yàn)證碼的宕機(jī) product: "float", // 產(chǎn)品形式,包括:float,popup width: "280px", https: true // 更多配置參數(shù)說明請參見:http://docs.geetest.com/install/client/web-front/ }, handler); } }); } function codeCutdown() { if(_wait == 0){ //倒計時完成 $(".getcheckcode").removeClass('dis').html("重新獲取"); }else{ $(".getcheckcode").addClass('dis').html("重新獲取("+_wait+"s)"); _wait--; setTimeout(function () { codeCutdown(); },1000); } } function inputValidate(ele,telInput) { var oInput = ele; var inputVal = oInput.val(); var oType = ele.attr('data-type'); var oEtag = $('#etag').val(); var oErr = oInput.closest('.form_box').next('.err_txt'); var empTxt = '請輸入'+oInput.attr('placeholder')+'!'; var errTxt = '請輸入正確的'+oInput.attr('placeholder')+'!'; var pattern; if(inputVal==""){ if(!telInput){ errFun(oErr,empTxt); } return false; }else { switch (oType){ case 'login_mobile': pattern = /^1[3456789]\d{9}$/; if(inputVal.length==11) { $.ajax({ url: '/login/checkmobile', type: "post", dataType: "json", data: { mobile: inputVal, etag: oEtag, page_ur: window.location.href, page_referer: document.referrer }, success: function (data) { } }); } break; case 'login_yzm': pattern = /^\d{6}$/; break; } if(oType=='login_mobile'){ } if(!!validateFun(pattern,inputVal)){ errFun(oErr,'') if(telInput){ $('.getcheckcode').removeClass('dis'); } }else { if(!telInput) { errFun(oErr, errTxt); }else { $('.getcheckcode').addClass('dis'); } return false; } } return true; } function errFun(obj,msg) { obj.html(msg); if(msg==''){ $('.login_submit').removeClass('dis'); }else { $('.login_submit').addClass('dis'); } } function validateFun(pat,val) { return pat.test(val); }