Neuroph studio 入门教程
PERCEPTRON
Perceptron is a simple two layer neural network with several neurons in input layer, and one or more neurons in output layer. All neurons use step transfer function and network can use LMS based learning algorithm such as Perceptron Learning or Delta Rule. This network can be used as a linear classifier, and it can only be applied to linear separable problems.

To create and train Perceptron neural network using Neuroph Studio do the following:
- Create Neuroph Project.
- Create Perceptron network.
- Create training set (in main menu choose Training >New Training Set).
- Train network
- Test trained network
Step 1. Create Neuroph project.
Click File > New Project.

Select Neuroph Project, click Next.

Enter project name and location, click Finish.

Project is created, now create neural network.
Step 2. Create Perceptron network.
Click File > New File

Select project from Project drop-down menu, select Neural Network file type, click next.

Enter network name, select Perceptron network type, click next.

In new perceptron dialog enter number ofneurons in input (2) and output layer (1) , choose Perceptron Learningand click Create button.

This will create the Perceptron neural network with two neurons in input, and one in output layer. By default, all neurons with Steptransfer functions.

Now we shall train this simple network to learn logical AND function. First we have to create the training setaccording to AND truth table.
Step 3. To create training set, click File>New File to open Data Set wizard.

Select DataSet file type, then click next.

Enter training set name, number of inputs andoutputs as shown on picture below and click Finish button.

Then create training set by entering training elements as input and desired output values of neurons in input and outputlayer. Use Add row button to add new elements, and click OK button when finished.

Step 4. Training network. To start network training procedure, drag n' drop training set to corresponding field in the network window, and 'Train' button will become enabled in toolbar. Click the 'Train' button to open Set Learning Parameters dialog.

In Set Learning parameters dialoguse default learning parameters, and just click the Train button.

When the Total Net Error is zero, thetraining is complete.

Step 5. After the training is complete, you can test the network for the whole training set by selecting training set to test, and clicking Test button..

This will show test results in the new tab.

To test single input, use Set Input button. This will open Set Network Input dialog in which you can enter input values for network delimited withspace.

The result of network test is shown on picture below. Network learned logical AND function. As we can see the outputneuron has value 1. Test the network to see how it behaves for other input values.

PERCEPTRON IN JAVA CODE
package org.neuroph.samples;
import java.util.Arrays;
import org.neuroph.core.NeuralNetwork;
import org.neuroph.nnet.Perceptron;
import org.neuroph.core.data.DataSet;
import org.neuroph.core.data.DataSetRow;
/**
* This sample shows how to create, train, save and load simple Perceptron neural network
*/
public class PerceptronSample {
public static void main(String args[]) {
// create training set (logical AND function)
DataSet trainingSet = new DataSet(2, 1);
trainingSet.addRow(new DataSetRow(new double[]{0, 0}, new double[]{0}));
trainingSet.addRow(new DataSetRow(new double[]{0, 1}, new double[]{0}));
trainingSet.addRow(new DataSetRow(new double[]{1, 0}, new double[]{0}));
trainingSet.addRow(new DataSetRow(new double[]{1, 1}, new double[]{1}));// create perceptron neural network
NeuralNetwork myPerceptron = new Perceptron(2, 1);// learn the training set
myPerceptron.learn(trainingSet);// test perceptron
System.out.println("Testing trained perceptron");
testNeuralNetwork(myPerceptron, trainingSet);// save trained perceptron
myPerceptron.save("mySamplePerceptron.nnet");// load saved neural network
NeuralNetwork loadedPerceptron = NeuralNetwork.createFromFile("mySamplePerceptron.nnet");// test loaded neural network
System.out.println("Testing loaded perceptron");
testNeuralNetwork(loadedPerceptron, trainingSet);}
public static void testNeuralNetwork(NeuralNetwork nnet, DataSet tset) {
for(DataSetRow dataRow : tset.getRows()) {
nnet.setInput(dataRow.getInput());
nnet.calculate();
double[ ] networkOutput = nnet.getOutput();
System.out.print("Input: " + Arrays.toString(dataRow.getInput()) );
System.out.println(" Output: " + Arrays.toString(networkOutput) );}
}
}
EXTERNAL LINKS
To learn more about the Perceptrons see:
Neuroph studio 入门教程的更多相关文章
- 自动化测试工具 Test Studio入门教程
Test Studio安装 可以到下载试用版 官网 http://www.telerik.com/teststudio , 装完以后需要装silverlight 安装好了,主界面是介个样子的 Test ...
- Android Studio JNI开发入门教程
Android Studio JNI开发入门教程 2016-08-29 14:38 3269人阅读 评论(0) 收藏 举报 分类: JNI(3) 目录(?)[+] 概述 在Andorid ...
- 《Visual C++ 2010入门教程》系列一:关于Visual Studio、VC和C++的那些事
原文:http://www.cnblogs.com/Mrt-02/archive/2011/07/24/2115606.html 作者:董波 日期:2010.6.15 写在前面 在我还在上学的时候,我 ...
- 官方入门教程和文档 | Visual Studio
Visual Studio 2017 概述 | Microsoft Docs(直接教你用vs) https://docs.microsoft.com/zh-cn/visualstudio/ide/vi ...
- 1,[VS入门教程] 使用Visual Studio写c语言 入门与技巧精品文~~~~下载安装篇
Microsoft Visual Studio是微软(俗称巨硬)公司出品的强大IDE(Integrated Development Environment 集成开发环境),功能强大齐全,界面舒服之类的 ...
- eclipse再见,android studio 新手入门教程(一)基本设置
写在前面: 作为一个刚半只脚踏入android开发的新手,在使用eclipse开发了两个自我感觉不甚成熟的商城类app之后,遇到了一些问题,总结为如下: 代码复用性.findviewById,oncl ...
- SharePoint 2013 入门教程
以下文章是自己在学习SharePoint的过程中,不断积累和总结的博文,现在总结一个目录,分享给大家.这个博客也是自己从SharePoint入门,到一个SharePoint开发的成长记录,里面记录的都 ...
- .NET轻量级MVC框架:Nancy入门教程(二)——Nancy和MVC的简单对比
在上一篇的.NET轻量级MVC框架:Nancy入门教程(一)——初识Nancy中,简单介绍了Nancy,并写了一个Hello,world.看到大家的评论,都在问Nancy的优势在哪里?和微软的MVC比 ...
- UWP 入门教程2——如何实现自适应用户界面
系列文章 UWP入门教程1——UWP的前世今生 如上文所说的,布局面板根据可用的屏幕空间,指定界面元素的大小和位置.例如StackPanel 会水平或垂直排列界面元素.Grid 布局与CSS 中的表格 ...
随机推荐
- Struts2文件的上传和下载实现
<一>简述: Struts2的文件上传其实也是通过拦截器来实现的,只是该拦截器定义为默认拦截器了,所以不用自己去手工配置,<interceptor name="fileUp ...
- 第198天:js---内置对象的原型链和其他知识
一.内置对象的原型链 1.Object原型 function test() {} alert(test.toString()); //新增属性 Object.prototype.mytest = fu ...
- 【.Net】C#获取Windows系统特殊文件夹的路径
系统特殊文件夹是包含公共信息的文件夹,如“Program Files”.“Programs”.“System”或“Startup”.特殊文件夹在默认情况下由系统设置,或者由用户在安装 Windows ...
- UVA11625_Lines of Containers
题意很简单,给你一个n*m的矩阵,现在问你这个矩阵能否变为标准矩阵(即数字从小到大),如果能最少需要几步呢? 其实是个赤果果的水题.记得暑假安叔也出过一个类似的题目,那个好像是在codeforces上 ...
- ubuntu16.04上安装配置DHCP服务的详细过程
DHCP服务器是为客户端机器分配IP地址的,所有分配的IP地址都保存在DHCP服务器的数据库中.为了在子网中实现DHCP分配IP地址,需要在目标主机上安装配置DHCP服务 1. 安装DHCP服务 安装 ...
- 洛谷P2125图书馆书架上的书 题解报告
题目描述 图书馆有n个书架,第1个书架后面是第2个书架,第2个书架后面是第3个书架……第n-1个书架后面是第n个书架,第n个书架后面是第1个书架,第i个书架上有b[i]本书.现在,为了让图书馆更美观, ...
- Ciesz się Polską
SZKOpułPoi at BZOJPA at BZOJONTAK at BZOJ Chinese Solution of Poi
- 关于EMGU CV的那些事——1.环境搭建(win8 vs2012 emgucv3.0)
http://blog.csdn.net/aptx704610875/article/details/46045689 楼主读研阶段研究图像处理,想用C#实现PTAM/PTAMM算法并用UNITY创建 ...
- Ubuntu 使用Compiz配置炫酷3D桌面
先看一下效果 要实现这种3D 的效果其实很简单. Step 1:安装N卡驱动工具 sudo apt- 这个东西其实没有太大的作用. Step 2:安装Compiz sudo apt-get insta ...
- HDU4003 树形DP
题意 :给一棵n个节点的树, 节点编号为1~n, 每条边都有一个花费值. 有k个机器人从S点出发, 问让机器人遍历所有边,最少花费值多少? 这题最难的地方应该就是如何定义状态了 定义dp ...