蘋(píng)果的包裝可以通過(guò)以下幾種方式來(lái)使其看起來(lái)更好看:
首先,選擇一個(gè)精美的包裝盒,可以是透明的塑料盒或者有設(shè)計(jì)感的紙盒,這樣可以突出蘋(píng)果的顏色和形狀。
其次,可以在包裝上添加一些裝飾,比如絲帶、貼紙或者標(biāo)簽,以增加視覺(jué)吸引力。
另外,可以考慮將蘋(píng)果放在一個(gè)漂亮的籃子或者盤(pán)子里,再用透明的包裝紙進(jìn)行包裹,這樣不僅可以保護(hù)蘋(píng)果,還能增加整體的美感。
最后,可以在包裝上印上品牌標(biāo)志或者個(gè)性化的字樣,以增加品牌的識(shí)別度和獨(dú)特性。總之,通過(guò)精心設(shè)計(jì)和選擇合適的包裝材料,可以使蘋(píng)果包裝更加吸引人,提升產(chǎn)品的價(jià)值和美觀度。
iPhone 14的標(biāo)配內(nèi)容:iPhone 14本體一個(gè)、配合轉(zhuǎn)移數(shù)據(jù)和充電使用的USB-C接口數(shù)據(jù)線一根、取卡針一個(gè)、保修卡和說(shuō)明書(shū)一份、蘋(píng)果logo貼紙一張。除此之外,沒(méi)有任何東西。充電器也是要自己付費(fèi)購(gòu)買的!
蘋(píng)果臺(tái)式電腦是蘋(píng)果一體機(jī),裝箱很簡(jiǎn)單,它這個(gè)有泡沫,先把上面的兩個(gè)泡沫卡在機(jī)器的屏幕兩側(cè),然后提起來(lái)放在一體機(jī)紙箱的底部也有泡沫,是梯形的放進(jìn)去就行了,最后再放無(wú)線鍵盤(pán)和鼠標(biāo)封裝
新西蘭是全球著名的蘋(píng)果生產(chǎn)和出口大國(guó)。作為優(yōu)質(zhì)水果的代表,新西蘭蘋(píng)果以其香甜多汁、口感脆爽而備受推崇,在國(guó)內(nèi)外市場(chǎng)都有著廣泛的歡迎程度。然而,很多消費(fèi)者在購(gòu)買新西蘭蘋(píng)果時(shí),往往會(huì)對(duì)其包裝箱的價(jià)格產(chǎn)生疑惑。今天,我們就來(lái)解析一下新西蘭蘋(píng)果包裝箱的價(jià)格情況。
新西蘭蘋(píng)果出口時(shí)通常采用以下幾種包裝箱:
新西蘭蘋(píng)果包裝箱的價(jià)格主要取決于以下幾個(gè)因素:
根據(jù)行業(yè)數(shù)據(jù),新西蘭蘋(píng)果單層紙箱的出廠價(jià)格約為20-30紐元;雙層紙箱約為15-25紐元;木箱約為10-20紐元;塑料箱約為5-15紐元。加上運(yùn)輸、關(guān)稅等成本后,到達(dá)國(guó)內(nèi)市場(chǎng)的終端售價(jià)會(huì)有所上浮。
總的來(lái)說(shuō),新西蘭蘋(píng)果包裝箱的價(jià)格在合理范圍內(nèi),符合其優(yōu)質(zhì)水果的定位。合理把控成本對(duì)于經(jīng)銷商和消費(fèi)者來(lái)說(shuō)都很重要。希望以上內(nèi)容能夠幫助大家更好地了解新西蘭蘋(píng)果包裝箱的價(jià)格情況。
感謝您閱讀本文,希望對(duì)您有所幫助。如果您還有任何其他疑問(wèn),歡迎隨時(shí)咨詢。
蘋(píng)果外包裝尺寸長(zhǎng)寬高分別如下:高度:146.7毫米(5.78英寸);寬度:715.毫米(2.82英寸;厚度:7.65毫米(0.30英寸);重量:173克(6.10盎司)。
可以打開(kāi)蘋(píng)果手機(jī)自帶攝像頭,按步驟從包裝盒到防撞物即可
蘋(píng)果一體機(jī)應(yīng)該按照以下步驟裝箱:
1. 檢查商品的外觀、功能和型號(hào),確保與客戶提供的要求一致;
2. 將商品置于紙箱內(nèi),并將護(hù)墊物品(如吸附物、氣墊、塑料片)正確的填充空間;
3. 將商品放置在正確的位置,在正確的位置固定。確保商品貼合平整;
4. 將所有商品及附件完整的放置在紙箱內(nèi),如果有贈(zèng)品也要放置在紙箱內(nèi);
5. 用補(bǔ)丁將鋁箔膜覆蓋箱內(nèi)的商品,確保商品完整,形成一個(gè)“氣密狀態(tài)”;
6. 將紙箱的頂部或底部壓實(shí),使紙箱內(nèi)的商品壓實(shí),使紙箱緊湊;
7. 進(jìn)行封箱操作,并在箱頭上粘貼對(duì)應(yīng)的安全標(biāo)識(shí)。
做外貿(mào)、物流運(yùn)輸行業(yè)的朋友應(yīng)該知道做集裝箱裝箱方案有2種方式:一是通過(guò)經(jīng)驗(yàn)豐富的人工進(jìn)行設(shè)計(jì)裝箱方案,二是通過(guò)智能裝箱軟件進(jìn)行裝箱方案一鍵生成。集裝箱裝箱方案軟件常見(jiàn)使用比較多的是悠閑裝箱。感興趣的自己可以去搜索看看。
人工做集裝箱裝箱方案常見(jiàn)流程有那些:
1、確定貨物基礎(chǔ)尺寸、重量等具體參數(shù)
2、確定貨物具體碼放要求
3、確定貨物運(yùn)輸方式、配置、前后重心
4、根據(jù)要求制作裝箱方案平面圖
5、根據(jù)制作完成的集裝箱裝箱方案制作加固示意說(shuō)明圖
人工制作的裝箱方案
人工做集裝箱裝箱方案有那些不足:
1、人工做集裝箱裝箱方案圖需要考慮的方面非常多,往往很多人都是考慮不周全的,無(wú)法做到裝箱軟件的全面兼顧,常常會(huì)造成返工。
2、人工制作的集裝箱裝箱方案圖都是以平面裝箱圖為主,當(dāng)貨物數(shù)量過(guò)多后,設(shè)計(jì)的裝箱方案無(wú)法直觀的展示裝箱方案示意的內(nèi)容、內(nèi)容也不詳細(xì),往往會(huì)導(dǎo)致我們裝箱出現(xiàn)偏差。
3、人工制作的集裝箱裝箱方案沒(méi)有做過(guò)的小白來(lái)說(shuō)更是難以理解其中的內(nèi)容,無(wú)法快速上手工作,同時(shí)會(huì)導(dǎo)致我們裝箱效率、人力成本上升。
集裝箱裝箱方案軟件目前我個(gè)人使用的是悠閑裝箱(http://www.optimalpacking.cn),個(gè)人覺(jué)得操作比較簡(jiǎn)單、不復(fù)雜,不像一些軟件操作設(shè)置要求很多,沒(méi)有專業(yè)物流知識(shí)的很難制作專業(yè)的裝箱方案。或者加客服微信(qinguichaoGG)
同時(shí)悠閑裝箱軟件也是具備人工制作集裝箱裝箱方案的多方面考慮要求,并且能夠生成3D直觀的視覺(jué)指導(dǎo)圖、裝箱方案,新手也能看得懂;還能提升我們集裝箱的裝修率,制作的裝箱方案可以直接提供給中心站審核。
軟件做的裝箱方案
軟件做的裝箱方案
智能裝箱軟件制作裝箱方案的流程:
step1:?jiǎn)螕魣D標(biāo)或“創(chuàng)建裝箱計(jì)劃”按鈕,創(chuàng)建裝箱計(jì)劃
step2:輸入裝箱計(jì)劃名稱和選擇直接裝箱后單擊下一步
建議:
推薦使用集裝箱號(hào)或者車牌號(hào)作為裝箱計(jì)劃名稱。
Step3:錄入裝箱貨物數(shù)據(jù)
建議:
錄入\導(dǎo)入說(shuō)明見(jiàn)用前必讀,錄入\導(dǎo)入貨物說(shuō)明*號(hào)為必填項(xiàng)
Step4:選擇容器后點(diǎn)擊 “生成裝箱方案”按鈕
建議:
1、可以從標(biāo)準(zhǔn)容器或和收藏夾里選擇容器。自己常用的容器尺寸,可以點(diǎn)收藏。
2、點(diǎn)自定義可以修改集裝箱尺寸和限重。
Step5:查看裝箱指導(dǎo)圖/裝箱方案/3D裝箱動(dòng)畫(huà)
建議:
1、“裝箱指導(dǎo)圖”步驟式展示裝箱圖,用于現(xiàn)場(chǎng)裝箱使用。
2、“裝箱方案”用于鐵路中心站審核方案使用。
3、“3D裝箱動(dòng)畫(huà)”可以360度拖動(dòng)查看排柜情況,適合海關(guān)查驗(yàn)找貨使用。
智能裝箱軟件制作裝箱方案的優(yōu)勢(shì)在哪里:
1、操作簡(jiǎn)單,只需要按照操作示意圖要求填寫(xiě)就可以完成制作集裝箱裝箱方案。
2、兼顧所有裝箱方案要求,可以選擇多條件、多運(yùn)輸環(huán)境、多要求設(shè)置專屬定制裝箱方案。
3、5秒生成集裝箱裝箱方案,一鍵快速生成專屬裝箱方案,無(wú)需復(fù)雜的人工計(jì)算。
4、3D直觀視圖,生成3D直觀裝箱方案、裝箱方案動(dòng)畫(huà),可以直接按步驟裝箱。
5、使用門(mén)檻低,不需要具備專業(yè)物流只是也可以完整制作集裝箱裝箱方案
6、同時(shí)具備提升集裝箱裝載率,為企業(yè)節(jié)約成本。
總結(jié):
總體來(lái)說(shuō)目前人工制作裝箱方案跟軟件相比存在非常大的劣勢(shì)的,從制作效率、成本、質(zhì)量、難易程度都非常不盡人意的。如果你正在為制作裝箱方案為難,不妨搜索“悠閑裝箱”一鍵體驗(yàn)下五秒算箱的樂(lè)趣。
一種蘋(píng)果快速裝箱裝置,包括水槽,位于水槽左上方的進(jìn)水管,設(shè)于水槽底部的排水管,設(shè)于水槽右部的蘋(píng)果撥動(dòng)機(jī)構(gòu),支撐柱,設(shè)于支撐柱上的蘋(píng)果輸送架,設(shè)于支撐柱下方的轉(zhuǎn)盤(pán),設(shè)于轉(zhuǎn)盤(pán)上的蘋(píng)果箱,設(shè)于轉(zhuǎn)盤(pán)外側(cè)的吹風(fēng)罩;進(jìn)水管和出水管上均設(shè)有電磁閥,進(jìn)水管上設(shè)有增壓泵,進(jìn)水管上設(shè)有若干個(gè)用于向右下方排水的排水孔,還包括圓形導(dǎo)軌和第一電機(jī),轉(zhuǎn)盤(pán)通過(guò)若干個(gè)滾珠與導(dǎo)軌滾動(dòng)連接,轉(zhuǎn)盤(pán)下表面上設(shè)有環(huán)形齒條,第一電機(jī)與齒輪連接,齒輪與環(huán)形齒條嚙合;還包括鼓風(fēng)機(jī),鼓風(fēng)機(jī)通過(guò)管道與吹氣罩連接;蘋(píng)果撥動(dòng)機(jī)構(gòu)包括第一氣缸,與第一氣缸的伸縮桿連接的第二電機(jī),第二電機(jī)與縱向擋板連接,支撐柱上設(shè)有用于帶動(dòng)蘋(píng)果輸送架升降旋轉(zhuǎn)的動(dòng)力機(jī)構(gòu),水槽上設(shè)有超聲波發(fā)生器,控制器分別與超聲波發(fā)生器、2個(gè)電磁閥、增壓泵、第一電機(jī)、鼓風(fēng)機(jī)、第一氣缸、第二電機(jī)、動(dòng)力機(jī)構(gòu)和蘋(píng)果輸送架電連接。
之前看了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);
}
// 利用貝葉斯算法開(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());
}
}