Change to ConvTo in lars

Signed-off-by: Omar Shrit <omar@avontech.fr>
This commit is contained in:
Omar Shrit
2024-01-30 22:21:20 +01:00
parent 7225f5457e
commit 251202b0f5
+6 -6
View File
@@ -697,7 +697,7 @@ LARS<ModelMatType>::Train(const MatType& matX,
// This is equivalent to the above 5 lines.
arma::Col<ElemType> newGramCol = matGram->elem(
changeInd * dataRef.n_cols +
arma::conv_to<arma::uvec>::from(activeSet));
ConvTo<arma::uvec>::from(activeSet));
CholeskyInsert((*matGram)(changeInd, changeInd), newGramCol);
}
@@ -1084,7 +1084,7 @@ inline void LARS<ModelMatType>::SelectBeta(
// However, we may need to compute the active set.
if (i != lambdaPath.size() - 1)
{
selectedActiveSet = arma::conv_to<std::vector<size_t>>::from(
selectedActiveSet = ConvTo<std::vector<size_t>>::from(
arma::find(betaPath[i] != 0));
}
@@ -1136,7 +1136,7 @@ inline void LARS<ModelMatType>::SelectBeta(
}
// Compute the active set of variables.
selectedActiveSet = arma::conv_to<std::vector<size_t>>::from(
selectedActiveSet = ConvTo<std::vector<size_t>>::from(
arma::find(selectedBeta != 0));
}
@@ -1346,7 +1346,7 @@ void LARS<ModelMatType>::serialize(Archive& ar, const uint32_t version)
// Older versions stored matGramInternal as type arma::mat.
arma::mat matGramInternalTmp;
ar(cereal::make_nvp("matGramInternal", matGramInternalTmp));
matGramInternal = arma::conv_to<ModelMatType>::from(matGramInternalTmp);
matGramInternal = ConvTo<ModelMatType>::from(matGramInternalTmp);
}
else
{
@@ -1366,7 +1366,7 @@ void LARS<ModelMatType>::serialize(Archive& ar, const uint32_t version)
// double/arma::mat and converts as needed.
arma::mat matUtriCholFactorTmp;
ar(cereal::make_nvp("matUtriCholFactor", matUtriCholFactorTmp));
matUtriCholFactor = arma::conv_to<ModelMatType>::from(matUtriCholFactorTmp);
matUtriCholFactor = ConvTo<ModelMatType>::from(matUtriCholFactorTmp);
ar(CEREAL_NVP(useCholesky));
ar(CEREAL_NVP(lasso));
@@ -1390,7 +1390,7 @@ void LARS<ModelMatType>::serialize(Archive& ar, const uint32_t version)
ar(cereal::make_nvp("betaPath", betaPathTmp));
betaPath.resize(betaPathTmp.size());
for (size_t i = 0; i < betaPathTmp.size(); ++i)
betaPath[i] = arma::conv_to<ModelColType>::from(betaPathTmp[i]);
betaPath[i] = ConvTo<ModelColType>::from(betaPathTmp[i]);
std::vector<double> lambdaPathTmp;
ar(cereal::make_nvp("lambdaPath", lambdaPathTmp));