<commit_before>---
layout: post
title: Machine Learning and Data Analysis - Week3 | Lasso Regression
published: true
---

This is the third assignment of the third course (of five)
[Data Analysis and Interpretation Specialization](https://www.coursera.org/specializations/data-analysis)
detailed information about it can be seeing [here](https://www.coursera.org/learn/machine-learning-data-analysis).

See the entire code and output for this week,  [here](https://github.com/Sidon/Sidon.github.io/blob/master/_posts/lasso.ipynb).

This assignment deals with Lasso Regression Analysis that provides information
for to obtain a subset of predictors that minimizes prediction error for a
quantitative response variable.


### Index
+ [Variables](#variables)
+ [Coeficients](#coefs)
+ [Conclusion](#conclusion)  

### <a name = "variables"></a>Variables

Details of my project can be seeing
[here](https://sidon.github.io/data-visualization-week1/), For this assignment,
I add 10 variables, to get easier, I made a summary bellow:

|Variable Name|Description|Type|Kind|
|-------------|-----------|:---------:|:-----:|:--:|
|Income       |GPD per capita |C|E|
|Alcohol      |Alcohol Consumption |C|E|
|Army         |Armed force rate|Q|E|
|bCancer      |Breast Cancer rate|Q|E|
|CO2          |Co2 emissions rate|Q|E|
|Female-employ|Female employ rate|Q|E|
|Net-rate     |Internet users rate|Q|E|
|polity       |Democracy indicator score|Q|E|   
|relectricperperson| relectric per person|Q|E|
|suicide|Suicide per 100th|Q|E|
|Employ|Employment rate|Q|E|
|Urban|Urbanization rate|Q|E|     
|Life         |Life Expectancy|Q|R|
Type: C = Categorical, Q = Quantitative <br />
Kind: E = Explanatory, R = Response


### <a name = "coefs"></a>Coeficients

Data were randomly split into a training set that included 70% of the
observations and a test set that included 30% of the observations. The least
angle regression algorithm with k=10 fold cross validation was used to estimate
the lasso regression model in the training set, and the model was validated
using the test set. The change in the cross validation average (mean) squared
error at each step was used to identify the best subset of predictor variables.

Bellow I shows de code an te table with coefficients generated

```python
<commit_msg>Update Machine Learn - Coursersa w3<commit_after>---
layout: post
title: Machine Learning and Data Analysis - Week3 | Lasso Regression
published: true
---

This is the third assignment of the third course (of five)
[Data Analysis and Interpretation Specialization](https://www.coursera.org/specializations/data-analysis)
detailed information about it can be seeing [here](https://www.coursera.org/learn/machine-learning-data-analysis).

See the entire code and output for this week,  [here](https://github.com/Sidon/Sidon.github.io/blob/master/_posts/lasso.ipynb).

This assignment deals with Lasso Regression Analysis that provides information
for to obtain a subset of predictors that minimizes prediction error for a
quantitative response variable.


### Index
+ [Variables](#variables)
+ [Coeficients](#coef
+ [Conclusion](#conclusion)  

### <a name = "variables"></a>Variables

Details of my project can be seeing
[here](https://sidon.github.io/data-visualization-week1/), For this assignment,
I add 10 variables, to get easier, I made a summary bellow:

|Variable Name|Description|Type       |Kind|
|-------------|-----------|:---------:|:--:|
|Income       |GPD per capita |C|E|
|Alcohol      |Alcohol Consumption |C|E|
|Army         |Armed force rate|Q|E|
|bCancer      |Breast Cancer rate|Q|E|
|CO2          |Co2 emissions rate|Q|E|
|Female-employ|Female employ rate|Q|E|
|Net-rate     |Internet users rate|Q|E|
|polity       |Democracy indicator score|Q|E|   
|relectricperperson| relectric per person|Q|E|
|suicide|Suicide per 100th|Q|E|
|Employ|Employment rate|Q|E|
|Urban|Urbanization rate|Q|E|     
|Life         |Life Expectancy|Q|R|
Type: C = Categorical, Q = Quantitative <br />
Kind: E = Explanatory, R = Response


### <a name = "coefs"></a>Coeficients

Data were randomly split into a training set that included 70% of the
observations and a test set that included 30% of the observations. The least
angle regression algorithm with k=10 fold cross validation was used to estimate
the lasso regression model in the training set, and the model was validated
using the test set. The change in the cross validation average (mean) squared
error at each step was used to identify the best subset of predictor variables.

Bellow I shows de code an te table with coefficients generated

```python

{'fraction_non_alphanumeric': 0.11606172571180179, 'fraction_numerical': 0.006737665724842426, 'mean_word_length': 4.153415453527436, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 8, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1846052', 'n_tokens_mistral': 1429, 'n_tokens_neox': 1333, 'n_words': 517}