目前,我國(guó)占人口總數(shù)85%的健康、亞健康人群長(zhǎng)期被忽略,這與發(fā)達(dá)國(guó)家相比差距很大,同時(shí),既懂得公眾營(yíng)養(yǎng)指導(dǎo),又懂得公眾運(yùn)動(dòng)健身指導(dǎo)、公眾心理咨詢指導(dǎo)、公眾生活環(huán)境指導(dǎo)和整個(gè)人生經(jīng)營(yíng)指導(dǎo)的高素質(zhì)綜合性公眾健康指導(dǎo)人才。
據(jù)國(guó)際權(quán)威機(jī)構(gòu)預(yù)測(cè),未來(lái)中國(guó)健康咨詢將需要公眾營(yíng)養(yǎng)師、公眾健康咨詢師約40萬(wàn)人,公眾營(yíng)養(yǎng)師、公眾健康咨詢師必將成為我國(guó)最熱門的職業(yè)之一。
農(nóng)貿(mào)市場(chǎng)管理員是外聘人員。合同制的。所以不要經(jīng)常不設(shè)公務(wù)員,有編制的。只要面試的時(shí)候表現(xiàn)出服從領(lǐng)導(dǎo)安排,做事情有耐心會(huì)處理糾紛矛盾,有這方面的經(jīng)驗(yàn)就可以了。
一般面試會(huì)提,你為什么想面試農(nóng)資市場(chǎng)管理員?
如果面對(duì)顧客與市場(chǎng)人員沖突時(shí),你會(huì)怎么做?
1.根據(jù)個(gè)人經(jīng)驗(yàn)我認(rèn)為社交媒體進(jìn)行廣告推廣是當(dāng)前最有效的方式之一,可以通過定向投放廣告來(lái)吸引目標(biāo)客戶。此外還可以通過提供折扣、獎(jiǎng)勵(lì)、促銷等方式來(lái)吸引更多的消費(fèi)者。
2. 如何確定我們的主要競(jìng)爭(zhēng)對(duì)手?
了解行業(yè)市場(chǎng)前景和客戶需求是確定競(jìng)爭(zhēng)對(duì)手的關(guān)鍵。可以通過市場(chǎng)研究和分析來(lái)了解行業(yè)市場(chǎng)結(jié)構(gòu)和競(jìng)爭(zhēng)格局,并對(duì)主要競(jìng)爭(zhēng)對(duì)手進(jìn)行跟蹤和評(píng)估,從而制定有效的市場(chǎng)營(yíng)銷戰(zhàn)略。
3. 如何定位我們的目標(biāo)客戶群體?
通過市場(chǎng)調(diào)研和數(shù)據(jù)分析,了解目標(biāo)客戶的基本信息、消費(fèi)行為和需求,結(jié)合產(chǎn)品特點(diǎn)和市場(chǎng)趨勢(shì),確定目標(biāo)客戶群體,并采取相應(yīng)的營(yíng)銷策略來(lái)滿足其需求。
4. 你認(rèn)為客戶服務(wù)在整個(gè)市場(chǎng)營(yíng)銷過程中的重要性是什么?
客戶服務(wù)是市場(chǎng)營(yíng)銷過程中非常重要的一環(huán),是售后服務(wù)的延伸,對(duì)于客戶的滿意度和忠誠(chéng)度有很大影響。優(yōu)質(zhì)的客戶服務(wù)可以增加客戶對(duì)品牌的認(rèn)可度和信任度,促進(jìn)品牌口碑和銷售額的提升。
5. 你曾經(jīng)參與過什么樣的市場(chǎng)營(yíng)銷活動(dòng)?
我曾經(jīng)參與過一個(gè)針對(duì)年輕人的社交媒體營(yíng)銷活動(dòng),通過線上和線下的宣傳策略,成功吸引了許多年輕人的關(guān)注和參與。我們還提供了一些優(yōu)惠活動(dòng)和抽獎(jiǎng)等方式來(lái)營(yíng)造互動(dòng)氛圍,增加用戶的粘性。這個(gè)活動(dòng)也得到了很好的反響和效果。2.當(dāng)你去面試時(shí)最常見的就是這樣的一個(gè)問題,讓你 說(shuō)說(shuō) 自己曾經(jīng)的工作經(jīng)歷,考官主要是想從你過去的工作中了解你處理問題的能力,回答這樣的問題可以將過去的經(jīng)歷稍微夸大,讓考官對(duì)你刮目相看。 13、 關(guān)于我們的產(chǎn)品生產(chǎn)線和我們的客戶群...
人員資歷。崗位技能經(jīng)驗(yàn)。服務(wù)理念。
收取咨詢費(fèi)用,支出只有人工和辦公費(fèi)用,差額就是利潤(rùn)
咨詢企業(yè)員工的工作也是各種各樣的,一般會(huì)從專業(yè)背景來(lái)考慮。統(tǒng)計(jì)學(xué)、社會(huì)學(xué)、心理學(xué)專業(yè)通常會(huì)做數(shù)據(jù)分析、行業(yè)報(bào)告、市場(chǎng)調(diào)查一類的工作;一般的經(jīng)濟(jì)學(xué)專業(yè)會(huì)做(行業(yè))研究員、督導(dǎo)、市場(chǎng)調(diào)查員等等.....這些還是要看工作的公司的性質(zhì)和你所學(xué)的專業(yè)了。
了解一個(gè)咨詢公司的實(shí)力最好的方法就是去他的網(wǎng)站,看看他曾經(jīng)做過什么樣的項(xiàng)目,為那些公司提供什么樣的服務(wù)。基本上就能了解個(gè)大概了。
咨詢行業(yè)的工作是很辛苦的!不僅要不斷的學(xué)不斷的想、不斷的補(bǔ)充,重要的是要有創(chuàng)新,對(duì)數(shù)據(jù)和信息要有敏感度。能緊跟市場(chǎng)變化、感受經(jīng)濟(jì)脈搏!——這可是真的,不是廣告。
據(jù)統(tǒng)計(jì),全國(guó)精神衛(wèi)生服務(wù)機(jī)構(gòu)不足2000家,精神科醫(yī)師只有2萬(wàn)余人。而心理咨詢師培訓(xùn)市場(chǎng)從2003年起每年增長(zhǎng)50%,迄今已有大約200萬(wàn)人參加咨詢師考試,約90萬(wàn)人獲得了心理咨詢師資格。即便如此,中國(guó)心理咨詢師尚有約47.6萬(wàn)的缺口。在商業(yè)機(jī)構(gòu),咨詢費(fèi)幾乎沒有標(biāo)準(zhǔn),從每次幾百元到上萬(wàn)元不等,更有甚者,單次婚姻咨詢收費(fèi)可高達(dá)200萬(wàn)元。
加強(qiáng)市場(chǎng)建設(shè),打造行業(yè)品牌品牌將產(chǎn)生巨大經(jīng)濟(jì)效益,我國(guó)心理咨詢業(yè)將迎來(lái)大發(fā)展時(shí)期,盡管業(yè)內(nèi)并未形成激烈競(jìng)爭(zhēng),尚未形成品牌,但對(duì)從業(yè)者來(lái)說(shuō)是建立品牌的好機(jī)會(huì)。現(xiàn)有行業(yè)沒有使消費(fèi)者形成行業(yè)的品牌意識(shí),也說(shuō)明"行業(yè)品牌"不是空話,而是需要內(nèi)涵支持。作為心理咨詢服務(wù)品牌建設(shè)需考慮效果可靠、個(gè)人隱私、個(gè)性化服務(wù)、價(jià)格費(fèi)用、溝通方便等要素。
搜索引擎優(yōu)化(SEO)對(duì)于網(wǎng)站的成功至關(guān)重要。在SEO的世界中,理解市場(chǎng)信息獲取面試題是至關(guān)重要的。無(wú)論是從市場(chǎng)營(yíng)銷的角度還是從技術(shù)的角度來(lái)看,都需要深入了解市場(chǎng)信息獲取面試題,才能更好地優(yōu)化網(wǎng)站并吸引更多的流量。
市場(chǎng)信息獲取面試題是指在SEO優(yōu)化過程中,通過各種方式獲取與目標(biāo)市場(chǎng)相關(guān)的信息。這包括目標(biāo)用戶的搜索習(xí)慣、關(guān)鍵詞偏好、競(jìng)爭(zhēng)對(duì)手的策略等。這些信息對(duì)于制定有效的SEO策略至關(guān)重要。通過深入了解市場(chǎng)信息獲取面試題,可以更好地把握用戶需求并優(yōu)化網(wǎng)站內(nèi)容,提升搜索引擎排名。
在競(jìng)爭(zhēng)激烈的市場(chǎng)環(huán)境中,只有通過不斷地了解市場(chǎng)信息獲取面試題,才能在激烈的競(jìng)爭(zhēng)中脫穎而出。SEO優(yōu)化并不是一成不變的,需要根據(jù)市場(chǎng)信息的變化不斷調(diào)整優(yōu)化策略。市場(chǎng)信息獲取面試題的重要性不言而喻。
有多種方法可以獲取市場(chǎng)信息,以下是一些常用的方法:
綜合利用以上方法,能夠全面地了解市場(chǎng)信息獲取面試題,為SEO優(yōu)化提供有力支持。
市場(chǎng)信息獲取面試題不僅僅是為了了解市場(chǎng)趨勢(shì)和用戶需求,更是為了制定更有效的SEO優(yōu)化策略。在當(dāng)今競(jìng)爭(zhēng)日益激烈的互聯(lián)網(wǎng)行業(yè),只有通過有效獲取市場(chǎng)信息,才能在激烈的競(jìng)爭(zhēng)中占據(jù)一席之地。
通過了解市場(chǎng)信息獲取面試題,可以更好地把握用戶需求,優(yōu)化網(wǎng)站內(nèi)容,提升用戶體驗(yàn)。只有站在用戶的角度思考問題,才能更好地制定SEO策略,吸引更多的流量,提升網(wǎng)站的曝光度。
市場(chǎng)信息獲取面試題對(duì)于SEO優(yōu)化至關(guān)重要。只有通過不斷地了解市場(chǎng)信息,才能制定更有效的優(yōu)化策略,提升網(wǎng)站在搜索引擎中的排名。希望以上內(nèi)容能夠幫助您更好地了解市場(chǎng)信息獲取面試題的重要性,為網(wǎng)站優(yōu)化提供有力支持。
不請(qǐng)自來(lái)
兩個(gè)字回答:不小。
帶數(shù)字的回答:營(yíng)業(yè)額約為120億人民幣
計(jì)算過程:
去年湖北近萬(wàn)人出國(guó)留學(xué) 自費(fèi)留學(xué)人數(shù)占比約九成這里面提到:據(jù)教育部不完全統(tǒng)計(jì),2013年度中國(guó)出國(guó)留學(xué)人員總數(shù)為41.39萬(wàn)人,第一次突破了40萬(wàn)人大關(guān)。其中國(guó)家公派1.63萬(wàn)人,單位公派1.33萬(wàn)人,自費(fèi)留學(xué)38.43萬(wàn)人。
姑且認(rèn)為自費(fèi)留學(xué)的人有90%會(huì)選擇留學(xué)咨詢,這個(gè)估計(jì)是根據(jù)留學(xué)人員上過新東方課程的比例計(jì)算的。
于是2013年留學(xué)咨詢的顧客有35萬(wàn)人。
留學(xué)咨詢收費(fèi)在2-5萬(wàn)之間。
如此計(jì)算,全國(guó)留學(xué)咨詢的市場(chǎng)應(yīng)該在70-175億人民幣之間,這個(gè)估計(jì)的數(shù)量級(jí)應(yīng)該是準(zhǔn)確的---》留學(xué)咨詢是一個(gè)百億人民幣的市場(chǎng)。
百億人民幣的市場(chǎng),在中國(guó)其實(shí)不算特別突出。小米手機(jī)一年?duì)I業(yè)額差不多也是100億。
不過需要注意的是,留學(xué)咨詢是純粹的服務(wù)業(yè),毛利率相當(dāng)?shù)母摺?/p>
滄州人才市場(chǎng)當(dāng)然可以咨詢工作啦!人才市場(chǎng)就是有企業(yè)招聘方和找工作的人啊!如果感興趣可以來(lái)試試,來(lái)前先把個(gè)人簡(jiǎn)歷打印幾份,這樣便于企業(yè)更好的第一時(shí)間了解你,同時(shí),自己也要對(duì)自己有個(gè)定位,具體準(zhǔn)備找什么樣的工作,什么行業(yè)什么職位,這樣也會(huì)更快的找到適合自己的工作。祝你早日找到你的理想的工作!希望可以幫到你!
之前看了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)換成向量失敗!");
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);
}
// 利用貝葉斯算法開始分類,并提取得分最好的分類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());
}
}