Skip to content

Instantly share code, notes, and snippets.

View shaypal5's full-sized avatar
🐢
Working away...

Shay Palachy-Affek shaypal5

🐢
Working away...
View GitHub Profile
@shaypal5
shaypal5 / bitbucket-pipelines.yml
Created July 30, 2020 13:14
Bitbucket status badges
image: python:3.8.3
# pipeline stages definitions
test: &test
step:
name: test
caches:
- pip
script:
- python --version
@shaypal5
shaypal5 / conftest.py
Created October 6, 2020 17:22
Temp environment variables for pytest
import os
import pytest
try:
from.temp_env_var import TEMP_ENV_VARS, ENV_VARS_TO_SUSPEND
except ImportError:
TEMP_ENV_VARS = {}
ENV_VARS_TO_SUSPEND = []
@shaypal5
shaypal5 / lifecycle_core.sh
Last active February 3, 2021 13:04
The core component of my Sagemaker lifecycle template for DS
#!/bin/bash
# --- script documentation
# recieves two arrays as input using the length prefix convention. See:
# https://stackoverflow.com/questions/43686878/pass-multiple-arrays-as-arguments-to-a-bash-script
# add mandatory packages here
# packages+=("pandas")
echo ">>> conda_envs: ${conda_envs[@]}"
@shaypal5
shaypal5 / gist:4522797c5971a48c628b56fe9b1b4b8e
Last active October 12, 2021 09:56 — forked from dotrung/gist:a32aad56ddbb5f218b7c3ec51639b6f0
Install Vim 8 with Python, Python 3 support on Ubuntu 16.04
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-gui-common
sudo apt-get install build-essential cmake
sudo apt-get install python-dev python3-dev
#Optional: so vim can be uninstalled again via `dpkg -r vim`
sudo apt-get install checkinstall
sudo rm -rf /usr/local/share/vim /usr/bin/vim
@shaypal5
shaypal5 / deepchecks-phishing-dataload.py
Created January 16, 2022 15:21
Deepchecks Phishing URLs Example: Loading the data
import pandas as pd; import deepchecks;
from deepchecks.datasets.classification.phishing import load_data
df = load_data(data_format='dataframe', as_train_test=False)
df.head(5)
@shaypal5
shaypal5 / deepchecks-phishing-single-dataset-integrity.py
Created January 16, 2022 16:41
Deepchecks Phishing URLs Example: Running the Single Dataset Integrity Suite
from deepchecks.suites import single_dataset_integrity
integ_suite = single_dataset_integrity()
integ_suite.run(test_dataset=df)
@shaypal5
shaypal5 / deepchecks-phishing-preprocessing.py
Last active January 16, 2022 18:10
Deepchecks Phishing URLs Example: Preprocessing
from deepchecks.datasets.classification.phishing import get_url_preprocessor
pipeline = get_url_preprocessor()
train_df = pipeline.fit_transform(raw_train_df)
train_X = train_df.drop('target', axis=1)
train_y = train_df['target']
test_df = pipeline.transform(raw_test_df)
test_X = test_df.drop('target', axis=1)
test_y = test_df['target']
@shaypal5
shaypal5 / deepchecks-phishing-first-train-test-val.py
Created January 16, 2022 18:18
Deepchecks Phishing URLs Example: First Train Test Validation Suite
from deepchecks.suites import train_test_validation
vsuite = train_test_validation()
ds_train = deepchecks.Dataset(df=train_X, label=train_y, set_datetime_from_dataframe_index=True, cat_features=[])
ds_test = deepchecks.Dataset(df=test_X, label=test_y, set_datetime_from_dataframe_index=True, cat_features=[])
vsuite.run(model=logreg, train_dataset=ds_train, test_dataset=ds_test)
@shaypal5
shaypal5 / deepchecks-phishing-log-reg-model-eval.py
Last active January 16, 2022 18:30
Deepchecks Phishing URLs Example: Log Reg Model Evaluation
from deepchecks.suites import model_evaluation
msuite = model_evaluation()
msuite.run(model=logreg, train_dataset=ds_train, test_dataset=ds_test)
@shaypal5
shaypal5 / deepchecks-phishing-random-forest-model-eval.py
Created January 16, 2022 20:53
Deepchecks Phishing URLs Example: Random Forest Model Evaluation
from sklearn.tree import DecisionTreeClassifier
model = DecisionTreeClassifier(criterion='entropy', splitter='random', random_state=SEED)
model.fit(train_X, train_y)
msuite.run(model=model, train_dataset=ds_train, test_dataset=ds_test)