1 //                                               -*- C++ -*-
2 /**
3  *  @brief Corrected implicit leave-one-out cross validation
4  *
5  *  Copyright 2005-2021 Airbus-EDF-IMACS-ONERA-Phimeca
6  *
7  *  This library is free software: you can redistribute it and/or modify
8  *  it under the terms of the GNU Lesser General Public License as published by
9  *  the Free Software Foundation, either version 3 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This library is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU Lesser General Public License for more details.
16  *
17  *  You should have received a copy of the GNU Lesser General Public License
18  *  along with this library.  If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 #ifndef OPENTURNS_CORRECTEDLEAVEONEOUT_HXX
22 #define OPENTURNS_CORRECTEDLEAVEONEOUT_HXX
23 
24 #include "openturns/FittingAlgorithmImplementation.hxx"
25 
26 BEGIN_NAMESPACE_OPENTURNS
27 
28 
29 
30 /**
31  * @class CorrectedLeaveOneOut
32  *
33  * Corrected implicit leave-one-out cross validation
34  */
35 class OT_API CorrectedLeaveOneOut
36   : public FittingAlgorithmImplementation
37 {
38   CLASSNAME
39 public:
40   typedef Collection<Function> FunctionCollection;
41 
42   /** Default constructor */
43   CorrectedLeaveOneOut();
44 
45   /** Virtual constructor */
46   CorrectedLeaveOneOut * clone() const override;
47 
48   /** String converter */
49   String __repr__() const override;
50 
51   /** Perform cross-validation */
52   Scalar run(const Sample & x,
53              const Sample & y,
54              const Point & weight,
55              const FunctionCollection & psi,
56              const Indices & indices) const override;
57 
58 #ifndef SWIG
59   Scalar run(const Sample & y,
60              const Point & weight,
61              const Indices & indices,
62              const DesignProxy & proxy) const override;
63 
64   Scalar run(LeastSquaresMethod & method,
65              const Sample & y) const override;
66 #endif
67 
68   /** Method save() stores the object through the StorageManager */
69   void save(Advocate & adv) const override;
70 
71   /** Method load() reloads the object from the StorageManager */
72   void load(Advocate & adv) override;
73 
74 }; /* class CorrectedLeaveOneOut */
75 
76 
77 END_NAMESPACE_OPENTURNS
78 
79 #endif /* OPENTURNS_CORRECTEDLEAVEONEOUT_HXX */
80