PLearn 0.1
|
The first sentence should be a BRIEF DESCRIPTION of what the class does. More...
#include <RunICPVariable.h>
Public Member Functions | |
RunICPVariable () | |
### declare public option fields (such as build options) here Start your comments with Doxygen-compatible comments such as //! | |
RunICPVariable (Variable *input) | |
Constructor initializing from input variable. | |
void | setScoreLayer (ScoreLayerVariable *the_score_layer) |
Set this variable's score layer. | |
void | addTemplate (PP< ChemicalICP > icp_aligner, PP< Molecule > mol_template, Var mol_coordinates) |
Declare a new template. | |
VarArray & | getPathsToResize (int i) |
Accessor to 'paths_to_resize[i]'. | |
virtual void | recomputeSize (int &l, int &w) const |
Recomputes the length l and width w that this variable should have, according to its parent variables. | |
virtual void | fprop () |
Nothing to do by default. | |
virtual void | bprop () |
Nothing to do by default. | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual RunICPVariable * | deepCopy (CopiesMap &copies) const |
virtual void | build () |
Post-constructor. | |
virtual void | makeDeepCopyFromShallowCopy (CopiesMap &copies) |
Transforms a shallow copy into a deep copy. | |
Static Public Member Functions | |
static string | _classname_ () |
RunICPVariable. | |
static OptionList & | _getOptionList_ () |
static RemoteMethodMap & | _getRemoteMethodMap_ () |
static Object * | _new_instance_for_typemap_ () |
static bool | _isa_ (const Object *o) |
static void | _static_initialize_ () |
static const PPath & | declaringFile () |
Public Attributes | |
TVec< PP< ChemicalICP > > | icp_aligners |
The ICP aligners. | |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Static Protected Member Functions | |
static void | declareOptions (OptionList &ol) |
Declares the class options. | |
Protected Attributes | |
TVec< PP< Molecule > > | templates |
The molecule templates. | |
VarArray | molecule_coordinates |
The i-th element is the variable that must contain the coordinates of the nearest points of the aligned molecule, after the i-th ICP alignement. | |
TVec< VarArray > | paths_to_resize |
The i-th element is the propagation path from ICP variables to the score output for the i-th ICP. | |
ScoreLayerVariable * | score_layer |
A ScoreLayerVariable that can give us a Molecule from an input id. | |
Private Types | |
typedef UnaryVariable | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
The first sentence should be a BRIEF DESCRIPTION of what the class does.
* RunICPVariable * Place the rest of the class programmer documentation here. Doxygen supports Javadoc-style comments. See http://www.doxygen.org/manual.html
Definition at line 65 of file RunICPVariable.h.
typedef UnaryVariable PLearn::RunICPVariable::inherited [private] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 67 of file RunICPVariable.h.
PLearn::RunICPVariable::RunICPVariable | ( | ) |
### declare public option fields (such as build options) here Start your comments with Doxygen-compatible comments such as //!
Default constructor.
Definition at line 57 of file RunICPVariable.cc.
: score_layer(0) { }
PLearn::RunICPVariable::RunICPVariable | ( | Variable * | input | ) |
Constructor initializing from input variable.
Definition at line 62 of file RunICPVariable.cc.
: inherited(input, 0, 3), score_layer(0) {}
string PLearn::RunICPVariable::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 52 of file RunICPVariable.cc.
OptionList & PLearn::RunICPVariable::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 52 of file RunICPVariable.cc.
RemoteMethodMap & PLearn::RunICPVariable::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 52 of file RunICPVariable.cc.
Reimplemented from PLearn::UnaryVariable.
Definition at line 52 of file RunICPVariable.cc.
Object * PLearn::RunICPVariable::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 52 of file RunICPVariable.cc.
StaticInitializer RunICPVariable::_static_initializer_ & PLearn::RunICPVariable::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 52 of file RunICPVariable.cc.
void PLearn::RunICPVariable::addTemplate | ( | PP< ChemicalICP > | icp_aligner, |
PP< Molecule > | mol_template, | ||
Var | mol_coordinates | ||
) |
Declare a new template.
The 'mol_template' argument is a pointer to the template. The 'mol_coordinates' argument is a pointer to the variable that will be used to store the coordinates of the nearest points in the molecule, after ICP has been run.
Definition at line 70 of file RunICPVariable.cc.
References PLearn::TVec< T >::append(), icp_aligners, molecule_coordinates, PLearn::Variable::sizeprop(), and templates.
{ icp_aligners.append(icp_aligner); templates.append(mol_template); molecule_coordinates.append(mol_coordinates); this->sizeprop(); // Resize this variable. }
void PLearn::RunICPVariable::bprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 147 of file RunICPVariable.cc.
{
// We do not backprop anything in this Variable.
}
void PLearn::RunICPVariable::build | ( | ) | [virtual] |
Post-constructor.
The normal implementation should call simply inherited::build(), then this class's build_(). This method should be callable again at later times, after modifying some option fields to change the "architecture" of the object.
Reimplemented from PLearn::UnaryVariable.
Definition at line 161 of file RunICPVariable.cc.
References PLearn::UnaryVariable::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::RunICPVariable::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::UnaryVariable.
Definition at line 211 of file RunICPVariable.cc.
Referenced by build().
{ // ### This method should do the real building of the object, // ### according to set 'options', in *any* situation. // ### Typical situations include: // ### - Initial building of an object from a few user-specified options // ### - Building of a "reloaded" object: i.e. from the complete set of // ### all serialised options. // ### - Updating or "re-building" of an object after a few "tuning" // ### options have been modified. // ### You should assume that the parent class' build_() has already been // ### called. }
string PLearn::RunICPVariable::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 52 of file RunICPVariable.cc.
void PLearn::RunICPVariable::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declares the class options.
Reimplemented from PLearn::UnaryVariable.
Definition at line 191 of file RunICPVariable.cc.
References PLearn::UnaryVariable::declareOptions().
{ // ### Declare all of this object's options here. // ### For the "flags" of each option, you should typically specify // ### one of OptionBase::buildoption, OptionBase::learntoption or // ### OptionBase::tuningoption. If you don't provide one of these three, // ### this option will be ignored when loading values from a script. // ### You can also combine flags, for example with OptionBase::nosave: // ### (OptionBase::buildoption | OptionBase::nosave) // ### ex: // declareOption(ol, "myoption", &RunICPVariable::myoption, // OptionBase::buildoption, // "Help text describing this option"); // ... // Now call the parent class' declareOptions inherited::declareOptions(ol); }
static const PPath& PLearn::RunICPVariable::declaringFile | ( | ) | [inline, static] |
RunICPVariable * PLearn::RunICPVariable::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 52 of file RunICPVariable.cc.
void PLearn::RunICPVariable::fprop | ( | ) | [virtual] |
Nothing to do by default.
Reimplemented from PLearn::UnaryVariable.
Definition at line 105 of file RunICPVariable.cc.
References PLearn::ScoreLayerVariable::getMolecule(), i, icp_aligners, PLearn::UnaryVariable::input, PLearn::TMat< T >::length(), PLearn::TVec< T >::length(), PLearn::Variable::matValue, molecule_coordinates, PLearn::ScoreLayerVariable::normalize_by_n_features, paths_to_resize, PLASSERT, PLearn::productTranspose(), score_layer, PLearn::ScoreLayerVariable::setScalingCoefficient(), PLearn::TMat< T >::subMat(), and templates.
{ PLASSERT( score_layer ); // We obtain the molecule from the input variable. PP<Molecule> molecule = score_layer->getMolecule(input->value[0]); // Launch all ICPs. int index_coord = 0; for (int i = 0; i < icp_aligners.length(); i++) { // Run ICP. PP<ChemicalICP> icp = icp_aligners[i]; PP<Molecule> template_mol = templates[i]; icp->setMolecule(molecule); icp->run(); // Modify score normalization coefficient if needed. if (score_layer->normalize_by_n_features) score_layer->setScalingCoefficient(i, real(1.0 / (template_mol->n_points() * (3 + icp->used_template_features.width())))); // Some variables will need to be resized after ICP has been run. paths_to_resize[i].sizeprop(); // Compute the aligned coordinates of the template and store them in // this variable. Mat template_coords = this->matValue.subMat(index_coord, 0, template_mol->n_points(), 3); index_coord += template_mol->n_points(); productTranspose(template_coords, template_mol->coordinates, icp->rotation); template_coords += icp->translation; // Obtain the coordinates of the nearest neighbors in the aligned // molecule. Mat molecule_coords = molecule_coordinates[i]->matValue; PLASSERT( molecule_coords.length() == template_mol->n_points() ); for (int k = 0; k < template_mol->n_points(); k++) { int neighbor = icp->matching[k]; molecule_coords(k) << molecule->coordinates(neighbor); } } }
OptionList & PLearn::RunICPVariable::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 52 of file RunICPVariable.cc.
OptionMap & PLearn::RunICPVariable::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 52 of file RunICPVariable.cc.
Accessor to 'paths_to_resize[i]'.
Definition at line 228 of file RunICPVariable.cc.
References i, PLearn::TVec< T >::length(), paths_to_resize, and PLearn::TVec< T >::resize().
Referenced by PLearn::ScoreLayerVariable::build_().
{ if (i >= paths_to_resize.length()) paths_to_resize.resize(i + 1); return paths_to_resize[i]; }
RemoteMethodMap & PLearn::RunICPVariable::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::UnaryVariable.
Definition at line 52 of file RunICPVariable.cc.
void PLearn::RunICPVariable::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Transforms a shallow copy into a deep copy.
Reimplemented from PLearn::UnaryVariable.
Definition at line 167 of file RunICPVariable.cc.
References PLearn::deepCopyField(), icp_aligners, PLearn::UnaryVariable::makeDeepCopyFromShallowCopy(), molecule_coordinates, paths_to_resize, score_layer, and templates.
{ inherited::makeDeepCopyFromShallowCopy(copies); // ### Call deepCopyField on all "pointer-like" fields // ### that you wish to be deepCopied rather than // ### shallow-copied. // ### ex: // deepCopyField(trainvec, copies); // To be deeped copied deepCopyField(icp_aligners, copies); deepCopyField(templates,copies); deepCopyField(molecule_coordinates,copies); deepCopyField(paths_to_resize, copies); deepCopyField(score_layer, copies); // ### If you want to deepCopy a Var field: // varDeepCopyField(somevariable, copies); // ### Remove this line when you have fully implemented this method. // PLERROR("RunICPVariable::makeDeepCopyFromShallowCopy not fully (correctly) implemented yet!"); }
Recomputes the length l and width w that this variable should have, according to its parent variables.
This is used for ex. by sizeprop() The default version stupidly returns the current dimensions, so make sure to overload it in subclasses if this is not appropriate.
Reimplemented from PLearn::Variable.
Definition at line 94 of file RunICPVariable.cc.
References i, PLearn::TVec< T >::length(), and templates.
void PLearn::RunICPVariable::setScoreLayer | ( | ScoreLayerVariable * | the_score_layer | ) |
Set this variable's score layer.
Definition at line 238 of file RunICPVariable.cc.
References score_layer.
{ score_layer = the_score_layer; }
Reimplemented from PLearn::UnaryVariable.
Definition at line 124 of file RunICPVariable.h.
The ICP aligners.
Definition at line 72 of file RunICPVariable.h.
Referenced by addTemplate(), fprop(), and makeDeepCopyFromShallowCopy().
VarArray PLearn::RunICPVariable::molecule_coordinates [protected] |
The i-th element is the variable that must contain the coordinates of the nearest points of the aligned molecule, after the i-th ICP alignement.
This variable is updated during fprop().
Definition at line 142 of file RunICPVariable.h.
Referenced by addTemplate(), fprop(), and makeDeepCopyFromShallowCopy().
TVec<VarArray> PLearn::RunICPVariable::paths_to_resize [protected] |
The i-th element is the propagation path from ICP variables to the score output for the i-th ICP.
All variables in this propagation path are resized after the ICP has been run, in order to ensure the correctness of all sizes.
Definition at line 148 of file RunICPVariable.h.
Referenced by fprop(), getPathsToResize(), and makeDeepCopyFromShallowCopy().
ScoreLayerVariable* PLearn::RunICPVariable::score_layer [protected] |
A ScoreLayerVariable that can give us a Molecule from an input id.
This is a raw C++ pointer to avoid PP cycles.
Definition at line 159 of file RunICPVariable.h.
Referenced by fprop(), makeDeepCopyFromShallowCopy(), and setScoreLayer().
TVec< PP<Molecule> > PLearn::RunICPVariable::templates [protected] |
The molecule templates.
Definition at line 136 of file RunICPVariable.h.
Referenced by addTemplate(), fprop(), makeDeepCopyFromShallowCopy(), and recomputeSize().