This provides a highly configurable implementation of a Radial Basis Function Neural Network. A RBF network is a type of neural network that contains one hidden layer, and is related to the LVQ algorithm. In a classical RBF Network, the distance between two data points is generally the {@lin
| 75 | * @author Edward Raff |
| 76 | */ |
| 77 | public class RBFNet implements Classifier, Regressor, DataTransform, Parameterized |
| 78 | { |
| 79 | |
| 80 | private static final long serialVersionUID = 5418896646203518062L; |
| 81 | private int numCentroids; |
| 82 | private Phase1Learner p1l; |
| 83 | private Phase2Learner p2l; |
| 84 | private double alpha; |
| 85 | private int p; |
| 86 | private DistanceMetric dm; |
| 87 | private boolean normalize = true; |
| 88 | |
| 89 | private Classifier baseClassifier; |
| 90 | private Regressor baseRegressor; |
| 91 | |
| 92 | private List<Double> centroidDistCache; |
| 93 | private List<Vec> centroids; |
| 94 | private double[] bandwidths; |
| 95 | |
| 96 | /** |
| 97 | * Creates a new RBF Network suitable for binary classification or |
| 98 | * regression and uses 100 hidden nodes. One of the other constructors |
| 99 | * should be used if you need classification for multi-class or if you need |
| 100 | * probability outputs. <br> |
| 101 | * <br> |
| 102 | * This will use {@link Phase1Learner#K_MEANS} for neuron selection and |
| 103 | * {@link Phase2Learner#NEAREST_OTHER_CENTROID_AVERAGE} for activation |
| 104 | * tuning. The {@link EuclideanDistance} will be use as the metric. |
| 105 | * |
| 106 | */ |
| 107 | public RBFNet() |
| 108 | { |
| 109 | this(100); |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * Creates a new RBF Network suitable for binary classification or |
| 114 | * regression. One of the other constructors should be used if you need |
| 115 | * classification for multi-class or if you need probability outputs. <br> |
| 116 | * <br> |
| 117 | * This will use {@link Phase1Learner#K_MEANS} for neuron selection and |
| 118 | * {@link Phase2Learner#NEAREST_OTHER_CENTROID_AVERAGE} for activation tuning. |
| 119 | * The {@link EuclideanDistance} will be use as the metric. |
| 120 | * |
| 121 | * @param numCentroids the number of centroids or neurons to use in the |
| 122 | * network's hidden layer |
| 123 | */ |
| 124 | public RBFNet(int numCentroids) |
| 125 | { |
| 126 | this(numCentroids, Phase1Learner.K_MEANS, Phase2Learner.NEAREST_OTHER_CENTROID_AVERAGE, 3, 3, new EuclideanDistance(), (Classifier) new DCDs()); |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Creates a new RBF Network for classification tasks. If the classifier can |
| 131 | * also perform regression, then the network will be able to perform both. |
| 132 | * |
| 133 | * @param numCentroids the number of centroids or neurons to use in the |
| 134 | * network's hidden layer |
nothing calls this directly
no outgoing calls
no test coverage detected