亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? svm.m4

?? 支撐向量機庫文件
?? M4
?? 第 1 頁 / 共 4 頁
字號:
					}				model.nSV[i] = nSV;				nz_count[i] = nSV;			}					System.out.print("Total nSV = "+nnz+"\n");			model.l = nnz;			model.SV = new svm_node[nnz][];			p = 0;			for(i=0;i<l;i++)				if(nonzero[i]) model.SV[p++] = x[i];			int[] nz_start = new int[nr_class];			nz_start[0] = 0;			for(i=1;i<nr_class;i++)				nz_start[i] = nz_start[i-1]+nz_count[i-1];			model.sv_coef = new double[nr_class-1][];			for(i=0;i<nr_class-1;i++)				model.sv_coef[i] = new double[nnz];			p = 0;			for(i=0;i<nr_class;i++)				for(int j=i+1;j<nr_class;j++)				{					// classifier (i,j): coefficients with					// i are in sv_coef[j-1][nz_start[i]...],					// j are in sv_coef[i][nz_start[j]...]					int si = start[i];					int sj = start[j];					int ci = count[i];					int cj = count[j];									int q = nz_start[i];					int k;					for(k=0;k<ci;k++)						if(nonzero[si+k])							model.sv_coef[j-1][q++] = f[p].alpha[k];					q = nz_start[j];					for(k=0;k<cj;k++)						if(nonzero[sj+k])							model.sv_coef[i][q++] = f[p].alpha[ci+k];					++p;				}		}		return model;	}	public static void svm_cross_validation(svm_problem prob, svm_parameter param, int nr_fold, double[] target)	{		int i;		int[] perm = new int[prob.l];				// random shuffle		for(i=0;i<prob.l;i++) perm[i]=i;		for(i=0;i<prob.l;i++)		{			int j = i+(int)(Math.random()*(prob.l-i));			swap(int,perm[i],perm[j]);		}		for(i=0;i<nr_fold;i++)		{			int begin = i*prob.l/nr_fold;			int end = (i+1)*prob.l/nr_fold;			int j,k;			svm_problem subprob = new svm_problem();			subprob.l = prob.l-(end-begin);			subprob.x = new svm_node[subprob.l][];			subprob.y = new double[subprob.l];			k=0;			for(j=0;j<begin;j++)			{				subprob.x[k] = prob.x[perm[j]];				subprob.y[k] = prob.y[perm[j]];				++k;			}			for(j=end;j<prob.l;j++)			{				subprob.x[k] = prob.x[perm[j]];				subprob.y[k] = prob.y[perm[j]];				++k;			}			svm_model submodel = svm_train(subprob,param);			if(param.probability == 1 &&			   (param.svm_type == svm_parameter.C_SVC ||			    param.svm_type == svm_parameter.NU_SVC))			{				double[] prob_estimates= new double[svm_get_nr_class(submodel)];				for(j=begin;j<end;j++)					target[perm[j]] = svm_predict_probability(submodel,prob.x[perm[j]],prob_estimates);			}			else				for(j=begin;j<end;j++)					target[perm[j]] = svm_predict(submodel,prob.x[perm[j]]);		}	}	public static int svm_get_svm_type(svm_model model)	{		return model.param.svm_type;	}	public static int svm_get_nr_class(svm_model model)	{		return model.nr_class;	}	public static void svm_get_labels(svm_model model, int[] label)	{		if (model.label != null)			for(int i=0;i<model.nr_class;i++)				label[i] = model.label[i];	}	public static double svm_get_svr_probability(svm_model model)	{		if ((model.param.svm_type == svm_parameter.EPSILON_SVR || model.param.svm_type == svm_parameter.NU_SVR) &&		    model.probA!=null)		return model.probA[0];		else		{			System.err.print("Model doesn't contain information for SVR probability inference\n");			return 0;		}	}	public static void svm_predict_values(svm_model model, svm_node[] x, double[] dec_values)	{		if(model.param.svm_type == svm_parameter.ONE_CLASS ||		   model.param.svm_type == svm_parameter.EPSILON_SVR ||		   model.param.svm_type == svm_parameter.NU_SVR)		{			double[] sv_coef = model.sv_coef[0];			double sum = 0;			for(int i=0;i<model.l;i++)				sum += sv_coef[i] * Kernel.k_function(x,model.SV[i],model.param);			sum -= model.rho[0];			dec_values[0] = sum;		}		else		{			int i;			int nr_class = model.nr_class;			int l = model.l;					double[] kvalue = new double[l];			for(i=0;i<l;i++)				kvalue[i] = Kernel.k_function(x,model.SV[i],model.param);			int[] start = new int[nr_class];			start[0] = 0;			for(i=1;i<nr_class;i++)				start[i] = start[i-1]+model.nSV[i-1];			int p=0;			int pos=0;			for(i=0;i<nr_class;i++)				for(int j=i+1;j<nr_class;j++)				{					double sum = 0;					int si = start[i];					int sj = start[j];					int ci = model.nSV[i];					int cj = model.nSV[j];									int k;					double[] coef1 = model.sv_coef[j-1];					double[] coef2 = model.sv_coef[i];					for(k=0;k<ci;k++)						sum += coef1[si+k] * kvalue[si+k];					for(k=0;k<cj;k++)						sum += coef2[sj+k] * kvalue[sj+k];					sum -= model.rho[p++];					dec_values[pos++] = sum;									}		}	}	public static double svm_predict(svm_model model, svm_node[] x)	{		if(model.param.svm_type == svm_parameter.ONE_CLASS ||		   model.param.svm_type == svm_parameter.EPSILON_SVR ||		   model.param.svm_type == svm_parameter.NU_SVR)		{			double[] res = new double[1];			svm_predict_values(model, x, res);			if(model.param.svm_type == svm_parameter.ONE_CLASS)				return (res[0]>0)?1:-1;			else				return res[0];		}		else		{			int i;			int nr_class = model.nr_class;			double[] dec_values = new double[nr_class*(nr_class-1)/2];			svm_predict_values(model, x, dec_values);			int[] vote = new int[nr_class];			for(i=0;i<nr_class;i++)				vote[i] = 0;			int pos=0;			for(i=0;i<nr_class;i++)				for(int j=i+1;j<nr_class;j++)				{					if(dec_values[pos++] > 0)						++vote[i];					else						++vote[j];				}			int vote_max_idx = 0;			for(i=1;i<nr_class;i++)				if(vote[i] > vote[vote_max_idx])					vote_max_idx = i;			return model.label[vote_max_idx];		}	}	public static double svm_predict_probability(svm_model model, svm_node[] x, double[] prob_estimates)	{		if ((model.param.svm_type == svm_parameter.C_SVC || model.param.svm_type == svm_parameter.NU_SVC) &&		    model.probA!=null && model.probB!=null)		{			int i;			int nr_class = model.nr_class;			double[] dec_values = new double[nr_class*(nr_class-1)/2];			svm_predict_values(model, x, dec_values);			double min_prob=1e-7;			double[][] pairwise_prob=new double[nr_class][nr_class];						int k=0;			for(i=0;i<nr_class;i++)				for(int j=i+1;j<nr_class;j++)				{					pairwise_prob[i][j]=Math.min(Math.max(sigmoid_predict(dec_values[k],model.probA[k],model.probB[k]),min_prob),1-min_prob);					pairwise_prob[j][i]=1-pairwise_prob[i][j];					k++;				}			multiclass_probability(nr_class,pairwise_prob,prob_estimates);			int prob_max_idx = 0;			for(i=1;i<nr_class;i++)				if(prob_estimates[i] > prob_estimates[prob_max_idx])					prob_max_idx = i;			return model.label[prob_max_idx];		}		else 			return svm_predict(model, x);	}	static final String svm_type_table[] =	{		"c_svc","nu_svc","one_class","epsilon_svr","nu_svr",	};	static final String kernel_type_table[]=	{		"linear","polynomial","rbf","sigmoid",	};	public static void svm_save_model(String model_file_name, svm_model model) throws IOException	{		DataOutputStream fp = new DataOutputStream(new FileOutputStream(model_file_name));		svm_parameter param = model.param;		fp.writeBytes("svm_type "+svm_type_table[param.svm_type]+"\n");		fp.writeBytes("kernel_type "+kernel_type_table[param.kernel_type]+"\n");		if(param.kernel_type == svm_parameter.POLY)			fp.writeBytes("degree "+param.degree+"\n");		if(param.kernel_type == svm_parameter.POLY ||		   param.kernel_type == svm_parameter.RBF ||		   param.kernel_type == svm_parameter.SIGMOID)			fp.writeBytes("gamma "+param.gamma+"\n");		if(param.kernel_type == svm_parameter.POLY ||		   param.kernel_type == svm_parameter.SIGMOID)			fp.writeBytes("coef0 "+param.coef0+"\n");		int nr_class = model.nr_class;		int l = model.l;		fp.writeBytes("nr_class "+nr_class+"\n");		fp.writeBytes("total_sv "+l+"\n");			{			fp.writeBytes("rho");			for(int i=0;i<nr_class*(nr_class-1)/2;i++)				fp.writeBytes(" "+model.rho[i]);			fp.writeBytes("\n");		}			if(model.label != null)		{			fp.writeBytes("label");			for(int i=0;i<nr_class;i++)				fp.writeBytes(" "+model.label[i]);			fp.writeBytes("\n");		}		if(model.probA != null) // regression has probA only		{			fp.writeBytes("probA");			for(int i=0;i<nr_class*(nr_class-1)/2;i++)				fp.writeBytes(" "+model.probA[i]);			fp.writeBytes("\n");		}		if(model.probB != null) 		{			fp.writeBytes("probB");			for(int i=0;i<nr_class*(nr_class-1)/2;i++)				fp.writeBytes(" "+model.probB[i]);			fp.writeBytes("\n");		}		if(model.nSV != null)		{			fp.writeBytes("nr_sv");			for(int i=0;i<nr_class;i++)				fp.writeBytes(" "+model.nSV[i]);			fp.writeBytes("\n");		}		fp.writeBytes("SV\n");		double[][] sv_coef = model.sv_coef;		svm_node[][] SV = model.SV;		for(int i=0;i<l;i++)		{			for(int j=0;j<nr_class-1;j++)				fp.writeBytes(sv_coef[j][i]+" ");			svm_node[] p = SV[i];			for(int j=0;j<p.length;j++)				fp.writeBytes(p[j].index+":"+p[j].value+" ");			fp.writeBytes("\n");		}		fp.close();	}	private static double atof(String s)	{		return Double.valueOf(s).doubleValue();	}	private static int atoi(String s)	{		return Integer.parseInt(s);	}	public static svm_model svm_load_model(String model_file_name) throws IOException	{		BufferedReader fp = new BufferedReader(new FileReader(model_file_name));		// read parameters		svm_model model = new svm_model();		svm_parameter param = new svm_parameter();		model.param = param;		model.rho = null;		model.probA = null;		model.probB = null;		model.label = null;		model.nSV = null;		while(true)		{			String cmd = fp.readLine();			String arg = cmd.substring(cmd.indexOf(' ')+1);			if(cmd.startsWith("svm_type"))			{				int i;				for(i=0;i<svm_type_table.length;i++)				{					if(arg.indexOf(svm_type_table[i])!=-1)					{						param.svm_type=i;						break;					}				}				if(i == svm_type_table.length)				{					System.err.print("unknown svm type.\n");					return null;				}			}			else if(cmd.startsWith("kernel_type"))			{				int i;				for(i=0;i<kernel_type_table.length;i++)				{					if(arg.indexOf(kernel_type_table[i])!=-1)					{						param.kernel_type=i;						break;					}				}				if(i == kernel_type_table.length)				{					System.err.print("unknown kernel function.\n");					return null;				}			}			else if(cmd.startsWith("degree"))				param.degree = atof(arg);			else if(cmd.startsWith("gamma"))				param.gamma = atof(arg);			else if(cmd.startsWith("coef0"))				param.coef0 = atof(arg);			else if(cmd.startsWith("nr_class"))				model.nr_class = atoi(arg);			else if(cmd.startsWith("total_sv"))				model.l = atoi(arg);			else if(cmd.startsWith("rho"))			{				int n = model.nr_class * (model.nr_class-1)/2;				model.rho = new double[n];				StringTokenizer st = new StringTokenizer(arg);				for(int i=0;i<n;i++)					model.rho[i] = atof(st.nextToken());			}			else if(cmd.startsWith("label"))			{				int n = model.nr_class;				model.label = new int[n];				StringTokenizer st = new StringTokenizer(arg);				for(int i=0;i<n;i++)					model.label[i] = atoi(st.nextToken());								}			else if(cmd.startsWith("probA"))			{				int n = model.nr_class*(model.nr_class-1)/2;				model.probA = new double[n];				StringTokenizer st = new StringTokenizer(arg);				for(int i=0;i<n;i++)					model.probA[i] = atof(st.nextToken());								}			else if(cmd.startsWith("probB"))			{				int n = model.nr_class*(model.nr_class-1)/2;				model.probB = new double[n];				StringTokenizer st = new StringTokenizer(arg);				for(int i=0;i<n;i++)					model.probB[i] = atof(st.nextToken());								}			else if(cmd.startsWith("nr_sv"))			{				int n = model.nr_class;				model.nSV = new int[n];				StringTokenizer st = new StringTokenizer(arg);				for(int i=0;i<n;i++)					model.nSV[i] = atoi(st.nextToken());			}			else if(cmd.startsWith("SV"))			{				break;			}			else			{				System.err.print("unknown text in model file\n");				return null;			}		}		// read sv_coef and SV		int m = model.nr_class - 1;		int l = model.l;		model.sv_coef = new double[m][l];		model.SV = new svm_node[l][];		for(int i=0;i<l;i++)		{			String line = fp.readLine();			StringTokenizer st = new StringTokenizer(line," \t\n\r\f:");			for(int k=0;k<m;k++)				model.sv_coef[k][i] = atof(st.nextToken());			int n = st.countTokens()/2;			model.SV[i] = new svm_node[n];			for(int j=0;j<n;j++)			{				model.SV[i][j] = new svm_node();				model.SV[i][j].index = atoi(st.nextToken());				model.SV[i][j].value = atof(st.nextToken());			}		}		fp.close();		return model;	}	public static String svm_check_parameter(svm_problem prob, svm_parameter param)	{		// svm_type		int svm_type = param.svm_type;		if(svm_type != svm_parameter.C_SVC &&		   svm_type != svm_parameter.NU_SVC &&		   svm_type != svm_parameter.ONE_CLASS &&		   svm_type != svm_parameter.EPSILON_SVR &&		   svm_type != svm_parameter.NU_SVR)		return "unknown svm type";			// kernel_type			int kernel_type = param.kernel_type;		if(kernel_type != svm_parameter.LINEAR &&		   kernel_type != svm_parameter.POLY &&		   kernel_type != svm_parameter.RBF &&		   kernel_type != svm_parameter.SIGMOID)		return "unknown kernel type";		// cache_size,eps,C,nu,p,shrinking		if(param.cache_size <= 0)			return "cache_size <= 0";		if(param.eps <= 0)			return "eps <= 0";		if(svm_type == svm_parameter.C_SVC ||		   svm_type == svm_parameter.EPSILON_SVR ||		   svm_type == svm_parameter.NU_SVR)			if(param.C <= 0)				return "C <= 0";		if(svm_type == svm_parameter.NU_SVC ||		   svm_type == svm_parameter.ONE_CLASS ||		   svm_type == svm_parameter.NU_SVR)			if(param.nu < 0 || param.nu > 1)				return "nu < 0 or nu > 1";		if(svm_type == svm_parameter.EPSILON_SVR)			if(param.p < 0)				return "p < 0";		if(param.shrinking != 0 &&		   param.shrinking != 1)			return "shrinking != 0 and shrinking != 1";		if(param.probability != 0 &&		   param.probability != 1)			return "probability != 0 and probability != 1";		if(param.probability == 1 &&		   svm_type == svm_parameter.ONE_CLASS)			return "one-class SVM probability output not supported yet";				// check whether nu-svc is feasible			if(svm_type == svm_parameter.NU_SVC)		{			int l = prob.l;			int max_nr_class = 16;			int nr_class = 0;			int[] label = new int[max_nr_class];			int[] count = new int[max_nr_class];			int i;			for(i=0;i<l;i++)			{				int this_label = (int)prob.y[i];				int j;				for(j=0;j<nr_class;j++)					if(this_label == label[j])					{						++count[j];						break;					}				if(j == nr_class)				{					if(nr_class == max_nr_class)					{						max_nr_class *= 2;						int[] new_data = new int[max_nr_class];						System.arraycopy(label,0,new_data,0,label.length);						label = new_data;												new_data = new int[max_nr_class];						System.arraycopy(count,0,new_data,0,count.length);						count = new_data;					}					label[nr_class] = this_label;					count[nr_class] = 1;					++nr_class;				}			}			for(i=0;i<nr_class;i++)			{				int n1 = count[i];				for(int j=i+1;j<nr_class;j++)				{					int n2 = count[j];					if(param.nu*(n1+n2)/2 > Math.min(n1,n2))						return "specified nu is infeasible";				}			}		}		return null;	}	public static int svm_check_probability_model(svm_model model)	{		if (((model.param.svm_type == svm_parameter.C_SVC || model.param.svm_type == svm_parameter.NU_SVC) &&		model.probA!=null && model.probB!=null) ||		((model.param.svm_type == svm_parameter.EPSILON_SVR || model.param.svm_type == svm_parameter.NU_SVR) &&		 model.probA!=null))			return 1;		else			return 0;	}}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
韩国午夜理伦三级不卡影院| 国产乱对白刺激视频不卡| 蜜臀av国产精品久久久久| 99国产精品久久| 欧美大片顶级少妇| 一区二区三区日韩欧美精品| 国内精品写真在线观看| 欧美日韩中字一区| 最新国产の精品合集bt伙计| 国产老女人精品毛片久久| 欧美美女网站色| 一个色综合网站| 白白色亚洲国产精品| 久久网站最新地址| 久久er精品视频| 欧美妇女性影城| 亚洲午夜精品网| 色综合视频在线观看| 国产午夜亚洲精品羞羞网站| 九九视频精品免费| 91精品国产一区二区三区香蕉| 亚洲一区二区三区四区五区黄| 99re66热这里只有精品3直播 | 国产精品伦一区| 狠狠v欧美v日韩v亚洲ⅴ| 日韩三级在线免费观看| 日韩精品91亚洲二区在线观看 | 91美女在线看| 成人欧美一区二区三区黑人麻豆| 国产99一区视频免费| 日本一区二区三区四区在线视频| 国产乱一区二区| 久久久久一区二区三区四区| 国产成人鲁色资源国产91色综| 久久蜜臀中文字幕| 国产精品白丝av| 国产精品麻豆视频| 不卡的av电影| 一区二区欧美在线观看| 在线观看一区日韩| 日韩黄色片在线观看| 欧美精品国产精品| 美女国产一区二区| 久久久国产精品午夜一区ai换脸| 成人午夜视频在线| 亚洲精品成人少妇| 欧美精品亚洲二区| 美女脱光内衣内裤视频久久网站| 精品久久久网站| 成人美女在线观看| 一级精品视频在线观看宜春院| 欧美精品色综合| 国产盗摄一区二区三区| 国产精品不卡在线| 欧美日韩精品欧美日韩精品| 美女免费视频一区| 国产精品进线69影院| 欧美人与禽zozo性伦| 久久国产精品免费| 亚洲欧美国产三级| 欧美一区日韩一区| 成人国产精品视频| 午夜伊人狠狠久久| 国产欧美一区二区精品仙草咪| 色婷婷国产精品久久包臀| 美日韩一区二区三区| 亚洲欧美中日韩| 3d成人动漫网站| 99麻豆久久久国产精品免费优播| 亚洲成人动漫av| 国产欧美日本一区二区三区| 欧美三区在线观看| 国产传媒久久文化传媒| 午夜久久电影网| 中文字幕第一区二区| 欧美精品v国产精品v日韩精品| 国产乱码精品一区二区三区av | 亚洲第一电影网| 欧美精品一区二区三区蜜桃| 91国偷自产一区二区三区成为亚洲经典| 日本在线播放一区二区三区| 亚洲色欲色欲www| 精品国产123| 91精品国产色综合久久不卡蜜臀 | 91麻豆成人久久精品二区三区| 久久se精品一区精品二区| 亚洲永久免费视频| 国产欧美综合在线| 日韩欧美国产精品| 欧美性生活大片视频| eeuss鲁片一区二区三区在线观看| 免费成人美女在线观看.| 亚洲一区二区高清| 亚洲视频一区在线| 国产视频在线观看一区二区三区| 欧美精品v日韩精品v韩国精品v| 欧美综合色免费| 99久久精品国产精品久久| 成人小视频在线| 国产精品一区二区不卡| 久久电影网电视剧免费观看| 奇米影视在线99精品| 亚洲国产精品一区二区www | 国产女人18毛片水真多成人如厕| 91精品国产综合久久精品图片 | 亚洲成人自拍一区| 日韩毛片一二三区| 日韩一区欧美小说| 中文字幕精品一区二区三区精品| 26uuu国产在线精品一区二区| 欧美一级精品大片| 日韩欧美一级在线播放| 欧美一区二区二区| 日韩三级高清在线| 日韩美女主播在线视频一区二区三区 | 欧美日韩dvd在线观看| 欧美在线免费视屏| 欧美人xxxx| 欧美一区二区在线播放| 欧美一二三四在线| 精品卡一卡二卡三卡四在线| 精品福利一二区| 国产日产亚洲精品系列| 国产精品色在线| 一区二区三区鲁丝不卡| 亚洲国产欧美日韩另类综合 | 精品久久国产97色综合| 精品国产伦一区二区三区观看体验 | 欧美mv日韩mv亚洲| 精品1区2区在线观看| 久久精品人人做人人综合| 国产亚洲福利社区一区| 国产精品九色蝌蚪自拍| 亚洲午夜av在线| 久久er99热精品一区二区| 国产剧情一区二区| 99r国产精品| 欧美精品粉嫩高潮一区二区| 亚洲精品在线免费播放| 国产精品美女久久久久av爽李琼| 一区二区三区高清不卡| 蜜臀久久久99精品久久久久久| 精品亚洲国内自在自线福利| 不卡av在线免费观看| 欧美日韩国产另类不卡| 337p粉嫩大胆噜噜噜噜噜91av| 国产精品久久久一区麻豆最新章节| 一区二区三区四区激情| 国产自产v一区二区三区c| 99久久精品99国产精品| 67194成人在线观看| 欧美激情一区二区三区在线| 亚洲成a人在线观看| 国产成人精品免费看| 欧日韩精品视频| 久久久激情视频| 日韩在线一二三区| 成人va在线观看| 91精品国产高清一区二区三区蜜臀| 欧美激情在线看| 日韩综合在线视频| 不卡的电影网站| 久久免费视频色| 青青草国产精品97视觉盛宴| 成人精品小蝌蚪| 精品国产一区二区三区忘忧草| 一区二区成人在线视频| 国产成人免费在线观看不卡| 日韩欧美激情一区| 亚洲精品视频在线| 国产传媒欧美日韩成人| 日韩精品一区二区在线观看| 一区二区三区欧美在线观看| 国产一区二区毛片| 日韩女优制服丝袜电影| 亚洲成人手机在线| 色婷婷综合五月| 亚洲欧洲在线观看av| 国产精品18久久久久久久久久久久 | 91色porny蝌蚪| 欧美激情中文字幕| 国产美女娇喘av呻吟久久| 91精品婷婷国产综合久久性色| 亚洲午夜免费电影| 91成人国产精品| 伊人婷婷欧美激情| 99在线热播精品免费| 国产日韩欧美高清| 国产一区二区福利| 2019国产精品| 国内精品写真在线观看| 欧美精品一区二区三区很污很色的| 日韩av一级片| 欧美一区二区三区在| 日韩一区欧美二区| 欧美日本视频在线| 蜜桃久久久久久久| 久久综合九色综合97_久久久| 久久精品免费看| 精品国产免费一区二区三区四区|