Package org.integratedmodelling.riskwiz.learning.data

Examples of org.integratedmodelling.riskwiz.learning.data.Instances


         * @param classIndex  the class index for the dataset
         * @return      the full dataset
         * @throws Exception   if resetting of loader fails
         */
        public Instances getDataSet(int classIndex) throws Exception {
            Instances    result;
       
            result = getDataSet();
            if (result != null) {
                result.setClassIndex(classIndex);
            }
       
            return result;
        }
View Full Code Here


         */
        public Instances getStructure() throws Exception {
            if (m_Loader != null) {
                return m_Loader.getStructure();
            } else {
                return new Instances(m_BatchBuffer, 0);
            }
        }
View Full Code Here

         * @param classIndex  the class index for the dataset
         * @return      the structure of the data
         * @throws Exception  if something goes wrong
         */
        public Instances getStructure(int classIndex) throws Exception {
            Instances    result;
       
            result = getStructure();
            if (result != null) {
                result.setClassIndex(classIndex);
            }
       
            return result;
        }
View Full Code Here

         * @throws Exception  if loading fails
         * @see      #DataSource(String)
         */
        public static Instances read(String location, Loader loader) throws Exception {
            DataSource  source;
            Instances    result;
       
            source = new DataSource(location, loader);
            result = source.getDataSet();
       
            return result;
View Full Code Here

         * @throws Exception  if loading fails
         * @see      #DataSource(InputStream)
         */
        public static Instances read(InputStream stream) throws Exception {
            DataSource  source;
            Instances    result;
       
            source = new DataSource(stream);
            result = source.getDataSet();
       
            return result;
View Full Code Here

         * @throws Exception  if loading fails
         * @see      #DataSource(Loader)
         */
        public static Instances read(Loader loader) throws Exception {
            DataSource  source;
            Instances    result;
       
            source = new DataSource(loader);
            result = source.getDataSet();
       
            return result;
View Full Code Here

       
            System.out.println("Incremental? " + loader.isIncremental());
            System.out.println(
                    "Loader: " + loader.getLoader().getClass().getName());
            System.out.println("Data:\n");
            Instances structure = loader.getStructure();

            System.out.println(structure);
            while (loader.hasMoreElements(structure)) {
                System.out.println(loader.nextElement(structure));
            }
       
            Instances inst = loader.getDataSet();

            loader = new DataSource(inst);
            System.out.println("\n\nProxy-Data:\n");
            System.out.println(loader.getStructure());
            while (loader.hasMoreElements(structure)) {
View Full Code Here

            relationName = (m_sourceFile.getName()).replaceAll(
                    "\\.[cC][sS][vV]$", "");
        } else {
            relationName = "stream";
        }
        Instances dataSet = new Instances(relationName, atts,
                m_cumulativeInstances.size());

        for (int i = 0; i < m_cumulativeInstances.size(); i++) {
            current = ((FastVector) m_cumulativeInstances.elementAt(i));
            double[] vals = new double[dataSet.numAttributes()];

            for (int j = 0; j < current.size(); j++) {
                Object cval = current.elementAt(j);

                if (cval instanceof String) {
                    if (((String) cval).compareTo("'?'") == 0) {
                        vals[j] = Instance.missingValue();
                    } else {
                        if (!dataSet.attribute(j).isNominal()) {
                            System.err.println("Wrong attribute type!!!");
                            System.exit(1);
                        }
                        // find correct index
                        Hashtable lookup = (Hashtable) m_cumulativeStructure.elementAt(
                                j);
                        int index = ((Integer) lookup.get(cval)).intValue();

                        vals[j] = index;
                    }
                } else if (dataSet.attribute(j).isNominal()) {
                    // find correct index
                    Hashtable lookup = (Hashtable) m_cumulativeStructure.elementAt(
                            j);
                    int index = ((Integer) lookup.get(cval)).intValue();

                    vals[j] = index;
                } else {
                    vals[j] = ((Double) cval).doubleValue();
                }
            }
            dataSet.add(new Instance(1.0, vals));
        }
        m_structure = new Instances(dataSet, 0);
        setRetrieval(BATCH);
        m_cumulativeStructure = null; // conserve memory
        return dataSet;
    }
View Full Code Here

            relationName = (m_sourceFile.getName()).replaceAll(
                    "\\.[cC][sS][vV]$", "");
        } else {
            relationName = "stream";
        }
        m_structure = new Instances(relationName, attribNames, 0);
    }
View Full Code Here

        if (options.length > 0) {
            try {
                loader.setFile(new File(options[0]));
                // incremental
                if (loader instanceof IncrementalConverter) {
                    Instances structure = loader.getStructure();

                    System.out.println(structure);
                    Instance temp;

                    do {
View Full Code Here

TOP

Related Classes of org.integratedmodelling.riskwiz.learning.data.Instances

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.