Skip to content

Instantly share code, notes, and snippets.

View sean-mcclure's full-sized avatar

Sean McClure sean-mcclure

  • Kedion
  • San Francisco
View GitHub Profile
@sean-mcclure
sean-mcclure / survival_probability.js
Created June 12, 2022 23:33
Survival Probability for Group Survival (data for plotly.js)
function survival_probability(options) {
var group_size = 1;
if(options.hasOwnProperty("custom_beta")) {
var betas = [options.custom_beta]
} else {
var betas = [100, 50, 25];
}
x_values = [-1, -0.75, -0.5, -0.25, 0, 0.25, 0.5, 0.75, 1];
plot_data = [];
betas.forEach(function(beta) {
@sean-mcclure
sean-mcclure / pipeline_optimizer.py
Created November 7, 2021 22:42
Training the AutoML algorithm
# Training the AutoML algorithm
pipeline_optimizer.fit(X_train, y_train)
@sean-mcclure
sean-mcclure / data.py
Created November 7, 2021 22:42
Loading a dataset for training
# Loading a dataset for training
data = datasets.load_breast_cancer()
# Splitting our data into train and test sets
X_train, X_test, y_train, y_test = train_test_split(data["data"],
data["target"],
test_size=0.2,
stratify=data["target"])
@sean-mcclure
sean-mcclure / TPOTClassifier.py
Created November 7, 2021 22:39
Initializing our TPOT pipeline optimizer
# Initializing our TPOT pipeline optimizer
pipeline_optimizer = TPOTClassifier(generations=5, verbosity=2, config_dict="TPOT light")
@sean-mcclure
sean-mcclure / tpot.py
Created November 7, 2021 22:38
Importing necessary tools and libraries
# Importing necessary tools and libraries
import tpot
from tpot import TPOTClassifier
import pandas as pd
from sklearn import datasets
from sklearn.model_selection import train_test_split
@sean-mcclure
sean-mcclure / classifier_config_dict.py
Created November 7, 2021 22:32
classifier_config_dict
classifier_config_dict = {
# Classifiers
'sklearn.naive_bayes.GaussianNB': {
},
'sklearn.naive_bayes.BernoulliNB': {
'alpha': [1e-3, 1e-2, 1e-1, 1., 10., 100.],
'fit_prior': [True, False]
},
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 3.
Configuration Name,Description,Operators
Default TPOT,"TPOT will search over a broad range of preprocessors, feature constructors, feature selectors, models, and parameters to find a series of operators that minimize the error of the model predictions. Some of these operators are complex and may take a long time to run, especially on larger datasets.
Note: This is the default configuration for TPOT. To use this configuration, use the default value (None) for the config_dict parameter.","Classification
Regression"
TPOT light,"TPOT will search over a restricted range of preprocessors, feature constructors, feature selectors, models, and parameters to find a series of operators that minimize the error of the model predictions. Only simpler and fast-running operators will be used in these pipelines, so TPOT light is useful for finding quick and simple pipelines for a classification or regression problem.
This configuration works for both the TPOTClassifier and TPOTRegressor.","Classification
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 8.
Configuration Name,Description,Operators
Default TPOT,"TPOT will search over a broad range of preprocessors, feature constructors, feature selectors, models, and parameters to find a series of operators that minimize the error of the model predictions. Some of these operators are complex and may take a long time to run, especially on larger datasets."
"Note: This is the default configuration for TPOT. To use this configuration, use the default value (None) for the config_dict parameter.",Classification
Regression
TPOT light,"TPOT will search over a restricted range of preprocessors, feature constructors, feature selectors, models, and parameters to find a series of operators that minimize the error of the model predictions. Only simpler and fast-running operators will be used in these pipelines, so TPOT light is useful for finding quick and simple pipelines for a classification or regression problem."
This configuration works for both the TPOTClassifier and TPOTRegressor.,Classification
Regression
TPOT MDR,"T
@sean-mcclure
sean-mcclure / load_model.py
Created November 3, 2021 23:44
Loading our model
# Loading our model
model = h2o.load_model(model_path)
@sean-mcclure
sean-mcclure / save_model.py
Created November 3, 2021 23:43
Saving our model
# Saving our model
model_path = h2o.save_model(model=best_model,
path="/tmp/leader_model",
force=True)