`
linest
  • 浏览: 150614 次
  • 性别: Icon_minigender_1
  • 来自: 内蒙古
社区版块
存档分类
最新评论
文章列表
用到: 文件读写,文件夹下遍历文件处理 package org.apache.mahout.classifier; public final class BayesFileFormatter 提供了两个处理方式 将文件夹下所有文件处理后写入单一文档,和文件分别写入文档 单文档 public static void collapse(String label, Analyzer analyzer, File inputDir, Charset charset, File outputFile) throws IOExcep ...
用到:泛型类   counter  哈希实现 package org.apache.mahout.clustering.minhash; public final class MinHashDriver extends AbstractJob 输入Sequence格式 输出根据debug模式可选向量和文本格式,文件可以Sequence和Text格式 Class<? extends Writable> outputClass = debugOutput ? VectorWritable.class : Text.class; Class& ...

ToolRunner机制

定义框架接口 由具体实现类实现 public interface Tool extends Configurable { int run(String [] args) throws Exception; } ToolRunner 同一的入口调用 按配置解析参数,调用接口方法 public static int run(Configuration conf, Tool tool, String[] args) throws Exception{ if(conf == null) { conf = new Configuration( ...

strlen 注意

没初始化的字符数组就不要strlen 否则会在内存中一直找到0 以下代码会悲剧 str[100]; memset(str,0,strlen(str)); strlen返回时无符号,不要进行运算 一旦负值就会悲剧 if(strlen("123")-5<0) 只比较还是可以的 if(strlen("123")<5)

文件统计

wc 命令   -c, --bytes            print the byte counts   -m, --chars            print the character counts   -l, --lines            print the newline counts   -L, --max-line-length  print the length of the longest line   -w, --words            print the word counts 统计文件夹下文件个数 ls |wc -l
package org.apache.mahout.fpm.pfpgrowth.fpgrowth; public class Pattern implements Comparable<Pattern> pattern封装了一组item,每个item的support值,整体的support值 private int[] pattern; private long support = Long.MAX_VALUE; private long[] supportValues; 判断pattern是否包含。由于pattern已经是升序排列, ...
package org.apache.mahout.fpm.pfpgrowth.convertors.string; public final class TopKStringPatterns implements Writable 用于存储pattern,进行merge找到top k的pattern 核心,pair链表,每个pair由pattern构成的string链表和long型support值组成。 即 <pattern,值> 链表 private final List<Pair<List<String>,Long>> freque ...

mutable 关键字

mutable 意为可变  和 const 语义相反。 声明为mutable的变量可以不受const的影响,保持可变性。 在类中为了保持类成员不变,成员函数用const修饰 但如果需要一个标记变量记录状态,则需要加mutable修饰, 这样的变量就好像与类状态无关。
package org.apache.mahout.classifier.bayes; public final class TrainClassifier bayes和cbyes的入口类 两个分支 public static void trainNaiveBayes(Path dir, Path outputDir, BayesParameters params) throws IOException { BayesDriver driver = new BayesDriver(); driver.runJob(dir, outputDir, params); ...
(builtin) 内部命令是shell解释程序内建的,有shell直接执行,不需要派生新的进程。 ("external command" or "disk command") 外部命令是二进制可执行文件,需要由磁盘装入内存执行。会派生新的进程,shell解释程序会调用fork自身的一个拷贝,然后用exec系列函数来执行外部命令,然后外部命令就取代了先前fork的子shell。 内部命令如:awk,cp,cat,ls,cd等 外部命令如sleep等 可用type 命令显示类型 [linest@036194.sqa.cm4]$ type -t sle ...

shell 特殊变量

[linest@036194.sqa.cm4]$ sh test.sh a b c d e $0 return shell name test.sh $n return nth parameter c $* return all parameters a b c d e $# return the number of parameters 5 $$ return current shell pid 32202 $! return last command pid 32203 $? return last command return value(0 success other fail) 0 $ ...
package org.apache.mahout.clustering.kmeans; public final class RandomSeedGenerator 完成中心点随机取样的过程 hdfs操作,比较普遍,先删除再新建 FileSystem fs = FileSystem.get(output.toUri(), conf); HadoopUtil.delete(conf, output); Path outFile = new Path(output, "part-randomSeed"); boolean newFi ...

时间获取

常用date参数 备查 上下午   %p   locale's equivalent of either AM or PM; blank if not known   %P   like %p, but lower case 月、星期   %a   locale's abbreviated weekday name (e.g., Sun)   %A   locale's full weekday name (e.g., Sunday)   %b   locale's abbreviated month name (e.g., Jan)   %B   locale's full month n ...

查看字符ascii值

转自http://blog.csdn.net/emili/article/details/5209119 > echo "A" | tr -d "/n" | od -An -t dC    65 > echo "X" | tr -d "/n" | od -An -t dC    88 > echo "a" | tr -d "/n" | od -An -t dC    97 如果在echo中输入特殊字符,比如ctrl+A,或者tab可以先输入ctrl+ ...
package org.apache.mahout.math; public final class VectorWritable extends Configured implements Writable VectorWritable 类包裹了Vector,提供了读写能力 private Vector vector; private boolean writesLaxPrecision; 常量选项定义采用1,2,4,8方式,通过位操作使用 public static final int FLAG_DENSE = 0x01; public static final int FLAG_SE ...
Global site tag (gtag.js) - Google Analytics