import numpy as np
from sklearn import datasets
from sklearn import datasets
import matplotlib.pyplot as plt
class AdalineGD(object):
'''
Adaptive Linear Neuron classifier
Paramters
------------------
eta : float
learning rate (between 0.0 and 1.0)
n_iter : int
number of iteration
Attributes
------------------
w_ : 1d-array
weights to be fitted
errors : list
Number of misclassifications in every epoch.
'''
def __init__(self,eta=0.01,n_iter=50):
self.eta = eta
self.n_iter = n_iter
def fit(self, X, y):
'''
Fit training data.
this function implements the algorithm of gradient descent
Parameters
--------------
X ; {array-like}, shape = [n_samples, n_features]
Training vectors
where n_sample is the number
Python实现自适应神经元模型梯度下降算法
最新推荐文章于 2023-03-31 17:11:16 发布