一个色的导航资源精品在线观看|手机看片在线精品视频|伊人亚洲成人电影|亚洲欧美在线男女|无码无码在线观看五月精品视频在线|超碰日韩欧美在线|午夜精品蜜桃一区二区久久久|91欧美动态国产精品女主播|色欲色香天天天综合网在线观看免费|伊人春色在线伊人

后勤崗位最容易遇到的面試題?

時(shí)間:2024-08-05 17:53 人氣:0 編輯:admin

一、后勤崗位最容易遇到的面試題?

以下是一些后勤崗位可能會(huì)遇到的面試題:

1. 你對(duì)后勤管理的理解和看法是什么?

2. 如何保證在物資采購(gòu)過(guò)程中的質(zhì)量和安全?

3. 請(qǐng)描述一下你在以前工作中處理過(guò)的緊急情況。

4. 如果你遇到了有關(guān)員工道德或職業(yè)操守的問(wèn)題,你會(huì)采取什么行動(dòng)?

5. 寫(xiě)一篇文章,探討現(xiàn)代后勤管理的新趨勢(shì)。

6. 你如何安排和管理你的時(shí)間,以保證所有任務(wù)都能按時(shí)完成?

7. 如果請(qǐng)你打造一個(gè)高效的后勤團(tuán)隊(duì),你會(huì)考慮哪些因素?

8. 在采購(gòu)處理過(guò)程中如何與供應(yīng)商進(jìn)行協(xié)商和處理糾紛?

9. 如何確定物資需求的數(shù)量?

10. 你如何利用技術(shù)手段提高后勤管理效率?

這些問(wèn)題可能涉及到后勤管理的不同方面,包括采購(gòu)、協(xié)調(diào)、協(xié)商、管理、安全、團(tuán)隊(duì)建設(shè)等,需要面試者具備豐富的經(jīng)驗(yàn)和知識(shí),同時(shí)具備優(yōu)秀的溝通和協(xié)調(diào)能力。

二、醫(yī)院后勤?

這送分題啊,沒(méi)得選,肯定公務(wù)員

首先,醫(yī)院是事業(yè)編,身份不一樣,而且你考的還是后勤崗,那你大概率在醫(yī)院沒(méi)有進(jìn)步上升發(fā)展的空間了,而公務(wù)員至少希望比醫(yī)院大,而且有天線的話,也更容易調(diào)動(dòng)

其次,值班這種事,其實(shí)沒(méi)什么。相比而言,后勤保障的事特別雜,而且吃力不討好,干不好你的鍋,干好了有都是應(yīng)該的。醫(yī)院這種業(yè)務(wù)性強(qiáng)的單位,什么事情都是優(yōu)先考慮醫(yī)生、護(hù)士等一線人員,后勤的都是稍后再說(shuō)

最后,不要看眼前的利益,眼光放長(zhǎng)遠(yuǎn)

以上

三、后勤專(zhuān)員是后勤主管嗎?

后勤專(zhuān)員不是后勤主管,后勤主管是管理后勤的日常事務(wù),例如后勤工作的日常安排、后勤人員的管理等都?xì)w后勤主管來(lái)管理。后勤專(zhuān)員一般是由公司或單位的管理層任命的,參與后勤的工作,無(wú)論是后勒專(zhuān)員還是后勤主管,都是為了整個(gè)單位做好后勤工作。

四、后勤筆順?

“后” 字共有 6 畫(huà),筆畫(huà)順序?yàn)椋?撇、撇、橫、豎、橫折、橫

“勤” 字共有 13 畫(huà),筆畫(huà)順序?yàn)椋?橫、豎、豎、橫、豎、橫折、橫、橫、橫、豎、提、橫折鉤、撇

“后”的基本含義為上古稱(chēng)君主,如商之先后;引申含義為帝王的妻子,如皇后、太后;指空間在背面,反面的。與“前”相對(duì),如后窗戶、后面。

在日常使用中,“后”也常做動(dòng)詞,表示繼承。

勤字的基本含義為做事盡力,不偷懶,如勤勞、勤快;引申含義為經(jīng)常,如來(lái)往很勤;擔(dān)心,憂慮,如勤恤。

在現(xiàn)代漢語(yǔ)中,勤字常用作名詞,表示上班、事務(wù),如出勤、后勤。

五、后勤標(biāo)語(yǔ)?

后勤的標(biāo)語(yǔ)參考如下:

1、后勤一片心,服務(wù)無(wú)止境。

2、自強(qiáng)不息、奮發(fā)向上、團(tuán)結(jié)拼搏、爭(zhēng)創(chuàng)一流。

3、用心服務(wù)、追求完美、實(shí)現(xiàn)價(jià)值。

六、后勤又稱(chēng)?

后勤也可以叫做:保障、支援、維護(hù),后勤保障部

后勤工作

后勤工作,亦稱(chēng)總務(wù)工作。是為各單位職能活動(dòng)正常進(jìn)行而提供的以服務(wù)為主要目的工作。

后勤工作(Logistics work)

所謂的后勤工作,亦稱(chēng)總務(wù)工作或者整合工作。是為各單位職能活動(dòng)正常進(jìn)行而提供的以服務(wù)為主要目的的工作。

后勤,本為軍事名詞,為“后方勤務(wù)”的簡(jiǎn)稱(chēng),是指從物資、衛(wèi)生、技術(shù)、運(yùn)輸?shù)确矫姹U宪婈?duì)需要的勤務(wù)?!氨R未動(dòng),糧草先行”,這是我國(guó)歷代兵家對(duì)后勤工作在軍事行動(dòng)中的地位、作用所作的高度概括和評(píng)價(jià)?,F(xiàn)在”后勤”一詞已有更為寬限的外延,后勤工作亦日益為人們高度重視,

后勤工作的沿革

后勤工作作為現(xiàn)今機(jī)關(guān)、企業(yè)事業(yè)單位不可缺少的一環(huán),有著漫長(zhǎng)的發(fā)展歷程。在不同的歷史時(shí)期,后勤工作的性質(zhì)、內(nèi)容都有不同特色。隨著社會(huì)的發(fā)展變化,其所賦予的含義也不斷地變化、更新

七、后勤口號(hào)

在一個(gè)高度競(jìng)爭(zhēng)的商業(yè)環(huán)境中,各個(gè)企業(yè)都在努力提高自己的競(jìng)爭(zhēng)力。而企業(yè)內(nèi)部的后勤工作,雖然看似不起眼,卻是整個(gè)運(yùn)作良好的企業(yè)的重要支持。后勤口號(hào)的制定和宣傳,可以更好地激勵(lì)員工,在提升后勤工作效率的同時(shí),增強(qiáng)團(tuán)隊(duì)凝聚力和士氣。

1. 后勤口號(hào)的重要性

后勤口號(hào)是企業(yè)內(nèi)部傳播的重要工具之一。它具有以下幾個(gè)重要的作用:

  • 激勵(lì)員工:后勤工作往往被認(rèn)為是比較枯燥乏味的,而后勤口號(hào)的制定可以激發(fā)員工的工作熱情,讓他們更加積極主動(dòng)地投入到工作中。
  • 塑造企業(yè)形象:一個(gè)有組織、有活力的企業(yè),后勤工作是必不可少的。通過(guò)制定合適的后勤口號(hào),可以表達(dá)企業(yè)對(duì)后勤工作的重視,給人留下良好的印象。
  • 提高工作效率:后勤口號(hào)可以凝聚員工的力量,讓他們?cè)诠ぷ髦懈訉?zhuān)注和高效,從而提高整個(gè)后勤工作的效率。
  • 增強(qiáng)團(tuán)隊(duì)凝聚力:通過(guò)共同的后勤口號(hào),員工之間可以產(chǎn)生共鳴和認(rèn)同感,進(jìn)而增強(qiáng)團(tuán)隊(duì)的凝聚力,形成良好的合作氛圍。

2. 制定后勤口號(hào)的原則和方法

制定一個(gè)好的后勤口號(hào)需要遵循一些原則和方法:

  • 簡(jiǎn)潔明了:后勤口號(hào)需要簡(jiǎn)單明了,容易記憶和理解。通過(guò)簡(jiǎn)短的口號(hào),能夠更好地傳達(dá)后勤工作的核心理念。
  • 積極向上:后勤口號(hào)應(yīng)該積極向上,鼓舞士氣,激勵(lì)員工。它可以傳達(dá)企業(yè)對(duì)后勤工作的重視,讓員工感到自豪和自信。
  • 貼合實(shí)際:后勤口號(hào)要符合實(shí)際情況,能夠代表企業(yè)的實(shí)際后勤工作情況和需求,一方面能夠激勵(lì)員工,另一方面也能夠做到可操作性。
  • 與企業(yè)價(jià)值觀一致:后勤口號(hào)應(yīng)與企業(yè)的價(jià)值觀一致,能夠體現(xiàn)企業(yè)的核心價(jià)值觀和文化特點(diǎn)。這樣可以增強(qiáng)后勤口號(hào)的說(shuō)服力和認(rèn)同感。

3. 成功案例:經(jīng)典的后勤口號(hào)

以下是一些經(jīng)典的后勤口號(hào)案例,這些口號(hào)通過(guò)簡(jiǎn)潔有力的表達(dá),成功地激發(fā)了員工的工作熱情和工作效率:

  • 追求卓越,服務(wù)至上
  • 高效運(yùn)作,協(xié)同發(fā)展
  • 準(zhǔn)時(shí)送達(dá),完美無(wú)瑕
  • 保障供應(yīng),質(zhì)量有保證
  • 科技創(chuàng)新,后勤引領(lǐng)

4. 后勤口號(hào)的宣傳和推廣

后勤口號(hào)的制定只是第一步,如何將口號(hào)宣傳和推廣到整個(gè)企業(yè),才能真正發(fā)揮其作用:

  • 內(nèi)部宣傳:在企業(yè)內(nèi)部,可以通過(guò)會(huì)議、內(nèi)部刊物、企業(yè)內(nèi)部網(wǎng)站等多種方式宣傳后勤口號(hào)。指定專(zhuān)門(mén)的負(fù)責(zé)人或團(tuán)隊(duì),負(fù)責(zé)后勤口號(hào)的宣傳工作。
  • 外部宣傳:對(duì)外宣傳可以通過(guò)企業(yè)新聞稿、社交媒體等渠道進(jìn)行。可以將后勤口號(hào)融入企業(yè)宣傳資料,讓更多的人了解到企業(yè)對(duì)后勤工作的重視。
  • 員工參與:激發(fā)員工的積極性,將后勤口號(hào)作為員工評(píng)優(yōu)的一項(xiàng)標(biāo)準(zhǔn),并將優(yōu)秀員工的故事與后勤口號(hào)結(jié)合起來(lái),進(jìn)行宣傳。
  • 定期回顧:定期回顧后勤口號(hào)的宣傳效果,并進(jìn)行總結(jié)和改進(jìn)。努力使后勤口號(hào)真正融入到員工的工作中,達(dá)到預(yù)期的目標(biāo)。

5. 后勤口號(hào)的價(jià)值

制定和宣傳后勤口號(hào)對(duì)企業(yè)具有重要的價(jià)值:

  • 增強(qiáng)員工的責(zé)任感和歸屬感,激發(fā)員工的工作熱情和工作動(dòng)力。
  • 提升后勤工作的執(zhí)行力和效率,加快企業(yè)運(yùn)營(yíng)速度。
  • 塑造企業(yè)形象,增強(qiáng)企業(yè)的競(jìng)爭(zhēng)力。
  • 促進(jìn)團(tuán)隊(duì)的凝聚力和協(xié)作能力,實(shí)現(xiàn)團(tuán)隊(duì)合作的最佳狀態(tài)。

綜上所述,制定和宣傳后勤口號(hào)是一個(gè)重要的管理工作,能夠在激發(fā)員工工作熱情的同時(shí),提高后勤工作的效率和質(zhì)量。每個(gè)企業(yè)都應(yīng)該充分認(rèn)識(shí)到后勤工作的重要性,并制定適合自己企業(yè)特點(diǎn)的后勤口號(hào),將口號(hào)宣傳落地,讓后勤工作真正成為企業(yè)競(jìng)爭(zhēng)力的重要組成部分。

八、后勤保障和后勤服務(wù)的區(qū)別?

后勤保障是指為服務(wù)的單位提供物質(zhì)條件的集體,而后勤服務(wù)只是提供服務(wù)。

九、后勤副校長(zhǎng)和后勤主任如何分工?

后勤校長(zhǎng)負(fù)責(zé)后勤的一切工作,而后勤主任是協(xié)助后勤校長(zhǎng)管理后勤的,后勤主任負(fù)責(zé)具體事物。主要是教學(xué)物資的供應(yīng)。包括,拉書(shū)分書(shū),作業(yè)本分發(fā),校服征訂,保險(xiǎn)繳納,班里和辦公室里衛(wèi)生工具的分發(fā),學(xué)校的校園管理,花木修剪,房屋維修,水電暖的維修等等包羅萬(wàn)象

十、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的工具類(lèi)實(shí)現(xiàn)分類(lèi)。

基本思想:

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

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

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

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

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

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

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

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

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

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

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

這三步,代碼我就一次全貼出來(lái);主要是兩個(gè)類(lèi) 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)換成向量失敗!");

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("文件序列化失?。?#34;);

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)練模型失?。?#34;);

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)始分類(lèi),并提取得分最好的分類(lè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è)所屬類(lèi)別是:"+getCheckResult());

}

}

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

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