回复 6 # zhouyang664 的帖子
最开始是这样的:
function run_SMP(datafile,discR)
% - datafile is the data file in which, there should be two variables,
% trans_data: binary matrix, each row is a sample, and each column is an item, a 1' in (i,j) means sample i has item j
% classnew: a binary column vector, which tells class label for each of the sample
% - discR: the parameter r defined in the paper (support difference)
sup = discR;
eps = 0;
filter = 0.9;
load (datafile);
x = find(classnew == 0);
y = find(classnew == 1);
cases = trans_data(x,:);
controls = trans_data(y,:);
file_result=sprintf('result_%s_%d',datafile,sup);
fid = fopen(file_result,'w');
fclose(fid);
func_supmax(sup,eps,discR,cases,controls,filter,file_result);
func_supmax(discR,0,discR,);
func_supmax(sup,eps,discR,controls,cases,filter,file_result);
1,本来是有参数的,我方便运行就直接写入了。
2,双引号我后来改了。
3,file_result=sprintf('result_%s_%d','disc_geneV20_data',sup)
fid = fopen(file_result,'w');
fclose(fid);这三句的功能我不是很清楚,只有中间的数据'disc_geneV20_data'文件是我自己后来修改的。
4,func_supmax是自定义函数
|