Changeset c16cce


Ignore:
Timestamp:
Feb 27, 2013, 12:39:33 PM (12 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:
1edc87
Parents:
3e236e
git-author:
Frederik Heber <heber@…> (12/06/12 14:16:57)
git-committer:
Frederik Heber <heber@…> (02/27/13 12:39:33)
Message:

Training fragments are sorted by error to fit value into a map.

  • this allows checking which fragments are the "worst" described. The numbering is checked to coincide with BondFragment.. files numbering.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/LevMartester.cpp

    r3e236e rc16cce  
    4343#include <boost/bind.hpp>
    4444#include <boost/filesystem.hpp>
     45#include <boost/foreach.hpp>
    4546#include <boost/function.hpp>
    4647#include <boost/program_options.hpp>
     
    277278      }
    278279
    279 //      LOG(0, "RESULT: " << *model << ".");
    280 //
     280      // create a map of each fragment with error.
     281      typedef std::multimap< double, size_t > WorseFragmentMap_t;
     282      WorseFragmentMap_t WorseFragmentMap;
     283      HomologyContainer::range_t fragmentrange = homologies.getHomologousGraphs(graph);
     284      // fragments make it into the container in reversed order, hence count from top down
     285      size_t index= std::distance(fragmentrange.first, fragmentrange.second)-1;
     286      for (HomologyContainer::const_iterator iter = fragmentrange.first;
     287          iter != fragmentrange.second;
     288          ++iter) {
     289        const Fragment& fragment = iter->second.first;
     290        const double &energy = iter->second.second;
     291
     292        // create arguments from the fragment
     293        FunctionModel::extractor_t extractor = model->getFragmentSpecificExtractor(charges);
     294        FunctionModel::arguments_t args = extractor(fragment, 1);
     295
     296        // calculate value from potential
     297        const double fitvalue = (*model)(args)[0];
     298
     299        // insert difference into map
     300        const double error = fabs(energy - fitvalue);
     301        WorseFragmentMap.insert( std::make_pair( error, index-- ) );
     302
     303        {
     304          // give only the distances in the debugging text
     305          std::stringstream streamargs;
     306          BOOST_FOREACH (argument_t arg, args) {
     307            streamargs << " " << arg.distance*AtomicLengthToAngstroem;
     308          }
     309          LOG(2, "DEBUG: frag.#" << index+1 << "'s error is |" << energy << " - " << fitvalue
     310              << "| = " << error << " for args " << streamargs.str() << ".");
     311        }
     312      }
     313      LOG(0, "RESULT: WorstFragmentMap " << WorseFragmentMap << ".");
     314
    281315      params = model->getParameters();
    282316
Note: See TracChangeset for help on using the changeset viewer.