NeuralNetworkAPI
一个用于在 Minecraft 中添加神经网络的 Bukkit 插件。
使用方法(基础演示)
- 首先,使用 `/nn cnn` 或 `/nn createNewNN` 查看所有神经网络类型列表。建议从 `LogicalOR`(逻辑或)开始。
- 然后,使用 `/nn startlearning` 开始训练该神经网络。
- 几乎在发送该命令后立即使用 `/nn stoplearning` 停止训练。在这两条命令发出的几秒钟内,机器人已经经历了超过一千种场景,准确率应达到 100%。(对于其他神经网络,可以通过检查控制台来查看准确率。)
- 现在,要测试它,请使用 `/nn test` 测试两个输入值,可以是 true 或 false。(例如:`/nn test true false`)
- 对于 LogicalOR,如果第一个和/或第二个输入为 true,它将输出 true。
针对非开发者
除了提供一些展示此 API 能实现的功能的演示外,本插件本身不提供任何其他功能。如果您不打算开发自己的 NeuralNetwork 插件或使用其他使用此 API 的插件,那么本插件对您来说可能毫无用处。
针对插件开发者
在尝试创建新的神经网络类型之前,您应该了解以下几点:
...并在主类的 onEnable 或 onLoad 中让 ConfigurationSerialization 类注册对象,如下所示:
public void onEnable(){
ConfigurationSerialization.registerClass(CustomNeuralNetwork.class);
}
- 完成上述操作后,您应该能够将 `NNBaseEntity` 保存到配置文件并从中加载。请注意,您不能将 `NeuralNetwork` 实例保存到配置文件中。
- 理想情况下,您的插件的其他部分不应直接引用自定义神经网络对象。相反,对该对象的所有调用都应通过 NeuralNetwork 对象进行。
- 为了获得最佳效果,仅在神经网络以任何方式失败时才调用 `DeepReinformentUtil.instantaneousReinforce`。当它返回正确值时调用它往往会导致其“忘记”已经学到的内容。
- 本 API 仍在开发中。本插件的一些方面可能会在未来的更新中发生变化。请持续关注 GitHub 页面以获取更新,并确保您的项目始终引用最新版本。
- 在训练神经网络时,如果您不希望控制台被调试消息填满,请使用 `NeuralNetwork#setBroadcasting(false);` 禁用控制台调试。
- 如果您的 AI 没有返回预期的值,或者想知道给定输入时神经网络正在“思考”什么,您可以打开图形化界面以可视化正在发生的事情。使用 `NeuralNetwork#openGrapher();` 打开图形化界面实例。完成后,可以使用 `NeuralNetwork#closeGrapher();` 正确关闭窗口。
- 向神经网络添加更多隐藏层会增加其可学习模式的复杂性。
- 在某些情况下,拥有 BiasNeuron(偏置神经元)可以增加或减少网络的学习能力。对于需要在没有输入的情况下产生某些输出的情况(例如 XNOR、NAND、反向),最好在输入层至少包含 1 个偏置神经元。
- 在隐藏层中使用 BiasNeurons 可能对某些情况有帮助,也可能没有帮助。
工作原理
神经网络由三个基本组件开始:感知数组、AI 对象和控制对象。
- 感知数组决定输入。这可以是代表真或假值的布尔值,也可以是代表输入可能状态的数字。
- AI 负责将输入转换为输出。通过一系列具有各自值和阈值的神经元,信息根据神经网络的训练情况从输入传递到输出。
- 控制对象是您将输出转换为您可使用数据的方式。例如,控制器可以将输出转换为布尔值,以确定 AI 是否检测到脏话(用于脏话过滤器),或者确定两个整数的总和。
GithubPage:
本插件使用 bStats 收集统计数据:
bStats 仅收集有关您的系统架构、服务器版本和插件版本的信息。如果您确实不希望发送任何这些信息,您可以通过进入配置文件并将 "enableStats" 设置为 false 来禁用 bStats。
NeuralNetworkAPI
A bukkit plugin for adding neural networks into minecraft.
How to use (Basic-Demo)
- To start, use `/nn cnn` or `/nn createNewNN` to see the list of all neural network types. I would recommend selecting `LogicalOR` to start off with
- Then, use `/nn startlearning` to start training the NN.
- Almost immediately after sending that command, use `/nn stoplearning` to stop training. Within the seconds of sending these two commands, the bot has gone through over a thousand scenarios, and should be 100% accurate. (For other NNs, you can check the accuracy by checking the console.)
- Now, to test it, use `/nn test` to test two inputs, either true or false. (example: `/nn test true false`)
- For LogicalOR, it should print out true if either the first and/or the second input is true.
For non-developers
This plugin provides nothing on its own besides a few demos of what this API can achieve. If you do not plan on developing your own NeuralNetwork plugin or using another plugin the uses this API, this plugin may be useless to you.
For plugin developers
There are a few things that you should know before attempting to make a new Neural network type
...and let the ConfigurationSerialization class register the object in the onEnable or onLoad of the main class like so:
public void onEnable(){
ConfigurationSerialization.registerClass(CustomNeuralNetwork.class);
}
- After this, you should be able to save and load the `NNBaseEntity` to and from the config. Note that you cannot save the `NeuralNetwork` instance to the config.
- Ideally, no other part of your plugin should directly reference your custom neural network object. Instead, all calls to that object should be done through the NeuralNetwork object.
- For best results, only call `DeepReinformentUtil.instantaneousReinforce` when the NN failed in any way. Calling it when it returned the correct value tends to make it "forget" what it may have already learned.
- This API is still in development. Some aspects of this plugin may change in future updates. Continually to check the github page for updates and make sure your project always references the newest version.
- When traing your NeuralNetwork, if you do not want the console to fill up with debug messages, use `NeuralNetwork#setBroadcasting(false);` to disable console debugging.
- If your AI is not return the values you expect, or want to know what your NN is "thinking" given an input, you can open the grapher to have a visualisation of what is happening. Use `NeuralNetwork#openGrapher();` to open the grapher instance. Once you are done, you can use `NeuralNetwork#closeGrapher();` to propperly shut down the window.
- Adding more hidden layers to your neural network increases the complexity of patterns that it can learn.
- In certain cases, having a BiasNeuron can increase or decrease the ability for the network to learn. For situations where certain outputs are needed if there are no inputs (XNOR,NAND, Inverted, for example), then it is better to have atleast 1 bias neuron in the inputs.
- Having BiasNeurons on the hidden layers may or may not help with certain situations.
How this works
NeuralNetworks start with three basic components, a Sensory array, an AI object, and a Controler object.
- The Sensory array determins the inputs. This could be booleans, representing a true or false value, or numbers which represent possible states the for the input.
- The AI is what converts the inputs into outputs. Through a series of neurons, each with their own values and thresholds, the information is passed from the input into outputs based on how the NN has been trained.
- The Controler is how you convert the outputs into data that you can use. For example, the controler can convert the outputs into a boolean, determining if the AI detected a swear word for a swear filter, or determining the sum of two integers.
GithubPage:
This plugin collects stats using bStats:
Bestats only collects information regarding your system architecture, the server version, and plugin version. If you really do not want any of this information being sent, you can disable bstats by going into the config and setting: "enableStats" to false.
评论 0
登录后参与评分
还没有评论,来抢沙发吧