本文整理汇总了C#中Gaussian.GetLength方法的典型用法代码示例。如果您正苦于以下问题:C# Gaussian.GetLength方法的具体用法?C# Gaussian.GetLength怎么用?C# Gaussian.GetLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gaussian
的用法示例。
在下文中一共展示了Gaussian.GetLength方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_BPM_Sparse_Shared
private static void Test_BPM_Sparse_Shared(
int nClass, int totalFeatures, double noisePrec, int maxItemsInBatch, int nChunks, string trainingFile,
int[][] xIndicesTest, double[][] xValuesTest)
{
Console.WriteLine("\n------- BPM Sparse Shared -------");
BPMSparse_Shared bpmSparseShared = new BPMSparse_Shared(nClass, totalFeatures, noisePrec, nChunks, 1);
bpmSparseShared.TrainingEngine.ShowProgress = false;
bpmSparseShared.TestEngine.ShowProgress = false;
Gaussian[][] wInferred = new Gaussian[nClass][];
for (int c = 0; c < nClass; c++)
{
wInferred[c] = new Gaussian[totalFeatures];
}
for (int pass = 0; pass < 5; pass++)
{
int LocToStart = 0;
for (int c = 0; c < nChunks; c++)
{
int[][][] xIndices;
double [][][] xValues = DataFromFile.Read(trainingFile, nClass, maxItemsInBatch, ref LocToStart, out xIndices);
wInferred = bpmSparseShared.Train(xIndices, xValues, c);
}
}
#if ShowWeights
for (int i = 0; i < wInferred.GetLength(0); i++)
{
for (int j = 0; j < wInferred[i].Length; j++)
{
Console.WriteLine(wInferred[i][j].ToString());
}
}
#endif
Console.WriteLine("\nPredictions:");
Discrete[] predictions = bpmSparseShared.Test(xIndicesTest, xValuesTest, 0);
foreach (Discrete pred in predictions)
Console.WriteLine(pred);
Console.WriteLine();
}
示例2: printMatrixToConsole
/// <summary>
/// Print the means of a 2-D array of Gaussians to the console
/// </summary>
/// <param name="matrix"></param>
private static void printMatrixToConsole(Gaussian[,] matrix)
{
for (int i = 0; i < matrix.GetLength(0); i++)
{
for (int j = 0; j < matrix.GetLength(1); j++)
Console.Write("{0,5:0.00}\t", matrix[i, j].GetMean());
Console.WriteLine("");
}
}
示例3: printVectorToConsole
/// <summary>
/// Print the means of a 1-D array of Gaussians to the console
/// </summary>
/// <param name="matrix"></param>
private static void printVectorToConsole(Gaussian[] vector)
{
for (int i = 0; i < vector.GetLength(0); i++)
Console.Write("{0,5:0.00}\t", vector[i].GetMean());
Console.WriteLine("");
}
示例4: meanAbsoluteRowMeans
/// <summary>
/// Mean absolute row means
/// </summary>
/// <param name="matrix"></param>
/// <returns></returns>
private static double[] meanAbsoluteRowMeans(Gaussian[,] matrix)
{
double[] mam = new double[matrix.GetLength(0)];
double mult = 1.0 / ((double)matrix.GetLength(1));
for (int i = 0; i < matrix.GetLength(0); i++)
{
double sum = 0.0;
for (int j = 0; j < matrix.GetLength(1); j++)
sum += Math.Abs(matrix[i, j].GetMean());
mam[i] = mult * sum;
}
return mam;
}