Changeset 1ba8a1


Ignore:
Timestamp:
Jun 27, 2014, 9:32:29 PM (11 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
4e009d
Parents:
1b1fa5
git-author:
Frederik Heber <heber@…> (02/27/14 19:07:56)
git-committer:
Frederik Heber <heber@…> (06/27/14 21:32:29)
Message:

DOCU: Extended documentation on FunctionApproximation and potential fitting.

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/FunctionApproximation/Extractors.hpp

    r1b1fa5 r1ba8a1  
    2222
    2323/** Namespace containing all simple extractor functions.
     24 *
     25 * Extractor functions extract distances from a given fragment matching with
     26 * a given set of particle types (i.e. elements, e.h. H2O).
     27 * Filter functions extract a subset of distances from a given set of distances
     28 * to be used with a specific model.
     29 *
     30 * To this end, each FunctionModel has both a filter and an extractor function.
     31 *
     32 * The functions in this namespace act as helpers or basic building blocks in
     33 * constructing such filters and extractors.
    2434 *
    2535 */
  • src/FunctionApproximation/FunctionApproximation.hpp

    r1b1fa5 r1ba8a1  
    4040 * <a href="http://www.ics.forth.gr/~lourakis/levmar/index.html">LevMar</a>
    4141 * package.
     42 *
     43 * \section FunctionApproximation-details Details on the inner workings.
     44 *
     45 *  FunctionApproximation::operator() is the main function that performs the
     46 *  non-linear regression. It consists of the following steps:
     47 *  -# hand given (initial) parameters over to model.
     48 *  -# convert output vector to format suitable to levmar
     49 *  -# allocate memory for levmar to work in
     50 *  -# depending on whether the model is constrained or not and whether we
     51 *   have a derivative, we make use of various levmar functions with prepared
     52 *   parameters.
     53 *  -# memory is free'd and some final infos is given.
     54 *
     55 *  levmar needs to evaluate the model. To this end, FunctionApproximation has
     56 *  two functions whose signatures is such as to match with the one required
     57 *  by the levmar package. Hence,
     58 *  -# FunctionApproximation::LevMarCallback()
     59 *  -# FunctionApproximation::LevMarDerivativeCallback()
     60 *  are used as callbacks by levmar only.
     61 *  These hand over the current set of parameters to the model, then both bind
     62 *  FunctionApproximation::evaluate() and
     63 *  FunctionApproximation::evaluateDerivative(), respectively, and execute
     64 *  FunctionModel::operator() or FunctionModel::parameter_derivative(),
     65 *  respectively.
    4266 *
    4367 */
  • src/Potentials/CompoundPotential.hpp

    r1b1fa5 r1ba8a1  
    2323class TrainingData;
    2424
    25 /** CompoundPotential combines several FunctionModel's as one to allow for
    26  * simultaneous FunctionApproximation to a single fragment/graph.
     25/** CompoundPotential combines several EmipiricalPotential's into one
     26 * FunctionModel to allow for simultaneous FunctionApproximation to a single
     27 * fragment/graph.
    2728 *
    2829 * The CompoundPotential obtains a Graph as parameter to cstor and looks through
     
    3031 * matches. All of these are placed into an internal vector and used for
    3132 * fitting.
     33 *
     34 * The main work is then in operator() and parameter_derivative(), where the
     35 * contained set of models has to be evaluated one after the other:
     36 *
    3237 */
    3338class CompoundPotential :
  • src/documentation/constructs/potentials.dox

    r1b1fa5 r1ba8a1  
    7272 *    perform the fit.
    7373 *
     74 * \section potentials-fit-potential-action What happens in FitPotentialAction.
     75 *
     76 *  First, either a potential file is parsed via PotentialDeserializer or charges
     77 *  and a potential type from the given options. This is used to instantiate
     78 *  EmpiricalPotentials via the PotentialFactory, stored within the
     79 *  PotentialRegistry. This is the available set of potentials (without requiring
     80 *  any knowledge as to the nature of the fragment employed in fitting).
     81 *
     82 *  Second, the given fragment is used to get a suitable HomologyGraph from
     83 *  the World's HomologyContainer. This is given to a CompoundPotential, that in
     84 *  turn browses through the PotentialRegistry, picking out those
     85 *  EmpiricalPotential's that match with a subset of the FragmentNode's of the
     86 *  given graph. These are stored as a list of FunctionModel's within the
     87 *  CompoundPotential instance. Here comes the specific fragment into play,
     88 *  picking a subset from the available potentials.
     89 *
     90 *  Third, we need to setup the training data. For this we need vectors of input
     91 *  and output data that are obtained from the HomologyContainer with the
     92 *  HomologyGraph as key. The output vector in our case is simply a number
     93 *  (although the interface allows for more). The input vector is the set of
     94 *  distances. In order to pre-process the input data for the specific model
     95 *  a filter is required in the TrainingData's constructor. The purpose of the
     96 *  filter is to pick out the subset of distance arguments for each model one
     97 *  after the other and concatenate them to a list. On evaluation of the model
     98 *  this concatenated list of distances is given to the model and it may easily
     99 *  dissect the list and hand over each contained potential its subset of
     100 *  arguments. See Extractors for more information.
     101 *
     102 *  Afterwards, training may commence: The goal is to find a set of parameters
     103 *  for the model such that it as good as possible reproduces the output vector
     104 *  for a given input vector. This non-linear regression is contained in the
     105 *  levmar package and its functionality is wrapped in the FunctionApproximation
     106 *  class. An instance is initialized with both the gathered training data and
     107 *  the model containing a list of potentials. See
     108 *  [FunctionApproximation-details] for more details.
     109 *
     110 *  During the fitting procedure, first the derivatives of the model is checked
     111 *  for consistency, then the model is initialized with a sensible guess of
     112 *  starting parameters, and afterwards the Levenberg-Marquardt algorithm
     113 *  commences that makes numerous calls to evaluate the model and its derivative
     114 *  to find the minimum in the L2-norm.
     115 *
     116 *  This is done more than once as high-dimensional regression is sensititive the
     117 *  the starting values as there are possible numerous local minima. The lowest
     118 *  of the found minima is taken, either via a given threshold or the best of a
     119 *  given number of attempts.
     120 *
     121 *  Eventually, these parameters of the best model are streamed via
     122 *  PotentialSerializer back into a potential file. Each EmpiricalPotential in
     123 *  the CompoundPotential making up the whole model is also a
     124 *  SerializablePotential. Hence, each in turn writes a single line with its
     125 *  respective subset of parameters and particle types, describing this
     126 *  particular fit function.
     127 *
     128 * \section potentials-function-evaluation How does the model evaluation work
     129 *
     130 *  We now come to the question of how the model and its derivative are actually
     131 *  evaluated. We have an input vector from the training data and we have the
     132 *  model with a specific set of parameters.
     133 *
     134 *  FunctionModel is just an abstract interface that is implemented by the
     135 *  potential functions, such as CompoundPotential, that combines multiple
     136 *  potentials into a single function for fitting, or PairPotential_Harmonic,
     137 *  that is a specific fit function for harmonic bonds.
     138 *
     139 *  The main issue with the evaluation is picking the right set of distances from
     140 *  ones given in the input vector and feed it to each potential contained in
     141 *  CompoundPotential. Note that the distances have already been prepared by
     142 *  the TrainingData instantiation.
     143 *
     144 *  Initially, the HomologyGraph only contains a list of configurations of a
     145 *  specific fragments (i.e. the position of each atom in the fragment) and an
     146 *  energy value. These first have to be converted into distances.
     147 *
     148 *
    74149 * \section potentials-howto-use Howto use the potentials
    75150 *
Note: See TracChangeset for help on using the changeset viewer.