IMP  2.1.0
The Integrative Modeling Platform
ChiSquareMetric.h
Go to the documentation of this file.
1 /**
2  * \file ChiSquareMetric.h
3  * \brief Chi2 Metric
4  *
5  * Copyright 2013 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPSTATISTICS_CHI_SQUARE_METRIC_H
9 #define IMPSTATISTICS_CHI_SQUARE_METRIC_H
10 
11 #include <IMP/statistics/statistics_config.h>
12 #include <IMP/statistics/Metric.h>
13 #include <IMP/base/object_macros.h>
14 #include <IMP/base/types.h>
15 #include <IMP/base/Pointer.h>
16 
17 IMPSTATISTICS_BEGIN_NAMESPACE
18 
19 //! Compute the distance between two configurations using chi2
20 /** Each configurations is defined by a list of data points and
21  * a list of standard deviations. The distance between the two
22  * configurations is defined as the chi2.
23  */
24 class IMPSTATISTICSEXPORT ChiSquareMetric : public Metric {
25 
26  //! list of weights
27  Floats weight_;
28  //! list of experimental data points
29  Floats data_exp_;
30  //! list of normalizations
31  Floats norm_;
32  //! type of constructor
33  int constr_type_;
34  //! list of lists of data points
35  std::vector<Floats> datas_;
36  //! list of lists of experimental data points
37  std::vector<Floats> stddev_;
38 
39  //! get chi2 between two configurations
40  double get_chisquare(unsigned i, unsigned j) const;
41  //! get scalar chi2 between two configurations
42  double get_scalarchisquare(unsigned i, unsigned j) const;
43 
44  public:
45 
46  ChiSquareMetric(Floats data_exp, int constr_type = 0);
47  //! add a configuration, defined by a list of data points,
48  //! a list of standard deviations, and one weight.
49  void add_configuration(Floats data, Floats stddev, double weight = 1.0);
50  //! get the list of data points for the i-th configuration
51  Floats get_data(unsigned i) const;
52  //! get the list of standard deviations for the i-th configuration
53  Floats get_standard_deviation(unsigned i) const;
54  //! get the weight for the i-th configuration
55  double do_get_weight(unsigned i) const IMP_OVERRIDE;
56  //! get chi2 from experimental data for the i-th configuration
57  double get_chi_square_experimental(unsigned i) const;
58 
59  double get_distance(unsigned int i, unsigned int j) const IMP_OVERRIDE;
60  unsigned int get_number_of_items() const IMP_OVERRIDE;
61 
63 };
64 
65 IMPSTATISTICS_END_NAMESPACE
66 
67 #endif /* IMPSTATISTICS_CHI_SQUARE_METRIC_H */
Basic types used by IMP.
A nullptr-initialized pointer to an IMP Object.
virtual double do_get_weight(unsigned int i) const
By default return 1.0.
Definition: Metric.h:29
Compute the distance between two configurations using chi2.
double get_distance(const Plane3D &pln, const Vector3D &p)
Return the distance between a plane and a point in 3D.
Definition: Plane3D.h:68
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Various general useful macros for IMP.
Cluster sets of points.
Store data to be clustered for distance metric based algorithms.
Definition: Metric.h:25