46 vector< map<int, double>> freqs(seqKeys.size());
48 for (
size_t i = 0; i < seqKeys.size(); ++i)
53 shared_ptr<CruxSymbolListInterface> seq(sc ?
58 std::map<int, double> counts;
62 for (
int k = 0; k < 20; ++k)
64 counts[k] += pseudoCount;
69 for (
int k = 0; k < 20; ++k)
74 for (
int k = 0; k < 20; ++k)
76 freqs.at(i)[k] = counts[k]/t;
84 for (
size_t i = 0; i < freqs.size(); ++i)
86 bool normalize =
false;
87 for (
size_t j = 0; j < 20; ++j)
89 map<int, double>::iterator it = freqs[i].find(
static_cast<int>(j));
90 if (it != freqs[i].end())
92 freqMatrix(i, j) = (*it).second;
96 freqMatrix(i, j) = 0.000001;
103 for (
size_t k = 0; k < 20; ++k)
105 sum += freqMatrix(i, k);
107 for (
size_t l = 0; l < 20; ++l)
109 freqMatrix(i, l) = freqMatrix(i, l) / sum;
134 ")... The number of parameters per branch is now equal to the number of axes kept by the COA analysis (" +
TextTools::toString(nbAxesConserved) +
")");
139 const vector<double> rCoords =
R_.
col(i);
142 double sd = VectorTools::sd<double, double>(rCoords);
143 auto constraint = make_shared<IntervalConstraint>(minCoord - sd, maxCoord + sd,
true,
true);
158 vector<double> E(20, 0.0);
160 for (
unsigned int i = 0; i < 20; i++)
162 for (
unsigned int j = 0; j < V.size(); j++)
164 E[i] = E[i] + P(j, i) * V[j];
std::vector< double > colWeights_
ParameterList paramValues_
CoalaCore(size_t nbAxes=0)
std::vector< double > prodMatrixVector(RowMatrix< double > &P, std::vector< double > &V)
ParameterList computeCOA(const SequenceDataInterface &data, double pseudoCount=0, bool param=true)
Comoute COA from data and return the axis position parameters.
const RowMatrix< double > & getPrincipalAxes() const
const RowMatrix< double > & getRowCoordinates() const
const std::vector< double > getColumnWeights() const
size_t getNbOfKeptAxes() const
virtual bool hasParameter(const std::string &name) const
virtual double getParameterValue(const std::string &name) const
virtual void addParameter(const Parameter ¶m)
std::vector< double > col(size_t j) const
virtual const SequenceType & sequence(const HashType &sequenceKey) const override=0
virtual std::vector< std::string > getSequenceKeys() const =0
std::string toString(T t)
Defines the basic types of data flow nodes.