obj_function_form

despasito.parameter_fitting.fit_functions.obj_function_form

obj_function_form(data_test, data0, weights=1.0, method='average-squared-deviation', nan_number=1000, nan_ratio=0.1)[source]

Sets objective functional form

Note that if the result is np.nan, that point is removed from the list for the purposes of averaging.

Parameters:
  • data_test (numpy.ndarray) – Data that is being assessed. Array of data of the same length as data_test

  • data0 (numpy.ndarray) – Reference data for comparison

  • weights ((numpy.ndarray or float), Optional, default=1.0) – Can be a float or array of data of the same length as data_test. Allows the user to tune the importance of various data points.

  • method (str, Optional, default=”mean-squared-relative-error”) – Keyword used to choose the functional form. Can be:

    • average-squared-deviation:

    \(\sum{(\\frac{data\_test-data0}{data0})^2}/N\) - sum-squared-deviation: \(\sum{(\\frac{data\_test-data0}{data0})^2}\) - sum-squared-deviation-boltz: \(\sum{(\\frac{data\_test-data0}{data0})^2\) \(exp(\\frac{data\_test\_min-data\_test}{|data\_test\_min|})}\) [DOI: 10.1063/1.2181979] - sum-deviation-boltz: \(\sum{\\frac{data\_test-data0}{data0}\) \(exp(\\frac{data\_test\_min-data\_test}{|data\_test\_min|})}\) [DOI: 10.1063/1.2181979] - percent-absolute-average-deviation: \(\sum{(\\frac{data\_test-data0}{data0})^2}/N \\times 100\)

  • nan_ratio (float, Optional, default=0.1) – If more than “nan_ratio*100” percent of the calculated data failed to produce NaN, increase the objective value by the number of entries where data_test is NaN times nan_number.

  • nan_number (float, Optional, default=1000) – If a thermodynamic calculation produces NaN, add this quantity to the objective value. (See nan_ratio)

Returns:

obj_value – Objective value given the calculated and reference information

Return type:

float