Lambda 是控制学习率的术语.换句话说,您希望模型在每次学习迭代中做出多少改变.混乱更糟糕的是,这些术语经常互换使用,我认为是由于图论、统计理论、数学理论以及编写常用机器学习库的个人不同但相似的概念在这里查看一些信息:https://www.analyticsvidhya.com/blog/2016/01/complete-tutorial-ridge-lasso-regression-python/ 但也可以寻找一些关于统计学习的免费学术教科书.Question : Logistic Regression Train logistic regression models with L1 regularization and L2 regularization using alpha = 0.1and lambda = 0.1. Report accuracy, precision, recall, f1-score and print the confusion matrixMy code is : _lambda = 0.1c = 1/_lambdaclassifier = LogisticRegression(penalty='l1',C=c)classifier.fit(X_train, y_train)y_pred = classifier.predict(X_test)I don't know where is really location of alpha and lambda.Did I work right? 解决方案 your examplealpha=0, lambda=10 (AKA .1/1)alphaalpha is the parameter that adds penalty for number of features to control overfitting, in this case either L1 (Lasso Regression) or L2 (Ridge Regression). L1 and L2 penalty cannot both be done at the same time, as there is only one Lambda coefficient. Quick aside - Elastic Net is an alpha parameter that is somewhere in between L1 and L2, so for example, if you are using sklearn.SGD_Regressor() alpha=0 is L1 alpha=0.5 is elasticnet, alpha=1 is Ridge.Lambdais a term that controls the learning rate. In other words, how much change do you want the model to make during each iteration of learning.confusionTo make matters worse, these terms are often used interchangedly, I think due to different yet similar concepts in graph theory, statistical theory, mathematical theory, and the individuals who write commonly-used machine-learning librariescheck out some info here: https://www.analyticsvidhya.com/blog/2016/01/complete-tutorial-ridge-lasso-regression-python/ but also look for some of the free academic textbooks about statistical learning. 这篇关于python中alpha和lambda正则化参数的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-26 20:03