Scikit-Learn


Output  2  We can change the values of parameters to get the desired output from the model.  Elastic-Net



Yüklə 1,92 Mb.
Pdf görüntüsü
səhifə44/124
tarix23.02.2023
ölçüsü1,92 Mb.
#101394
1   ...   40   41   42   43   44   45   46   47   ...   124
sklearn

Output 

We can change the values of parameters to get the desired output from the model. 
Elastic-Net 
The Elastic-Net is a regularised regression method that linearly combines both penalties 
i.e. L1 and L2 of the Lasso and Ridge regression methods. It is useful when there are 
multiple correlated features. The difference between Lass and Elastic-Net lies in the fact 
that Lasso is likely to pick one of these features at random while elastic-net is likely to 
pick both at once. 
Sklearn provides a linear model named 
ElasticNet
 
which is trained with both L1, L2-norm 
for regularisation of the coefficients. The advantage of such combination is that it allows 
for learning a sparse model where few of the weights are non-zero like Lasso regularisation 
method, while still maintaining the regularization properties of Ridge regularisation 
method. 
Following is the objective function to minimise: 
min
𝑤
1
2𝑛
𝑠𝑎𝑚𝑝𝑙𝑒𝑠
||𝑋
𝑤
− 𝑦||
2
2
+ 𝛼𝜌||𝑤||
1
+
𝛼(1 − 𝜌)
2
||𝑤||
2
2
Parameters 
Following table consist the parameters used by 
ElasticNet 
module: 
Parameter 
Description 
alpha
: float, optional, default = 1.0 
Alpha, the constant that multiplies the L1/L2 term, 
is the tuning parameter that decides how much we 
want to penalize the model. The default value is 
1.0. 
l1_ratio
: float 
This is called the ElasticNet mixing parameter. Its 
range is 0 < = l1_ratio < = 1. If l1_ratio = 1, the 
penalty would be L1 penalty. If l1_ratio = 0, the 
penalty would be an L2 penalty. If the value of l1 
ratio is between 0 and 1, the penalty would be the 
combination of L1 and L2. 


Scikit-Learn
48 
fit_intercept

Boolean, 
optional. 
Default=True 
This parameter specifies that a constant (bias or 
intercept) should be added to the decision 
function. No intercept will be used in calculation, if 
it will set to false.
tol
: float, optional 
This parameter represents the tolerance for the 
optimization. The 
tol
value and updates would be 
compared and if found updates smaller than 
tol

the optimization checks the dual gap for optimality 
and continues until it is smaller than 
tol.
normalise
: Boolean, optional, default = 
False
If this parameter is set to True, the regressor X will 
be 
normalised 
before 
regression. 
The 
normalisation will be done by subtracting the mean 
and dividing it by L2 norm. If 

Yüklə 1,92 Mb.

Dostları ilə paylaş:
1   ...   40   41   42   43   44   45   46   47   ...   124




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə