Package org.integratedmodelling.riskwiz.learning.data

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


            initTokenizer();

            readHeader(1000);
            initBuffers();
     
            Instance inst;

            while ((inst = readInstance(m_Data)) != null) {
                m_Data.add(inst);
            }
            ;
View Full Code Here


         * @see      #getData()
         */
        public ArffReader(Reader reader, Instances template, int lines) throws IOException {
            this(reader, template, lines, 100);

            Instance inst;

            while ((inst = readInstance(m_Data)) != null) {
                m_Data.add(inst);
            }
            ;
View Full Code Here

            double[] tempValues = new double[numValues];
            int[] tempIndices = new int[numValues];

            System.arraycopy(m_ValueBuffer, 0, tempValues, 0, numValues);
            System.arraycopy(m_IndicesBuffer, 0, tempIndices, 0, numValues);
            Instance inst = new SparseInstance(1, tempValues, tempIndices,
                    m_Data.numAttributes());

            inst.setDataset(m_Data);
     
            return inst;
        }
View Full Code Here

            if (flag) {
                getLastToken(true);
            }
       
            // Add instance to dataset
            Instance inst = new Instance(1, instance);

            inst.setDataset(m_Data);
     
            return inst;
        }
View Full Code Here

                    default:
                        vals[i - 1] = Instance.missingValue();
                    }
                }
                Instance newInst;

                newInst = new Instance(1.0, vals);
                instances.addElement(newInst);
            }  
   
            // Create the header and add the instances to the dataset
            // System.err.println("Creating header...");
View Full Code Here

            default:
                vals[i - 1] = Instance.missingValue();
            }
        }
        Instance inst = new Instance(1.0, vals);

        // get rid of m_idColumn
        if (m_DataBaseConnection.getUpperCase()) {
            m_idColumn = m_idColumn.toUpperCase();
        }
        if (m_structure.attribute(0).name().equals(m_idColumn)) {
            inst.deleteAttributeAt(0);
            m_oldStructure.add(inst);
            inst = m_oldStructure.instance(0);
            m_oldStructure.delete(0);
        } else {
            // instances is added to and deleted from the structure to get the true nominal values instead of the index of the values.
View Full Code Here

        }
        // pseudoInremental: Load all instances into main memory in batch mode and give them incrementally to user
        if (m_pseudoIncremental) {
            setRetrieval(INCREMENTAL);
            if (m_datasetPseudoInc.numInstances() > 0) {
                Instance current = m_datasetPseudoInc.instance(0);

                m_datasetPseudoInc.delete(0);
                return current;
            } else {
                resetStructure();
                return null;
            }
        }
        // real incremental mode. At the moment(version 1.0) only for MySQL and HSQLDB (Postgres not tested, should work)
        setRetrieval(INCREMENTAL);
        try {
            if (!m_DataBaseConnection.isConnected()) {
                connectToDatabase();
            }
            // if no key columns specified by user, try to detect automatically
            if (m_firstTime && m_orderBy.size() == 0) {
                if (!checkForKey()) {
                    throw new Exception(
                            "A unique order cannot be detected automatically.\nYou have to use SELECT * in your query to enable this feature.\nMaybe JDBC driver is not able to detect key.\nDefine primary key in your database or use -P option (command line) or enter key columns in the GUI.");
                }
            }
            if (m_firstTime) {
                m_firstTime = false;
                m_rowCount = getRowCount();
            }
            // as long as not all rows has been loaded
            if (m_counter < m_rowCount) {
                if (m_DataBaseConnection.execute(
                        limitQuery(m_query, m_counter, m_choice))
                                == false) {
                    throw new Exception("Tuple could not be retrieved.");
                }
                m_counter++;
                ResultSet rs = m_DataBaseConnection.getResultSet();

                rs.next();
                Instance current = readInstance(rs);

                rs.close();
                return current;
            } else {
                m_DataBaseConnection.disconnectFromDatabase();
View Full Code Here

                System.out.println(atf.getDataSet());
            } else {
                Instances structure = atf.getStructure();

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

                do {
                    temp = atf.getNextInstance(structure);
                    if (temp != null) {
                        System.out.println(temp);
View Full Code Here

        if (m_structure == null) {
            getStructure();
        }

        // Read all instances
        Instance inst;

        while ((inst = m_ArffReader.readInstance(m_structure)) != null) {
            m_structure.add(inst);
        }
   
View Full Code Here

            throw new IOException(
                    "Cannot mix getting Instances in both incremental and batch modes");
        }
        setRetrieval(INCREMENTAL);

        Instance current = m_ArffReader.readInstance(m_structure);

        if (current == null) {
            try {
                reset();
            } catch (Exception ex) {
View Full Code Here

TOP

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

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.