91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 8KB
    文件類型: .py
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-01-05
  • 語(yǔ)言: Python
  • 標(biāo)簽: Lasso??Python??

資源簡(jiǎn)介

利用隨機(jī)坐標(biāo)下降法和循環(huán)坐標(biāo)下降法求解lasso回歸,并作比較。

資源截圖

代碼片段和文件信息

import?numpy?as?np
import?pandas?as?pd
import?matplotlib.pyplot?as?plt
from?sklearn?import?linear_model
from?sklearn?import?preprocessing
from?sklearn.model_selection?import?train_test_split
import?copy

class?Algorithm:
“““
This?is?a?demo?of?using?coordinate?descent?algorithm?(including?both?cyclic?coordinate?descent?
and?randomized?coordinate?descent)?to?solve?the?LASSO?problem?that?is?the?‘l1-regularized?
least-squares?regression?problem.

“““
def?__init__(self?lambduh=6.46?max_iter=1000):
“““
Coordinate?descent?algorithm?to?solve?the?LASSO?problem.

Parameters
----------
lambduh?:?float
Regularization?parameter.
The?default?lambduh?is?set?as?6.46?(the?optimal?lambduh?from?cross?validation?result).?
However?users?are?allowed?set?lambduh?in?the?__main__?function

評(píng)論

共有 條評(píng)論