Skip to content

Commit

Permalink
Take S.H.'s review into account
Browse files Browse the repository at this point in the history
Apply suggestions from code review
Co-authored-by: Sofiane Haddad <sofianehaddad@users.noreply.github.com>
  • Loading branch information
mbaudin47 committed May 3, 2024
1 parent 8d94f0f commit 8f87552
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @brief Validation of a functional chaos expansion
*
* Copyright 2005-2023 Airbus-EDF-IMACS-ONERA-Phimeca
* Copyright 2005-2024 Airbus-EDF-IMACS-ONERA-Phimeca
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -141,7 +141,13 @@ Sample FunctionalChaosValidation::ComputeMetamodelLeaveOneOutPredictions(
const Point diagonalH = leastSquaresMethod.getHDiag();
for (UnsignedInteger j = 0; j < outputDimension; ++j)
for (UnsignedInteger i = 0; i < sampleSize; ++i)
{
if (diagonalH[i] == 1.0)
throw InvalidArgumentException(HERE)
<< "The leverage of observation #" << i
<< " is equal to 1. Cannot divide by zero.";
cvPredictions(i, j) = outputSample(i, j) - residualsSample(i, j) / (1.0 - diagonalH[i]);
} // For observations indices
return cvPredictions;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @brief The validation of a chaos expansion
*
* Copyright 2005-2023 Airbus-EDF-IMACS-ONERA-Phimeca
* Copyright 2005-2024 Airbus-EDF-IMACS-ONERA-Phimeca
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -48,7 +48,7 @@ public:
FunctionalChaosValidation();

/** Parameter constructor */
FunctionalChaosValidation(const FunctionalChaosResult & chaosResult);
explicit FunctionalChaosValidation(const FunctionalChaosResult & chaosResult);

/** Parameter constructor */
FunctionalChaosValidation(const FunctionalChaosResult & chaosResult,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @brief The linear model validation
*
* Copyright 2005-2023 Airbus-EDF-IMACS-ONERA-Phimeca
* Copyright 2005-2024 Airbus-EDF-IMACS-ONERA-Phimeca
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* @brief The linear model validation
*
* Copyright 2005-2023 Airbus-EDF-IMACS-ONERA-Phimeca
* Copyright 2005-2024 Airbus-EDF-IMACS-ONERA-Phimeca
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -33,7 +33,7 @@ BEGIN_NAMESPACE_OPENTURNS
/**
* @class LinearModelValidation
*
* The linear model analysis
* The linear model validation
*/

class OT_API LinearModelValidation :
Expand All @@ -49,12 +49,12 @@ public:
explicit LinearModelValidation(const LinearModelResult & linearModelResult);

/** Parameter constructor based on result and leave-one-out */
explicit LinearModelValidation(const LinearModelResult & linearModelResult,
const LeaveOneOutSplitter & splitter);
LinearModelValidation(const LinearModelResult & linearModelResult,
const LeaveOneOutSplitter & splitter);

/** Parameter constructor based on result and K-Fold */
explicit LinearModelValidation(const LinearModelResult & linearModelResult,
const KFoldSplitter & splitter);
LinearModelValidation(const LinearModelResult & linearModelResult,
const KFoldSplitter & splitter);

/** Virtual constructor */
LinearModelValidation * clone() const override;
Expand Down

0 comments on commit 8f87552

Please sign in to comment.