联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Python编程Python编程

日期:2020-11-08 08:01

ECON 570 Problem Set 3

Due: November 13, 2020

1 Lalonde NSW Data

A. Load the Lalonde experimental dataset with the lalonde_data method from the module

causalinference.utils. The outcome variable is earnings in 1978, and the covariates

are, in order:

Black Indicator variable; 1 if Black, 0 otherwise.

Hispanic Indicator variable; 1 if Hispanic, 0 otherwise.

Age Age in years.

Married Marital status; 1 if married, 0 otherwise.

Nodegree Indicator variable; 1 if no degree, 0 otherwise.

Education Years of education.

E74 Earnings in 1974.

U74 Unemployment status in 1974; 1 if unemployed, 0 otherwise.

E75 Earnings in 1975.

U75 Unemployment status in 1975; 1 if unemployed, 0 otherwise.

Using CausalModel from the module causalinference, provide summary statistics

for the outcome variable and the covariates. Which covariate has the largest normalized

difference?

B. Estimate the propensity score using the selection algorithm est_propensity_s. In

selecting the basic covariates set, specify E74, U74, E75, and U75. What are the additional

linear terms and second-order terms that were selected by the algorithm?

C. Trim the sample using trim_s to get rid of observations with extreme propensity score

values. What is the cut-off that is selected? How many observations are dropped as a

result?

1

D. Stratify the sample using stratify_s. How many propensity bins are created? Report

the summary statistics for each bin.

E. Estimate the average treatment effect using OLS, blocking, and matching. For matching,

set the number of matches to 2 and adjust for bias. How much do the estimates

differ?

2 Document Classification

A. From the module sklearn.datasets, load the training data set using the method

fetch_20newsgroups. This dataset comprises around 18000 newsgroups posts on 20

topics. Print out a couple sample posts and list out all the topic names.

B. Convert the posts (blobs of texts) into bag-of-word vectors. What is the dimensionality

of these vectors? That is, what is the number of words that have appeared in this data

set?

C. Use your favorite dimensionality reduction technique to compress these vectors into

ones of K = 30 dimensions.

D. Use your favorite supervised learning model to train a model that tries to predict the

topic of a post from the vectorized representation of the post you obtained in the

previous step.

E. Use the test data to tune your model. Make sure to include K as a hyperparameter as

well. Use accuracy_score from sklearn.metrics as your evaluation metric. What

is the highest accuracy you are able to achieve?

2


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp