public class APIUtils
extends java.lang.Object
APIUtils
is a utility class where some enumerations and other static stuff are declaredModifier and Type | Class and Description |
---|---|
static class |
APIUtils.DISCRETIZATION
Enumeration of the available discretization algorithms.
|
static class |
APIUtils.LEARNING_ALGORITHM
Enumeration of the available learning algorithms.
|
static class |
APIUtils.LETTER_CASE
Enumeration of the available case formats for
StringFormatter . |
static class |
APIUtils.MEAN_MODE
Enumeration of the mean observation's modes
|
static class |
APIUtils.NODE_SORTING_METHOD
Enumeration of the node sorting methods.
|
Constructor and Description |
---|
APIUtils() |
Modifier and Type | Method and Description |
---|---|
static double[][] |
discretize(DiscretizationSettings discretizationSettings,
double[] values,
double[] weights)
Perform a discretization of the given values and weights accordingly to the discretization settings provided.
|
static double[][] |
discretize(TargetedDiscretizationSettings discretizationSettings,
double[] values,
double[] weights,
short[] classes)
Perform a discretization of the given values and weights accordingly to the discretization settings provided.
|
static java.awt.image.BufferedImage |
getBufferedImage(ResizableIcon icon)
Returns a
BufferedImage generated from the given icon. |
static NetworkDescriptor |
getNetworkDescriptor(BayesianNetworkTransferHandler networkHandler)
Return and instance of
NetworkDescriptor representing the Bayesian Network read from the given InputStream . |
static NetworkDescriptor |
getNetworkDescriptor(java.io.InputStream stream)
Return and instance of
NetworkDescriptor representing the Bayesian Network read from the given InputStream . |
static NetworkDescriptor |
getNetworkDescriptor(java.lang.String fileName)
Return and instance of
NetworkDescriptor representing the Bayesian Network stored in the given file. |
static ResizableIcon |
getResizableIcon(java.awt.image.BufferedImage image)
Returns a
ResizableIcon built from the given BufferedImage |
static ResizableIcon |
getResizableIcon(java.io.File file)
Returns the icon loaded from the given file.
|
static ResizableIcon |
getResizableIcon(java.net.URL imageUrl)
Returns a
ResizableIcon loaded from the given URL. |
public static final NetworkDescriptor getNetworkDescriptor(java.lang.String fileName)
NetworkDescriptor
representing the Bayesian Network stored in the given file.fileName
- the name of the xbl file where the Bayesian network is stored inpublic static final NetworkDescriptor getNetworkDescriptor(java.io.InputStream stream)
NetworkDescriptor
representing the Bayesian Network read from the given InputStream
.stream
- the stream from where the network is readpublic static final NetworkDescriptor getNetworkDescriptor(BayesianNetworkTransferHandler networkHandler)
NetworkDescriptor
representing the Bayesian Network read from the given InputStream
.networkHandler
- networkHandler the transfer handler containing the networkpublic static double[][] discretize(DiscretizationSettings discretizationSettings, double[] values, double[] weights)
intervals[0][0]
, and the maximum value is intervals[n-1][1]
, where n
is the number of intervals found.discretizationSettings
- the settings defining the discretization algorithm to usevalues
- the values to be discretizedweights
- the weights associated to the valuesDiscretizationSettings
,
APIUtils.DISCRETIZATION
public static double[][] discretize(TargetedDiscretizationSettings discretizationSettings, double[] values, double[] weights, short[] classes)
intervals[0][0]
, and the maximum value is intervals[n-1][1]
, where n
is the number of intervals found.discretizationSettings
- the settings defining the targeted discretization algorithm to usevalues
- the values to be discretizedweights
- the weights associated to the valuesclasses
- the target classes used by the discretization algorithmTargetedDiscretizationSettings
,
APIUtils.DISCRETIZATION.DECISION_TREE
public static ResizableIcon getResizableIcon(java.awt.image.BufferedImage image)
ResizableIcon
built from the given BufferedImage
image
- an instance of BufferedImage
public static java.awt.image.BufferedImage getBufferedImage(ResizableIcon icon)
BufferedImage
generated from the given icon. This image has the same size as the icon.icon
- an instance of ResizableIcon
BufferedImage
on which the icon is paintedpublic static ResizableIcon getResizableIcon(java.net.URL imageUrl) throws java.io.IOException
ResizableIcon
loaded from the given URL.imageUrl
- an URL to a valid image (png, jpg, gif and svg)java.io.IOException
- when an error occurs while loadingpublic static ResizableIcon getResizableIcon(java.io.File file) throws java.io.IOException
file
- the file where the icon is stored.java.io.IOException
- when an error occurs while loading