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 中的表格 ...
随机推荐
- Spring Boot 学习资料【m了以后看】(转)
推荐博客: 程序员DD SpringBoot集成 liaokailin的专栏 纯洁的微笑 SpringBoot揭秘与实战 catoop的专栏 方志朋Spring Boot 专栏 简书Spring Bo ...
- TTPPRC —— 商业分析模型
欢迎讨论 : ) 前言1 TTPPRC,是一个为了更容易.透切地进行商业分析而整理出的分析模型.通过这个模型,可以让不具备专业商业知识的大众都能容易得出商业分析结果. 此文是读者阅读原文后,而整理的一 ...
- Shell Script的默认变量
$? #上一个命令执行后所回传的值,当我们执行某些命令时,这些命令都会回传一个执行后的代码.一般来说,如果成功执行该命令则会回传一个0值.如果执行过程发生错误,就会回传“错误代码” $$ #代表目前这 ...
- js 变量定义的注意点
- NewCaffe
NewCaffe
- [洛谷P5190][COCI 2010] PROGRAM
题目大意:给你$k(k\leqslant10^6)$个数,$f(x)$表示$x$的约数在$k$个数中出现的次数,在这任何数都是$0$的约数.$m(m\leqslant10^6)$次询问,每次给出$l, ...
- 解题:SCOI 2008 天平
题面 我们很容易想到差分约束,但是我们建出来图之后好像并不好下手,因为我们只能得到砝码间的大小关系,并不能容易地得到每个砝码的具体重量. 于是我们有了一种神奇的思路:既然得不到具体重量我们就不求具体重 ...
- django 表单验证和字段验证
表单验证和字段验证 表单验证发生在数据验证之后.如果你需要自定义这个过程,有几个不同的地方可以修改,每个地方的目的不一样.表单处理过程中要运行三种类别的验证方法.它们通常在你调用表单的is_valid ...
- cin/cout与scanf/printf的比较
转自http://www.cnblogs.com/penelope/articles/2426577.html cin .cout 基本说明: cin是标准输入流对象,代表标准输入设备(键盘), ...
- 图像处理之中值滤波介绍及C实现
1 中值滤波概述 中值滤波是基于排序统计理论的一种能有效抑制噪声的非线性信号平滑处理技术,它将每一像素点的灰度值设置为该点某邻域窗口内的所有像素点灰度值的中值. 中值滤波的基本原理是把数字图像或数字序 ...