Description
Fits bounded observations after collection without claiming big-O.
Analyze
function Analyze (Set : Observation_Set) return Empirical_Scaling_Analysis
Fit y = coefficient * f(n) in log space for a fixed six-model set. At least four distinct positive points spanning a factor of two are required. An adequate selected model needs R-squared >= 0.90 and RMS log residual <= 0.10, and must be distinguishable from its competitor.
Parameters
- Set
Stored or synthetic observations.
Return value
Available or explicitly unavailable empirical analysis.
Append
procedure Append (Set : in out Observation_Set; Point : Sweeps.Parameter_Point; Observation : Long_Float)
Append one observation in retained order. Duplicate point identities and mixtures of size and count parameters are rejected. Observation validity is assessed by Analyze so invalid stored or synthetic data produces an explicit unavailable analysis.
Parameters
- Set
Destination bounded set.
- Point
Exact positive input identity.
- Observation
Positive measured or synthetic value.
Available
function Available (Result : Empirical_Scaling_Analysis) return Boolean
Test whether a model was selected adequately.
Parameters
- Result
Empirical analysis.
Return value
True only for Scaling_Available.
Diagnostic
function Diagnostic (Result : Empirical_Scaling_Analysis; Model : Scaling_Model) return Model_Diagnostic
Return one candidate's complete diagnostics.
Parameters
- Result
Empirical analysis.
- Model
Candidate to inspect.
Return value
Fitting diagnostics and availability.
Empirical_Scaling_Analysis
type Empirical_Scaling_Analysis is private;
Selected and competing diagnostics over one observed input range.
Input_Kind
function Input_Kind (Result : Empirical_Scaling_Analysis) return Sweeps.Parameter_Kind
Return the coherent parameter kind shared by all observations.
Parameters
- Result
Empirical analysis.
Return value
Size or count parameter kind.
Raised exceptions
- Constraint_Error
No observation supplied a parameter kind.
Input_Kind_Available
function Input_Kind_Available (Result : Empirical_Scaling_Analysis) return Boolean
Test whether the analysis has a retained parameter kind.
Parameters
- Result
Empirical analysis.
Return value
False only when no observation was supplied.
Input_Range_Available
function Input_Range_Available (Result : Empirical_Scaling_Analysis) return Boolean
Test whether an observed input range exists.
Parameters
- Result
Empirical analysis.
Return value
False only when no observation was supplied.
Length
function Length (Set : Observation_Set) return Natural
Return the retained observation count.
Parameters
- Set
Observation set.
Return value
Number of appended observations.
Maximum_Input
function Maximum_Input (Result : Empirical_Scaling_Analysis) return Sweeps.Exact_Value
Return the largest observed input.
Parameters
- Result
Empirical analysis.
Return value
Maximum exact input.
Raised exceptions
- Constraint_Error
No observation supplied an input.
Minimum_Input
function Minimum_Input (Result : Empirical_Scaling_Analysis) return Sweeps.Exact_Value
Return the smallest observed input.
Parameters
- Result
Empirical analysis.
Return value
Minimum exact input.
Raised exceptions
- Constraint_Error
No observation supplied an input.
Model_Diagnostic
type Model_Diagnostic is record
Model : Scaling_Model := Constant_Model;
Available : Boolean := False;
Selected : Boolean := False;
Coefficient : Long_Float := 0.0;
Nominal_Exponent : Long_Float := 0.0;
R_Squared : Long_Float := 0.0;
RMS_Log_Residual : Long_Float := 0.0;
Maximum_Absolute_Log_Residual : Long_Float := 0.0;
end record;
Diagnostics for one fixed candidate model.
Record fields
- Model
Candidate family.
- Available
Whether its basis and arithmetic were valid.
- Selected
Whether this is the accepted model of an available analysis. Rejected analyses have no selected diagnostic.
- Coefficient
Fitted multiplier in y = coefficient times f(n).
- Nominal_Exponent
Polynomial exponent, excluding logarithmic terms.
- R_Squared
Goodness of fit in log-observation space.
- RMS_Log_Residual
Root-mean-square log residual.
- Maximum_Absolute_Log_Residual
Largest absolute log residual.
Observation_Set
type Observation_Set (Maximum_Points : Positive) is tagged private;
Bounded ordered observations retained independently of collection.
Record fields
- Maximum_Points
Maximum observations stored by this value.
Points_Analyzed
function Points_Analyzed (Result : Empirical_Scaling_Analysis) return Natural
Return the number of supplied points.
Parameters
- Result
Empirical analysis.
Return value
Observation count assessed by Analyze.
Scaling_Model
type Scaling_Model is
(Constant_Model, Logarithmic_Model, Linear_Model, N_Log_N_Model, Quadratic_Model, Cubic_Model);
Candidate empirical growth families.
Enumeration literals
- Constant_Model
Constant over the observed range.
- Logarithmic_Model
Proportional to log n.
- Linear_Model
Proportional to n.
- N_Log_N_Model
Proportional to n log n.
- Quadratic_Model
Proportional to n squared.
- Cubic_Model
Proportional to n cubed.
Scaling_Status
type Scaling_Status is
(Scaling_Available,
Too_Few_Distinct_Points,
Invalid_Observation,
Degenerate_Input_Range,
Scaling_Numeric_Overflow,
No_Adequate_Model,
Poor_Model_Identifiability);
Availability of an empirical scaling result.
Enumeration literals
- Scaling_Available
A model met fit and identifiability rules.
- Too_Few_Distinct_Points
Fewer than four inputs were supplied.
- Invalid_Observation
An observation was nonpositive or non-finite.
- Degenerate_Input_Range
Inputs span less than a factor of two.
- Scaling_Numeric_Overflow
Fitting exceeded numeric bounds.
- No_Adequate_Model
No candidate met the goodness-of-fit rules.
- Poor_Model_Identifiability
Top candidates were indistinguishable.
Selected_Model
function Selected_Model (Result : Empirical_Scaling_Analysis) return Scaling_Model
Return the lowest-residual candidate.
Parameters
- Result
Empirical analysis.
Return value
Lowest-residual candidate when fitting reached model comparison; otherwise the default candidate. Rejected analyses leave every diagnostic's Selected field false, so inspect Status before interpreting this value.
Status
function Status (Result : Empirical_Scaling_Analysis) return Scaling_Status
Return analysis availability.
Parameters
- Result
Empirical analysis.
Return value
Exact availability or rejection state.