• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SquareNeighbourhood类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.commons.math3.ml.neuralnet.SquareNeighbourhood的典型用法代码示例。如果您正苦于以下问题:Java SquareNeighbourhood类的具体用法?Java SquareNeighbourhood怎么用?Java SquareNeighbourhood使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SquareNeighbourhood类属于org.apache.commons.math3.ml.neuralnet包,在下文中一共展示了SquareNeighbourhood类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: test2x2Network2

import org.apache.commons.math3.ml.neuralnet.SquareNeighbourhood; //导入依赖的package包/类
@Test
public void test2x2Network2() {
    final FeatureInitializer[] initArray = { init };
    final Network net = new NeuronSquareMesh2D(2, false,
                                               2, false,
                                               SquareNeighbourhood.MOORE,
                                               initArray).getNetwork();
    Collection<Neuron> neighbours;

    // All neurons
    for (long id : new long[] { 0, 1, 2, 3 }) {
        neighbours = net.getNeighbours(net.getNeuron(id));
        for (long nId : new long[] { 0, 1, 2, 3 }) {
            if (id != nId) {
                Assert.assertTrue(neighbours.contains(net.getNeuron(nId)));
            }
        }
    }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:20,代码来源:NeuronSquareMesh2DTest.java


示例2: test3x2CylinderNetwork2

import org.apache.commons.math3.ml.neuralnet.SquareNeighbourhood; //导入依赖的package包/类
@Test
public void test3x2CylinderNetwork2() {
    final FeatureInitializer[] initArray = { init };
    final Network net = new NeuronSquareMesh2D(2, false,
                                         3, true,
                                         SquareNeighbourhood.MOORE,
                                         initArray).getNetwork();
    Collection<Neuron> neighbours;

    // All neurons.
    for (long id : new long[] { 0, 1, 2, 3, 4, 5 }) {
        neighbours = net.getNeighbours(net.getNeuron(id));
        for (long nId : new long[] { 0, 1, 2, 3, 4, 5 }) {
            if (id != nId) {
                Assert.assertTrue("id=" + id + " nId=" + nId,
                                  neighbours.contains(net.getNeuron(nId)));
            }
        }
    }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:21,代码来源:NeuronSquareMesh2DTest.java


示例3: test3x3TorusNetwork2

import org.apache.commons.math3.ml.neuralnet.SquareNeighbourhood; //导入依赖的package包/类
@Test
public void test3x3TorusNetwork2() {
    final FeatureInitializer[] initArray = { init };
    final Network net = new NeuronSquareMesh2D(3, true,
                                         3, true,
                                         SquareNeighbourhood.MOORE,
                                         initArray).getNetwork();
    Collection<Neuron> neighbours;

    // All neurons.
    for (long id : new long[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }) {
        neighbours = net.getNeighbours(net.getNeuron(id));
        for (long nId : new long[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }) {
            if (id != nId) {
                Assert.assertTrue("id=" + id + " nId=" + nId,
                                  neighbours.contains(net.getNeuron(nId)));
            }
        }
    }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:21,代码来源:NeuronSquareMesh2DTest.java


示例4: NeuronSquareMesh2D

import org.apache.commons.math3.ml.neuralnet.SquareNeighbourhood; //导入依赖的package包/类
/**
 * Constructor with restricted access, solely used for deserialization.
 *
 * @param wrapRowDim Whether to wrap the first dimension (i.e the first
 * and last neurons will be linked together).
 * @param wrapColDim Whether to wrap the second dimension (i.e the first
 * and last neurons will be linked together).
 * @param neighbourhoodType Neighbourhood type.
 * @param featuresList Arrays that will initialize the features sets of
 * the network's neurons.
 * @throws NumberIsTooSmallException if {@code numRows < 2} or
 * {@code numCols < 2}.
 */
NeuronSquareMesh2D(boolean wrapRowDim,
                   boolean wrapColDim,
                   SquareNeighbourhood neighbourhoodType,
                   double[][][] featuresList) {
    numberOfRows = featuresList.length;
    numberOfColumns = featuresList[0].length;

    if (numberOfRows < 2) {
        throw new NumberIsTooSmallException(numberOfRows, 2, true);
    }
    if (numberOfColumns < 2) {
        throw new NumberIsTooSmallException(numberOfColumns, 2, true);
    }

    wrapRows = wrapRowDim;
    wrapColumns = wrapColDim;
    neighbourhood = neighbourhoodType;

    final int fLen = featuresList[0][0].length;
    network = new Network(0, fLen);
    identifiers = new long[numberOfRows][numberOfColumns];

    // Add neurons.
    for (int i = 0; i < numberOfRows; i++) {
        for (int j = 0; j < numberOfColumns; j++) {
            identifiers[i][j] = network.createNeuron(featuresList[i][j]);
        }
    }

    // Add links.
    createLinks();
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:46,代码来源:NeuronSquareMesh2D.java


示例5: SerializationProxy

import org.apache.commons.math3.ml.neuralnet.SquareNeighbourhood; //导入依赖的package包/类
/**
 * @param wrapRows Whether the row dimension is wrapped.
 * @param wrapColumns Whether the column dimension is wrapped.
 * @param neighbourhood Neighbourhood type.
 * @param featuresList List of neurons features.
 * {@code neuronList}.
 */
SerializationProxy(boolean wrapRows,
                   boolean wrapColumns,
                   SquareNeighbourhood neighbourhood,
                   double[][][] featuresList) {
    this.wrapRows = wrapRows;
    this.wrapColumns = wrapColumns;
    this.neighbourhood = neighbourhood;
    this.featuresList = featuresList;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:17,代码来源:NeuronSquareMesh2D.java


示例6: ChineseRingsClassifier

import org.apache.commons.math3.ml.neuralnet.SquareNeighbourhood; //导入依赖的package包/类
/**
 * @param rings Training data.
 * @param dim1 Number of rows of the SOFM.
 * @param dim2 Number of columns of the SOFM.
 */
public ChineseRingsClassifier(ChineseRings rings,
                              int dim1,
                              int dim2) {
    this.rings = rings;
    sofm = new NeuronSquareMesh2D(dim1, false,
                                  dim2, false,
                                  SquareNeighbourhood.MOORE,
                                  makeInitializers());
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:15,代码来源:ChineseRingsClassifier.java


示例7: testMinimalNetworkSize1

import org.apache.commons.math3.ml.neuralnet.SquareNeighbourhood; //导入依赖的package包/类
@Test(expected=NumberIsTooSmallException.class)
public void testMinimalNetworkSize1() {
    final FeatureInitializer[] initArray = { init };

    new NeuronSquareMesh2D(1, false,
                           2, false,
                           SquareNeighbourhood.VON_NEUMANN,
                           initArray);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:10,代码来源:NeuronSquareMesh2DTest.java


示例8: testMinimalNetworkSize2

import org.apache.commons.math3.ml.neuralnet.SquareNeighbourhood; //导入依赖的package包/类
@Test(expected=NumberIsTooSmallException.class)
public void testMinimalNetworkSize2() {
    final FeatureInitializer[] initArray = { init };

    new NeuronSquareMesh2D(2, false,
                           0, false,
                           SquareNeighbourhood.VON_NEUMANN,
                           initArray);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:10,代码来源:NeuronSquareMesh2DTest.java


示例9: testGetFeaturesSize

import org.apache.commons.math3.ml.neuralnet.SquareNeighbourhood; //导入依赖的package包/类
@Test
public void testGetFeaturesSize() {
    final FeatureInitializer[] initArray = { init, init, init };

    final Network net = new NeuronSquareMesh2D(2, false,
                                               2, false,
                                               SquareNeighbourhood.VON_NEUMANN,
                                               initArray).getNetwork();
    Assert.assertEquals(3, net.getFeaturesSize());
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:11,代码来源:NeuronSquareMesh2DTest.java


示例10: testSerialize

import org.apache.commons.math3.ml.neuralnet.SquareNeighbourhood; //导入依赖的package包/类
@Test
public void testSerialize()
    throws IOException,
           ClassNotFoundException {
    final FeatureInitializer[] initArray = { init };
    final NeuronSquareMesh2D out = new NeuronSquareMesh2D(4, false,
                                                          3, true,
                                                          SquareNeighbourhood.VON_NEUMANN,
                                                          initArray);

    final ByteArrayOutputStream bos = new ByteArrayOutputStream();
    final ObjectOutputStream oos = new ObjectOutputStream(bos);
    oos.writeObject(out);

    final ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
    final ObjectInputStream ois = new ObjectInputStream(bis);
    final NeuronSquareMesh2D in = (NeuronSquareMesh2D) ois.readObject();

    for (Neuron nOut : out.getNetwork()) {
        final Neuron nIn = in.getNetwork().getNeuron(nOut.getIdentifier());

        // Same values.
        final double[] outF = nOut.getFeatures();
        final double[] inF = nIn.getFeatures();
        Assert.assertEquals(outF.length, inF.length);
        for (int i = 0; i < outF.length; i++) {
            Assert.assertEquals(outF[i], inF[i], 0d);
        }

        // Same neighbours.
        final Collection<Neuron> outNeighbours = out.getNetwork().getNeighbours(nOut);
        final Collection<Neuron> inNeighbours = in.getNetwork().getNeighbours(nIn);
        Assert.assertEquals(outNeighbours.size(), inNeighbours.size());
        for (Neuron oN : outNeighbours) {
            Assert.assertTrue(inNeighbours.contains(in.getNetwork().getNeuron(oN.getIdentifier())));
        }
    }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:39,代码来源:NeuronSquareMesh2DTest.java



注:本文中的org.apache.commons.math3.ml.neuralnet.SquareNeighbourhood类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LogisticRegressionWithLBFGS类代码示例发布时间:2022-05-15
下一篇:
Java SCMUploaderCanUploadRequestProto类代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap