Package org.integratedmodelling.riskwiz.learning.data

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


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


     * builds up the XML structure based on the given data
     *
     * @param data  data to generate the XML from
     */
    public void setInstances(Instances data) {
        m_Instances = new Instances(data);
        clear();
        headerToXML();
        dataToXML();
    }
View Full Code Here

        case Attribute.RELATIONAL:
            list = getChildTags(node, TAG_ATTRIBUTES);
            node = (Element) list.get(0);
            atts = createAttributes(node, new int[1]);
            if (metadata == null) {
                result = new Attribute(name, new Instances(name, atts, 0));
            } else {
                result = new Attribute(name, new Instances(name, atts, 0),
                        metadata);
            }
            break;
        }
   
View Full Code Here

        Vector  list;
        Vector  subList;
        double[]  values;
        String  content;
        double  weight;
        Instances  data;
   
        result = null;

        // sparse?
        sparse = (parent.getAttribute(ATT_TYPE).equals(VAL_SPARSE));
View Full Code Here

     * @param parent  the instances node
     * @return    the generated Instances
     * @throws Exception  if generation fails, e.g., due to unknown attribute type
     */
    protected Instances createInstances(Instances header, Element parent) throws Exception {
        Instances  result;
        Vector  list;
        int    i;
   
        result = new Instances(header, 0);
   
        list = getChildTags(parent, TAG_INSTANCE);
        for (i = 0; i < list.size(); i++) {
            result.add(createInstance(result, (Element) list.get(i)));
        }
   
        return result;
    }
View Full Code Here

     *
     * @return    the generated header
     * @throws Exception  if generation fails
     */
    protected Instances headerFromXML() throws Exception {
        Instances  result;
        Element  root;
        Element  node;
        Vector  list;
        FastVector  atts;
        Version  version;
        int[]  classIndex;

        root = m_Document.getDocumentElement();
   
        // check version
        version = new Version();
        // if (version.isOlder(root.getAttribute(ATT_VERSION)))
        // System.out.println(
        // "WARNING: loading data of version " + root.getAttribute(ATT_VERSION)
        // + " with version " + Version.VERSION);
   
        // attributes
        list = getChildTags(root, TAG_HEADER);
        node = (Element) list.get(0);
        list = getChildTags(node, TAG_ATTRIBUTES);
        node = (Element) list.get(0);
        classIndex = new int[1];
        atts = createAttributes(node, classIndex);

        // generate header
        result = new Instances(root.getAttribute(ATT_NAME), atts, 0);
        result.setClassIndex(classIndex[0]);
   
        return result;
    }
View Full Code Here

            throw new IOException("No source has been specified");
        }

        // We could cache a structure-only if getStructure is likely to be called
        // many times.
        return new Instances(m_Dataset, 0);
    }
View Full Code Here

     * @param header  the header structure
     * @return    the complete dataset
     * @throws Exception  if generation fails
     */
    protected Instances dataFromXML(Instances header) throws Exception {
        Instances  result;
        Element  node;
        Vector  list;

        list = getChildTags(m_Document.getDocumentElement(), TAG_BODY);
        node = (Element) list.get(0);
View Full Code Here

                }
                r = new BufferedReader(new InputStreamReader(in));
            }
     
            if (args[0].endsWith(Instances.FILE_EXTENSION)) {
                XMLInstances i = new XMLInstances(new Instances(r));

                System.out.println(i.toString());
            } else {
                Instances i = new XMLInstances(r).getInstances();

                System.out.println(i.toSummaryString());
            }
        } catch (Exception ex) {
            ex.printStackTrace();
            System.err.println(ex.getMessage());
        }
View Full Code Here

         *
         * @return      the full dataset
         * @throws Exception   if resetting of loader fails
         */
        public Instances getDataSet() throws Exception {
            Instances    result;
       
            result = null;
       
            // reset the loader
            reset();
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.