⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 crossval

📁 vc的源代码程序的基于最小特征向量的元素的集合方法的程序源代码
💻
字号:
#!/usr/bin/csh#---------------------------------------------------------------------# N-way cross-validation script#---------------------------------------------------------------------#	prepare the data for cross-validationset ResDir = $1.CVrm -rf $ResDirmkdir $ResDir # making a directory where the source iscd $ResDirrstbl ../$1.data XDF.data # make a shuffled data in $ResDircp /dev/null XDF.testln ../$1.names XDF.names  # copy the names file in $ResDirset fold = $2set times = $3set NthMethod = $4set method = ($5)set option = ($6)set junk = `wc XDF.data`  set examples = $junk[1]   # get the file lengthset large = `expr $examples % $2`set segsize = `expr \( $examples / $2 \) + 1` # get test data size#	perform the cross-validation trialsset j = 1    while ( $j <= $times )       # repeat this number of times the x-validation	set i = 1	while ( $i <= $fold )      # for each fold of x-validation	  if ( $i == $large ) set segsize = `expr $examples / $2`	  cat XDF.test XDF.data | split -`expr $examples - $segsize`	  mv xaa XDF.data	  mv xab XDF.test	# allX $i XDF			set ext_fold_time = allRes.fold$i.time$j# the continuous results for all methods are the same# we run this once for continuous results.		echo "======== c4.5 cross validation ======== Conitnuous"		c4.5 -f XDF -u | grep "<<" > .tmp.cont.tmp_classifier		sel .tmp.cont.tmp_classifier > .tmp.cont.tmp_classifier.sel 		set k = 1		while ( $k <= $NthMethod ) # for each method			echo Discretize.CV XDF $method[$k] $option[$k]			discretize.CV XDF $method[$k] $option[$k]					set ext = $method[$k].$i 			echo classifier.CV XDF $ext			classifier.CV XDF $ext				echo "-----------"# we need to add it to each methods			cat .tmp.cont.tmp_classifier.sel >> c4_5.cont.$method[$k].$ext_fold_time			cat XDF.c4_5.$ext  >> c4_5.$method[$k].$ext_fold_time			cat XDF.nbc.$ext >> nbc.$method[$k].$ext_fold_time			cat Clock.sec >> clock.$method[$k].$ext_fold_time			cat Points >> points.$method[$k].$ext_fold_time			echo "-----------"				@ k++		end  # the methods		rm XDF.c4_5.* XDF.nbc.*		  @ i++	end  # the folds# all the folds for each time	set k = 1	while ( $k <= $NthMethod )		cat c4_5.cont.$method[$k].allRes.fold*.time$j >> \			c4_5.cont.$method[$k].allRes.time$j		cat c4_5.$method[$k].allRes.fold*.time$j >> \			c4_5.$method[$k].allRes.time$j		cat nbc.$method[$k].allRes.fold*.time$j >> \			nbc.$method[$k].allRes.time$j		cat clock.$method[$k].allRes.fold*.time$j >> \			clock.$method[$k].allRes.time$j		cat points.$method[$k].allRes.fold*.time$j >> \			points.$method[$k].allRes.time$j		@ k++	end	rm *.allRes.fold*.time$j # remove individual files	@ j++end  # the times#echo Average for all\: "--------"set k = 1set ext_all = "allRes.time*"set ext_avg = avgAllwhile ( $k <= $NthMethod )	cat c4_5.cont.$method[$k].$ext_all | average_sd >  \		c4_5.cont.$method[$k].$ext_avg 	cat c4_5.$method[$k].$ext_all | average_sd > \		c4_5.$method[$k].$ext_avg 	cat nbc.$method[$k].$ext_all | average_sd > \		nbc.$method[$k].$ext_avg 	cat clock.$method[$k].$ext_all | average1 > \		clock.$method[$k].$ext_avg 	cat points.$method[$k].$ext_all | average1 > \		points.$method[$k].$ext_avg 	rm *.$method[$k].$ext_all	@ k++endrm -f *XDF* .tmp.* set k = 1set c1 = c4_5.cont   # classification method 1set c2 = c4_5        # classification method 2set c3 = nbc         # classification method 3while ( $k <= $NthMethod )  set ext = "$method[$k].avg*"	paste $c1.$ext $c2.$ext $c3.$ext | tail -2 > ..tmp 	echo $method[$k] > ..tmp1	paste ..tmp clock.$method[$k].avg* ..tmp1 >> $1.summary	@ k++end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -