Skip to content

Instantly share code, notes, and snippets.

View micahmelling's full-sized avatar

Micah Melling micahmelling

View GitHub Profile
from functools import reduce
import warnings
import jenkspy
import pandas as pd
warnings.filterwarnings('ignore')
pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
pd.set_option('display.width', None)
import pandas as pd
import networkx as nx
from sklearn.base import BaseEstimator, TransformerMixin
class CentralityEncoder(BaseEstimator, TransformerMixin):
def __init__(self, node_column, edge_column):
self.mapping_dict = {}
self.node_column = node_column
self.edge_column = edge_column
from sklearn.base import ClassifierMixin, RegressorMixin
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import FunctionTransformer
from helpers.wrangling import drop_features
from modeling.config import CATEGORICAL_FEATURES, FEATURES_TO_DROP
from modeling.embedding import EmbeddingsEncoder
def get_pipeline(model: RegressorMixin or ClassifierMixin) -> Pipeline:
from copy import deepcopy
import pandas as pd
from keras import models
from keras.layers import Dense, Embedding, Flatten
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.preprocessing import LabelEncoder, StandardScaler
class EmbeddingsEncoder(BaseEstimator, TransformerMixin):
import boto3
import json
import string
import random
import warnings
from botocore.config import Config
from ds_helpers.aws import get_secrets_manager_secret
from ds_helpers.db import connect_to_mysql
import pandas as pd
import joblib
import os
from sklearn.model_selection import cross_val_score
from hyperopt import fmin, tpe, Trials, space_eval
def train_model(x_train, y_train, get_pipeline_function, model_uid, model, param_space, iterations, cv_strategy,
cv_scoring, static_param_space):
import mimetypes
import pulumi_aws as aws
import pulumi
from pulumi import FileAsset
from pulumi_aws import s3
def main(bucket_name, index_html_path, aliases, certificate_arn, domain_name, hosted_zone_id, ip_address):
"""
from sklearn.ensemble import GradientBoostingClassifier, RandomForestClassifier, ExtraTreesClassifier
from xgboost import XGBClassifier
from lightgbm import LGBMClassifier
from hyperopt import hp
from sklearn.metrics import log_loss, brier_score_loss, roc_auc_score, f1_score, balanced_accuracy_score
from collections import namedtuple
TARGET = 'target'
TEST_SET_START_YEAR = 2017
import os
from tqdm import tqdm
def upload_directory_to_s3(local_directory, bucket):
"""
Uploads an entire directory to S3.
:param local_directory: name of the local directory
import shap
import pandas as pd
import numpy as np
import os
import matplotlib.pyplot as plt
import multiprocessing as mp
from functools import partial
from statistics import mean