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

📄 tool.cpp

📁 对用于分类器的向量数据按某个数值随机进行选取的算法
💻 CPP
字号:
// Tool.cpp: implementation of the Tool class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Random.h"
#include "Tool.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

Tool::Tool()
{

}

Tool::~Tool()
{

}

void Tool::Rand()
{
    CStdioFile fIn("data_svm.txt",CFile::modeRead);
	CStdioFile fTrain("train_data.txt",CFile::modeCreate|CFile::modeWrite);
	CStdioFile fTest("test_data.txt",CFile::modeCreate|CFile::modeWrite);
	CString strLine;
	int count=1;
	while(fIn.ReadString(strLine))
	{
		if (count%5==0)
		{
			CString strTemp=strLine+="\n";
            fTest.WriteString(strTemp);
		}
		else 
		{
            CString strTemp=strLine+="\n";
			fTrain.WriteString(strTemp);
		}
		count++;
	}
}

⌨️ 快捷键说明

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