Example usage for weka.core UnassignedDatasetException UnassignedDatasetException

List of usage examples for weka.core UnassignedDatasetException UnassignedDatasetException

Introduction

In this page you can find the example usage for weka.core UnassignedDatasetException UnassignedDatasetException.

Prototype

public UnassignedDatasetException(String message) 

Source Link

Document

Creates a new UnassignedDatasetException.

Usage

From source file:com.jgaap.util.Instance.java

License:Open Source License

/**
 * Returns the attribute with the given index.
 *
 * @param index the attribute's index/*from  www. j  a v a 2 s. co  m*/
 * @return the attribute at the given position
 * @throws UnassignedDatasetException if instance doesn't have access to a
 * dataset
 */
//@ requires m_Dataset != null;
public /*@pure@*/ Attribute attribute(int index) {

    if (m_Dataset == null) {
        throw new UnassignedDatasetException("Instance doesn't have access to a dataset!");
    }
    return m_Dataset.attribute(index);
}

From source file:com.jgaap.util.Instance.java

License:Open Source License

/**
 * Returns the attribute with the given index. Does the same
 * thing as attribute().//from  ww w .j a va  2s .co  m
 *
 * @param indexOfIndex the index of the attribute's index 
 * @return the attribute at the given position
 * @throws UnassignedDatasetException if instance doesn't have access to a
 * dataset
 */
//@ requires m_Dataset != null;
public /*@pure@*/ Attribute attributeSparse(int indexOfIndex) {

    if (m_Dataset == null) {
        throw new UnassignedDatasetException("Instance doesn't have access to a dataset!");
    }
    return m_Dataset.attribute(indexOfIndex);
}

From source file:com.jgaap.util.Instance.java

License:Open Source License

/**
 * Returns class attribute.//from w w  w  . j  a va2s .  c o  m
 *
 * @return the class attribute
 * @throws UnassignedDatasetException if the class is not set or the
 * instance doesn't have access to a dataset
 */
//@ requires m_Dataset != null;
public /*@pure@*/ Attribute classAttribute() {

    if (m_Dataset == null) {
        throw new UnassignedDatasetException("Instance doesn't have access to a dataset!");
    }
    return m_Dataset.classAttribute();
}

From source file:com.jgaap.util.Instance.java

License:Open Source License

/**
 * Returns the class attribute's index./*  w w w .jav a2 s  .com*/
 *
 * @return the class index as an integer 
 * @throws UnassignedDatasetException if instance doesn't have access to a dataset 
 */
//@ requires m_Dataset != null;
//@ ensures  \result == m_Dataset.classIndex();
public /*@pure@*/ int classIndex() {

    if (m_Dataset == null) {
        throw new UnassignedDatasetException("Instance doesn't have access to a dataset!");
    }
    return m_Dataset.classIndex();
}

From source file:com.jgaap.util.Instance.java

License:Open Source License

/**
 * Returns an enumeration of all the attributes.
 *
 * @return enumeration of all the attributes
 * @throws UnassignedDatasetException if the instance doesn't
 * have access to a dataset /*from ww w  .  j ava 2s  .  c  o m*/
 */
//@ requires m_Dataset != null;
public /*@pure@*/ Enumeration enumerateAttributes() {

    if (m_Dataset == null) {
        throw new UnassignedDatasetException("Instance doesn't have access to a dataset!");
    }
    return m_Dataset.enumerateAttributes();
}

From source file:com.jgaap.util.Instance.java

License:Open Source License

/**
 * Tests if the headers of two instances are equivalent.
 *
 * @param inst another instance// w  w w  .  j  a  v  a  2s  .co  m
 * @return true if the header of the given instance is 
 * equivalent to this instance's header
 * @throws UnassignedDatasetException if instance doesn't have access to any
 * dataset
 */
//@ requires m_Dataset != null;
public /*@pure@*/ boolean equalHeaders(Instance inst) {

    if (m_Dataset == null) {
        throw new UnassignedDatasetException("Instance doesn't have access to a dataset!");
    }
    return m_Dataset.equalHeaders(inst.m_Dataset);
}

From source file:com.jgaap.util.Instance.java

License:Open Source License

/**
 * Tests whether an instance has a missing value. Skips the class attribute if set.
 * @return true if instance has a missing value.
 * @throws UnassignedDatasetException if instance doesn't have access to any
 * dataset//from   www.j  av a 2 s  . c o m
 */
//@ requires m_Dataset != null;
public /*@pure@*/ boolean hasMissingValue() {

    if (m_Dataset == null) {
        throw new UnassignedDatasetException("Instance doesn't have access to a dataset!");
    }
    for (int i = 0; i < numAttributes(); i++) {
        if (i != classIndex()) {
            if (isMissing(i)) {
                return true;
            }
        }
    }
    return false;
}

From source file:com.jgaap.util.Instance.java

License:Open Source License

/**
 * Returns the number of class labels./*from  w  w w.j  ava  2 s  .  c  om*/
 *
 * @return the number of class labels as an integer if the 
 * class attribute is nominal, 1 otherwise.
 * @throws UnassignedDatasetException if instance doesn't have access to any
 * dataset
 */
//@ requires m_Dataset != null;
public /*@pure@*/ int numClasses() {

    if (m_Dataset == null) {
        throw new UnassignedDatasetException("Instance doesn't have access to a dataset!");
    }
    return m_Dataset.numClasses();
}