本文整理汇总了C++中Observations::GetTotalSumOfLandmarks方法的典型用法代码示例。如果您正苦于以下问题:C++ Observations::GetTotalSumOfLandmarks方法的具体用法?C++ Observations::GetTotalSumOfLandmarks怎么用?C++ Observations::GetTotalSumOfLandmarks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Observations
的用法示例。
在下文中一共展示了Observations::GetTotalSumOfLandmarks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NumberOfTimePoints
Observations
MultivariateModel
::SimulateData(io::DataSettings &DS)
{
/// This function simulates observations (Patients and their measurements y_ij at different time points t_ij)
/// according to the model, with a given noise level e_ij, such that y_ij = f(t_ij) + e_ij
/// Their is two option:
/// 1) The model is not initialized (neither random variables of number of realizations) and it has to be
/// This case corresponds to simulated data used to test the model, meaning if it can recover the random variables
/// used to simulate the data
/// 2) The model is already initialized, thus it should rely on its current state (random variables, realizations, ...)
/// This case corresponds to new data, for a dataset augmentation for instance
// TODO :
/// PITFALL : As for now, only the first option is implemented
/// PITFALL2 : Take a closer look at / merge with InitializeFakeRandomVariables
/// Initialize the model
m_ManifoldDimension = DS.GetCognitiveScoresDimension();
m_NumberOfSubjects = DS.GetNumberOfSimulatedSubjects();
m_RealizationsPerRandomVariable["G"] = 1;
for(size_t i = 1; i < m_ManifoldDimension; ++i)
m_RealizationsPerRandomVariable["Delta#" + std::to_string(i)] = 1;
for(size_t i = 0; i < m_NbIndependentSources*(m_ManifoldDimension - 1); ++i)
m_RealizationsPerRandomVariable["Beta#" + std::to_string(i)] = 1;
m_RealizationsPerRandomVariable["Ksi"] = m_NumberOfSubjects;
m_RealizationsPerRandomVariable["Tau"] = m_NumberOfSubjects;
for(int i = 0; i < m_NbIndependentSources; ++i)
m_RealizationsPerRandomVariable["S#" + std::to_string(i)] = m_NumberOfSubjects;
auto R = SimulateRealizations();
/// Update the model
m_G = exp(R.at("G", 0));
ComputeDeltas(R);
ComputeOrthonormalBasis();
ComputeAMatrix(R);
ComputeSpaceShifts(R);
ComputeBlock(R);
/// Simulate the data
std::random_device RD;
std::mt19937 RNG(RD());
std::uniform_int_distribution<int> Uni(DS.GetMinimumNumberOfObservations(), DS.GetMaximumNumberOfObservations());
UniformRandomVariable NumberOfTimePoints(60, 95);
GaussianRandomVariable Noise(0, m_Noise->GetVariance());
/// Simulate the data
Observations Obs;
for(int i = 0; i < m_NumberOfSubjects; ++i)
{
/// Get a random number of timepoints and sort them
VectorType T = NumberOfTimePoints.Samples(Uni(RNG));
T.sort();
m_SubjectTimePoints.push_back(T);
/// Simulate the data base on the time-points
IndividualObservations IO(T);
std::vector<VectorType> Landmarks;
for(size_t j = 0; j < T.size(); ++j)
{
Landmarks.push_back(ComputeParallelCurve(i, j) + Noise.Samples(m_ManifoldDimension));
}
IO.AddLandmarks(Landmarks);
Obs.AddIndividualData(IO);
}
/// Initialize the observation and model attributes
Obs.InitializeGlobalAttributes();
m_IndividualObservationDate = Obs.GetObservations();
m_SumObservations = Obs.GetTotalSumOfLandmarks();
m_NbTotalOfObservations = Obs.GetTotalNumberOfObservations();
return Obs;
}