mahout常用Vector一览表

mahout常用Vector一览表:

org.apache.mahout.math.ConstantVector;
org.apache.mahout.math.DenseVector;
org.apache.mahout.math.NamedVector;
org.apache.mahout.math.RandomAccessSparseVector;
org.apache.mahout.math.SequentialAccessSparseVector;

ConstantVector:

生成常量型向量如:

{1, 1 }

DenseVector:

生成一个浮点数数组,对向量里所有域都进行存储,适合用于存储密集向量

{0.18, 520, 2 ,0}

NamedVector:

保存向量的id信息如:

“向量id”->{0.18, 520, 2,0 }

 RandomAccessSparseVector:

基于浮点数的 HashMap 实现的,key 是整形 (int) 类型,value 是浮点数 (double) 类型,它只存储向量中不为空的值,并提供随机访问。

{0.18, 520, 2 }

SequentialAccessSparseVector:

实现为整形 (int) 类型和浮点数 (double) 类型的并行数组,它也只存储向量中不为空的值,但只提供顺序访问

{0.18, 520, 2 }

猜你喜欢

转载自snv.iteye.com/blog/1850402
今日推荐