Skip to content

Instantly share code, notes, and snippets.

View MattJBritton's full-sized avatar

Matt Britton MattJBritton

View GitHub Profile
@MattJBritton
MattJBritton / 01_multi_select_widget_readme.md
Last active September 19, 2023 02:25 — forked from pbugnion/01_multi_select_widget_readme.md
Multiple checkbox selection with searching with ipywidgets

Multiple selection with checkboxes and search field

This gist is forked from pbugnion's great work on building a searchable multi-checkbox using ipywidgets. You can find that work in this gist.

This version adds compatability with Jupyter Widgets' interactive_output() function, and also makes it easier to see which elements were selected by sorting them to the top. It also makes a few small changes to enable this to work in Jupyter Lab.

Image of dropdown

Usage

@MattJBritton
MattJBritton / script.py
Last active June 1, 2020 19:27
Answer to Cassie Kozyrkov Pattern Challenge
import math
import pandas as pd
import numpy as np
from sklearn.linear_model import LinearRegression
# load data
data = [
(1,28), (2,17), (3,92),
(4,41),(5,9), (6,87),
@MattJBritton
MattJBritton / minimal_example.py
Created May 27, 2020 03:59
Feature Space Diagram
import numpy as np
import pandas as pd
from scipy.spatial.distance import pdist, squareform
from sklearn import datasets
from sklearn.decomposition import PCA
from sklearn.cluster import FeatureAgglomeration
from sklearn.preprocessing import StandardScaler
from sklearn.impute import SimpleImputer
from sklearn.metrics import silhouette_score
@MattJBritton
MattJBritton / titanic_sklearn_decision_tree.py
Last active May 3, 2020 03:18
InteractiveDecisionTrees Titanic simple sklearn model
# imports
import pandas as pd
import numpy as np
from scipy.stats import entropy
from sklearn.tree import DecisionTreeClassifier, export_text
from sklearn.impute import KNNImputer, SimpleImputer
# dataset from https://www.kaggle.com/c/titanic/data
# Load dataset
titanic_df = pd.read_csv("data/titanic_train.csv")