|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umbc.cs.maple.utils.MLUtils
public class MLUtils
A collection of machine learning utility functions.
Copyright (c) 2008 Eric Eaton
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Constructor Summary | |
---|---|
MLUtils()
|
Method Summary | |
---|---|
static java.awt.geom.Point2D[] |
appendSortX(java.awt.geom.Point2D[] pts1,
java.awt.geom.Point2D[] pts2)
Combine two sorted vectors of points into one vector of sorted points. |
static double[] |
areaBetweenLearningCurves(java.awt.geom.Point2D[] baselineLearningCurve,
java.awt.geom.Point2D[] targetLearningCurve)
Given two learning curves, determines the area between the two curves. |
static double |
computePolygonArea(java.awt.geom.Point2D[] pts)
Computes the area of the specified polygon. |
static java.awt.geom.Point2D[] |
cropLineX(java.awt.geom.Point2D[] line,
double startingXcoord,
double stoppingXcoord)
Crops a line to the given x-coordinates. |
static java.awt.geom.Point2D[] |
ensureCurveHasXCoordinates(java.awt.geom.Point2D[] curve,
double[] xCoords)
Ensures that the given curve contains all of the specified x-coordinates. |
static java.awt.geom.Point2D |
interpolate(java.awt.geom.Point2D[] points,
double x)
Interpolates the given x onto the line of points. |
static java.awt.geom.Point2D |
interpolate(java.awt.geom.Point2D pt1,
java.awt.geom.Point2D pt2,
double x)
Does linear interpolation at x of the line from pt1 to pt2. |
static java.awt.geom.Point2D |
intersection(java.awt.geom.Line2D lineA,
java.awt.geom.Line2D lineB)
Computes the intersection between two lines. |
static boolean |
isPointOnLine(java.awt.geom.Line2D line,
java.awt.geom.Point2D point)
Determines whether a given point is on a line. |
static void |
main(java.lang.String[] args)
|
static double |
maxY(java.awt.geom.Point2D[] points)
Determines the maximum y-coordinate for the set of points. |
static double |
minY(java.awt.geom.Point2D[] points)
Determines the minimum y-coordinate for the set of points. |
static double |
normalizedAreaBetweenLearningCurves(java.awt.geom.Point2D[] baselineLearningCurve,
java.awt.geom.Point2D[] targetLearningCurve,
double bestPerformance)
Calculates the normalized the area between these two learning curves by the area between the baselineLearningCurve and a horizontal line at the bestPerformance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MLUtils()
Method Detail |
---|
public static double normalizedAreaBetweenLearningCurves(java.awt.geom.Point2D[] baselineLearningCurve, java.awt.geom.Point2D[] targetLearningCurve, double bestPerformance)
baselineLearningCurve
- targetLearningCurve
- bestPerformance
-
public static void main(java.lang.String[] args)
public static double[] areaBetweenLearningCurves(java.awt.geom.Point2D[] baselineLearningCurve, java.awt.geom.Point2D[] targetLearningCurve)
baselineLearningCurve
- - the baseline learning curve vertices, in increasing order by x-coordinatetargetLearningCurve
- - the target learning curve vertices, in increasing order by x-coordinate
public static java.awt.geom.Point2D[] ensureCurveHasXCoordinates(java.awt.geom.Point2D[] curve, double[] xCoords)
curve
- a curve specified by a set of points in sorted order by x-coordinatexCoords
- a set of x-coordinates, sorted in increasing order
public static double computePolygonArea(java.awt.geom.Point2D[] pts)
pts
- the vertices specifying the polygon.
public static java.awt.geom.Point2D intersection(java.awt.geom.Line2D lineA, java.awt.geom.Line2D lineB)
lineA
- the first linelineB
- the second line
public static boolean isPointOnLine(java.awt.geom.Line2D line, java.awt.geom.Point2D point)
line
- point
-
public static java.awt.geom.Point2D[] appendSortX(java.awt.geom.Point2D[] pts1, java.awt.geom.Point2D[] pts2)
pts1
- pts2
-
public static java.awt.geom.Point2D[] cropLineX(java.awt.geom.Point2D[] line, double startingXcoord, double stoppingXcoord)
line
- startingXcoord
- stoppingXcoord
-
public static java.awt.geom.Point2D interpolate(java.awt.geom.Point2D pt1, java.awt.geom.Point2D pt2, double x)
pt1
- one endpoint of the line.pt2
- another endpoint of the line.x
- the x-coordinate of the interpolated point.
public static java.awt.geom.Point2D interpolate(java.awt.geom.Point2D[] points, double x)
points
- x
-
public static double minY(java.awt.geom.Point2D[] points)
points
-
public static double maxY(java.awt.geom.Point2D[] points)
points
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |