rbf neural network in R

本文介绍了使用R语言实现RBF神经网络来拟合非线性曲线的过程。由于RBF网络对初始参数敏感,作者采用了K-means聚类进行初始化。
摘要由CSDN通过智能技术生成

之前工作用到神经网络拟合nonliear curve
语言用的R语言
找不到源码所以自己参照别人的matlab 代码实现了一个
RBF网络具体介绍见参考文章
参考文章

RBF网络对初始参数设置比较敏感
所以对初始delta 和 center 我利用了kmean 聚类初始化

library(dplyr)
library(data.table)
rbf <- NULL
#Guassian径向基函数
Green <- function(x, c, delta){
        greenValue <- exp(-1.0 * sum((x - c)^2) / (2 * delta^2))
}
hiddenSize <- 2
# cols <- 5
# rows <- 7
# train.x <- matrix(runif(cols * rows), ncol = 1)
# train.y <- matrix(runif( cols * rows), ncol = 1)
 x <- seq(0,3.14*2, by = 0.01)
 y <- sin(x) + runif(length(x))
train.x <- x %>% data.matrix()
train.y <- y %>% data.matrix()

kmeans.parameters <- kmeans(train.x, hiddenSize)

init.centers <- kmeans.parameters$centers
init.delta <- kmeans.parameters$withinss/kmeans.parameters$size + 0.2

rbf$hiddenSize <- hiddenSize
rbf$inputSize <- ncol(train.x)
rbf$outputSize <- ncol(train.y)
rbf
  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Uncover the power of artificial neural networks by implementing them through R code. About This Book Develop a strong background in neural networks with R, to implement them in your applications Build smart systems using the power of deep learning Real-world case studies to illustrate the power of neural network models Who This Book Is For This book is intended for anyone who has a statistical background with knowledge in R and wants to work with neural networks to get better results from complex data. If you are interested in artificial intelligence and deep learning and you want to level up, then this book is what you need! What You Will Learn Set up R packages for neural networks and deep learning Understand the core concepts of artificial neural networks Understand neurons, perceptrons, bias, weights, and activation functions Implement supervised and unsupervised machine learning in R for neural networks Predict and classify data automatically using neural networks Evaluate and fine-tune the models you build. In Detail Neural networks are one of the most fascinating machine learning models for solving complex computational problems efficiently. Neural networks are used to solve wide range of problems in different areas of AI and machine learning. This book explains the niche aspects of neural networking and provides you with foundation to get started with advanced topics. The book begins with neural network design using the neural net package, then you'll build a solid foundation knowledge of how a neural network learns from data, Table of Contents Chapter 1. Neural Network and Artificial Intelligence Concepts Chapter 2. Learning Process in Neural Networks Chapter 3. Deep Learning Using Multilayer Neural Networks Chapter 4. Perceptron Neural Network Modeling – Basic Models Chapter 5. Training and Visualizing a Neural Network in R Chapter 6. Recurrent and Convolutional Neural Networks Chapter 7. Use Cases of Neural Networks – Advanced Topics
scikit-learn的神经网络neural_network)库中的径向基函数(rbf)经验网络是一种基于径向基函数的反向传播(radial basis function neural network)的模型。 径向基函数是一种常用的非线性函数,常用于将高维输入映射到低维空间。该函数的形式为:K(x,y) = exp(-gamma*||x-y||^2),其中x和y是向量,gamma是一个参数,||x-y||是x和y之间的欧几里得距离。 在scikit-learn的neural_network库中,径向基函数经验网络(RBF network)是一种多层感知器(MLP)的变种,它的隐藏层单元由径向基函数构成。该模型的结构类似于传统的多层感知器,只是隐藏层的激活函数不再是传统的sigmoid函数或ReLU函数,而是径向基函数。 径向基函数经验网络使用径向基函数作为隐藏层的激活函数,并通过反向传播算法来更新网络的权重和偏置。这种模型的优点是可以处理非线性问题,并且不需要预先对数据进行特征工程。然而,该模型的训练过程相对复杂,需要较大的样本量和计算资源。 在sklearn的neural_network库中,可以使用RBF经验网络通过调用RBFRegressor或RBFClassifier类来构建模型。然后,可以使用fit()方法对模型进行训练,使用predict()方法对新的样本进行预测。 总之,sklearn的neural_network库中的rbf经网网络是一种基于径向基函数的反向传播神经网络模型,可以用于解决非线性问题,并且不需要进行特征工程。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值