This library provides functions to perform fitting of 2D data to various functions. require.mx('mxjs/base/xdistributionfit.js');
Status | Name |
---|---|
BestFitter BestFit.exp
(
Table ↓Table,
Function ↓read_FieldX,
Function ↓read_FieldY,
Function ↓optional_read_Filter
)
Returns a bestfitter created by using a balanced exponential fit on the input data |
|
BestFitter BestFit.exp_array
(
Array ↓x_array,
Array ↓y_array,
Number ↓num_points
)
Returns a bestfitter created by using a balanced exponential fit on the input data |
|
BestFitter BestFit.expSimple
(
Table ↓Table,
Function ↓read_FieldX,
Function ↓read_FieldY,
Function ↓optional_read_Filter
)
Returns a bestfitter created by using a simple exponential fit on the input data |
|
BestFitter BestFit.expSimple_array
(
Array ↓x_array,
Array ↓y_array,
Number ↓num_points
)
Returns a bestfitter created by using a simple exponential fit on the input data |
|
BestFitter BestFit.linear
(
Table ↓Table,
Function ↓read_FieldX,
Function ↓read_FieldY,
Function ↓optional_read_Filter
)
Returns a bestfitter created by using a linear fit on the input data |
|
BestFitter BestFit.linear_array
(
Array ↓x_array,
Array ↓y_array,
Number ↓num_points
)
Returns a bestfitter created by using a linear fit on the input data |
|
BestFitter BestFit.log
(
Table ↓Table,
Function ↓read_FieldX,
Function ↓read_FieldY,
Function ↓optional_read_Filter
)
Returns a bestfitter created by using a logarithmic fit on the input data |
|
BestFitter BestFit.log_array
(
Array ↓x_array,
Array ↓y_array,
Number ↓num_points
)
Returns a bestfitter created by using a logarithmic fit on the input data |
|
BestFitter BestFit.piecewiseLinear
(
Table ↓Table,
Function ↓read_FieldX,
Function ↓read_FieldY,
Function ↓optional_read_Filter
)
Returns a piecewise linear interpolator on the input data. It returns fitted values as the linear interpolation between the closest data points in the set on either side of the input. If there are only points available on one side, it returns the value of the closest data point. |
|
BestFitter BestFit.piecewiseLinear_array
(
Array ↓x_array,
Array ↓y_array,
Number ↓num_points
)
Returns a piecewise linear interpolator on the input data. It returns fitted values as the linear interpolation between the closest data points in the set on either side of the input. If there are only points available on one side, it returns the value of the closest data point. |
|
BestFitter BestFit.polynomial
(
Number ↓order,
Table ↓Table,
Function ↓read_FieldX,
Function ↓read_FieldY,
Function ↓optional_read_Filter
)
Returns a bestfitter created by using a polynomial fit of the specified order on the input data |
|
BestFitter BestFit.polynomial_array
(
Number ↓order,
Array ↓x_array,
Array ↓y_array,
Number ↓num_points
)
Returns a bestfitter created by using a polynomial fit of the specified order on the input data |
|
BestFitter BestFit.power
(
Table ↓Table,
Function ↓read_FieldX,
Function ↓read_FieldY,
Function ↓optional_read_Filter
)
Returns a bestfitter created by using a power fit on the input data |
|
BestFitter BestFit.power_array
(
Array ↓x_array,
Array ↓y_array,
Number ↓num_points
)
Returns a bestfitter created by using a power fit on the input data |
|
Bestfitter Create.exp
(
)
Creates a balanced exponential bestfitter. |
|
Bestfitter Create.exponentialConstant
(
)
Creates a fitter for exponential with constant |
|
Bestfitter Create.expSimple
(
)
Creates a simple exponential bestfitter. This variant is faster but is weighted towards values closer to zero. |
|
Bestfitter Create.linear
(
)
Creates a linear bestfitter |
|
Bestfitter Create.log
(
)
Creates a logarithmic (ln) bestfitter. |
|
Bestfitter Create.piecewiseLinear
(
)
Creates a piecewise linear interpolator |
|
Bestfitter Create.polynomial
(
Number order
)
Creates a polynomial bestfitter for the specified order |
|
Bestfitter Create.power
(
)
Creates a power bestfitter |
|
Number Measure.ks
(
BestFitter ↓bestfitter,
Table ↓Table,
Function ↓read_FieldX,
Function ↓read_FieldY,
Function ↓optional_read_Filter
)
Returns the Kolmogorov�Smirnov test result between the provided data points, and the fit from the provided bestfitter |
|
Number Measure.ks_array
(
BestFitter ↓bestfitter,
Array ↓x_array,
Array ↓y_array,
Number ↓num_points
)
Returns the Kolmogorov�Smirnov test result between the provided data points, and the fit from the provided bestfitter |
|
Number Measure.rmse
(
BestFitter ↓bestfitter,
Table ↓Table,
Function ↓read_FieldX,
Function ↓read_FieldY,
Function ↓optional_read_Filter
)
Returns the root-mean-square-error result between the provided data points, and the fit from the provided bestfitter |
|
Number Measure.rmse_array
(
BestFitter ↓bestfitter,
Array ↓x_array,
Array ↓y_array,
Number ↓num_points
)
Returns the root-mean-square-error result between the provided data points, and the fit from the provided bestfitter |
|
Number Measure.rsquare
(
BestFitter ↓bestfitter,
Table ↓Table,
Function ↓read_FieldX,
Function ↓read_FieldY,
Function ↓optional_read_Filter
)
Returns the R-square result between the provided data points, and the fit from the provided bestfitter |
|
Number Measure.rsquare_array
(
BestFitter ↓bestfitter,
Array ↓x_array,
Array ↓y_array,
Number ↓num_points
)
Returns the R-square result between the provided data points, and the fit from the provided bestfitter |
|
Function Result.generateFunction
(
BestFitter ↓bestfitter
)
Returns a function f(x) that can be used to generate values for the best fitted equation. |
|
Object Result.getCoefficients
(
BestFitter ↓bestfitter
)
Gets the coefficients for a particular bestfitter. The coefficients are specific to each bestfitter type. |
|
Text Result.getEquation
(
BestFitter ↓bestfitter
)
Gets the textual representation of the equation for a particular bestfitter |
|
BestFitter Result.loadFromJson
(
Text ↓text
)
Returns a bestfitter as loaded from the JSON text |
|
Text Result.saveAsJson
(
BestFitter ↓bestfitter
)
Returns JSON text which contains the saved state of the bestfitter. This can be persisted to Table values or columns. It allows the Bestfitter to be saved and/or used in another calculation. |
|
SetPoints.addPoint
(
BestFitter ↓bestfitter,
Number x,
Number y
)
Adds input for a bestfitter object from a data point (x, y) |
|
SetPoints.fromArray
(
BestFitter ↓bestfitter,
Array ↓x_array,
Array ↓y_array,
Number ↓num_points
)
Adds input for a bestfitter object from arrays |
|
SetPoints.fromArray
(
BestFitter ↓bestfitter,
Table ↓Table,
Function ↓read_FieldX,
Function ↓read_FieldY,
Function ↓read_Filter
)
Adds input for a bestfitter object from data table columns. The filter is optional, providing it will use only data points that passed the filter. |
These functions provide a BestFitter object based on input.
Returns a bestfitter created by using a balanced exponential fit on the input data
Parameters:Table
↓Table - Table containing the input dataFunction
↓read_FieldX - Table read function for the x of the data points.Function
↓read_FieldY - Table read function for the y of the data points.Function
↓optional_read_Filter - optional Table read function for the filterBestFitter
↑bestfitter Returns a bestfitter created by using a balanced exponential fit on the input data
Parameters:Array
↓x_array - array containing the x of the data pointsArray
↓y_array - array containing the y of the data pointsNumber
↓num_points - the number of data points provided in the arrays above.BestFitter
↑bestfitter Returns a bestfitter created by using a simple exponential fit on the input data
Parameters:Table
↓Table - Table containing the input dataFunction
↓read_FieldX - Table read function for the x of the data points.Function
↓read_FieldY - Table read function for the y of the data points.Function
↓optional_read_Filter - optional Table read function for the filterBestFitter
↑bestfitter Returns a bestfitter created by using a simple exponential fit on the input data
Parameters:Array
↓x_array - array containing the x of the data pointsArray
↓y_array - array containing the y of the data pointsNumber
↓num_points - the number of data points provided in the arrays above.BestFitter
↑bestfitter Returns a bestfitter created by using a linear fit on the input data
Parameters:Table
↓Table - Table containing the input dataFunction
↓read_FieldX - Table read function for the x of the data points.Function
↓read_FieldY - Table read function for the y of the data points.Function
↓optional_read_Filter - optional Table read function for the filterBestFitter
↑bestfitter Returns a bestfitter created by using a linear fit on the input data
Parameters:Array
↓x_array - array containing the x of the data pointsArray
↓y_array - array containing the y of the data pointsNumber
↓num_points - the number of data points provided in the arrays above.BestFitter
↑bestfitter Returns a bestfitter created by using a logarithmic fit on the input data
Parameters:Table
↓Table - Table containing the input dataFunction
↓read_FieldX - Table read function for the x of the data points.Function
↓read_FieldY - Table read function for the y of the data points.Function
↓optional_read_Filter - optional Table read function for the filterBestFitter
↑bestfitter Returns a bestfitter created by using a logarithmic fit on the input data
Parameters:Array
↓x_array - array containing the x of the data pointsArray
↓y_array - array containing the y of the data pointsNumber
↓num_points - the number of data points provided in the arrays above.BestFitter
↑bestfitter Returns a piecewise linear interpolator on the input data. It returns fitted values as the linear interpolation between the closest data points in the set on either side of the input. If there are only points available on one side, it returns the value of the closest data point.
Parameters:Table
↓Table - Table containing the input dataFunction
↓read_FieldX - Table read function for the x of the data points.Function
↓read_FieldY - Table read function for the y of the data points.Function
↓optional_read_Filter - optional Table read function for the filterBestFitter
↑interpolator Returns a piecewise linear interpolator on the input data. It returns fitted values as the linear interpolation between the closest data points in the set on either side of the input. If there are only points available on one side, it returns the value of the closest data point.
Parameters:Array
↓x_array - array containing the x of the data pointsArray
↓y_array - array containing the y of the data pointsNumber
↓num_points - the number of data points provided in the arrays above.BestFitter
↑interpolator Returns a bestfitter created by using a polynomial fit of the specified order on the input data
Parameters:Number
↓order - order of the polynomial fitTable
↓Table - Table containing the input dataFunction
↓read_FieldX - Table read function for the x of the data points.Function
↓read_FieldY - Table read function for the y of the data points.Function
↓optional_read_Filter - optional Table read function for the filterBestFitter
↑bestfitter Returns a bestfitter created by using a polynomial fit of the specified order on the input data
Parameters:Number
↓order - order of the polynomial fitArray
↓x_array - array containing the x of the data pointsArray
↓y_array - array containing the y of the data pointsNumber
↓num_points - the number of data points provided in the arrays above.BestFitter
↑bestfitter Returns a bestfitter created by using a power fit on the input data
Parameters:Table
↓Table - Table containing the input dataFunction
↓read_FieldX - Table read function for the x of the data points.Function
↓read_FieldY - Table read function for the y of the data points.Function
↓optional_read_Filter - optional Table read function for the filterBestFitter
↑bestfitter Returns a bestfitter created by using a power fit on the input data
Parameters:Array
↓x_array - array containing the x of the data pointsArray
↓y_array - array containing the y of the data pointsNumber
↓num_points - the number of data points provided in the arrays above.BestFitter
↑bestfitter These functions create bestfitter data objects.
Creates a balanced exponential bestfitter.
Parameters:Bestfitter
↑bestfitter Creates a fitter for exponential with constant
Parameters:Bestfitter
↑bestfitter Creates a simple exponential bestfitter. This variant is faster but is weighted towards values closer to zero.
Parameters:Bestfitter
↑bestfitter Creates a linear bestfitter
Parameters:Bestfitter
↑bestfitter Creates a logarithmic (ln) bestfitter.
Parameters:Bestfitter
↑bestfitter Creates a piecewise linear interpolator
Parameters:Bestfitter
↑bestfitter Creates a polynomial bestfitter for the specified order
Parameters:Number
order - of polynomial fittingBestfitter
↑bestfitter Creates a power bestfitter
Parameters:Bestfitter
↑bestfitter These functions compute a measure of goodness of fit given the original input points (or an alternative sample set) and the BestFitter object.
Returns the Kolmogorov�Smirnov test result between the provided data points, and the fit from the provided bestfitter
Parameters:BestFitter
↓bestfitter - bestfitter object to compare againstTable
↓Table - Table containing the data pointsFunction
↓read_FieldX - Table read function for the x of the data points.Function
↓read_FieldY - Table read function for the y of the data points.Function
↓optional_read_Filter - optional Table read function for the filterNumber
↑ks - - the Kolmogorov�Smirnov test resultReturns the Kolmogorov�Smirnov test result between the provided data points, and the fit from the provided bestfitter
Parameters:BestFitter
↓bestfitter - bestfitter object to compare againstArray
↓x_array - array containing the x of the data pointsArray
↓y_array - array containing the y of the data pointsNumber
↓num_points - the number of data points provided in the arrays above.Number
↑ks - - the Kolmogorov�Smirnov test resultReturns the root-mean-square-error result between the provided data points, and the fit from the provided bestfitter
Parameters:BestFitter
↓bestfitter - bestfitter object to compare againstTable
↓Table - Table containing the data pointsFunction
↓read_FieldX - Table read function for the x of the data points.Function
↓read_FieldY - Table read function for the y of the data points.Function
↓optional_read_Filter - optional Table read function for the filterNumber
↑rmse - - the root-mean-square-error resultReturns the root-mean-square-error result between the provided data points, and the fit from the provided bestfitter
Parameters:BestFitter
↓bestfitter - bestfitter object to compare againstArray
↓x_array - array containing the x of the data pointsArray
↓y_array - array containing the y of the data pointsNumber
↓num_points - the number of data points provided in the arrays above.Number
↑rmse - - the root-mean-square-error resultReturns the R-square result between the provided data points, and the fit from the provided bestfitter
Parameters:BestFitter
↓bestfitter - bestfitter object to compare againstTable
↓Table - Table containing the data pointsFunction
↓read_FieldX - Table read function for the x of the data points.Function
↓read_FieldY - Table read function for the y of the data points.Function
↓optional_read_Filter - optional Table read function for the filterNumber
↑rsquare - - the R-square resultReturns the R-square result between the provided data points, and the fit from the provided bestfitter
Parameters:BestFitter
↓bestfitter - bestfitter object to compare againstArray
↓x_array - array containing the x of the data pointsArray
↓y_array - array containing the y of the data pointsNumber
↓num_points - the number of data points provided in the arrays above.Number
↑rsquare - - the R-square resultThese functions extract output from a bestfitter object after input has been specified.
Returns a function f(x) that can be used to generate values for the best fitted equation.
Parameters:BestFitter
↓bestfitter Function
↑function - this function takes a single numeric input x, and returns the fitted value for x.Gets the coefficients for a particular bestfitter. The coefficients are specific to each bestfitter type.
Parameters:BestFitter
↓bestfitter Object
↑coefficients Gets the textual representation of the equation for a particular bestfitter
Parameters:BestFitter
↓bestfitter Text
↑equation Returns a bestfitter as loaded from the JSON text
Parameters:Text
↓text BestFitter
↑bestfitter Returns JSON text which contains the saved state of the bestfitter. This can be persisted to Table values or columns. It allows the Bestfitter to be saved and/or used in another calculation.
Parameters:BestFitter
↓bestfitter Text
↑text These functions provide data to a bestfitter object.
Adds input for a bestfitter object from a data point (x, y)
Parameters:BestFitter
↓bestfitter - - the BestFitter to add the data point toNumber
x Number
y Adds input for a bestfitter object from arrays
Parameters:BestFitter
↓bestfitter - - the Bestfitter to add data points toArray
↓x_array - - input array containing x of data pointsArray
↓y_array - - input array containing y of data pointsNumber
↓num_points - - number of data points (size of the x, y arrays)Adds input for a bestfitter object from data table columns. The filter is optional, providing it will use only data points that passed the filter.
Parameters:BestFitter
↓bestfitter - - the Bestfitter to add data points toTable
↓Table - - input Table containing data pointsFunction
↓read_FieldX - - input Table read Function containing x of data pointsFunction
↓read_FieldY - - input Table read Function containing y of data pointsFunction
↓read_Filter - - optional input Table read Function containing filterA BestFitter object contains the calculated coefficients from a data set and can compute the fitted value for input.
Status | Name |
---|---|
addPoint
(
Number x,
Number y
)
Adds the data point (x, y) provided, and recomputes the fit |
|
Function generateFunction
(
)
Generates a function f(x) that will compute the fitted value for any input x. The function once generated is standalone from the BestFitter (function will not change if you provide additional data points to this BestFitter that changes the coefficients) |
|
Number generator
(
Number x
)
Computes the fitted value for a specified input x |
|
Object getCoefficients
(
)
Returns an object containing the coefficients for this bestfitter. How the coefficients are stored or specified is specific to the BestFitter type. |
|
Text getEquation
(
)
Gets a textual representation of the fitted equation. |
Generates a function f(x) that will compute the fitted value for any input x. The function once generated is standalone from the BestFitter (function will not change if you provide additional data points to this BestFitter that changes the coefficients)
Parameters:Function
function - - a function f(x) that will compute the fitted value for input x.Returns an object containing the coefficients for this bestfitter. How the coefficients are stored or specified is specific to the BestFitter type.
Parameters:Object
coefficients - - coefficients object. How the coefficients are stored or specified is specific to the BestFitter type.Gets a textual representation of the fitted equation.
Parameters:Text
equation - - textual representation of the fitted equation