And*_*sen 9 text-analysis neural-network brain.js
我正在尝试进行一些文本分析,以确定给定的字符串是否......谈论政治.我想我可以创建一个神经网络,其中输入是一个字符串或一个单词列表(排序可能很重要?),输出是字符串是否与政治有关.
但是,brain.js库只接受0到1之间的数字输入或0到1之间的数字数组.如何以可以完成任务的方式强制我的数据?
Pre*_*nth 11
new brain.recurrent.LSTM();
Run Code Online (Sandbox Code Playgroud)
这对你来说很有用.
例,
var brain = require('brain.js')
var net = new brain.recurrent.LSTM();
net.train([
{input: "my unit-tests failed.", output: "software"},
{input: "tried the program, but it was buggy.", output: "software"},
{input: "i need a new power supply.", output: "hardware"},
{input: "the drive has a 2TB capacity.", output: "hardware"},
{input: "unit-tests", output: "software"},
{input: "program", output: "software"},
{input: "power supply", output: "hardware"},
{input: "drive", output: "hardware"},
]);
console.log("output = "+net.run("drive"));
output = hardware
Run Code Online (Sandbox Code Playgroud)
参考这个链接=> https://github.com/BrainJS/brain.js/issues/65 这有明确的解释和使用brain.recurrent.LSTM()
| 归档时间: |
|
| 查看次数: |
5494 次 |
| 最近记录: |