KMeans::KMeans(unsigned int dim, unsigned int k, std::string filename, unsigned int maxIter) :
            __dimensionality(dim), __k(k), __iFileName(filename), __maxIter(maxIter) {
        if (k == 0)
            throw ZeroClustersEx();

        std::ifstream iFile(filename.c_str());

        if (iFile.fail())
            throw DataFileOpenEx(filename);

        iFile.close();
    }
Beispiel #2
0
//    class KMeans {
//        unsigned int __dimensionality;
//        unsigned int __k;
//        Cluster **__clusters;
//        Point **__initCentroids;
//        std::string __iFileName;
//        unsigned int __maxIter;
//        unsigned int __numIter;
//        unsigned int __numNonempty;
//        unsigned int __numMovesLastIter;
//
KMeans::KMeans(unsigned int dim, unsigned int k, std::string filename, unsigned int maxIter)
    {
        if (k==0)
        { throw ZeroClustersEx(); }

        std::ifstream inFile;
        inFile.open("filename");
        if (!inFile)
        { throw DataFileOpenEx(filename); }

        __dimensionality = dim;
        __k = k;
        __iFileName = filename;
        __maxIter = maxIter;
        __numNonempty = 1;
        __numIter = 0;
    }