Class ArffDatasetAdapter

  • All Implemented Interfaces:
    org.api4.java.ai.ml.core.dataset.serialization.IDatasetDeserializer<org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance>>

    public class ArffDatasetAdapter
    extends java.lang.Object
    implements org.api4.java.ai.ml.core.dataset.serialization.IDatasetDeserializer<org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance>>
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected static org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> createDataset​(ai.libs.jaicore.basic.kvstore.KVStore relationMetaData, java.util.List<org.api4.java.ai.ml.core.dataset.schema.attribute.IAttribute> attributes)  
      org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> deserializeDataset()  
      org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> deserializeDataset​(org.api4.java.ai.ml.core.dataset.descriptor.IDatasetDescriptor datasetDescriptor)  
      org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> deserializeDataset​(org.api4.java.ai.ml.core.dataset.descriptor.IFileDatasetDescriptor datasetDescriptor, int columnWithClassIndex)  
      org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> deserializeDataset​(org.api4.java.ai.ml.core.dataset.descriptor.IFileDatasetDescriptor datasetFile, java.lang.String nameOfClassAttribute)  
      org.api4.java.ai.ml.core.dataset.schema.attribute.IAttribute getAttributeWithName​(org.api4.java.ai.ml.core.dataset.descriptor.IFileDatasetDescriptor datasetFile, java.lang.String nameOfAttribute)  
      protected static org.api4.java.ai.ml.core.dataset.schema.attribute.IAttribute parseAttribute​(java.lang.String line)  
      protected static java.lang.Object parseInstance​(boolean sparseData, java.util.List<org.api4.java.ai.ml.core.dataset.schema.attribute.IAttribute> attributes, int targetIndex, java.lang.String line)  
      protected static ai.libs.jaicore.basic.kvstore.KVStore parseRelation​(java.lang.String line)
      Extracts meta data about a relation from a string.
      static org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> readDataset​(boolean sparseMode, java.io.File datasetFile)  
      static org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> readDataset​(boolean sparseMode, java.io.File datasetFile, int columnWithClassIndex)  
      static org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> readDataset​(java.io.File datasetFile)  
      static void serializeDataset​(java.io.File arffOutputFile, org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<? extends org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> data)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ArffDatasetAdapter

        public ArffDatasetAdapter​(boolean sparseMode,
                                  org.api4.java.ai.ml.core.dataset.descriptor.IDatasetDescriptor datasetDescriptor)
      • ArffDatasetAdapter

        public ArffDatasetAdapter​(boolean sparseMode)
      • ArffDatasetAdapter

        public ArffDatasetAdapter()
    • Method Detail

      • getAttributeWithName

        public org.api4.java.ai.ml.core.dataset.schema.attribute.IAttribute getAttributeWithName​(org.api4.java.ai.ml.core.dataset.descriptor.IFileDatasetDescriptor datasetFile,
                                                                                                 java.lang.String nameOfAttribute)
                                                                                          throws org.api4.java.ai.ml.core.dataset.serialization.DatasetDeserializationFailedException
        Throws:
        org.api4.java.ai.ml.core.dataset.serialization.DatasetDeserializationFailedException
      • deserializeDataset

        public org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> deserializeDataset​(org.api4.java.ai.ml.core.dataset.descriptor.IFileDatasetDescriptor datasetFile,
                                                                                                                                                            java.lang.String nameOfClassAttribute)
                                                                                                                                                     throws org.api4.java.ai.ml.core.dataset.serialization.DatasetDeserializationFailedException
        Throws:
        org.api4.java.ai.ml.core.dataset.serialization.DatasetDeserializationFailedException
      • deserializeDataset

        public org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> deserializeDataset​(org.api4.java.ai.ml.core.dataset.descriptor.IFileDatasetDescriptor datasetDescriptor,
                                                                                                                                                            int columnWithClassIndex)
                                                                                                                                                     throws org.api4.java.ai.ml.core.dataset.serialization.DatasetDeserializationFailedException
        Throws:
        org.api4.java.ai.ml.core.dataset.serialization.DatasetDeserializationFailedException
      • deserializeDataset

        public org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> deserializeDataset​(org.api4.java.ai.ml.core.dataset.descriptor.IDatasetDescriptor datasetDescriptor)
                                                                                                                                                     throws org.api4.java.ai.ml.core.dataset.serialization.DatasetDeserializationFailedException,
                                                                                                                                                            java.lang.InterruptedException
        Specified by:
        deserializeDataset in interface org.api4.java.ai.ml.core.dataset.serialization.IDatasetDeserializer<org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance>>
        Throws:
        org.api4.java.ai.ml.core.dataset.serialization.DatasetDeserializationFailedException
        java.lang.InterruptedException
      • deserializeDataset

        public org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> deserializeDataset()
                                                                                                                                                     throws java.lang.InterruptedException,
                                                                                                                                                            org.api4.java.ai.ml.core.dataset.serialization.DatasetDeserializationFailedException
        Throws:
        java.lang.InterruptedException
        org.api4.java.ai.ml.core.dataset.serialization.DatasetDeserializationFailedException
      • parseRelation

        protected static ai.libs.jaicore.basic.kvstore.KVStore parseRelation​(java.lang.String line)
        Extracts meta data about a relation from a string.
        Parameters:
        line - The line which is to be parsed to extract the necessary information from the relation name.
        Returns:
        A KVStore containing the parsed meta data.
      • parseAttribute

        protected static org.api4.java.ai.ml.core.dataset.schema.attribute.IAttribute parseAttribute​(java.lang.String line)
                                                                                              throws org.api4.java.ai.ml.core.dataset.serialization.UnsupportedAttributeTypeException
        Throws:
        org.api4.java.ai.ml.core.dataset.serialization.UnsupportedAttributeTypeException
      • parseInstance

        protected static java.lang.Object parseInstance​(boolean sparseData,
                                                        java.util.List<org.api4.java.ai.ml.core.dataset.schema.attribute.IAttribute> attributes,
                                                        int targetIndex,
                                                        java.lang.String line)
      • createDataset

        protected static org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> createDataset​(ai.libs.jaicore.basic.kvstore.KVStore relationMetaData,
                                                                                                                                                                 java.util.List<org.api4.java.ai.ml.core.dataset.schema.attribute.IAttribute> attributes)
      • readDataset

        public static org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> readDataset​(java.io.File datasetFile)
                                                                                                                                                     throws org.api4.java.ai.ml.core.dataset.serialization.DatasetDeserializationFailedException
        Throws:
        org.api4.java.ai.ml.core.dataset.serialization.DatasetDeserializationFailedException
      • readDataset

        public static org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> readDataset​(boolean sparseMode,
                                                                                                                                                            java.io.File datasetFile)
                                                                                                                                                     throws org.api4.java.ai.ml.core.dataset.serialization.DatasetDeserializationFailedException
        Throws:
        org.api4.java.ai.ml.core.dataset.serialization.DatasetDeserializationFailedException
      • readDataset

        public static org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> readDataset​(boolean sparseMode,
                                                                                                                                                            java.io.File datasetFile,
                                                                                                                                                            int columnWithClassIndex)
                                                                                                                                                     throws org.api4.java.ai.ml.core.dataset.serialization.DatasetDeserializationFailedException
        Throws:
        org.api4.java.ai.ml.core.dataset.serialization.DatasetDeserializationFailedException
      • serializeDataset

        public static void serializeDataset​(java.io.File arffOutputFile,
                                            org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<? extends org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> data)
                                     throws java.io.IOException
        Throws:
        java.io.IOException