华宇考试网

当前位置: > 公考 > 公务员省考 > 面试辅导 >

公司的面试人员都是从哪里找的面试题mahout面试题

时间:2023-01-24来源:华宇网校作者:面试辅导 公务员网课
公司的面试人员都是从哪里找的面试题

公司的面试人员都是从哪里找的面考试试卷?

当然是公司比较厉害的领导阶层,平常人都是没有机会的,但是,大多数情况下都是秘书,或者公司的得力助手来帮忙面试的,还有就是比较推测、猜想人性,懂得人性的人更适合作为面试官,肯定都是从本公司找的,因为那样比较节省时间,也了解领导的口味,想要哪种人?

公司的面试人员大多数情况下都是从公司历来出的,一部分面考试试卷,还有从网络在线下载的,甚至可以是在一部分行业里面去搜索到的。

网络在线找的和自己想的。

mahout面考试试卷?

以前看了Mahout官方示例 20news 的调用达到;于是想按照示例的流程达到其他例子。网络在线看到了一个有关天气适不合适打羽毛球的例子。

训练数据:

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

检测数据:

sunny,hot,high,weak

结果:

Yes=》 0.007039

No=》 0.027418

于是为了让用Java代码调用Mahout的工具类达到分类。

基本思想:

1. 构造分类数据。

2. 使用Mahout工具类进行训练,得到训练模型。

3。将要检测数据转换成vector数据。

4. 分类器对vector数据进行分类。

贴下我的代码达到=》

1. 构造分类数据:

在hdfs主要创建一个文件夹路径 /zhoujainfeng/playtennis/input 并将分类文件夹 no 和 yes 的数据传到hdfs上面。

数据文件格式,如D1文件内容: Sunny Hot High Weak

2. 使用Mahout工具类进行训练,得到训练模型。

3。将要检测数据转换成vector数据。

4. 分类器对vector数据进行分类。

这三步,代码我就一次全贴出来;主要是两个类 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;

/*

* 测试代码

*/

public static void main(String[] args) {

//将训练数据转换成 vector数据

makeTrainVector();

//出现训练模型

makeModel(false);

//测试检测数据

BayesCheckData.printResult();

}

public static void makeCheckVector(){

//将测试数据转换成序列化文件

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参数是是否递归删除的意思

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);

}

//将序列化文件转换成向量文件

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参数是是否递归删除的意思

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(序列化文件转换成向量失败!);

System.out.println(2);

}

}

public static void makeTrainVector(){

//将测试数据转换成序列化文件

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参数是是否递归删除的意思

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);

}

//将序列化文件转换成向量文件

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参数是是否递归删除的意思

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(序列化文件转换成向量失败!);

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参数是是否递归删除的意思

fs.delete(out, true);

}

if(fs.exists(label)){

//boolean参数是是否递归删除的意思

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(生成训练模型失败!);

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 MapString, Integer dictionary;

private static MapInteger, Long documentFrequency;

private static MapInteger, 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(检测数据构导致vectors初始化时报错。。);

System.exit(4);

}

}

/**

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

* @param conf

* @param dictionnaryDir

* @return

*/

private static MapString, Integer readDictionnary(Configuration conf, Path dictionnaryDir) {

MapString, Integer dictionnary = new HashMapString, Integer();

PathFilter filter = new PathFilter() {

@Override

public boolean accept(Path path) {

String name = path.getName();

return name.startsWith(dictionary.file);

}

};

for (PairText, IntWritable pair : new SequenceFileDirIterableText, 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 MapInteger, Long readDocumentFrequency(Configuration conf, Path documentFrequencyDir) {

MapInteger, Long documentFrequency = new HashMapInteger, Long();

PathFilter filter = new PathFilter() {

@Override

public boolean accept(Path path) {

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

}

};

for (PairIntWritable, LongWritable pair : new SequenceFileDirIterableIntWritable, 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

MultisetString 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时表示总文档数

for (Multiset.EntryString 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(检测所属类别是:+getCheckResult());

}

}

运维面考试试卷,有客户反馈网页打开慢,怎么排查?

这是个很常见的问题,网页打开慢有不少种因素,作为运维,第一要确定官方网站服务器正常运行:

官方网站代码杂糅,也许致使官方网站性能查,加载过慢

假设官方网站没做CDN加速,访问量激增,也许致使网页加载慢

公网传输互联网的带宽也影响网页加载速率

还有一个也是比较常见的一个,就是访客本地互联网速率过低

建议拿网络速度通站长工具练练手,查性能、查故障、测互联网,网络速度通都具备,多借助工具可是只需要花一半的时间就能够完成一倍的效果!

tcp/ip协议和http协议面考试试卷?

tcp/ip是互联网四层协议,涵盖物理接口层,互联网接口层,传输层,应用层是现今互联网运用的广的协议。

http是超文本协议是在tcp/ip内的高层应用层的一个协议,主要是提供80端口的使用,可以使用超文本协议连接互联网地点位置进行网页访问,查看网页内容。

震坤行发公告让我明天去面试,有清楚面考试试卷的吗?

面试都不会有固定考试试卷,有朋友去面试过,听说震坤行的员工还是比较亲切的,常态发挥完全就能够了,不需要太担心。

以上就是面试辅导栏目公司的面试人员都是从哪里找的面试题mahout面试题的详细介绍,备战省考公务员考试的学员可点击右侧资料下载,免费获取百度云网盘资料下载链接(视频课程、电子书教材、历年真题),希望通过这些学习资料能对你公考上岸之路提供帮助,考试!!加油!!!

公务员视频课程 (文章编辑:华宇考试网;相关博客:公务员考试网)

    面试辅导热门资讯

  • 公司的面试人员都是从哪里找的面试题mahout面试题

    公司的面试人员都是从哪里找的面考试试卷? 当然是公司比较厉害的领导阶层,平常人都是没有机会的,但是,大多数情况下都是秘书,或者公司的得力助手来帮忙面试的,还有就是比较推测、猜想人性,懂得人性的人更适合作为...

    2023-01-24

  • 1988年参加工作的 公务员科员,公务员 前退休金标准是

    1988年参与工作的, 公务员科员职务岗位工资380元级别工资683元属多少档和级别? (一)直接从各种学校录用的公务员试用期工资。 初中毕业生为170元;高中、中专毕业生为180元;大专毕业生为195元;本科毕业生为205元;取得双...

    2023-01-23

  • 事业单位面试一般是几个题,事业单位面试资料哪些好写

    事业单位面试大多数情况下是哪些题? 面试时间大多数情况下是15-20分钟左右,面考试试卷大多数情况下是3-4道题,每道题时间五分钟。面试时学员按照面试官的指示进行题目作答,有的是考官将题都读完,学员都思考结束后一起...

    2023-01-23

  • 铁路公安体测在面试前还是面试后,出入境公务员考试科目有哪

    铁路公安体测在面试前还是面试后? 铁路公安先面试。面试结束后,根据学员总成绩从高到低进行排序,然后等额确定后参与体检的人员名单。 有体能测试的岗位,招聘考试单位会以公告信息形式公告,公告信息上会有有关单...

    2023-01-23

  • 公考面试考官打分都是整数吗,乡镇公务员面试76分什么水平啊

    公职考试面试考官打分都是整数吗? 公务员面试考官不是打的整数,会有小数点。 乡镇公务员面试76分什么水平? 乡镇公务员面试76分还行吧,中等水平。公务员面试的成绩大多数情况下在70至87分当中。有的时候,主考官会在面...

    2023-01-16