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

📄 classify.java

📁 包含了模式识别中常用的一些分类器设计算法
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
      AlgorithmPCA algo_pca = new AlgorithmPCA();      algo_vec_d.add(algo_pca);      algo_index_pcaci_d = 1;      AlgorithmRVM algo_rvm = new AlgorithmRVM();      algo_vec_d.add(algo_rvm);      algo_index_rvm_d = 2;      AlgorithmPCA2 algo_pca2 = new AlgorithmPCA2();      algo_vec_d.add(algo_pca2);      algo_index_pca2_d = 3;      // Added By Phil Trasatti - 7/10/03      AlgorithmLDA algo_lda = new AlgorithmLDA();      algo_vec_d.add(algo_lda);      algo_index_ldaci_d = 4;      // Added By Phil Trasatti - 7/10/03      AlgorithmLDA2 algo_lda2 = new AlgorithmLDA2();      algo_vec_d.add(algo_lda2);      algo_index_lda2_d = 5;      // Added By Phil Trasatti - 7/10/03      AlgorithmLBG algo_lbg = new AlgorithmLBG();      algo_vec_d.add(algo_lbg);      algo_index_lbg_d = 6;      // Added By Phil Trasatti - 7/10/03      AlgorithmKMeans algo_kmeans = new AlgorithmKMeans();      algo_vec_d.add(algo_kmeans);      algo_index_kmeans_d = 7;      // Added By Phil Trasatti - 7/10/03      AlgorithmNN algo_nn = new AlgorithmNN();    algo_vec_d.add(algo_nn);    algo_index_nn_d = 8;   // Added By Phil Trasatti - 7/10/03    AlgorithmED algo_ed = new AlgorithmED();    algo_vec_d.add(algo_ed);    algo_index_ed_d = 9;        // Added By Jun-Won Suh - 27/10/04     AlgorithmLDAPCA algo_ldapca = new AlgorithmLDAPCA();     algo_vec_d.add(algo_ldapca);     algo_index_ldapca1_d = 10;     // Added By Jun-Won Suh - 27/10/04     // AlgorithmLDAPCA2 algo_ldapca2 = new AlgorithmLDAPCA2();     // algo_vec_d.add(algo_ldapca2);     // algo_index_ldapca2_d = 11;          // Added By Jun-Won Suh - 27/10/04     // AlgorithmPARTICLE algo_particle = new AlgorithmPARTICLE();     // algo_vec_d.add(algo_particle);     // algo_index_particle_d = 12;          // Added By Jun-Won Suh - 27/10/04     AlgorithmLP algo_lp = new AlgorithmLP();     algo_vec_d.add(algo_lp);     algo_index_lp_d = 11;     AlgorithmPF algo_pf = new AlgorithmPF();     algo_vec_d.add(algo_pf);     algo_index_pf_d = 12;     AlgorithmKF algo_kf = new AlgorithmKF();     algo_vec_d.add(algo_kf);     algo_index_kf_d = 13;          // set the default algo     algo_index_d = algo_index_pf_d;       }        /**     * determines the dimensions of the selection area     *     */    public void DetermineDimensions()    {		Dimension dimen = this.getSize();	width_d = dimen.width;	height_d = dimen.height;		// divide by 2	//	zero_x_d = width_d >> 1;	zero_y_d = height_d >> 1;    }    /**     * determine the current algorithm and returns an object for it     *     * @return Object of current algorithm     *     */    static public Object getCurrAlgo()    {	// Debug	//	//	System.out.println("Classify : getCurrAlgo()");		//algo_index_d = 0 ;	return algo_vec_d.get(algo_index_d);    }        /**     * determine the dimensions of the selection area     *     * @param    algo_a The algorithm to he initialized     * @return   true     *     */    static public boolean initializeAlgo(Algorithm algo_a)    {		// initialize i/o compoents	//	algo_a.setDataPoints(input_points_d);	//algo_a.setInputPanel(input_panel_d);	algo_a.setOutputPanel(output_panel_d);	algo_a.setProcessBox(pro_box_d);		// init the algorithm	//	return true;	    }    /**     * determine the dimensions of the selection area     * actually this draws a line of width 3 pixels in either directions     * in way, this draws a + sign..     * 3 pixels because, -3 /2 and + 3 / 2 on either side.     *     * @param   device_a  graphics object used     * @param   point_a   point which will be displayed     * @param   type_a    integer describing type     * @param   color_a   color of the point     *     * @return  true     *     */  static public boolean drawPoint(				  Graphics device_a,				  Point point_a,				  int type_a,				  Color color_a)    {	int X, Y;	Color curr_color = device_a.getColor();	device_a.setColor(color_a);		X = (int)point_a.x;	Y = (int)point_a.y;		// draw different point	//	switch (type_a)	{	case PTYPE_INPUT :	    device_a.drawLine(X - 3 / 2, Y, X + 3 / 2, Y);	    device_a.drawLine(X, Y - 3 / 2, X, Y + 3 / 2);	    device_a.setColor(curr_color);	    break;	    	case PTYPE_OUTPUT :	    break;	    	case PTYPE_SUPPORT_VECTOR :	    device_a.setColor(color_a);	    device_a.drawOval(X - 5 / 2, Y - 5 / 2, 5, 5);	    device_a.setColor(curr_color);	    break;	    	case PTYPE_OUTPUT_LARGE :	    device_a.setColor(color_a);	    device_a.fillOval(X - 5 / 2, Y - 5 / 2, 5, 5);	    device_a.setColor(curr_color);	    break;	    	default :	    break;	}		// reset the color	//	device_a.setColor(curr_color);		// init the algorithm	//	return true;    }    /**     * determine the dimensions of the selection area     *     * @param   device_a  graphics object used     * @param   points_a  points which will be displayed     * @param   type_a    integer describing type     * @param   color_a   color of the point     *     * @return  true     *     */    static public boolean drawPoints(				     Graphics device_a,				     Vector points_a,				     int type_a,				     Color color_a)    {	// put the code here for drawing lines..	if (type_a == PTYPE_LINE)	{	    putLines(device_a, points_a, type_a, color_a);	}		if (type_a != PTYPE_LINE)	{	    for (int i = 0; i < points_a.size(); i++)	    {   		drawPoint(device_a, (Point)points_a.get(i), type_a, color_a);	    }	}	// init the algorithm	//	return true;    }        /**     * Method : putlines     * Method to draw a line between a series of points. The lines sequentially     * connect the first point to the second then the second to the third,     * til the last point.     *     * @param   device_a  graphics object used     * @param   points_a  points which will be displayed     * @param   type_a    integer describing type     * @param   color_a   color of the point     *     * @return  true     */    static public boolean putLines (				    Graphics device_a,				    Vector points_a, 				    int type_a,				    Color color_a)    {		for (int i = 0; i < points_a.size() - 1; i++)	{	    putLine(device_a, (Point)points_a.get(i), (Point)points_a.get(i + 1), color_a);	}	return true;    }        /**     * Method to draw a line between two points. The method is called     * for putting a single line at a time by method putlines which is used      * to draw lines between a series of points     *     * @param   device_a  graphics object used     * @param   first_pt_a Line begining point     * @param   second_pt_a Line ending point     * @param   color_a The color of the line     *     * @return  boolean     */    static public boolean putLine (				   Graphics device_a,				   Point first_pt_a, 				   Point second_pt_a,				   Color color_a)    {	Color curr_color = device_a.getColor();	device_a.setColor(color_a);		int X1 = 0;	int X2 = 0;	int Y1 = 0;	int Y2 = 0;		X1 = (int) first_pt_a.x;	X2 = (int) second_pt_a.x;	Y1 = (int) first_pt_a.y;	Y2 = (int) second_pt_a.y;		// draw line between two consecutive points	//	device_a.drawLine(X1, Y1, X2, Y2);	device_a.drawLine(X1 - 1 / 2, Y1, X2 - 1 / 2, Y2);	device_a.drawLine(X1 + 1 / 2, Y1, X2 + 1 / 2, Y2);	device_a.setColor(curr_color);		return true;    } }

⌨️ 快捷键说明

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