为了实现k-means算法,我为每个样本计算了形状using System;
namespace caesarCipher
{
class Program
{
static void Main(string[] args)
{
string text;
Console.WriteLine("Enter the text to encrypt ");
text = System.Convert.ToString(Console.ReadLine());
string lower = text.ToLower();
Random rnd = new Random();
int shift = rnd.Next(1, 25);
foreach (char c in lower)
{
int unicode = c;
int shiftUnicode = unicode + shift;
Console.WriteLine(shiftUnicode);
if (shiftUnicode >= 123)
{
int overflowUnicode = 97 + (shiftUnicode - 123);
char character = (char)overflowUnicode;
string newText = character.ToString();
}
else
{
char character = (char)shiftUnicode;
string newText = character.ToString();
}
}
Console.ReadLine();
}
}
}
的聚类索引0..K-1
:
(N, 1)
现在我想采用样本张量0
1
2
2
1
1
...
0
并计算新的形状(N, 3)
。
在(K, 3)
我会写:
numpy
如何对for i_cluster in range(n_clusters):
mu[i_cluster, :] = X[cluster_indice == i_cluster, :].mean(0)
执行相同操作?
更新
我可能需要使用tf.dynamic_partition()
...
答案 0 :(得分:0)
我这样写道:
parent::__construct($par1)