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

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

?? testdoc.cpp

?? 用C++寫的函數逼近的例子!可以設置步長
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
	}
	delete [] weight_i_h;

	for(x=0; x<input_array_size; x++)
	{
		delete [] original_weight_ih[x];
	}
	delete [] original_weight_ih;

	for(x=0; x<input_array_size; x++)
	{
		delete [] old_weight_ih[x];
	}
	delete [] old_weight_ih;

	for(x=0; x<input_array_size; x++)
	{
		delete [] last_weight_ih[x];
	}
	delete [] last_weight_ih;

	for(x=0; x<input_array_size; x++)
	{
		delete [] last_old_weight_ih[x];
	}
	delete [] last_old_weight_ih;

	for(x=0; x<hidden_array_size; x++)
	{
		delete [] weight_h_o[x];
	}
	delete [] weight_h_o;

	for(x=0; x<hidden_array_size; x++)
	{
		delete [] original_weight_ho[x];
	}
	delete [] original_weight_ho;

	for(x=0; x<hidden_array_size; x++)
	{
		delete [] old_weight_ho[x];
	}
	delete [] old_weight_ho;

	for(x=0; x<hidden_array_size; x++)
	{
		delete [] last_weight_ho[x];
	}
	delete [] last_weight_ho;

	for(x=0; x<hidden_array_size; x++)
	{
		delete [] last_old_weight_ho[x];
	}
	delete [] last_old_weight_ho;

	delete [] errorsignal_hidden;
	
	delete [] errorsignal_output;

	delete [] delta_error_output;

	delete [] last_delta_error_output;

	delete [] delta_error_hidden;

	delete [] last_delta_error_hidden;

	for (x=0; x<input_array_size; x++)
	{
		delete [] delta_weight_ih[x];
	}
	delete [] delta_weight_ih;

	for (x=0; x<input_array_size; x++)
	{
		delete [] last_delta_weight_ih[x];
	}
	delete [] last_delta_weight_ih;

	for (x=0; x<hidden_array_size; x++)
	{
		delete [] delta_weight_ho[x];
	}
	delete [] delta_weight_ho;

	for (x=0; x<hidden_array_size; x++)
	{
		delete [] last_delta_weight_ho[x];
	}
	delete [] last_delta_weight_ho;

	file_loaded = FALSE;
	return;
}


void CTestDoc::OnMenuLearn() 
{
	// TODO: Add your command handler code here
	ofstream out(BIAS_FILE);
	ofstream out_num(BIASNUM_FILE);
	ofstream out_temp(TEMP_FILE);
	ofstream out_opti(OPTI_FILE);

	dispmode = 2;
	UpdateAllViews(NULL);
    for (int method=START_METHOD; method<LEARN_METHOD; method++)
	{
		//for (angle=START_ANGLE; angle<=MAX_ANGLE; angle+=ANGLE_STEP)
		//for (max_step=START_STEP; max_step<=MAX_STEP ;max_step+=DELTA)
    //{
		
		load_original_data();
			
		while(notkeyhit) 
		{
			for(int y=0; y<number_of_input_patterns; y++) 
			{
				forward_pass(y);
			}
	
			backward_pass(out, method, out_opti);

			if(compare_output_to_target()&&progress)
			{
				success = TRUE;
				break;
			}
			
			MSG message;
			if (::PeekMessage(&message,NULL,0,0,PM_REMOVE))
			{
				::TranslateMessage(&message);
				::DispatchMessage(&message);
			}		
		}
		if (success)
		{
			out << endl << endl;
			out_num << total << endl;
			if (method == 1)
			{
				out_temp << "max_step=" << max_step;
				//out_temp << "angle=" << angle;
				out_temp << " ---------- total=" << total << endl;
				TRACE("\n\n---------average=%.8f--------\n\n",sum/double(bias_array_size));
			}
		}
		else 
		{
			break;
		}
	//}
	}
	dispmode = 0;
	UpdateAllViews(NULL);
		
	out.close();
	out_num.close();
	out_temp.close();
	out_opti.close();
	if (success)
	{
		Beep(618,50);
		::AfxMessageBox("Learning successful");
		data_learned = TRUE;
		can_learn = FALSE;
	}
	else
	{
		::AfxMessageBox("Learning not successful yet");
	}
	return;
}

void CTestDoc::forward_pass(int pattern)
{
	//_control87 (MCW_EM, MCW_EM);
	double temp=0.0;
	int x,y;

	// INPUT -> HIDDEN
	for(y=0; y<hidden_array_size; y++)
	{
		for(x=0; x<input_array_size; x++)
		{
			temp += (input[pattern][x] * weight_i_h[x][y]); //∑Wi*Xi
		}
		hidden[pattern][y] = (1.0 / (1.0 + 
			       exp(-1.0 * (temp + bias[y]))));//1/(1+e^(-uj)); uj=∑Wi*Xi - θj
		temp = 0.0;                                //各隱層結點的輸出
	}

	// HIDDEN -> OUTPUT
	for(y=0; y<output_array_size; y++)	//有output_array_size個輸出結點
	{
		for(x=0; x<hidden_array_size; x++) 
		{
			temp += (hidden[pattern][x] * weight_h_o[x][y]);
		}
		output[pattern][y] = (1.0 / (1.0 +
			                exp(-1.0 * (temp + bias[y + hidden_array_size]))));
		temp = 0.0;
	}
	return;
}

void CTestDoc::backward_pass(ofstream& f_out, int method, ofstream& out_temp)
{
	int x, y, p;
	double temp = 0.0;
	double e = 0.0;
		      
	for (x=0; x<output_array_size; x++) 
	{
		delta_error_output[x] = 0.0;
	}
	for (x=0; x<hidden_array_size; x++)
	{
		delta_error_hidden[x] = 0.0;
	}
	for (x=0; x<input_array_size; x++)
	{
		for (y=0; y<hidden_array_size; y++)
		{
			delta_weight_ih[x][y] = 0.0;
		}
	}	
	for (x=0; x<hidden_array_size; x++)
	{
		for (y=0; y<output_array_size; y++)
		{
			delta_weight_ho[x][y] = 0.0;
		}	
	}
	for (x=0; x<number_of_input_patterns; x++)
	{
		for (y=0; y<output_array_size; y++)
		{
			gamma[x][y] = 0.0;
		}
	}

	for (p=0; p<number_of_input_patterns; p++)
	{
		//TRACE("\n----------------p=%d\n",p);
		for (x=0; x<output_array_size; x++)// COMPUTE ERRORSIGNAL FOR OUTPUT UNITS
		{
			errorsignal_output[x] = (target[p][x]-output[p][x]);//(t-y)
			e += errorsignal_output[x] * errorsignal_output[x];//(∑(t-y)^2)
			gamma[p][x] = output[p][x] * (1-output[p][x]);
			//TRACE("gamma[%d][%d]=%.8f\n",p,x,gamma[p][x]);
			errorsignal_output[x] *= gamma[p][x];//output[p][x] * (1-output[p][x]);//δ= y*(1-y)*(t-y)
			delta_error_output[x] += errorsignal_output[x];
		}
	
		for (x=0; x<hidden_array_size; x++)// COMPUTE ERRORSIGNAL FOR HIDDEN UNITS
		{
			for (y=0; y<output_array_size; y++)
			{ 
				temp += (errorsignal_output[y] * weight_h_o[x][y]);//∑δ*W
			}
			errorsignal_hidden[x] = hidden[p][x] * (1-hidden[p][x]) *
									temp;//δh=Xk*(1-Xk)∑δ*W
			temp = 0.0;
			delta_error_hidden[x] += errorsignal_hidden[x];
		}
        
		for (x=0; x<hidden_array_size; x++)
		{
			for (y=0; y<output_array_size; y++)
			{
				delta_weight_ho[x][y] += errorsignal_output[y]*hidden[p][x];
			}
		}

		for (x=0; x<input_array_size; x++)
		{
			for (y=0; y<hidden_array_size; y++)
			{
				delta_weight_ih[x][y] += errorsignal_hidden[y]*input[p][x];
			}
		}
	}

	double temp_weight = 0.0,
		  delta_weight = 0.0,
		     temp_bias = 0.0,
		    delta_bias = 0.0,
				temp_e = 0.0,
		   error_angle = angle+1;

	e /= 2.0;//e = (∑(t-y)^2)/2
	if (method==0)
	{
		f_out << e << ' ';
		alpha = 0.9;
		total++;
	}
	else
	{
		if (progress)
		{
			if (not_onward)
			{
				if (back_e > e)
				{
					back_e = e;
					optimum_decrease_length = decrease_length;
				}
				decrease_length -= DECREASE_STEP;
				if (decrease_length < MIN_DECREASE)
				{
					decrease_length = optimum_decrease_length;
					not_onward = FALSE;

					TRACE("OPTIMUM_DECREASE_LENGTH=%.2f\n",decrease_length);
					out_temp << total << ' ' << 1 << ' ' << (last_learning_rate) << ' ';
					out_temp << (last_total_e-last_old_e) << ' ' << decrease_length << endl;
					//out_temp << total << ' ' << 1 << ' ' << function(last_learning_rate) << ' ';
					//out_temp << function(last_total_e-last_old_e) << ' ' << decrease_length << endl;
				}
				temp_e = 1.0;//temp_e > 0
			}
			else
			{
				total_e = e;
			    TRACE("---TOTAL=%d---\n",total+1);
			    if (total != 0)
				{
					temp_e = total_e - old_e;
				}
				else
				{
					temp_e = -1.0 * 0.001;
				}
				TRACE("ΔE=%.8f\n",temp_e);
				if (temp_e < 0.0)
				{
					error_angle = double( (atan( fabs(temp_e)*10 ) / PI) ) * 180;
					TRACE("error_angle=%.2f\n",error_angle);
					f_out << total_e << ' ';
					total++;
					save_last_data();
					old_e = total_e;
					//tracebias();
				}
				circle = CIRCLE;
				loop = LOOP;
			}
		}
		else
		{
			if (min_e > e)
			{
				min_e = e;
				optimum_step = step_rate;
			}
		   	step_rate++;
			if (step_rate > max_step)
			{
				step_rate = optimum_step;
				progress = TRUE;

				TRACE("***FLAT***\toptimun_step=%d\n",optimum_step);
				out_temp << optimum_step/MAX_STEP << endl;
				//out_temp << 0 << ' ' << function(last_learning_rate) << ' ' ;
				//out_temp << function((last_total_e-last_old_e)) << ' ' << optimum_step/MAX_STEP << endl;
			}

			read_last_data();
			old_e = total_e;
			temp_e = -1;
			error_angle = angle - 1;
		}
				
		if (temp_e < 0.0)
		{
			learning_rate += increase_length;
			alpha = ALPHA;
			original_rate = learning_rate;
			if (error_angle < angle)
			{		
				if (circle)
				{
					circle = FALSE;//開始狀態
					progress = FALSE;
					step_rate = MIN_STEP;
					min_e = MIN_ERROR;
					out_temp << total << ' ' <<  0 << ' ' << (learning_rate-increase_length) << ' ' ;
					out_temp << (temp_e) << ' ' ;
					//out_temp << total << ' ' <<  0 << ' ' << function(learning_rate-increase_length) << ' ' ;
					//out_temp << function(temp_e) << ' ' ;
				}
				learning_rate += step_rate*increase_length;
			}
			else
			{
				out_temp << total << ' ' <<  '-' << ' ' << (learning_rate-increase_length) << ' ' ;
				out_temp << (temp_e) << endl;
			}
		}
		else
		{
			if (loop)
			{
				TRACE("!+++++++++++++ ΔE > 0 +++++++++++\n");
				loop = FALSE;//開始狀態
				not_onward = TRUE;
				decrease_length = MAX_DECREASE;
				back_e = MIN_ERROR;
				//tracebias();
			}
		
			read_last_data();
			old_e = total_e;
			learning_rate = original_rate * decrease_length;
			alpha = 0.0;
		}
	}
	// ADJUST WEIGHTS OF CONNECTIONS FROM HIDDEN TO OUTPUT UNITS
	for(x=0; x<hidden_array_size; x++)
	{
		for(y=0; y<output_array_size; y++)
		{
			temp_weight = weight_h_o[x][y];
			delta_weight = weight_h_o[x][y] - old_weight_ho[x][y];
			weight_h_o[x][y] += (learning_rate * delta_weight_ho[x][y] +
								delta_weight * alpha);
			old_weight_ho[x][y] = temp_weight;
		}
		temp_weight = 0.0;
		delta_weight = 0.0;
	}

    // ADJUST BIASES OF HIDDEN UNITS
	for(x=hidden_array_size; x<bias_array_size; x++)
	{   
		temp_bias = bias[x];
		delta_bias = bias[x] - old_bias[x];
		bias[x] += (learning_rate * delta_error_output[x - hidden_array_size] + 
			        delta_bias * alpha);
		old_bias[x] =  temp_bias;
		temp_bias = 0.0;
		delta_bias = 0.0;
	}
    // ADJUST WEIGHTS OF CONNECTIONS FROM INPUT TO HIDDEN UNITS
	for(x=0; x<input_array_size; x++)
	{                     
		for(y=0; y<hidden_array_size; y++) 
		{
			temp_weight = weight_i_h[x][y];
			delta_weight = weight_i_h[x][y] - old_weight_ih[x][y];
			weight_i_h[x][y] += (learning_rate * delta_weight_ih[x][y] +								
								delta_weight * alpha);
			old_weight_ih[x][y] = temp_weight;
		}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲sss视频在线视频| 亚洲一区二区三区美女| 久热成人在线视频| 欧美精品1区2区3区| 亚洲国产精品视频| 国产.欧美.日韩| 久久麻豆一区二区| 毛片av一区二区| 日韩欧美国产麻豆| 蜜臀av性久久久久蜜臀aⅴ流畅| 欧美人伦禁忌dvd放荡欲情| 国产亚洲精品7777| 不卡免费追剧大全电视剧网站| 亚洲国产精品激情在线观看| 久国产精品韩国三级视频| 久久久综合视频| 精品卡一卡二卡三卡四在线| 老司机精品视频导航| 久久久久国色av免费看影院| 国产精品一区二区视频| 精品久久久久久最新网址| 精品亚洲porn| 国产色一区二区| 99久久免费国产| 亚洲夂夂婷婷色拍ww47| 日本久久一区二区三区| 夜夜精品视频一区二区| 欧美在线一区二区| 午夜精品福利久久久| 欧美三级电影网站| 偷拍一区二区三区四区| 欧美精品一区二区三区四区| 国产成人精品亚洲777人妖| 亚洲日本va午夜在线影院| 欧美亚男人的天堂| 中文字幕一区二区三区四区不卡 | 欧美中文字幕亚洲一区二区va在线| 7777精品久久久大香线蕉| 极品少妇xxxx精品少妇偷拍 | 99久久婷婷国产综合精品| 亚洲一区在线观看视频| 国产成人免费在线观看不卡| 亚洲欧美综合在线精品| 欧美美女直播网站| 粉嫩一区二区三区性色av| 成人免费观看视频| 久久精品国产一区二区三| 国产精品电影一区二区三区| 欧美日韩国产经典色站一区二区三区 | 久久蜜桃一区二区| 欧美在线不卡视频| 国产一区高清在线| 天天av天天翘天天综合网| 国产欧美一区二区精品秋霞影院 | 99久久夜色精品国产网站| 日韩电影在线观看网站| 国产精品视频一二三| 69久久99精品久久久久婷婷| 国产在线精品免费av| 午夜精品一区二区三区免费视频 | 色拍拍在线精品视频8848| 精品一区二区在线视频| 亚洲影视资源网| 蜜桃久久精品一区二区| 欧美在线三级电影| 色综合 综合色| 青青草国产成人av片免费| 亚洲一区二区三区四区五区黄| 国产亚洲精品免费| 国产午夜一区二区三区| 91精品国产美女浴室洗澡无遮挡| 国产欧美日韩卡一| 激情丁香综合五月| 7777精品伊人久久久大香线蕉超级流畅 | 26uuu另类欧美亚洲曰本| 99综合电影在线视频| 美腿丝袜亚洲一区| 免费亚洲电影在线| 亚洲成人av在线电影| 一区二区三区免费看视频| 国产精品成人一区二区艾草| 91精品福利在线一区二区三区| 色婷婷av一区| 91色综合久久久久婷婷| 成人激情文学综合网| 成人性生交大片免费看在线播放| 成人免费毛片app| 色婷婷综合久久久| 欧美日韩综合一区| 欧美区视频在线观看| 91麻豆精品91久久久久久清纯| 777a∨成人精品桃花网| 日韩亚洲欧美综合| 久久一区二区视频| 国产精品久久一级| 一区二区三区在线免费观看 | 中文字幕一区二区三区视频| 最新不卡av在线| 亚洲一区二区三区国产| 日韩av成人高清| 国产成人亚洲精品狼色在线| 不卡av在线免费观看| 日本高清视频一区二区| 777色狠狠一区二区三区| 久久综合久久鬼色中文字| 国产精品福利在线播放| 亚洲午夜免费福利视频| 美国十次综合导航| 99免费精品在线| 欧美精品 国产精品| 久久亚洲一级片| 一区二区三区四区蜜桃| 久久激情五月婷婷| 一本久久精品一区二区| 日韩免费一区二区| 18成人在线观看| 久久精品国产久精国产爱| 91啪亚洲精品| 欧美va亚洲va在线观看蝴蝶网| 日韩精品资源二区在线| 久久亚洲综合av| 一区二区欧美精品| 偷拍日韩校园综合在线| 国产精品一区二区久久不卡| 国产伦精一区二区三区| 色综合色综合色综合色综合色综合 | 国产精品系列在线| 亚洲天堂精品视频| 久久国产精品99久久久久久老狼| 一区二区三区四区不卡在线| 久久精品人人做人人爽人人| 久久99久久久欧美国产| 欧美日韩高清不卡| 中文字幕中文乱码欧美一区二区| 日韩电影在线一区二区三区| 成人丝袜高跟foot| 精品国产乱码久久久久久影片| 国产精品国产三级国产a| 亚洲一区二区欧美日韩| eeuss鲁片一区二区三区在线看 | 国产精品白丝jk黑袜喷水| 欧美日韩国产精品成人| 亚洲成av人片在线| 欧美精品自拍偷拍| 日本在线不卡一区| 欧美另类高清zo欧美| 婷婷综合五月天| 91精品国产丝袜白色高跟鞋| 欧美bbbbb| 欧美日韩精品一区二区三区| 一区二区三区精品视频| 91 com成人网| 亚洲欧美经典视频| 国内精品伊人久久久久影院对白| 欧美美女直播网站| 成人黄色片在线观看| 亚洲午夜在线电影| 美女视频黄频大全不卡视频在线播放| 久久电影网站中文字幕| 在线观看成人小视频| 欧美国产日韩在线观看| 蜜臀久久99精品久久久久宅男| 在线精品国精品国产尤物884a| 国产精品午夜在线观看| 久久精品国产77777蜜臀| 在线视频欧美区| 国产精品久久久一区麻豆最新章节| 国产三级精品三级在线专区| 洋洋成人永久网站入口| 污片在线观看一区二区| 色综合咪咪久久| 国产精品久久久久永久免费观看 | 99re这里只有精品6| 久久久久久久久久久久久夜| 麻豆精品在线观看| 欧美一区二区大片| 奇米精品一区二区三区在线观看一 | 久久女同性恋中文字幕| 国产精品资源在线| 精品999在线播放| 国产成人夜色高潮福利影视| 日韩精品影音先锋| 国产乱人伦精品一区二区在线观看 | 日本午夜一区二区| 欧美人牲a欧美精品| 黄色日韩网站视频| 欧美精品一区二区三区蜜臀 | 亚洲欧洲av在线| 精品一区二区在线看| 国产欧美精品国产国产专区| 成人一区二区三区视频在线观看| 国产日韩三级在线| 337p粉嫩大胆色噜噜噜噜亚洲| 国产欧美视频一区二区| av男人天堂一区| 亚洲欧洲中文日韩久久av乱码| 欧美性感一类影片在线播放| 亚洲精品日韩专区silk | 国产精品91一区二区| 国产精品欧美一级免费|