【发布时间】:2011-02-24 05:29:42
【问题描述】:
好吧,试着用搜索引擎做点什么。
我从 5 个文档的集合中生成了一个矩阵(术语文档)。输出是:
docs= (5,1) 1.0000 (1,2) 0.7071 (3,2) 0.7071 (1,3) 0.7071 (5,3) 0.7071 (3,4) 1.0000 (4,5) 1.0000
另外,我从用户查询中生成了一个查询矩阵。
q= (1,1) 1 (2,1) 1
我正在尝试查找文档集与应用向量空间建模的用户查询的相似性。代码如下:
% docs is a sprase matrix presenting a number of document.
sc=zeros(1, n); doc_inds=zeros(1, n);
% q is the user query.
sc=q'*docs;
%sort documents according to their
similarity coefficient with the query
[sc, doc_inds]=sort(sc);
sc=sc(end:-1:1);doc_inds=doc_inds(end:-1:1);
sc=q'*docs; 行总是产生错误:???内部矩阵维度必须。 同意。
谁能帮我想办法解决它?珍惜你的时间。
【问题讨论】:
标签: matlab sparse-matrix