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

📄 gcluster.h

📁 一个由Mike Gashler完成的机器学习方面的includes neural net, naive bayesian classifier, decision tree, KNN, a genet
💻 H
字号:
/*	Copyright (C) 2006, Mike Gashler	This library is free software; you can redistribute it and/or	modify it under the terms of the GNU Lesser General Public	License as published by the Free Software Foundation; either	version 2.1 of the License, or (at your option) any later version.	see http://www.gnu.org/copyleft/lesser.html*/#ifndef __GCLUSTER_H__#define __GCLUSTER_H__class GIntArray;class GArffRelation;class GArffData;// This one is slow. It finds the best matches and merges them until the desired// number of clusters is found.class GMergeClusterer{protected:	GArffRelation* m_pRelation;	GArffData* m_pData;	int m_nClusters;	int* m_pClusters;public:	GMergeClusterer(GArffRelation* pRelation, GArffData* pData, int nClusters);	~GMergeClusterer();	int GetCluster(int nVector);protected:	bool FindBestMatch(int* pA, int* pB);	void ChangeCluster(int nFrom, int nTo);};// An implementation of the K-means clustering algorithm. Note that this operates// only on input attributes. If you want it to consider all attributes, set them// all to be input attributes before constructing this class.class GKMeans{protected:	GArffRelation* m_pRelation;	GArffData* m_pData;	int m_nClusters;	int* m_pClusters;public:	GKMeans(GArffRelation* pRelation, GArffData* pData, int nClusters);	~GKMeans();	int GetCluster(int nVector);protected:	bool Cluster(int nMaxIterations);	bool SelectSeeds(GArffData* pSeeds);};// This clusters every vector with it's k nearest neighbors. It's somewhat// fast, but it isn't very noise tolerant.class GNeighborClusterer{protected:	GIntArray* m_pClusters;	GIntArray* m_pVectors;	GNeighborClusterer(int nVectorCount);public:	static GNeighborClusterer* Cluster(GArffRelation* pRelation, GArffData* pData, int nNeighbors);	~GNeighborClusterer();	int GetClusterCount();	int GetClusterSize(int nCluster);	int GetVectorIndex(int nCluster, int nVector);#ifndef NO_TEST_CODE	static void Test();#endif // NO_TEST_CODE};#endif // __GCLUSTER_H__

⌨️ 快捷键说明

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