本文整理汇总了C#中Chain.CongenericChain方法的典型用法代码示例。如果您正苦于以下问题:C# Chain.CongenericChain方法的具体用法?C# Chain.CongenericChain怎么用?C# Chain.CongenericChain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chain
的用法示例。
在下文中一共展示了Chain.CongenericChain方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Calculate
/// <summary>
/// Calculation method.
/// </summary>
/// <param name="chain">
/// Source sequence.
/// </param>
/// <param name="link">
/// Link of intervals in chain.
/// </param>
/// <returns>
/// Average remoteness dispersion <see cref="double"/> value.
/// </returns>
public double Calculate(Chain chain, Link link)
{
List<int> intervals = new List<int>();
for (int i = 0; i < chain.Alphabet.Cardinality; i++)
{
intervals.AddRange(chain.CongenericChain(i).GetIntervals(link).ToList());
}
List<int> uniqueIntervals = intervals.Distinct().ToList();
List<int> intervalsCounts = new List<int>();
for (int i = 0; i < uniqueIntervals.Count; i++)
{
var currentInterval = uniqueIntervals[i];
intervalsCounts.Add(intervals.Count(interval => interval == currentInterval));
}
double result = 0;
double gDelta = geometricMean.Calculate(chain, link);
int n = (int)intervalsCount.Calculate(chain, link);
for (int i = 0; i < uniqueIntervals.Count; i++)
{
int nk = intervalsCounts[i];
double kDelta = uniqueIntervals[i];
double centeredRemoteness = Math.Log(kDelta, 2) - Math.Log(gDelta, 2);
result += nk == 0 ? 0 : centeredRemoteness * centeredRemoteness * nk / n;
}
return result;
}
示例2: Calculate
/// <summary>
/// Calculation method.
/// </summary>
/// <param name="chain">
/// Source sequence.
/// </param>
/// <param name="link">
/// Link of intervals in chain.
/// </param>
/// <returns>
/// Average remoteness dispersion <see cref="double"/> value.
/// </returns>
public double Calculate(Chain chain, Link link)
{
double result = 0;
double g = averageRemoteness.Calculate(chain, link);
int n = (int)intervalsCount.Calculate(chain, link);
for (int i = 0; i < chain.Alphabet.Cardinality; i++)
{
double nj = intervalsCount.Calculate(chain.CongenericChain(chain.Alphabet[i]), link);
double gj = averageRemoteness.Calculate(chain.CongenericChain(chain.Alphabet[i]), link);
double gDelta = gj - g;
result += n == 0 ? 0 : gDelta * gDelta * nj / n;
}
return result;
}
示例3: Calculate
/// <summary>
/// Calculation method.
/// </summary>
/// <param name="chain">
/// Source sequence.
/// </param>
/// <param name="link">
/// Link of intervals in chain.
/// </param>
/// <returns>
/// Entropy Kurtosis <see cref="double"/> value.
/// </returns>
public double Calculate(Chain chain, Link link)
{
double result = 0;
double h = identificationInformation.Calculate(chain, link);
int n = (int)intervalsCount.Calculate(chain, link);
for (int i = 0; i < chain.Alphabet.Cardinality; i++)
{
double nj = intervalsCount.Calculate(chain.CongenericChain(chain.Alphabet[i]), link);
double hj = identificationInformation.Calculate(chain.CongenericChain(chain.Alphabet[i]), link);
double deltaH = hj - h;
result += n == 0 ? 0 : deltaH * deltaH * deltaH * deltaH * nj / n;
}
return result;
}
示例4: Calculate
/// <summary>
/// Calculated as base 2 logarithm of multiplication
/// of intervals between nearest elements
/// in congeneric sequence.
/// </summary>
/// <param name="chain">
/// Source sequence.
/// </param>
/// <param name="link">
/// Link of intervals in chain.
/// </param>
/// <returns>
/// Average remoteness <see cref="double"/> value.
/// </returns>
public double Calculate(Chain chain, Link link)
{
double result = 0;
for (int i = 0; i < chain.Alphabet.Cardinality; i++)
{
result += Calculate(chain.CongenericChain(i), link);
}
return result;
}
示例5: Calculate
/// <summary>
/// Calculation method.
/// </summary>
/// <param name="chain">
/// Source sequence.
/// </param>
/// <param name="link">
/// Link of intervals in chain.
/// </param>
/// <returns>
/// Intervals count in chain as <see cref="double"/>.
/// </returns>
public double Calculate(Chain chain, Link link)
{
double sum = 0;
for (int i = 0; i < chain.Alphabet.Cardinality; i++)
{
sum += Calculate(chain.CongenericChain(i), link);
}
return (int)sum;
}