用R语言实现的神经网络做排序,调用了R语言中的caret、neuralnet包,基本原理不复杂,原文给出的关键代码
library(neuralnet)
# Helper method to generate a training set containing size random numbers (a, b, c) and sorted (x, y, z).
generateSet <- function(size = 100, max = 100) {
# Generate size random numbers between 1 and max.
training <- data.frame(a=sample(1:max, size, replace=