ai.libs.jaicore.ml

Class WekaUtil

  • java.lang.Object
    • ai.libs.jaicore.ml.WekaUtil


  • public class WekaUtilextends java.lang.Object
    • Constructor Detail

      • WekaUtil

        public WekaUtil()
    • Method Detail

      • getBasicLearners

        public static java.util.Collection<java.lang.String> getBasicLearners()
      • getNativeMultiClassClassifiers

        public static java.util.Collection<java.lang.String> getNativeMultiClassClassifiers()
      • getBinaryClassifiers

        public static java.util.Collection<java.lang.String> getBinaryClassifiers()
      • getFeatureEvaluators

        public static java.util.Collection<java.lang.String> getFeatureEvaluators()
      • getSearchers

        public static java.util.Collection<java.lang.String> getSearchers()
      • getMetaLearners

        public static java.util.Collection<java.lang.String> getMetaLearners()
      • isValidPreprocessorCombination

        public static boolean isValidPreprocessorCombination(java.lang.String searcher,                                                     java.lang.String evaluator)
      • getAdmissibleSearcherEvaluatorCombinationsForAttributeSelection

        public static java.util.Collection<java.util.List<java.lang.String>> getAdmissibleSearcherEvaluatorCombinationsForAttributeSelection()
        Determines all attribute selection variants (search/evaluator combinations with default parametrization)
        Returns:
      • fromJAICoreInstances

        public static weka.core.Instances fromJAICoreInstances(Instances instances)
      • getEmptyDatasetForJAICoreInstance

        public static weka.core.Instances getEmptyDatasetForJAICoreInstance(Instance instance)
      • fromJAICoreInstance

        public static weka.core.Instance fromJAICoreInstance(Instance instance)
      • fromJAICoreInstance

        public static weka.core.Instance fromJAICoreInstance(LabeledInstance<java.lang.String> instance)
      • fromJAICoreInstances

        public static weka.core.Instances fromJAICoreInstances(LabeledInstances<java.lang.String> labeledInstances)
      • needsBinarization

        public static boolean needsBinarization(weka.core.Instances wekaInstances,                                        boolean ignoreClassAttribute)
        Returns true if there is at least one nominal attribute in the given dataset that has more than 2 values.
        Parameters:
        wekaInstances - dataset that is checked
        ignoreClassAttribute - if true class attribute is ignored.
      • toJAICoreLabeledInstance

        public static LabeledInstance<java.lang.String> toJAICoreLabeledInstance(weka.core.Instance wekaInst)
      • toJAICoreInstances

        public static Instances toJAICoreInstances(weka.core.Instances wekaInstances)
      • getPossibleClassValues

        public static java.util.Collection<java.lang.String> getPossibleClassValues(weka.core.Instance instance)
      • toJAICoreInstance

        public static Instance toJAICoreInstance(weka.core.Instance wekaInst)
      • getClassifierDescriptor

        public static java.lang.String getClassifierDescriptor(weka.classifiers.Classifier c)
      • getOptionsOfWekaAlgorithm

        public static java.util.Collection<weka.core.Option> getOptionsOfWekaAlgorithm(java.lang.Object o)
      • getClassNames

        public static java.util.List<java.lang.String> getClassNames(weka.core.Instance instance)
      • getClassNameToIDMap

        public static java.util.Map<java.lang.String,java.lang.Integer> getClassNameToIDMap(weka.core.Instance instance)
      • getIntValOfClassName

        public static int getIntValOfClassName(weka.core.Instance instance,                                       java.lang.String className)
      • printClassSplitAssignments

        public static void printClassSplitAssignments(java.util.List<weka.core.Instances> split)
      • getInstancesOfClass

        public static weka.core.Instances getInstancesOfClass(weka.core.Instances data,                                                      java.util.Collection<java.lang.String> classNames)
      • getInstancesOfClass

        public static weka.core.Instances getInstancesOfClass(weka.core.Instances data,                                                      java.lang.String className)
      • getClassName

        public static java.lang.String getClassName(weka.core.Instance instance)
      • getInstancesPerClass

        public static java.util.Map<java.lang.String,weka.core.Instances> getInstancesPerClass(weka.core.Instances data)
      • getNumberOfInstancesPerClass

        public static java.util.Map<java.lang.String,java.lang.Integer> getNumberOfInstancesPerClass(weka.core.Instances data)
      • getNumberOfInstancesFromClass

        public static int getNumberOfInstancesFromClass(weka.core.Instances data,                                                java.lang.String c)
      • getNumberOfInstancesFromClass

        public static int getNumberOfInstancesFromClass(weka.core.Instances data,                                                java.util.Collection<java.lang.String> cs)
      • getRelativeNumberOfInstancesFromClass

        public static double getRelativeNumberOfInstancesFromClass(weka.core.Instances data,                                                           java.lang.String c)
      • getRelativeNumberOfInstancesFromClass

        public static double getRelativeNumberOfInstancesFromClass(weka.core.Instances data,                                                           java.util.Collection<java.lang.String> cs)
      • getArbitrarySplit

        public static java.util.Collection<java.lang.Integer>[] getArbitrarySplit(weka.core.Instances data,                                                                          java.util.Random rand,                                                                          double... portions)
      • realizeSplit

        public static java.util.List<weka.core.Instances> realizeSplit(weka.core.Instances data,                                                               java.util.Collection<java.lang.Integer>[] split)
      • realizeSplit

        public static java.util.List<weka.core.Instances> realizeSplit(weka.core.Instances data,                                                               java.util.List<java.util.List<java.lang.Integer>> split)
      • realizeSplitAsCopiedInstances

        public static java.util.List<weka.core.Instances> realizeSplitAsCopiedInstances(weka.core.Instances data,                                                                                java.util.List<java.util.List<java.lang.Integer>> split)
      • realizeSplitAsCopiedInstances

        public static java.util.List<weka.core.Instances> realizeSplitAsCopiedInstances(weka.core.Instances data,                                                                                java.util.Collection<java.lang.Integer>[] split)
      • realizeSplitAsSubInstances

        public static java.util.List<weka.core.Instances> realizeSplitAsSubInstances(weka.core.Instances data,                                                                             java.util.Collection<java.lang.Integer>[] split)
      • getStratifiedSplitIndices

        public static java.util.Collection<java.lang.Integer>[] getStratifiedSplitIndices(weka.core.Instances data,                                                                                  java.util.Random rand,                                                                                  double... pPortions)
      • getStratifiedSplitIndicesAsList

        public static java.util.List<java.util.List<java.lang.Integer>> getStratifiedSplitIndicesAsList(weka.core.Instances data,                                                                                                java.util.Random rand,                                                                                                double... portions)
      • splitToJsonArray

        public static com.fasterxml.jackson.databind.node.ArrayNode splitToJsonArray(java.util.Collection<java.lang.Integer>[] splitDecision)
      • getStratifiedSplit

        public static java.util.List<weka.core.Instances> getStratifiedSplit(weka.core.Instances data,                                                                     long seed,                                                                     double... portions)
      • getStratifiedSplit

        public static java.util.List<ReproducibleInstances> getStratifiedSplit(ReproducibleInstances data,                                                                       java.util.Random rand,                                                                       double... portions)
        Creates a stratified split for a given ReproducibleInstances Object. The history will be updated to track the split.
        Parameters:
        data - - Input data
        rand - - random used to get a seed, which can be used and saved
        portions - - ratios to split
        Returns:
        a list of ReproducibleInstances. For each of them the history will be updated to track the split
      • getStratifiedSplit

        public static java.util.List<ReproducibleInstances> getStratifiedSplit(ReproducibleInstances data,                                                                       long seed,                                                                       double... portions)
        Creates a StratifiedSplit for a given ReproducibleInstances Object. THe History will be updated to track the split.
        Parameters:
        data - - Input data
        seed - - random seed
        portions - - ratios to split
        Returns:
        a List of ReproducibleInstances. For each of them the history will be updated to track the split
      • getDatasetsInFolder

        public static java.util.List<java.io.File> getDatasetsInFolder(java.io.File folder)                                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • getRefactoredInstances

        public static weka.core.Instances getRefactoredInstances(weka.core.Instances data,                                                         java.util.Map<java.lang.String,java.lang.String> classMap)
      • getRefactoredInstance

        public static weka.core.Instance getRefactoredInstance(weka.core.Instance instance)
      • getRefactoredInstance

        public static weka.core.Instance getRefactoredInstance(weka.core.Instance instance,                                                       java.util.List<java.lang.String> classes)
      • getEmptySetOfInstancesWithRefactoredClass

        public static weka.core.Instances getEmptySetOfInstancesWithRefactoredClass(weka.core.Instances instances)
      • getEmptySetOfInstancesWithRefactoredClass

        public static weka.core.Instances getEmptySetOfInstancesWithRefactoredClass(weka.core.Instances instances,                                                                            java.util.List<java.lang.String> classes)
      • getAttributes

        public static java.util.List<weka.core.Attribute> getAttributes(weka.core.Instances inst,                                                                boolean includeClassAttribute)
      • getAttributes

        public static java.util.List<weka.core.Attribute> getAttributes(weka.core.Instance inst)
      • hasOnlyNumericAttributes

        public static boolean hasOnlyNumericAttributes(weka.core.Instances instances)
      • getNewClassAttribute

        public static weka.core.Attribute getNewClassAttribute(weka.core.Attribute attribute)
      • getNewClassAttribute

        public static weka.core.Attribute getNewClassAttribute(weka.core.Attribute attribute,                                                       java.util.List<java.lang.String> classes)
      • getReplacedAttributeList

        public static java.util.List<weka.core.Attribute> getReplacedAttributeList(java.util.List<weka.core.Attribute> attributes,                                                                           weka.core.Attribute classAttribute)
      • mergeClassesOfInstances

        public static weka.core.Instances mergeClassesOfInstances(weka.core.Instances data,                                                          java.util.Collection<java.lang.String> cluster1,                                                          java.util.Collection<java.lang.String> cluster2)
      • mergeClassesOfInstances

        public static weka.core.Instances mergeClassesOfInstances(weka.core.Instances data,                                                          java.util.List<java.util.Set<java.lang.String>> instancesCluster)
      • getClassesDeclaredInDataset

        public static java.util.List<java.lang.String> getClassesDeclaredInDataset(weka.core.Instances data)
      • getClassesActuallyContainedInDataset

        public static java.util.Collection<java.lang.String> getClassesActuallyContainedInDataset(weka.core.Instances data)
      • getClassesAsArray

        public static double[] getClassesAsArray(weka.core.Instances inst)
      • getClassesAsList

        public static java.util.List<java.lang.Double> getClassesAsList(weka.core.Instances inst)
      • instancesToJsonString

        public static java.lang.String instancesToJsonString(weka.core.Instances data)
      • jsonStringToInstances

        public static weka.core.Instances jsonStringToInstances(java.lang.String json)
      • getIndicesOfContainedInstances

        public static int[] getIndicesOfContainedInstances(weka.core.Instances dataset,                                                   weka.core.Instances subset)
        Compute indices of instances of the original data set that are contained in the given subset. This does only work for data sets that contain an instance at most once!
        Parameters:
        dataset -
        subset -
        Returns:
      • useFilterOnSingleInstance

        public static weka.core.Instance useFilterOnSingleInstance(weka.core.Instance instance,                                                           weka.filters.Filter filter)                                                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • removeClassAttribute

        public static weka.core.Instances removeClassAttribute(weka.core.Instances data)                                                throws java.lang.Exception
        Throws:
        java.lang.Exception
      • removeClassAttribute

        public static weka.core.Instance removeClassAttribute(weka.core.Instance inst)                                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • cloneClassifier

        public static weka.classifiers.Classifier cloneClassifier(weka.classifiers.Classifier c)                                                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getIndicesOfSubset

        public static int[] getIndicesOfSubset(weka.core.Instances data,                                       weka.core.Instances subset)
      • printNestedWekaClassifier

        public static java.lang.String printNestedWekaClassifier(weka.classifiers.Classifier c)


NOTHING
NOTHING
Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14