久久精品日韩无码|61伊人久久绿帽|最新国产浮力网站|亚州aV无码国产|明星一二三区av|超碰人人在线成人|澳门无码福利av

公安部地址?

時(shí)間:2024-09-01 01:47 人氣:0 編輯:招聘街

一、公安部地址?

中華人民共和國(guó)公安部的地址:北京市東

城區(qū)東長(zhǎng)安街14號(hào);郵編:100741;電

話:010-66262114。也可直接登陸下方

的網(wǎng)址訪問(wèn)公安部官網(wǎng)。

二、公安部門編制?

公安局有事業(yè)編制人員。公安局的正式事業(yè)編制的工勤人員屬于待入警人員,并不是公務(wù)員,不享有執(zhí)法權(quán)。一般都在非執(zhí)法崗位,如110接警中心等。工勤人員無(wú)警銜和警服,享受人民警察待遇,工資相比少了個(gè)警銜津貼。公安局工勤編制就是公安里的職工,不是公務(wù)員編制。比協(xié)警強(qiáng)點(diǎn),可以享受公安人員的工資和其它待遇,比如養(yǎng)老和住房工基金,理論上說(shuō)是沒(méi)有警銜的,如同國(guó)企里的工人,稱之為事業(yè)單位在編人員,不是干部或公務(wù)員。

三、中央公安部網(wǎng)站?

公安網(wǎng)分為內(nèi)網(wǎng)和外網(wǎng)。內(nèi)網(wǎng)只有公安機(jī)關(guān)工作人員可以瀏覽。

普通公民只能瀏覽公安部及其下屬公安局網(wǎng)站。如,公安部的官方網(wǎng)站為http://www.mps.gov.cn。在公安系統(tǒng)查詢個(gè)人信息:1,支付寶首頁(yè)打開(kāi)市民中心。2在市民中心辦事大廳里,選擇公安交管,然后點(diǎn)擊個(gè)人信息查詢。3仔細(xì)閱讀公安系統(tǒng)的查詢須知,然后點(diǎn)擊同意。4.輸入個(gè)人信息查詢的申請(qǐng)信息,點(diǎn)擊提交就可以了,結(jié)果會(huì)在幾個(gè)工作日內(nèi)發(fā)到你的郵箱。

四、公安部欠薪規(guī)定?

根據(jù)《公安部關(guān)于加強(qiáng)支付離休干部報(bào)銷及工資支付工作的規(guī)定》(公安部令第32號(hào)),公安部規(guī)定,工資應(yīng)及時(shí)正常支付,未及時(shí)發(fā)放工資的,應(yīng)當(dāng)正常發(fā)放補(bǔ)發(fā)工資,不得征收不正當(dāng)手續(xù)費(fèi),也不得把未發(fā)工資算作未發(fā)補(bǔ)貼、公積金等。

五、公安部報(bào)案平臺(tái)?

有因?yàn)楣膊吭O(shè)有“110接警平臺(tái)”和“公安部網(wǎng)絡(luò)違法犯罪舉報(bào)網(wǎng)站”,可供民眾使用。 110接警平臺(tái)是公安機(jī)關(guān)接受警情和求助的電話平臺(tái),是全國(guó)統(tǒng)一的警務(wù)電話,撥打110可以報(bào)警和求助;同時(shí),公安部網(wǎng)絡(luò)違法犯罪舉報(bào)網(wǎng)站也提供了方便快捷的網(wǎng)絡(luò)舉報(bào)渠道,民眾可以通過(guò)該網(wǎng)站進(jìn)行網(wǎng)絡(luò)違法犯罪的舉報(bào)和投訴,包括網(wǎng)絡(luò)詐騙、色情等行為。為民眾提供了一個(gè)安全、便捷的報(bào)案渠道,讓民眾可以更及時(shí)有效地保護(hù)自己的合法權(quán)益。

六、公安部 工資

在中國(guó),公安部門是負(fù)責(zé)維護(hù)社會(huì)安全和治安秩序的重要組織。作為執(zhí)行國(guó)家法律和保護(hù)人民生命財(cái)產(chǎn)安全的機(jī)構(gòu),公安部門的工作任務(wù)非常繁重和關(guān)鍵。而公安部門的工資待遇也一直備受關(guān)注,因?yàn)樗苯雨P(guān)系到公安機(jī)關(guān)的工作積極性和效率。

作為國(guó)家機(jī)關(guān)工作人員,公安部門的工資待遇由一系列因素決定,主要包括職位等級(jí)、工作年限和績(jī)效表現(xiàn)。公安部門中分為許多職位,從普通警員到高級(jí)警官,每個(gè)職位對(duì)應(yīng)的工資水平都有所不同。

職位等級(jí)

在公安部門,警員的職位等級(jí)可以根據(jù)其實(shí)際職位、職責(zé)和資歷來(lái)劃分。普通警員大多數(shù)是從基層干部逐漸晉升而來(lái),他們的工資水平相對(duì)較低。而隨著職位的晉升,警員將逐漸獲得更高的職位等級(jí)和相應(yīng)的工資待遇。

高級(jí)職位的公安人員,如警督、警司等,通常需要具備更高的學(xué)歷和豐富的經(jīng)驗(yàn)。他們?cè)诠补ぷ髦谐袚?dān)著更多的責(zé)任和管理職責(zé),因此他們的工資待遇相對(duì)較高。

工作年限

工作年限也是影響公安部門工資的重要因素之一。隨著工作年限的增加,警員的經(jīng)驗(yàn)和實(shí)際工作能力會(huì)得到提高,因此工資待遇也會(huì)逐步增加。

同時(shí),公安部門通常設(shè)有一些晉升渠道,通過(guò)參加培訓(xùn)和考試,公安人員可以獲得更高的職位和更高的工資待遇。

績(jī)效表現(xiàn)

績(jī)效表現(xiàn)是公安部門工資待遇的重要考量因素之一。公安人員的工作表現(xiàn)將直接關(guān)系到工資的增長(zhǎng)和晉升的機(jī)會(huì)。

公安部門通常會(huì)根據(jù)警員的勤勉程度、案件偵破率、榮譽(yù)表彰等因素評(píng)估績(jī)效。表現(xiàn)優(yōu)秀的警員將有較高的機(jī)會(huì)得到晉升和加薪。

工資待遇的透明性

公安部門工資待遇的透明性是一個(gè)受到關(guān)注的問(wèn)題。對(duì)于公眾來(lái)說(shuō),了解公安人員的工資待遇情況有助于增強(qiáng)對(duì)公安部門的信任。

一些地方政府已經(jīng)開(kāi)始提倡公安工資的公開(kāi)透明化。通過(guò)公開(kāi)公安人員的工資等信息,可以方便公眾監(jiān)督和評(píng)估公安工作。

努力提高公安人員工資待遇的必要性

提高公安人員工資待遇是一個(gè)關(guān)系到公安工作質(zhì)量和效率的重要問(wèn)題。公安人員承擔(dān)著維護(hù)社會(huì)穩(wěn)定和保護(hù)公民安全的重任,應(yīng)該得到合理的回報(bào)和激勵(lì)。

適當(dāng)提高公安人員的工資待遇可以激勵(lì)他們更加投入地履行職責(zé),提高工作積極性和干勁。

另外,與其他行業(yè)相比,公安部門的工作壓力較大,工作環(huán)境較為復(fù)雜和危險(xiǎn)。因此,提高公安人員的工資待遇可以提升其工作積極性和幸福感,避免高壓環(huán)境下的人才流失。

結(jié)論

公安部門工資待遇是公安人員關(guān)注的焦點(diǎn)之一,它直接影響到公安機(jī)關(guān)的工作效率和公民對(duì)公安部門的信任。因此,政府應(yīng)該重視公安人員的工資待遇問(wèn)題,并采取措施提高其工資水平。

公安部門也應(yīng)該通過(guò)透明化公安工資待遇,增加公眾對(duì)公安工作的理解和支持。

七、公安部退休規(guī)定?

一、警察退休年齡新規(guī)定

公安民警的退休政策應(yīng)和普通公務(wù)員有所區(qū)別,可實(shí)施彈性退休政策,民警從警年限滿25年的,本人自愿提出申請(qǐng),可以提前退休。

國(guó)家規(guī)定的退休年齡:

《國(guó)務(wù)院關(guān)于安置老弱病殘干部的暫行辦法》和《國(guó)務(wù)院關(guān)于工人退休、退職的暫行辦法》(國(guó)發(fā)〔1978〕104號(hào))文件所規(guī)定的退休年齡。即:全民所有制企業(yè)、事業(yè)單位和黨政機(jī)關(guān)、群眾團(tuán)體的工人:

(一)男年滿六十周歲,女年滿五十周歲,并且連續(xù)工齡滿十年的;

(二)男年滿五十五周歲、女年滿四十五周歲,連續(xù)工齡滿十年的,從事井下、高空、高溫、特別繁重體力勞動(dòng)或其他有害身體健康的工作;

(三)男年滿五十周歲,女年滿四十五周歲,連續(xù)工齡滿十年,由醫(yī)院證明,并經(jīng)勞動(dòng)鑒定委員會(huì)確認(rèn),完全喪失勞動(dòng)能力的應(yīng)當(dāng)準(zhǔn)予退休。

二、警察退休金怎么計(jì)算

人民警察基本退休金計(jì)算辦法如下:

基本退休金=基礎(chǔ)養(yǎng)老金+過(guò)渡性養(yǎng)老金+個(gè)人賬戶養(yǎng)老金+人民警察警銜津貼

1、基礎(chǔ)養(yǎng)老金=退休時(shí)全省上年度在崗職工月平均工資×(1+本人平均繳費(fèi)工資指數(shù))÷2×繳費(fèi)年限×1%。

其中,本人平均繳費(fèi)工資指數(shù)=(視同繳費(fèi)指數(shù)×視同繳費(fèi)年限+實(shí)際平均繳費(fèi)指數(shù)×實(shí)際繳費(fèi)年限)÷繳費(fèi)年限。

2、個(gè)人賬戶養(yǎng)老金=退休時(shí)本人基本養(yǎng)老保險(xiǎn)個(gè)人賬戶累計(jì)儲(chǔ)存額÷計(jì)發(fā)月數(shù)。

3、過(guò)渡性養(yǎng)老金=退休時(shí)全省上年度在崗職工月平均工資×本人視同繳費(fèi)指數(shù)×視同繳費(fèi)年限×過(guò)渡系數(shù)(1.2%)。

4、人民警察警銜津貼標(biāo)準(zhǔn)是按銜級(jí)執(zhí)行相應(yīng)的津貼標(biāo)準(zhǔn)。各銜級(jí)每月的警銜津貼標(biāo)準(zhǔn)為:二級(jí)警員64元,一級(jí)警員68元;三級(jí)警司72元,二級(jí)警司76元,一級(jí)警司80元;三級(jí)警督85元,二級(jí)警督90元;一級(jí)警督95元;三級(jí)警監(jiān)100元,二級(jí)警監(jiān)105元,一級(jí)警監(jiān)110元;副總警監(jiān)116元,總警監(jiān)123元。

八、公安部怎么考入?

等公安部招考的時(shí)候,符合條件即可去報(bào)名,若能夠通過(guò)筆試、面試、體檢就行了。

九、公安部網(wǎng)站備案?

網(wǎng)站公安備案的目的就是受當(dāng)?shù)鼐W(wǎng)警監(jiān)管,一起維護(hù)互聯(lián)網(wǎng)信息安全。

附上備案網(wǎng)址:http://www.beian.gov.cn/portal/index.do

網(wǎng)站備案的速度和網(wǎng)站類型有關(guān)。

一、非交互型的網(wǎng)站,如:企業(yè)官網(wǎng)等只是為了展示的網(wǎng)站,由于沒(méi)有提供用戶「發(fā)言」等交互的入口,是相對(duì)安全的,備案很快。

二、交互型的網(wǎng)站,特別是含有:發(fā)帖、發(fā)文章、發(fā)表評(píng)論等功能的網(wǎng)站,備案就會(huì)相對(duì)嚴(yán)格些。

因?yàn)榻换バ途W(wǎng)站的運(yùn)營(yíng)需要有嚴(yán)格的章程,來(lái)保證這個(gè)網(wǎng)站不會(huì)展示和幫助非法信息傳播。

交互型網(wǎng)站公安備案的流程如下:

1、建立網(wǎng)絡(luò)安全管理制度(制度文件打印簽字蓋章)

2、負(fù)責(zé)人寫(xiě)互聯(lián)網(wǎng)信息安全承諾書(shū)(承諾書(shū)文件打印簽字蓋章)

3、保證網(wǎng)管24小時(shí)監(jiān)管網(wǎng)站

4、保證網(wǎng)站已導(dǎo)入下發(fā)的屏蔽關(guān)鍵詞

5、在線提交互聯(lián)網(wǎng)安全評(píng)估報(bào)告

6、在線提交備案申請(qǐng)

完成以上,一般在線申請(qǐng)的就會(huì)通過(guò)了。最直接的辦法是,如果當(dāng)?shù)鼐W(wǎng)警短信通知,未通過(guò),又不知道原因的情況沒(méi),就在其工作時(shí)間回電話過(guò)去詢問(wèn)即可,一般都會(huì)告知的。因?yàn)樗麄円膊皇敲刻於加泻芏嗪芏嗟膫浒干暾?qǐng),是記得當(dāng)天拒絕的這份申請(qǐng)的原因是什么的。

十、mahout面試題?

之前看了Mahout官方示例 20news 的調(diào)用實(shí)現(xiàn);于是想根據(jù)示例的流程實(shí)現(xiàn)其他例子。網(wǎng)上看到了一個(gè)關(guān)于天氣適不適合打羽毛球的例子。

訓(xùn)練數(shù)據(jù):

Day Outlook Temperature Humidity Wind PlayTennis

D1 Sunny Hot High Weak No

D2 Sunny Hot High Strong No

D3 Overcast Hot High Weak Yes

D4 Rain Mild High Weak Yes

D5 Rain Cool Normal Weak Yes

D6 Rain Cool Normal Strong No

D7 Overcast Cool Normal Strong Yes

D8 Sunny Mild High Weak No

D9 Sunny Cool Normal Weak Yes

D10 Rain Mild Normal Weak Yes

D11 Sunny Mild Normal Strong Yes

D12 Overcast Mild High Strong Yes

D13 Overcast Hot Normal Weak Yes

D14 Rain Mild High Strong No

檢測(cè)數(shù)據(jù):

sunny,hot,high,weak

結(jié)果:

Yes=》 0.007039

No=》 0.027418

于是使用Java代碼調(diào)用Mahout的工具類實(shí)現(xiàn)分類。

基本思想:

1. 構(gòu)造分類數(shù)據(jù)。

2. 使用Mahout工具類進(jìn)行訓(xùn)練,得到訓(xùn)練模型。

3。將要檢測(cè)數(shù)據(jù)轉(zhuǎn)換成vector數(shù)據(jù)。

4. 分類器對(duì)vector數(shù)據(jù)進(jìn)行分類。

接下來(lái)貼下我的代碼實(shí)現(xiàn)=》

1. 構(gòu)造分類數(shù)據(jù):

在hdfs主要?jiǎng)?chuàng)建一個(gè)文件夾路徑 /zhoujainfeng/playtennis/input 并將分類文件夾 no 和 yes 的數(shù)據(jù)傳到hdfs上面。

數(shù)據(jù)文件格式,如D1文件內(nèi)容: Sunny Hot High Weak

2. 使用Mahout工具類進(jìn)行訓(xùn)練,得到訓(xùn)練模型。

3。將要檢測(cè)數(shù)據(jù)轉(zhuǎn)換成vector數(shù)據(jù)。

4. 分類器對(duì)vector數(shù)據(jù)進(jìn)行分類。

這三步,代碼我就一次全貼出來(lái);主要是兩個(gè)類 PlayTennis1 和 BayesCheckData = =》

package myTesting.bayes;

import org.apache.hadoop.conf.Configuration;

import org.apache.hadoop.fs.FileSystem;

import org.apache.hadoop.fs.Path;

import org.apache.hadoop.util.ToolRunner;

import org.apache.mahout.classifier.naivebayes.training.TrainNaiveBayesJob;

import org.apache.mahout.text.SequenceFilesFromDirectory;

import org.apache.mahout.vectorizer.SparseVectorsFromSequenceFiles;

public class PlayTennis1 {

private static final String WORK_DIR = "hdfs://192.168.9.72:9000/zhoujianfeng/playtennis";

/*

* 測(cè)試代碼

*/

public static void main(String[] args) {

//將訓(xùn)練數(shù)據(jù)轉(zhuǎn)換成 vector數(shù)據(jù)

makeTrainVector();

//產(chǎn)生訓(xùn)練模型

makeModel(false);

//測(cè)試檢測(cè)數(shù)據(jù)

BayesCheckData.printResult();

}

public static void makeCheckVector(){

//將測(cè)試數(shù)據(jù)轉(zhuǎn)換成序列化文件

try {

Configuration conf = new Configuration();

conf.addResource(new Path("/usr/local/hadoop/conf/core-site.xml"));

String input = WORK_DIR+Path.SEPARATOR+"testinput";

String output = WORK_DIR+Path.SEPARATOR+"tennis-test-seq";

Path in = new Path(input);

Path out = new Path(output);

FileSystem fs = FileSystem.get(conf);

if(fs.exists(in)){

if(fs.exists(out)){

//boolean參數(shù)是,是否遞歸刪除的意思

fs.delete(out, true);

}

SequenceFilesFromDirectory sffd = new SequenceFilesFromDirectory();

String[] params = new String[]{"-i",input,"-o",output,"-ow"};

ToolRunner.run(sffd, params);

}

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

System.out.println("文件序列化失??!");

System.exit(1);

}

//將序列化文件轉(zhuǎn)換成向量文件

try {

Configuration conf = new Configuration();

conf.addResource(new Path("/usr/local/hadoop/conf/core-site.xml"));

String input = WORK_DIR+Path.SEPARATOR+"tennis-test-seq";

String output = WORK_DIR+Path.SEPARATOR+"tennis-test-vectors";

Path in = new Path(input);

Path out = new Path(output);

FileSystem fs = FileSystem.get(conf);

if(fs.exists(in)){

if(fs.exists(out)){

//boolean參數(shù)是,是否遞歸刪除的意思

fs.delete(out, true);

}

SparseVectorsFromSequenceFiles svfsf = new SparseVectorsFromSequenceFiles();

String[] params = new String[]{"-i",input,"-o",output,"-lnorm","-nv","-wt","tfidf"};

ToolRunner.run(svfsf, params);

}

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

System.out.println("序列化文件轉(zhuǎn)換成向量失?。?#34;);

System.out.println(2);

}

}

public static void makeTrainVector(){

//將測(cè)試數(shù)據(jù)轉(zhuǎn)換成序列化文件

try {

Configuration conf = new Configuration();

conf.addResource(new Path("/usr/local/hadoop/conf/core-site.xml"));

String input = WORK_DIR+Path.SEPARATOR+"input";

String output = WORK_DIR+Path.SEPARATOR+"tennis-seq";

Path in = new Path(input);

Path out = new Path(output);

FileSystem fs = FileSystem.get(conf);

if(fs.exists(in)){

if(fs.exists(out)){

//boolean參數(shù)是,是否遞歸刪除的意思

fs.delete(out, true);

}

SequenceFilesFromDirectory sffd = new SequenceFilesFromDirectory();

String[] params = new String[]{"-i",input,"-o",output,"-ow"};

ToolRunner.run(sffd, params);

}

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

System.out.println("文件序列化失敗!");

System.exit(1);

}

//將序列化文件轉(zhuǎn)換成向量文件

try {

Configuration conf = new Configuration();

conf.addResource(new Path("/usr/local/hadoop/conf/core-site.xml"));

String input = WORK_DIR+Path.SEPARATOR+"tennis-seq";

String output = WORK_DIR+Path.SEPARATOR+"tennis-vectors";

Path in = new Path(input);

Path out = new Path(output);

FileSystem fs = FileSystem.get(conf);

if(fs.exists(in)){

if(fs.exists(out)){

//boolean參數(shù)是,是否遞歸刪除的意思

fs.delete(out, true);

}

SparseVectorsFromSequenceFiles svfsf = new SparseVectorsFromSequenceFiles();

String[] params = new String[]{"-i",input,"-o",output,"-lnorm","-nv","-wt","tfidf"};

ToolRunner.run(svfsf, params);

}

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

System.out.println("序列化文件轉(zhuǎn)換成向量失??!");

System.out.println(2);

}

}

public static void makeModel(boolean completelyNB){

try {

Configuration conf = new Configuration();

conf.addResource(new Path("/usr/local/hadoop/conf/core-site.xml"));

String input = WORK_DIR+Path.SEPARATOR+"tennis-vectors"+Path.SEPARATOR+"tfidf-vectors";

String model = WORK_DIR+Path.SEPARATOR+"model";

String labelindex = WORK_DIR+Path.SEPARATOR+"labelindex";

Path in = new Path(input);

Path out = new Path(model);

Path label = new Path(labelindex);

FileSystem fs = FileSystem.get(conf);

if(fs.exists(in)){

if(fs.exists(out)){

//boolean參數(shù)是,是否遞歸刪除的意思

fs.delete(out, true);

}

if(fs.exists(label)){

//boolean參數(shù)是,是否遞歸刪除的意思

fs.delete(label, true);

}

TrainNaiveBayesJob tnbj = new TrainNaiveBayesJob();

String[] params =null;

if(completelyNB){

params = new String[]{"-i",input,"-el","-o",model,"-li",labelindex,"-ow","-c"};

}else{

params = new String[]{"-i",input,"-el","-o",model,"-li",labelindex,"-ow"};

}

ToolRunner.run(tnbj, params);

}

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

System.out.println("生成訓(xùn)練模型失??!");

System.exit(3);

}

}

}

package myTesting.bayes;

import java.io.IOException;

import java.util.HashMap;

import java.util.Map;

import org.apache.commons.lang.StringUtils;

import org.apache.hadoop.conf.Configuration;

import org.apache.hadoop.fs.Path;

import org.apache.hadoop.fs.PathFilter;

import org.apache.hadoop.io.IntWritable;

import org.apache.hadoop.io.LongWritable;

import org.apache.hadoop.io.Text;

import org.apache.mahout.classifier.naivebayes.BayesUtils;

import org.apache.mahout.classifier.naivebayes.NaiveBayesModel;

import org.apache.mahout.classifier.naivebayes.StandardNaiveBayesClassifier;

import org.apache.mahout.common.Pair;

import org.apache.mahout.common.iterator.sequencefile.PathType;

import org.apache.mahout.common.iterator.sequencefile.SequenceFileDirIterable;

import org.apache.mahout.math.RandomAccessSparseVector;

import org.apache.mahout.math.Vector;

import org.apache.mahout.math.Vector.Element;

import org.apache.mahout.vectorizer.TFIDF;

import com.google.common.collect.ConcurrentHashMultiset;

import com.google.common.collect.Multiset;

public class BayesCheckData {

private static StandardNaiveBayesClassifier classifier;

private static Map<String, Integer> dictionary;

private static Map<Integer, Long> documentFrequency;

private static Map<Integer, String> labelIndex;

public void init(Configuration conf){

try {

String modelPath = "/zhoujianfeng/playtennis/model";

String dictionaryPath = "/zhoujianfeng/playtennis/tennis-vectors/dictionary.file-0";

String documentFrequencyPath = "/zhoujianfeng/playtennis/tennis-vectors/df-count";

String labelIndexPath = "/zhoujianfeng/playtennis/labelindex";

dictionary = readDictionnary(conf, new Path(dictionaryPath));

documentFrequency = readDocumentFrequency(conf, new Path(documentFrequencyPath));

labelIndex = BayesUtils.readLabelIndex(conf, new Path(labelIndexPath));

NaiveBayesModel model = NaiveBayesModel.materialize(new Path(modelPath), conf);

classifier = new StandardNaiveBayesClassifier(model);

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

System.out.println("檢測(cè)數(shù)據(jù)構(gòu)造成vectors初始化時(shí)報(bào)錯(cuò)。。。。");

System.exit(4);

}

}

/**

* 加載字典文件,Key: TermValue; Value:TermID

* @param conf

* @param dictionnaryDir

* @return

*/

private static Map<String, Integer> readDictionnary(Configuration conf, Path dictionnaryDir) {

Map<String, Integer> dictionnary = new HashMap<String, Integer>();

PathFilter filter = new PathFilter() {

@Override

public boolean accept(Path path) {

String name = path.getName();

return name.startsWith("dictionary.file");

}

};

for (Pair<Text, IntWritable> pair : new SequenceFileDirIterable<Text, IntWritable>(dictionnaryDir, PathType.LIST, filter, conf)) {

dictionnary.put(pair.getFirst().toString(), pair.getSecond().get());

}

return dictionnary;

}

/**

* 加載df-count目錄下TermDoc頻率文件,Key: TermID; Value:DocFreq

* @param conf

* @param dictionnaryDir

* @return

*/

private static Map<Integer, Long> readDocumentFrequency(Configuration conf, Path documentFrequencyDir) {

Map<Integer, Long> documentFrequency = new HashMap<Integer, Long>();

PathFilter filter = new PathFilter() {

@Override

public boolean accept(Path path) {

return path.getName().startsWith("part-r");

}

};

for (Pair<IntWritable, LongWritable> pair : new SequenceFileDirIterable<IntWritable, LongWritable>(documentFrequencyDir, PathType.LIST, filter, conf)) {

documentFrequency.put(pair.getFirst().get(), pair.getSecond().get());

}

return documentFrequency;

}

public static String getCheckResult(){

Configuration conf = new Configuration();

conf.addResource(new Path("/usr/local/hadoop/conf/core-site.xml"));

String classify = "NaN";

BayesCheckData cdv = new BayesCheckData();

cdv.init(conf);

System.out.println("init done...............");

Vector vector = new RandomAccessSparseVector(10000);

TFIDF tfidf = new TFIDF();

//sunny,hot,high,weak

Multiset<String> words = ConcurrentHashMultiset.create();

words.add("sunny",1);

words.add("hot",1);

words.add("high",1);

words.add("weak",1);

int documentCount = documentFrequency.get(-1).intValue(); // key=-1時(shí)表示總文檔數(shù)

for (Multiset.Entry<String> entry : words.entrySet()) {

String word = entry.getElement();

int count = entry.getCount();

Integer wordId = dictionary.get(word); // 需要從dictionary.file-0文件(tf-vector)下得到wordID,

if (StringUtils.isEmpty(wordId.toString())){

continue;

}

if (documentFrequency.get(wordId) == null){

continue;

}

Long freq = documentFrequency.get(wordId);

double tfIdfValue = tfidf.calculate(count, freq.intValue(), 1, documentCount);

vector.setQuick(wordId, tfIdfValue);

}

// 利用貝葉斯算法開(kāi)始分類,并提取得分最好的分類label

Vector resultVector = classifier.classifyFull(vector);

double bestScore = -Double.MAX_VALUE;

int bestCategoryId = -1;

for(Element element: resultVector.all()) {

int categoryId = element.index();

double score = element.get();

System.out.println("categoryId:"+categoryId+" score:"+score);

if (score > bestScore) {

bestScore = score;

bestCategoryId = categoryId;

}

}

classify = labelIndex.get(bestCategoryId)+"(categoryId="+bestCategoryId+")";

return classify;

}

public static void printResult(){

System.out.println("檢測(cè)所屬類別是:"+getCheckResult());

}

}

相關(guān)資訊
熱門頻道

Copyright © 2024 招聘街 滇ICP備2024020316號(hào)-38