[ GAMB | Source | Keywords | Summary | Ancestors | All Members | Descendants ]
public: | |
// Constructors | |
WeightedAttribute(); | |
WeightedAttribute(float pref); | |
WeightedAttribute(float pref, float weight); | |
WeightedAttribute(const AttributeT& att, const Func& func); | |
WeightedAttribute(const AttributeT& att, const Func& func, float pref); | |
WeightedAttribute(const AttributeT& att, const Func& func, float pref, float wght); | |
WeightedAttribute(const ParticleAttribute< AttributeT,Func>& new_att, float pref); | |
WeightedAttribute(const ParticleAttribute< AttributeT,Func>& new_att, float pref, float wght); | |
WeightedAttribute(const WeightedAttribute& watt); | |
// Information Retrieving | |
float | Pref() const ; |
float | Weight() const ; |
// Operators | |
float | operator()(const AttributeT& attrib); |
float | operator()(const AttributeT& attrib, float norm_pref); |
float | operator()(const AttributeT& att1, const AttributeT& att2); |
float | operator()(const AttributeT& att1, const AttributeT& att2, float norm_pref); |
bool | operator< (const WeightedAttribute& prt) const; |
bool | operator>(const WeightedAttribute& prt) const; |
// apply functions | |
float | apply_all_sum_weighted(const vector< AttributeT>& list); |
float | apply_circ_sum_weighted(const vector< AttributeT>& list); |
float | apply_sum_weights(const vector< AttributeT>& list1, const vector< AttributeT>& list2); |
protected: |
Back to the top of WeightedAttribute
Copyright: SAMBA group, Tel-Aviv Univ. Israel 1998
Back to the top of WeightedAttribute
Back to the top of WeightedAttribute
This class should be used when you want to weight several attribute on preference bases. It has an applying operator() the same as particle attribute but it returns a weighted measure i.e. the measure function applied on both attributes times the weight. Please notice if you invoke this class with no information it will receive the max preference (100). The default weighting is 1.0 of course. You can apply the fmeasure function inherited from ParticleAttribute, in many ways, please note the different configuration of the operator(). Also one can work on a vector of attributes or two vectors of attribute and get a weighted information from them. One function measure all the attribute couples in a given vector. One function measures each attribute in the vector against its right neighbour (the beginning of the vector being the right neighbour of the end of the vector). One function measure the attributes vector vs. vector according to their place until the end of the shorter of the two.
Back to the top of WeightedAttribute
#include <Vector3.h> #include <math.h> class VectorDist { public: float operator()(const Vector3& vec1, const Vector3& vec2) { return vec1.dist(vec2); }; class VectorProd { public: float operator()(const Vector3& vec1, const Vector3& vec2) { return vec1*vec2; }; class AngleBetween { public: float operator()(const Vector3& vec1, const Vector3& vec2) { return (vec1^vec2); };
Now for invoking it you should do something like:
#include "WeightedAttribute.h" #include "Euclidean.h" #include "SurfacePoint.h" #include "macros.h" #include <vector> struct MatchValue {
here we make the difference in place twice the impact the normals difference but if the normal are more then pi from each other we return a negative weight
WeightedAttribute<Vector3, VecDistance> place_diff(5,2); WeightedAttribute<Vector3, VecProduct> normal_diff(6); float operator()(const SurfacePoint& pnt1, const SurfacePoint& pnt2) { if (normal_diff(pnt1.nrom(), pnt2.norm()) < 0) return -1; return (place_diff(pnt1.place(), pnt2.place()) +normal_diff(pnt1.nrom(), pnt2.norm()); } };
Now assume we have a class called Hydro that given two types of residues return +1 if they are both hydrophobic -1 if they are both hydrophilic and 0 if they are neither. We can define a general weighting on a match list :
#include <vector> #include <RigidTrans3.h> WeightedAttribute<SurfacePoint, MatchValue> match_euclid(5,6); WeightedAttribute<SurfacePoint, Hydro> match_hydrophobicity(4, 2); float calculate_fit(const vector<SurfaceParticle>& list1, const vector<SurfaceParticle>& list2) { return match_euclid.apply_sum_weights(list, list2) +match_hydrophobicity(list,list2); }
Back to the top of WeightedAttribute
WeightedAttribute();
Empty Constructor
WeightedAttribute();
Back to the top of WeightedAttribute
WeightedAttribute(float pref);
Constructor: Empty in the ParticleAttribute constructor, preference
as requested and default weight is 1.0
WeightedAttribute(float pref);
Back to the top of WeightedAttribute
WeightedAttribute(float pref, float weight);
Constructor: Empty in the ParticleAttribute constructor, preference
as requested and weight as requested
WeightedAttribute(float pref, float weight);
Back to the top of WeightedAttribute
WeightedAttribute(const AttributeT& att, const Func& func);
Weight=1.0 Preference=MAX ParticleAttribute built on parameters
WeightedAttribute(const AttributeT& att, const Func& func);
Back to the top of WeightedAttribute
WeightedAttribute(const AttributeT& att, const Func& func, float pref);
Same as above on requested preference
WeightedAttribute(const AttributeT& att, const Func& func, float pref);
Back to the top of WeightedAttribute
WeightedAttribute(const AttributeT& att, const Func& func, float pref, float wght);
Same as above with also requested weight
WeightedAttribute(const AttributeT& att, const Func& func, float pref, float wght);
Back to the top of WeightedAttribute
WeightedAttribute(const ParticleAttribute< AttributeT,Func>& new_att, float pref);
Constructor with Particle Attribute copy constructor
and float preference default weight 1.0
WeightedAttribute(const ParticleAttribute< AttributeT,Func>& new_att, float pref);
Back to the top of WeightedAttribute
WeightedAttribute(const ParticleAttribute< AttributeT,Func>& new_att, float pref, float wght);
Constructor with Particle Attribute copy constructor
and float preference and a given weight
WeightedAttribute(const ParticleAttribute< AttributeT,Func>& new_att, float pref, float wght);
Back to the top of WeightedAttribute
WeightedAttribute(const WeightedAttribute& watt);
Copy Constructor
WeightedAttribute(const WeightedAttribute& watt);
Back to the top of WeightedAttribute
float Pref() const ;
Returning the preference
float Pref() const ;
Function is currently defined inline.
Back to the top of WeightedAttribute
float Weight() const ;
Returning the associated weight
float Weight() const ;
Function is currently defined inline.
Back to the top of WeightedAttribute
float operator()(const AttributeT& attrib);
Applying the weighted attribute measure against ourselves, meaning:
Func(our_att,att)*weight
float operator()(const AttributeT& attrib);
Back to the top of WeightedAttribute
float operator()(const AttributeT& attrib, float norm_pref);
Applying the weighted attribute measure against ourselves
with preference as a normalizing constant
Func(our_att, att)*weight*(preference/norm_pref)
float operator()(const AttributeT& attrib, float norm_pref);
Back to the top of WeightedAttribute
float operator()(const AttributeT& att1, const AttributeT& att2);
Applying the weighted attribute measure, meaning:
Func(att1, att2)*weight
float operator()(const AttributeT& att1, const AttributeT& att2);
Back to the top of WeightedAttribute
float operator()(const AttributeT& att1, const AttributeT& att2, float norm_pref);
Applying the weighted attribute measure with preference
as a normalizing constant, meaning:
Func(att1, att2)*weight*(preference/nor_pref)
float operator()(const AttributeT& att1, const AttributeT& att2, float norm_pref);
Back to the top of WeightedAttribute
bool operator< (const WeightedAttribute& prt) const;
Sorting only according to the preference
bool operator< (const WeightedAttribute& prt) const;
Back to the top of WeightedAttribute
bool operator>(const WeightedAttribute& prt) const;
Sorting only according to the preference
bool operator>(const WeightedAttribute& prt) const;
Back to the top of WeightedAttribute
float apply_all_sum_weighted(const vector< AttributeT>& list);
in this function we do the following
weight all the attributes in the list one against the other using the
fun held in weighted attribute. the cumulative function is summation
might want to borden this where the cumulative function is something else
float apply_all_sum_weighted(const vector< AttributeT>& list);
Back to the top of WeightedAttribute
float apply_circ_sum_weighted(const vector< AttributeT>& list);
The same only each attribute is compared with its consecutive neighbour
meaning : (att1, att2) + ...+ (att_i,att_i+1) + ... + (att_n, att1)
the notice about the cumulative function is the same as before
float apply_circ_sum_weighted(const vector< AttributeT>& list);
Back to the top of WeightedAttribute
float apply_sum_weights(const vector< AttributeT>& list1, const vector< AttributeT>& list2);
the same as above only operating on two lists assuming their length
is the same comparing every time list1(i-th element) with
list2(i-th element)
float apply_sum_weights(const vector< AttributeT>& list1, const vector< AttributeT>& list2);
Back to the top of WeightedAttribute
public: | ||
---|---|---|
// Info and updates | ||
Func | measure() const ; | |
void | updateMeasureFunc(const Func& new_measure); | |
// Operators | ||
float | operator()(const AttributeT& att1, const AttributeT& att2); | |
bool | operator==(const ParticleAttribute& att); | |
// Information Retrieving | ||
float | Pref() const ; | |
float | Weight() const ; | |
// Operators | ||
float | operator()(const AttributeT& attrib); | |
float | operator()(const AttributeT& attrib, float norm_pref); | |
float | operator()(const AttributeT& att1, const AttributeT& att2, float norm_pref); | |
bool | operator< (const WeightedAttribute& prt) const; | |
bool | operator>(const WeightedAttribute& prt) const; | |
// apply functions | ||
float | apply_all_sum_weighted(const vector< AttributeT>& list); | |
float | apply_circ_sum_weighted(const vector< AttributeT>& list); | |
float | apply_sum_weights(const vector< AttributeT>& list1, const vector< AttributeT>& list2); | |
protected: |
Back to the top of WeightedAttribute
Back to the top of WeightedAttribute
Back to the top of WeightedAttribute
Report problems to jkotula@unimax.com