de.dfki.madm.mlwizard
Class Util

java.lang.Object
  extended by de.dfki.madm.mlwizard.Util

public class Util
extends java.lang.Object


Field Summary
static java.lang.String DATASETS_FOLDER
           
static java.lang.String FILE_PATH
           
static java.lang.String RESOURCE_PATH
           
 
Constructor Summary
Util()
           
 
Method Summary
static com.rapidminer.operator.meta.ParameterSet combineParameterSets(com.rapidminer.operator.meta.ParameterSet p1, com.rapidminer.operator.meta.ParameterSet p2, com.rapidminer.operator.performance.PerformanceVector pv)
          combine two parameter sets
static double dist(com.rapidminer.example.Example a, com.rapidminer.example.Example b)
          computes the squared euclidean distance between a and b (omits the square root calculation for efficiency reasons)
static double dist(com.rapidminer.example.Example a, com.rapidminer.example.Example b, com.rapidminer.example.AttributeWeights weights)
          computes the squared euclidean distance between a and b (omits the square root calculation for efficiency reasons) using the given set of attributes only
static double dist(com.rapidminer.example.Example a, com.rapidminer.example.Example b, long mask)
          computes the squared euclidean distance between a and b (omits the square root calculation for efficiency reasons) using the given binary mask of attribute
static com.rapidminer.example.Example getExampleFromId(com.rapidminer.example.ExampleSet exampleSet, java.lang.String id)
          gets the example with the given id using a linear search
static java.io.InputStream getStream(java.lang.String name)
           
static java.io.InputStream getStreamFromFile(java.lang.String filePath)
           
static java.io.InputStream getStreamFromResource(java.lang.String resourcePath)
           
static com.rapidminer.example.ExampleSet mergeExampleSets(com.rapidminer.example.ExampleSet a, com.rapidminer.example.ExampleSet b)
           
static
<T extends com.rapidminer.operator.IOObject>
T
read(java.lang.String name, java.lang.Class<T> clazz)
          reads an object from a resource or a file.
static java.lang.String readFileAsString(java.lang.String filePath)
           
static
<T extends com.rapidminer.operator.IOObject>
T
readFromFile(java.lang.String filePath, java.lang.Class<T> clazz)
          reads an IOObject from a file
static
<T extends com.rapidminer.operator.IOObject>
T
readFromRepository(java.lang.String location, java.lang.Class<T> clazz)
           
static
<T extends com.rapidminer.operator.IOObject>
T
readFromResource(java.lang.String resourcePath, java.lang.Class<T> clazz)
          reads an IOObject from a resource
static void write(java.lang.String name, com.rapidminer.operator.IOObject object)
           
static void writeToRepository(com.rapidminer.operator.IOObject object, java.lang.String location)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE_PATH

public static final java.lang.String RESOURCE_PATH
See Also:
Constant Field Values

FILE_PATH

public static final java.lang.String FILE_PATH
See Also:
Constant Field Values

DATASETS_FOLDER

public static final java.lang.String DATASETS_FOLDER
See Also:
Constant Field Values
Constructor Detail

Util

public Util()
Method Detail

getExampleFromId

public static com.rapidminer.example.Example getExampleFromId(com.rapidminer.example.ExampleSet exampleSet,
                                                              java.lang.String id)
gets the example with the given id using a linear search

Parameters:
exampleSet - the dataset
id - the desired id
Returns:
the example with the id or null if no such example exists

dist

public static double dist(com.rapidminer.example.Example a,
                          com.rapidminer.example.Example b)
computes the squared euclidean distance between a and b (omits the square root calculation for efficiency reasons)

Parameters:
a - example a
b - example b
Returns:
(pseudo) distance between a and b

dist

public static double dist(com.rapidminer.example.Example a,
                          com.rapidminer.example.Example b,
                          com.rapidminer.example.AttributeWeights weights)
computes the squared euclidean distance between a and b (omits the square root calculation for efficiency reasons) using the given set of attributes only

Parameters:
a - example a
b - example b
weights - only attributes with a weight >=1 will be used within the distance calculation
Returns:
the distance between a and b

dist

public static double dist(com.rapidminer.example.Example a,
                          com.rapidminer.example.Example b,
                          long mask)
computes the squared euclidean distance between a and b (omits the square root calculation for efficiency reasons) using the given binary mask of attribute

Parameters:
a - example a
b - example b
mask - only attributes with the given bit in the mask set are used within the distance calculation (first attribute corresponds to lowest significant bit)
Returns:
the distance between a and b

combineParameterSets

public static com.rapidminer.operator.meta.ParameterSet combineParameterSets(com.rapidminer.operator.meta.ParameterSet p1,
                                                                             com.rapidminer.operator.meta.ParameterSet p2,
                                                                             com.rapidminer.operator.performance.PerformanceVector pv)
combine two parameter sets

Parameters:
p1 - parameter set 1
p2 - parameter set 1
pv - the performance of the new parameter set
Returns:
parameter set containing all parameters from p1 and p2

read

public static <T extends com.rapidminer.operator.IOObject> T read(java.lang.String name,
                                                                  java.lang.Class<T> clazz)
                                                       throws java.io.IOException
reads an object from a resource or a file. First, reading from the resource is tried, if it fails, reading from the file is tried.

Parameters:
name -
clazz -
Returns:
Throws:
java.io.IOException

readFromResource

public static <T extends com.rapidminer.operator.IOObject> T readFromResource(java.lang.String resourcePath,
                                                                              java.lang.Class<T> clazz)
                                                                   throws java.io.IOException
reads an IOObject from a resource

Parameters:
resourcePath - the resource location
clazz - the desired class of the IOObject
Returns:
the object read
Throws:
java.io.IOException

readFromFile

public static <T extends com.rapidminer.operator.IOObject> T readFromFile(java.lang.String filePath,
                                                                          java.lang.Class<T> clazz)
                                                               throws java.io.IOException
reads an IOObject from a file

Parameters:
name - the resource location
clazz - the desired class of the IOObject
Returns:
the object read
Throws:
java.io.IOException

write

public static void write(java.lang.String name,
                         com.rapidminer.operator.IOObject object)
                  throws java.io.FileNotFoundException,
                         java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

getStream

public static java.io.InputStream getStream(java.lang.String name)
                                     throws java.io.IOException,
                                            com.rapidminer.tools.XMLException
Throws:
java.io.IOException
com.rapidminer.tools.XMLException

getStreamFromResource

public static java.io.InputStream getStreamFromResource(java.lang.String resourcePath)
                                                 throws java.io.IOException,
                                                        com.rapidminer.tools.XMLException
Throws:
java.io.IOException
com.rapidminer.tools.XMLException

getStreamFromFile

public static java.io.InputStream getStreamFromFile(java.lang.String filePath)
                                             throws java.io.IOException,
                                                    com.rapidminer.tools.XMLException
Throws:
java.io.IOException
com.rapidminer.tools.XMLException

writeToRepository

public static void writeToRepository(com.rapidminer.operator.IOObject object,
                                     java.lang.String location)
                              throws com.rapidminer.operator.OperatorCreationException,
                                     com.rapidminer.operator.OperatorException
Throws:
com.rapidminer.operator.OperatorCreationException
com.rapidminer.operator.OperatorException

readFromRepository

public static <T extends com.rapidminer.operator.IOObject> T readFromRepository(java.lang.String location,
                                                                                java.lang.Class<T> clazz)
                                                                     throws com.rapidminer.operator.OperatorCreationException,
                                                                            com.rapidminer.operator.OperatorException
Throws:
com.rapidminer.operator.OperatorCreationException
com.rapidminer.operator.OperatorException

readFileAsString

public static java.lang.String readFileAsString(java.lang.String filePath)
                                         throws java.io.IOException
Throws:
java.io.IOException

mergeExampleSets

public static com.rapidminer.example.ExampleSet mergeExampleSets(com.rapidminer.example.ExampleSet a,
                                                                 com.rapidminer.example.ExampleSet b)
                                                          throws com.rapidminer.operator.OperatorCreationException,
                                                                 com.rapidminer.operator.OperatorException
Throws:
com.rapidminer.operator.OperatorCreationException
com.rapidminer.operator.OperatorException


Copyright © 2001-2009 by Rapid-I