src/main/java/com/feedzai/fos/impl/weka/utils/WekaUtils.java
public static Instance objectArray2Instance(Object[] data, InstanceSetter[] setters, FastVector attributes) throws FOSException {
        checkNotNull(data, "Instance cannot be null");
        checkNotNull(attributes, "Attributes cannot be null");
        checkNotNull(setters, "Setters cannot be null");

        Instance instance = new Instance(attributes.size());

        if (data.length == setters.length) {
            for (int idx = 0; idx < data.length; idx++) {
                if (data[idx] != null) {
                    setters[idx].set(instance, (weka.core.Attribute) attributes.elementAt(idx), data[idx].toString());
                } else {
                    instance.setMissing(idx);
                }
            }
        } else {
            throw new Data2ConfigurationMismatch(String.format("Data is not the same size as configured attributes (expected data size '%s' but was '%s')", setters.length, data.length));
        }

        return instance;
    }
public static Instance objectArray2Instance(Object[] data, InstanceSetter[] setters, FastVector attributes) throws FOSException {
        checkNotNull(data, "Instance cannot be null");
        checkNotNull(attributes, "Attributes cannot be null");
        checkNotNull(setters, "Setters cannot be null");

        Instance instance = new Instance(attributes.size());

        if (data.length == setters.length) {
            for (int idx = 0; idx < data.length; idx++) {
                if (data[idx] != null) {
                    setters[idx].set(instance, (weka.core.Attribute) attributes.elementAt(idx), data[idx].toString());
                } else {
                    instance.setMissing(idx);
                }
            }
        } else {
            throw new Data2ConfigurationMismatch(String.format("Data is not the same size as configured attributes (expected data size '%s' but was '%s')", setters.length, data.length));
        }

        return instance;
    }
public static Instance objectArray2Instance ( Object [ ] data , InstanceSetter [ ] setters , FastVector attributes ) throws FOSException { checkNotNull ( data , "Instance cannot be null" ) ; checkNotNull ( attributes , "Attributes cannot be null" ) ; checkNotNull ( setters , "Setters cannot be null" ) ; Instance instance = new Instance ( attributes . size ( ) ) ; if ( data . length == setters . length ) { for ( int idx = 0 ; idx < data . length ; idx ++ ) { if ( data [ idx ] != null ) { setters [ idx ] . set ( instance , ( weka . core . Attribute ) attributes . elementAt ( idx ) , data [ idx ] . toString ( ) ) ; } else { instance . setMissing ( idx ) ; } } } else { throw new Data2ConfigurationMismatch ( String . format ( "Data is not the same size as configured attributes (expected data size '%s' but was '%s')" , setters . length , data . length ) ) ; } return instance ; }
Converts from the received Object[] to a weka <code>Instance</code>.

@param data       the Object[] to convert (the scorable)
@param setters    the setters that will copy the data to the instance
@param attributes the list of attributes to copy over
@return an <code>Instance</code> with all data elements copied over from the Object[]
@throws WekaClassifierException when the setters and the data do not have the same size (more data than setters, or more setters than data)
Converts from the received Object [] to a weka <code > Instance< / code > .