Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkGeneralizedLinearModel.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef mitkGeneralizedLinearModel_h
18 #define mitkGeneralizedLinearModel_h
19 
20 #include <MitkCLImportanceWeightingExports.h>
21 
22 #include <vnl/vnl_matrix.h>
23 #include <vnl/vnl_vector.h>
24 
25 namespace mitk
26 {
34  class MITKCLIMPORTANCEWEIGHTING_EXPORT GeneralizedLinearModel
35  {
36  public:
47  GeneralizedLinearModel (const vnl_matrix<double> &xData, const vnl_vector<double> &yData, bool addConstantColumn=true);
48 
60  double Predict(const vnl_vector<double> &c);
61 
73  vnl_vector<double> Predict(const vnl_matrix<double> &x);
74 
83  vnl_vector<double> ExpMu(const vnl_matrix<double> &x);
84 
88  vnl_vector<double> B();
89 
90  private:
91 
92  // Estimates the rank of the matrix and creates a permutation vector so
93  // that the most important columns are first. Depends on a QR-algorithm.
94  void EstimatePermutation(const vnl_matrix<double> &xData);
95 
96 #pragma warning(disable: 4251)
97  vnl_vector<unsigned int> m_Permutation; // Holds a permutation matrix which is used during calculation of B
98  vnl_vector<double> m_B; // B-Values. Linear componentn of the model.
99  bool m_AddConstantColumn; // If true, a constant value is added to each row
100 // int m_Rank; // The estimated input rank of the matrix.
101  };
102 }
103 
104 #endif //mitkGeneralizedLInearModel_h
DataCollection - Class to facilitate loading/accessing structured data.
Generalized Linear Model that allows linear models for non-gaussian data.