MLPRegressor多层感知机

sklearn.neural_network.MLPRegressor(hidden_layer_sizes=(100, ), activation='relu', solver='adam', alpha=0.0001, batch_size='auto', learning_rate='constant', learning_rate_init=0.001, power_t=0.5, max_iter=200, shuffle=True, random_state=None, tol=0.0001, verbose=False, warm_start=False, momentum=0.9, nesterovs_momentum=True, early_stopping=False, validation_fraction=0.1, beta_1=0.9, beta_2=0.999, epsilon=1e-08)

hidden_layer_sizes : tuple, length = n_layers - 2, default (100,)

The ith element represents the number of neurons in the ith hidden layer.

隐藏层的数量,以及神经元的数量。

activation : {‘identity’, ‘logistic’, ‘tanh’, ‘relu’}, default ‘relu’

Activation function for the hidden layer.

‘identity’, no-op activation, useful to implement linear bottleneck, returns f(x) = x

'identity',无操作激活,对实现线性瓶颈很有用,返回f(x)= x

‘logistic’, the logistic sigmoid function, returns f(x) = 1 / (1 + exp(-x)).

logistic函数,用sigmoid函数

‘tanh’, the hyperbolic tan function, returns f(x) = tanh(x).

双曲线tan函数

‘relu’, the rectified linear unit function, returns f(x) = max(0, x)

修正线性单元函数,也是非线性的,

隐藏层的激活函数

https://blog.csdn.net/zchang81/article/details/70224688激活函数使用建议

线性的缺点是,线性函数的组合仍然是线性函数,意味着无论堆积多少层网络,如果每一层都使用线性激活函数,那这些曾最终等效于一层。

solver : {‘lbfgs’, ‘sgd’, ‘adam’}, default ‘adam’

The solver for weight optimization.

‘lbfgs’ is an optimizer in the family of quasi-Newton methods.

'lbfgs'是准牛顿方法族的优化者。

‘sgd’ refers to stochastic gradient descent.

随机梯度下降

‘adam’ refers to a stochastic gradient-based optimizer proposed by Kingma, Diederik, and Jimmy Ba

              'adam'是指由Kingma,Diederik和Jimmy Ba提出的基于随机梯度的优化器

Note: The default solver ‘adam’ works pretty well on relatively large datasets (with thousands of training samples or more) in terms of both training time and validation score. For small datasets, however, ‘lbfgs’ can converge faster and perform better.

解法

L2惩罚系数      alpha : float, optional, default 0.0001

L2 penalty (regularization term) parameter.

batch_size : int, optional, default ‘auto’

Size of minibatches for stochastic optimizers. If the solver is ‘lbfgs’, the classifier will not use minibatch. When set to “auto”, batch_size=min(200, n_samples)

用于随机优化器的小型机的大小。 如果求解器是'lbfgs',则分类器将不使用minibatch。 设置为“auto”时,batch_size = min(200,n_samples)

learning_rate : {‘constant’, ‘invscaling’, ‘adaptive’}, default ‘constant’

Learning rate schedule for weight updates.权重更新的学习率计划

‘constant’ is a constant learning rate given by ‘learning_rate_init’.'constant'是'learning_rate_init'给出的恒定学习率。

‘invscaling’ gradually decreases the learning rate learning_rate_ at each time step ‘t’ using an inverse scaling exponent of ‘power_t’. effective_learning_rate = learning_rate_init / pow(t, power_t)

'invscaling'使用'power_t'的逆缩放指数在每个时间步't'逐渐降低学习速率learning_rate_。 effective_learning_rate = learning_rate_init / pow(t,power_t)

‘adaptive’ keeps the learning rate constant to ‘learning_rate_init’ as long as training loss keeps decreasing. Each time two consecutive epochs fail to decrease training loss by at least tol, or fail to increase validation score by at least tol if ‘early_stopping’ is on, the current learning rate is divided by 5.

只要训练损失不断减少,“adaptive”将学习速率保持为“learning_rate_init”。 每当两个连续的时期未能将训练损失减少至少tol,或者如果'early_stopping'开启则未能将验证分数增加至少tol,则将当前学习速率除以5。

Only used when solver=’sgd’.

learning_rate_init : double, optional, default 0.001

The initial learning rate used. It controls the step-size in updating the weights. Only used when solver=’sgd’ or ‘adam’.使用初始学习率。 它控制更新权重的步长。 仅在solver ='sgd'或'adam'时使用。

power_t : double, optional, default 0.5

The exponent for inverse scaling learning rate. It is used in updating effective learning rate when the learning_rate is set to ‘invscaling’. Only used when solver=’sgd’.

反缩放学习率的指数。 当learning_rate设置为“invscaling”时,它用于更新有效学习率。 仅在solver ='sgd'时使用。

max_iter : int, optional, default 200

Maximum number of iterations. The solver iterates until convergence (determined by ‘tol’) or this number of iterations. For stochastic solvers (‘sgd’, ‘adam’), note that this determines the number of epochs (how many times each data point will be used), not the number of gradient steps.

最大迭代次数。 求解器迭代直到收敛(由'tol'确定)或这个迭代次数。 对于随机解算器('sgd','adam'),请注意,这决定了时期的数量(每个数据点的使用次数),而不是梯度步数。

shuffle : bool, optional, default True

Whether to shuffle samples in each iteration. Only used when solver=’sgd’ or ‘adam’.

是否在每次迭代中对样本进行洗牌。 仅在solver ='sgd'或'adam'时使用。

random_state : int, RandomState instance or None, optional, default None

If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.

如果是int,则random_state是随机数生成器使用的种子; 如果是RandomState实例,则random_state是随机数生成器; 如果为None,则随机数生成器是np.random使用的RandomState实例。

tol : float, optional, default 1e-4

Tolerance for the optimization. When the loss or score is not improving by at least tol for two consecutive iterations, unless learning_rate is set to ‘adaptive’, convergence is considered to be reached and training stops.

优化容差。 当损失或分数在两次连续迭代中没有提高至少tol时,除非将learning_rate设置为“自适应”,否则认为会达到收敛并且训练停止。

verbose : bool, optional, default False

Whether to print progress messages to stdout.

是否将进度消息打印到stdout。

warm_start : bool, optional, default False

When set to True, reuse the solution of the previous call to fit as initialization, otherwise, just erase the previous solution.

设置为True时,重用上一次调用的解决方案以适合初始化,否则,只需擦除以前的解决方案。

momentum : float, default 0.9

Momentum for gradient descent update. Should be between 0 and 1. Only used when solver=’sgd’.

梯度下降更新的动量。 应该在0和1之间。仅在solver ='sgd'时使用。

nesterovs_momentum : boolean, default True

Whether to use Nesterov’s momentum. Only used when solver=’sgd’ and momentum > 0.

是否使用Nesterov的势头。 仅在solver ='sgd'和momentum> 0时使用。

early_stopping : bool, default False

Whether to use early stopping to terminate training when validation score is not improving. If set to true, it will automatically set aside 10% of training data as validation and terminate training when validation score is not improving by at least tol for two consecutive epochs. Only effective when solver=’sgd’ or ‘adam’

当验证评分没有改善时,是否使用提前停止来终止培训。 如果设置为true,它将自动留出10%的训练数据作为验证,并在验证得分没有提高至少两个连续时期的tol时终止训练。 仅在solver ='sgd'或'adam'时有效

validation_fraction : float, optional, default 0.1

The proportion of training data to set aside as validation set for early stopping. Must be between 0 and 1. Only used if early_stopping is True

将训练数据的比例留作早期停止的验证集。 必须介于0和1之间。仅在early_stopping为True时使用

beta_1 : float, optional, default 0.9

Exponential decay rate for estimates of first moment vector in adam, should be in [0, 1). Only used when solver=’adam’

亚当中第一时刻向量估计的指数衰减率应为[0,1]。 仅在solver ='adam'时使用

beta_2 : float, optional, default 0.999

Exponential decay rate for estimates of second moment vector in adam, should be in [0, 1). Only used when solver=’adam’

亚当中二阶矩矢量估计的指数衰减率应为[0,1]。 仅在solver ='adam'时使用

epsilon : float, optional, default 1e-8

Value for numerical stability in adam. Only used when solver=’adam’

亚当数值稳定性的价值。 仅在solver ='adam'时使用

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 157,924评论 4 360
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 66,902评论 1 290
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 107,716评论 0 239
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,783评论 0 203
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,166评论 3 286
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,510评论 1 216
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,784评论 2 311
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,476评论 0 196
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,196评论 1 241
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,459评论 2 243
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 31,978评论 1 258
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,321评论 2 252
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 32,964评论 3 235
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,046评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,803评论 0 193
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,530评论 2 271
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,420评论 2 265

推荐阅读更多精彩内容

  • 去过青岛很多次,头一次冬天去,而且赶上雨天。连锁酒店的价格比夏天便宜一半多,有暖气,还算舒适。雨淅淅沥沥地下了一天...
    简禾时光阅读 330评论 0 1
  • 20171108在前屿小学5楼多功能室我们开始备第三单元的课啦 从<妈妈的红沙发>一场大火夺走了全部,在街坊邻居的...
    A琳子93520阅读 110评论 0 0
  • 突然就想写一封长长的情书给你 满心欢喜却又突然无从说起 思念如蛊吞噬着所有理智 一路横行只留遍地相思 我压抑不住控...
    云心月阅读 115评论 0 2
  • 一、觉察日记 【事实】工作上和领导的交流 【感受】很开心、很轻松 【意图】抓住每个人的特点,沟通顺畅 【反思】1....
    以诗为名阅读 194评论 0 0