Package stallone.datasequence

Examples of stallone.datasequence.DataList


     * Executes the clustering algorithm. Use setters or constructor to prepare input data.
     */
    @Override
    public void perform()
    {
        DataList centroids = new DataList();

        Iterator<IDoubleArray> it = data.iterator();

        if (datasize > 0)
        {
            // take first element as centroid
            centroids.add(it.next());
        }
        else
        {
            throw new RuntimeException("No first element .... aborting.");
        }


        IDoubleArray current;

        while(it.hasNext())
        {
            current = it.next();

            double[] d = calculateDistances(centroids, current, metric);
            int minIndex = minIndex(d);

            if (d[minIndex] >= dmin)
            {
                centroids.add(current);
                System.out.println(d[minIndex] + "\t" + centroids.size());
            }
        }

        this.clusterCenters = centroids;
        this.voronoiPartitioning = new VoronoiDiscretization(this.clusterCenters, this.metric);
View Full Code Here


     * Creates an empty data sequence of flexible size
     * @return a data list object
     */
    public IDataList list()
    {
        DataList ds = new DataList();
        return(ds);
    }
View Full Code Here

    }

    public IDiscretization regularSelectionDiscretization(IDataSequence data,
        IMetric<IDoubleArray> metric, int k)
    {
        DataList clusterCenters = new DataList(k);
        IIntArray indexes = Ints.create.arrayRange(0, data.size(), data.size() / k);
        for (int i = 0; i < indexes.size(); i++)
        {
            clusterCenters.set(i, data.get(indexes.get(i)));
        }
        VoronoiDiscretization vd = new VoronoiDiscretization(clusterCenters, metric);
        return (vd);
    }
View Full Code Here

    }

    public IDiscretization randomSelectionDiscretization(IDataSequence data,
        IMetric<IDoubleArray> metric, int k)
    {
        DataList clusterCenters = new DataList(k);
        IIntArray indexes = Ints.create.arrayRandomIndexes(data.size(), k);
        for (int i = 0; i < indexes.size(); i++)
        {
            clusterCenters.add(data.get(indexes.get(i)));
        }

        VoronoiDiscretization vd = new VoronoiDiscretization(clusterCenters, metric);
        return (vd);
    }
View Full Code Here

TOP

Related Classes of stallone.datasequence.DataList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.