Skip to content

Instantly share code, notes, and snippets.

View allisonmorgan's full-sized avatar

Allison Morgan allisonmorgan

View GitHub Profile
@allisonmorgan
allisonmorgan / logistic_example.ipynb
Created April 23, 2021 23:56
Logistic regression example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@allisonmorgan
allisonmorgan / scrape_gradhotline.ipynb
Last active May 3, 2021 23:03
Scraping US Grad Hotline
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@allisonmorgan
allisonmorgan / eob_compared_to_nsf_sed.ipynb
Last active October 26, 2020 21:53
Expectations of brilliance with NSF survey of earned doctorates
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@allisonmorgan
allisonmorgan / acronym_count.txt
Last active October 23, 2018 22:15
Counting punctuation in DBLP titles
1959 2 80
1960 0 9
1961 0 26
1962 7 147
1963 1 13
1964 4 42
1965 4 75
1966 20 157
1967 37 279
1968 65 549
from requests.packages.urllib3.exceptions import InsecureRequestWarning
from selenium import webdriver
def get_url(url):
print("Requesting fresh HTML")
driver = webdriver.Safari()
res = driver.get(url)
r = driver.page_source
driver.close()
@allisonmorgan
allisonmorgan / intro.md
Last active July 18, 2018 14:37
Salsa Analysis

Steps to evaluating salsa success:

  1. Used an API to get information on 500 recipes which contain the query string “salsa” and have been classified as a “condiment or sauce”.

  2. Tried to clean and stem the ingredients from these recipes the best I could (see util.py). Note in some cases the ingredient was listed ambiguously: onion, versus red, white or green onion. I did not standardize on those.

The process resulted in a feature matrix of each recipe (500 rows by 228 ingredients). Each row is filled with zeros or ones indicating the presence of an ingredient. (Information about amounts was much trickier to obtain and standardize.)

  1. Ran an ordered logistic regression model for predicting these recipes ratings (scale of 1 to 5), where my covariates were the first 60 most common ingredients (these ingredients described 90% of all recipes). The significant variables (p < 0.05) were:
@allisonmorgan
allisonmorgan / sudoku.py
Created December 29, 2017 01:49
Solving sudoku
"""
The Sudoku Problem Formulation for the PuLP Modeller
https://github.com/coin-or/pulp/blob/master/examples/Sudoku1.py
Authors: Antony Phillips, Dr Stuart Mitcehll
Adapted: Allison Morgan (12/27/2017)
"""
# Import PuLP modeler functions
from pulp import *
@allisonmorgan
allisonmorgan / cookie_count.ipynb
Last active December 13, 2017 04:13
Code for generating cookie bar charts