Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/272.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在Accord.net SOM(Kohonen';s)中从网络分配类别/标签_C#_Accord.net_Self Organizing Maps - Fatal编程技术网

C# 如何在Accord.net SOM(Kohonen';s)中从网络分配类别/标签

C# 如何在Accord.net SOM(Kohonen';s)中从网络分配类别/标签,c#,accord.net,self-organizing-maps,C#,Accord.net,Self Organizing Maps,谁能告诉我如何从经过培训的网络中获取/分配集群类/标签 下面是一个代码示例,让您了解如何执行它: Accord.Math.Random.Generator.Seed = 0; int numberOfInputs = 3; int hiddenNeurons = 25; double[][] input = { new double[] { -1, -1, -1 }, new double[] { -1, 1, -1 }, new double[] { 1

谁能告诉我如何从经过培训的网络中获取/分配集群类/标签

下面是一个代码示例,让您了解如何执行它:


Accord.Math.Random.Generator.Seed = 0;

int numberOfInputs = 3;
int hiddenNeurons = 25;

double[][] input =
{
     new double[] { -1, -1, -1 },
     new double[] { -1,  1, -1 },
     new double[] {  1, -1, -1 },
     new double[] {  1,  1, -1 },
     new double[] { -1, -1,  1 },
     new double[] { -1,  1,  1 },
     new double[] {  1, -1,  1 },
     new double[] {  1,  1,  1 },
     // ...
};

var network = new DistanceNetwork(numberOfInputs, hiddenNeurons);
var teacher = new SOMLearning(network);
double error = double.PositiveInfinity;

for (int i = 0; i < 1000; i++)
    error = teacher.RunEpoch(input);

// how can I know/assign class/label of each item in input array?


Accord.Math.Random.Generator.Seed=0;
int numberOfInputs=3;
int-hiddenNeurons=25;
双[]输入=
{
新的双[]{-1,-1,-1},
新的双[]{-1,1,-1},
新的双[]{1,-1,-1},
新的双[]{1,1,-1},
新的双[]{-1,-1,1},
新的双[]{-1,1,1},
新的双[]{1,-1,1},
新的双[]{1,1,1},
// ...
};
var网络=新的距离网络(输入数,hiddenNeurons);
var教师=新学习(网络);
双重错误=双重正不确定性;
对于(int i=0;i<1000;i++)
错误=教师.RunEpoch(输入);
//如何知道/分配输入数组中每个项的类/标签?

雅阁样品可能会有进一步的帮助:

特别是本节:

for (int y = 0, i = 0; y < 100; y++)
{
    // for all pixels
    for (int x = 0; x < 100; x++, i++, ptr += 6)
    {
        Neuron neuron = layer.Neurons[i];

        // red
        ptr[2] = ptr[2 + 3] = ptr[2 + stride] = ptr[2 + 3 + stride] =
            (byte)Math.Max(0, Math.Min(255, neuron.Weights[0]));

        // green
        ptr[1] = ptr[1 + 3] = ptr[1 + stride] = ptr[1 + 3 + stride] =
            (byte)Math.Max(0, Math.Min(255, neuron.Weights[1]));

        // blue
        ptr[0] = ptr[0 + 3] = ptr[0 + stride] = ptr[0 + 3 + stride] =
            (byte)Math.Max(0, Math.Min(255, neuron.Weights[2]));
    }

    ptr += offset;
    ptr += stride;
}
for(int y=0,i=0;y<100;y++)
{
//对于所有像素
对于(int x=0;x<100;x++,i++,ptr++=6)
{
神经元=层神经元[i];
//红色的
ptr[2]=ptr[2+3]=ptr[2+步幅]=ptr[2+3+步幅]=
(字节)Math.Max(0,Math.Min(255,neuron.Weights[0]);
//绿色的
ptr[1]=ptr[1+3]=ptr[1+步幅]=ptr[1+3+步幅]=
(字节)Math.Max(0,Math.Min(255,neuron.Weights[1]);
//蓝色的
ptr[0]=ptr[0+3]=ptr[0+步幅]=ptr[0+3+步幅]=
(字节)Math.Max(0,Math.Min(255,neuron.Weights[2]);
}
ptr+=偏移量;
ptr+=步幅;
}

雅阁样品可能会有进一步的帮助:

特别是本节:

for (int y = 0, i = 0; y < 100; y++)
{
    // for all pixels
    for (int x = 0; x < 100; x++, i++, ptr += 6)
    {
        Neuron neuron = layer.Neurons[i];

        // red
        ptr[2] = ptr[2 + 3] = ptr[2 + stride] = ptr[2 + 3 + stride] =
            (byte)Math.Max(0, Math.Min(255, neuron.Weights[0]));

        // green
        ptr[1] = ptr[1 + 3] = ptr[1 + stride] = ptr[1 + 3 + stride] =
            (byte)Math.Max(0, Math.Min(255, neuron.Weights[1]));

        // blue
        ptr[0] = ptr[0 + 3] = ptr[0 + stride] = ptr[0 + 3 + stride] =
            (byte)Math.Max(0, Math.Min(255, neuron.Weights[2]));
    }

    ptr += offset;
    ptr += stride;
}
for(int y=0,i=0;y<100;y++)
{
//对于所有像素
对于(int x=0;x<100;x++,i++,ptr++=6)
{
神经元=层神经元[i];
//红色的
ptr[2]=ptr[2+3]=ptr[2+步幅]=ptr[2+3+步幅]=
(字节)Math.Max(0,Math.Min(255,neuron.Weights[0]);
//绿色的
ptr[1]=ptr[1+3]=ptr[1+步幅]=ptr[1+3+步幅]=
(字节)Math.Max(0,Math.Min(255,neuron.Weights[1]);
//蓝色的
ptr[0]=ptr[0+3]=ptr[0+步幅]=ptr[0+3+步幅]=
(字节)Math.Max(0,Math.Min(255,neuron.Weights[2]);
}
ptr+=偏移量;
ptr+=步幅;
}