Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

feature importance plot using lasso regression

# Import Lasso
from sklearn.linear_model import Lasso

# Instantiate a lasso regression model
lasso = Lasso(alpha=0.3)

# Fit the model to the data
lasso.fit(X, y)

# Compute and print the coefficients
lasso_coef = lasso.coef_
print(lasso_coef)
plt.bar(sales_columns, lasso_coef)
plt.xticks(rotation=45)
plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: find occerences in list python 
Python :: pandas turn column of list into binary 
Python :: python kiwi install 
Python :: replace() python 
Python :: cmake python interpreter 
Python :: Python Pandas export Dataframe to csv File 
Python :: django add to cart 
Python :: python ip address increment 
Python :: mosaicplot pandas 
Python :: python write list to file with newlines 
Python :: Pillow opencv convert RGB to BRG or RGB to BRG 
Python :: format json data ipynb 
Python :: fetch last record from django model 
Python :: null=true django 
Python :: img not responding jupyter notebook imshow 
Python :: cmap perlin noise python 
Python :: tensorflow io check file exist 
Python :: dictionary python 
Python :: pandas sequential numbering within group 
Python :: what is mustafa nickname 
Python :: binary search iterative python 
Python :: python crosshair overlay 
Python :: how to make a pattern in python in one line 
Python :: python ascii() 
Python :: matplotlib force scientific notation and define exponent 
Python :: python website example 
Python :: how to use with statement in python 2.5 and earlier 
Python :: python timedelta get days with fraction 
Python :: python string [::-1] 
Python :: how to get index of pandas dataframe python 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =