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

📄 test.c

📁 贝叶斯分类程序,iris数据集,很有用,已测试
💻 C
字号:
#include "global.h"

void main()
{
	double choice;
	int type;

	double test_attri[ATTRIBUTENUM];
	
	IrisData();
	MeanEstimation();
	CovarianceEstimation();
	ReverseMatrix();
	
	printf("*************************贝叶斯分类器建立完毕:****************************\n\n");

	while(1)
	{
        printf("****分类(1):****\n");

		printf("****退出(2):****\n");
		
		scanf("%lf",&(choice));

		if(choice==1)
		{	
			printf("输入属性值:\n");
			
          	printf("setal_length:\n");
        	scanf("%lf",&(test_attri[0]));
 
        	printf("setal_width:\n");
        	scanf("%lf",&(test_attri[1]));

        	printf("petal_length:\n");
        	scanf("%lf",&(test_attri[2]));
 
        	printf("petal_width:\n");
        	scanf("%lf",&(test_attri[3]));
 
    		type=ClassiFier(test_attri);	
		
    		switch(type)
			{
		
        	case IRIS_SETOSA:

    	    	printf("所属类别:\n\n******Iris_setosa******\n");
        		break;
			
			case IRIS_VERSICOLOR:
				
				printf("所属类别:\n\n******Iris_versicolor******\n");
        		break;

        	case IRIS_VERGINICA:
     
        		printf("所属类别:\n\n******Iris_verginica******\n");
        		break;
	
        	default:
		
        		printf("%d\n",type);
		}
	
		}
		
		else if(choice==2)
		{
			break;
		}

		else
		{
			//printf("%d\n",choice);
			printf("重新输入!!!\n");
		}

		printf("\n");
	}

}

⌨️ 快捷键说明

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