2009年11月19日星期四
gnuplot 画图
在windows版本下的gnuplot版本terminal 是windows
在linux版本下的gnuplot版本terminal 是 wxt
# Support the parameters?
plot 'digit_cons2.txt' u 1:2 w lp lw 2 lt 1 pt 1 t 'MODRPaC', \
'' u 1:3 w lp lw 2 lt 2 pt 2 t 'NPSSDR', \
'' u 1:4 w lp lw 2 lt 3 pt 3 t 'SSDR', \
'' u 1:5 w lp lw 2 lt 4 pt 4 t 'CLPP', \
'' u 1:6 w lp lw 2 lt 5 pt 5 t 'CMM', \
'' u 1:7 w lp lw 2 lt 6 pt 6 t 'PCA'
# How to set the font of given key?
set key on;
set key above;
set xlabel 'Number of Constraints' font "Arial,22"
set ylabel 'Accuracy' font "Arial,22"
set xrange [10:150]
#set title font "Arial, 12"
#replot
# How to output the eps?
set terminal postscript eps enhanced color solid lw 2 dl 2 font "Arial" 22 set output "plot1.eps"
replot
set outputset terminal windows
首先将mat数据,用dlmwrite转成文本形式。x,y,分别各为1列,'MODRPaC' 和 'PCA' 各为一列。
3D figure:
set xrange [0:1]
set yrange [0:1]
set ticslevel 0
set dgrid3d 30,30
set hidden3d
splot "./mesh_digit.txt" u 1:2:3 w l t 'MODRPaC', '' u 1:2:4 w l t 'PCA'
2009年8月17日星期一
plot画图的颜色线型
y 黄色 · 点线
m 粉红 ○ 圈线
c 亮蓝 × ×线
r 大红 + +字线
g 绿色 - 实线
b 蓝色 * 星形线
w 白色 : 虚线
k 黑色 -· (--) 点划线
matlab6.1线形:[ + o * . x square diamond v ^ > < pentagram hexagram ]
square 正方形 diamond 菱形 pentagram 五角星 hexagram 六角星
2009年6月16日星期二
matlab 一些有用的函数
h=figure(1);
plot([start:step:ending],SemiCNP_Normal_AVE,'r-',...[start:step:ending],SemiCNP_Complex_AVE,'g-',...[start:step:ending],SemiCNP_Simple_AVE,'b-',...[start:step:ending],SemiCNP_Reduce_AVE,'k-','LineWidth',2);
legend('Normal','Complex','Simple','Reduce');
x_label = sprintf('Number of Constraints (Dim: %d; K Neighbor: %d; KNN: %d)',... dim, k_neighbor_value, knn_k_value); xlabel(x_label);ylabel('Accuracy');title(fname);
fig_filename = [filename,'.fig'];
jpg_filename = [filename,'.jpg'];
saveas(h,fig_filename);
saveas(h,jpg_filename,'jpg');
close(h);
关于路径的一些代码:
currPath = fileparts(mfilename('fullpath'));
cd(currPath)
%tree_path = genpath(currPath);
%if isempty(findstr(fname, tree_path))%
mkdir(fname);
%end
if ~exist(fname,'dir')
mkdir(fname);
end
currPath = [currPath,'\',fname,'\'];
file_path = ['D:\Self_Compare\',fname];
字符串数组:
files =strvcat('balance.dat','pima.dat','segment.dat','soybean.dat','wine.dat','iris.dat','digit-test.dat','sonar.dat','heart.dat','ionosphere.dat');
There are blanks behind each string.
Thus, we need take such an operation bellows: fname = deblank(fname);
2009年5月30日星期六
Latex使用小技巧
2, 在画图的时候, subfigure 和 subfig package 不能同时用,否则提示错误:
LaTeX Error: No counter 'subfigure@save' defined.
2009年4月8日星期三
实验室请了两个法国教授做报告
The first person is the president of the French association for AI andthe second person is a former president.They are visiting our lab until Friday.
Dr. Michele Sebag(http://www.lri.fr/~sebag/)
day & time: 4/8 13:00-14:30
location:W2 3F lecture rooms 5 and 6 (rooms 325 and 326)
title: Data Streaming based on Affinity Propagation; Application to Autonomic Computing
abstract: Affinity Propagation, a recent clustering algorithm based onmessage propagation techniques, yields quasi-optimal and stablesolutions at the price of a quadratic complexity. Two extensions will bedescribed, one for reducing the complexity and the other for dealingwith online clustering (data streaming). The talk will describe theapplication of StrAP to Autonomic Grid. The EGEE grid system involvesabout 80,000 CPUs, and concurrently processes 300,000 jobs on a 24 hour,7 day basis. The StrAP algorithm provides an online summary of the jobdistribution, amenable to the prompt detection of anomalies.
Marc Schoenauer (http://www.lri.fr/~marc/)
day & time:4/8 14:30-16:00
location:W2 3F lecture rooms 5 and 6 (rooms 325 and 326)
title: Crossing the Chasm for Evolutionary Algorithms
abstract: One drawback of Evolutionary Algorithms, preventing their wideuse outside the Evolutionary Computation community, paradoxically comesfrom their high flexibility. The large number of parameters EAs offer tothe user does indeed make them difficult to fine tune. This talk willsurvey the current state of research in the area of parameter tuning,both off-line and on-line, focusing on the continuous optimization case,where on-line adaptation provides state-of-the-art algorithms.
2009年2月21日星期六
2009年2月19日星期四
解决matlab中out of memory <转>
但使用后效果均不理想,数据量一旦增加,马上要出现out of memory的问题。后来把程序相关算法优化了一遍,尤其是针对循环嵌套,把没必要的变量clear掉了,把有用的变量先save,后clear掉,最后终于得出较好的结果。
下面介绍一下关于clear、save、load的特殊用法,这对在for或while等多重循环里出现out of memory非常有效。
for k = 1:N % N为循环次数 % ---------------------
var0 = k; % 获得变量var0 %----------------------
string = [sprintf('var_%d', k) ' = var0;' ]; eval(string); % 等价于 var_k = var0; save(sprintf('var_%d.mat', k), sprintf('var_%d')); % 等价于 save var_k.mat var_k
clear(sprintf('var_%d')); % 等价于 clear var_kend 如果要读取刚才存取的变量var_k, (k = 1,2, ..., N).
那么,可以使用如下用法
for k = 1:N
load(sprintf('var_%d.mat', k)); % 等价于 load var_k.mat k = 1,2, ..., N
end
另外,还有一些非常有用的用法。如果用清除刚才读取的变量var_k, k = 1, 2, ..., Nclear '-regexp' '^var_' % 清除所有以“ var_ ”开头的变量还有很多关于save、clear、load等用法,具体help一下。