Exemplo n.º 1
0
def push(OK):
    with open('ok.py', 'wt') as f:
        json.dump(OK, f)

    from client.api.notebook import Notebook

    ok = Notebook('ok.py')
    ok.auth(inline=True)
    ok.submit()
Exemplo n.º 2
0
# Construct and save the submission:
submission_df = pd.DataFrame({
    "Id": test['id'],
    "Class": test_predictions,
},
                             columns=['Id', 'Class'])
timestamp = datetime.isoformat(datetime.now()).split(".")[0]
submission_df.to_csv("submission_{}.csv".format(timestamp), index=False)

print('Created a CSV file: {}.'.format("submission_{}.csv".format(timestamp)))
print('You may now upload this CSV file to Kaggle for scoring.')

# In[ ]:

# # Submit
# Make sure you have run all cells in your notebook in order before running the cell below, so that all images/graphs appear in the output.
# **Please save before submitting!**
#
# <!-- EXPECT 9 EXPORTED QUESTIONS -->

# In[ ]:

# Save your notebook first, then run this cell to submit.
import jassign.to_pdf

jassign.to_pdf.generate_pdf('proj2.ipynb', 'proj2.pdf')
ok.submit()

# In[ ]:
# name: q2_2_9
# manual: true
# -->
# <!-- EXPORT TO PDF -->

# One reason why this cannot be used to say that high cholesterol causes heart disease is because this data was obtained through a an observational study. This matters because, unlike a randomized controlled exeperiment, observational studies cannot effectively control for confounding variables. Thus, we can only conclude that an association is present rather than establishing causality between high cholesterol and heart disease.

# Similar studies from the 1950s found positive associations between diets high in saturated fat, high cholesterol, and incidence of heart disease. In 1962, the U.S. Surgeon General said:
#
# *"Although there is evidence that diet and dietary habits may be implicated in the development of coronary heart disease and may be significant in its prevention or control, at present our only research evidence is associative and not conclusive."*

# #### Congratulations, you have reached the checkpoint! Run the submit cell below to generate the checkpoint submission.

# In[63]:

_ = ok.submit()

# ## Part 3: The Nurses' Health Study and Hormone Replacement Therapy

# The Nurses' Health Study (NHS) is another very large observational study which has brought many insights into women's health. It was begun in 1976 by Dr. Frank Speizer, with questionnaires that were mailed to 121,964 female registered nurses in the United States asking about their medical history, cholesterol and blood pressure, current medications, and so on (one of the benefits of studying nurses is their ability to give reliably accurate answers to these questions). The study's initial focus was on investigating the long-term health effects of oral contraceptives, whose use had become much more widespread in the U.S. during the 1960s, but the focus soon expanded to investigating a wide variety of questions on women's health. The NHS continues to this day, tracking its third generation of nurses in the US.
#
# One of the most consequential early findings from the NHS was about hormone replacement therapy (HRT): supplementary estrogen and progesterone for post-menopausal women to relieve side effects of declining hormone levels due to menopause. The NHS found that HRT in postmenopausal women was negatively associated with heart attack risk. In a landmark 1985 paper in the *New England Journal of Medicine* (NEJM), Speizer and his coauthors wrote that
# > As compared with the risk in women who had never used postmenopausal hormones, the age-adjusted relative risk of coronary disease in those who had ever used them was 0.5 (95 per cent confidence limits, 0.3 and 0.8; P = 0.007)... These data support the hypothesis that the postmenopausal use of estrogen reduces the risk of severe coronary heart disease. [(Stampfer et al., 1985)](https://www.ncbi.nlm.nih.gov/pubmed/4047106)
#
# In other words, the authors are saying that women on HRT are half as likely to suffer a heart attack over a certain time period. We'll define the term "relative risk" later in this section, and we'll also investigate the interpretation of these claims and their statistical basis.

# **Question 1.** The block quote above is a direct quote from the 1985 article's abstract. Do you find any of the claims to be suspect? If so, why?
#
# <!--
# BEGIN QUESTION
# name: q3_1