Package stallone.api.datasequence

Examples of stallone.api.datasequence.IDataList


        return nClusters;
    }

    public static void main(String[] args)
    {
        IDataList data = DataSequence.create.list();
        data.add(Doubles.create.arrayFrom(-1.4));
        data.add(Doubles.create.arrayFrom(-1.3));
        data.add(Doubles.create.arrayFrom(-1.2));
        data.add(Doubles.create.arrayFrom(-1.1));
        data.add(Doubles.create.arrayFrom(-1));
        data.add(Doubles.create.arrayFrom(0.5));
        data.add(Doubles.create.arrayFrom(1));
        data.add(Doubles.create.arrayFrom(1.1));
        data.add(Doubles.create.arrayFrom(1.2));
        data.add(Doubles.create.arrayFrom(1.3));
        data.add(Doubles.create.arrayFrom(1.4));


        /*DensityBasedClusteringSimple clustering = new DensityBasedClusteringSimple(0.5, 3);
        clustering.setClusterInput(data);
        clustering.setMetric(new EuclideanDistance());
View Full Code Here


        throw new UnsupportedOperationException("Not supported yet.");
    }

    public static void main(String[] args)
    {
        IDataList data = DataSequence.create.list();
        data.add(Doubles.create.arrayFrom(-1.4));
        data.add(Doubles.create.arrayFrom(-1));
        data.add(Doubles.create.arrayFrom(1));
        data.add(Doubles.create.arrayFrom(1.1));
        data.add(Doubles.create.arrayFrom(1.2));
        data.add(Doubles.create.arrayFrom(-1.3));
        data.add(Doubles.create.arrayFrom(-1.2));
        data.add(Doubles.create.arrayFrom(-1.1));
        data.add(Doubles.create.arrayFrom(1.3));
        data.add(Doubles.create.arrayFrom(1.4));

        DensityBasedClusteringOPTICS clustering = new DensityBasedClusteringOPTICS(0.5, 2, 2);
        clustering.setInput(data);
        clustering.setMetric(new EuclideanDistance());
        clustering.perform();
View Full Code Here

        return true;
    }

    private IDataList select(IIntArray indexes)
    {
        IDataList res = dataNew.list();
        Iterator<IDoubleArray> dataIterator = data.iterator();
        IDoubleArray x;
        int k = 0;
        for (int i=0; i<datasize; i++)
        {
            if (! dataIterator.hasNext())
                throw(new RuntimeException("Data set is shorter than specified"));
            x = dataIterator.next();
            if (i == indexes.get(k))
            {
                res.add(x);
                k++;
            }
            if (k >= indexes.size())
                break;
        }
View Full Code Here

    public void perform()
    {
        int nfound = 0;
        int nsought = nClusters;
        IIntList acceptedCenterIndexes = intsNew.list(0);
        IDataList acceptedCenters = dataNew.list();

        int nAttempts = 0;
        while (nfound < nClusters && nAttempts <= 10)
        {
            // decide which indexes should be centers
            IIntArray I = intsNew.arrayRandomIndexes(datasize, nsought);
            ints.sort(I);
            // get corresponding data points
            IDataList datapoints = select(I);

            // add new ones
            for (int i=0; i<I.size(); i++)
            {
                if (isNew(acceptedCenters, datapoints.get(i)))
                {
                    acceptedCenterIndexes.append(I.get(i));
                    acceptedCenters.add(datapoints.get(i));
                }
            }

            nfound = acceptedCenters.size();
            nAttempts++;
View Full Code Here

    }

    @Override
    public IDataSequence load()
    {
        IDataList res = DataSequence.create.list();
        for (Iterator<IDoubleArray> it = iterator(); it.hasNext();)
        {
            res.add(it.next());
        }

        return res;
    }
View Full Code Here

    }
   
    @Override
    public IDataSequence load()
    {
        IDataList res = DataSequence.create.list();
        for (int i=0; i<this.size(); i++)
            res.add(get(i));
        return res;
    }
View Full Code Here

    }
   
    @Override
    public IDataSequence load()
    {
        IDataList res = DataSequence.create.list();
        for (int i=0; i<this.size(); i++) {
            // TODO : think about it: why should one use a copy here?
            //res.add(get(i).copy());
            res.add(get(i));
        }
        return res;
    }
View Full Code Here

     * @param nsteps the total number of integration steps done
     * @param nsave the number of integration steps before writing out coordinates
     */
    public IDataSequence run(IDoubleArray x0, IIntegrator integrator, int nsteps, int nsave)
    {
        IDataList out = dataNew.list();
        integrator.setX(x0);

        for (int i=0; i<nsteps; i++)
        {
            integrator.step();

            if (i % nsave == 0)
                out.add(integrator.getX().copy());
        }
        return out;
    }
View Full Code Here

TOP

Related Classes of stallone.api.datasequence.IDataList

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.