Skip to content

Instantly share code, notes, and snippets.

View alainrafiki's full-sized avatar
💭
Web Development, Data Science, and Data Analytics

Alain Rafiki alainrafiki

💭
Web Development, Data Science, and Data Analytics
View GitHub Profile
@alainrafiki
alainrafiki / predictive_analytics2.py
Created December 21, 2021 01:34 — forked from accessnash/predictive_analytics2.py
Forward stepwise variable selection for logistic regression - Chapter 2 - Predictive Analytics - Datacamp
# Import the linear_model and roc_auc_score modules
from sklearn import linear_model
from sklearn.metrics import roc_auc_score
# Consider two sets of variables
variables_1 = ["mean_gift","income_low"]
variables_2 = ["mean_gift","income_low","gender_F","country_India","age"]
# Make predictions using the first set of variables and assign the AUC to auc_1
X_1 = basetable[variables_1]
import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
import missingno
import warnings
warnings.filterwarnings("ignore")
%matplotlib inline
@alainrafiki
alainrafiki / compress_s3_images.py
Created February 8, 2016 00:58 — forked from rigoneri/compress_s3_images.py
Simple python code to compress (jpeg/png) images uploaded to S3. In this use case I want to compress down all images that are over 500 KB down to 80% quality which brings the images down to about 100KB. Feel free to muck with the values.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from boto.s3.connection import S3Connection
from cStringIO import StringIO
from PIL import Image as pil
AWS_KEY = '[AWS KEY HERE]'