This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TMP=`mktemp` | |
trap ctrlC INT | |
removeTempFiles() { | |
rm -f $TMP | |
} | |
ctrlC() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See https://machinelearningmastery.com/columntransformer-for-numerical-and-categorical-data/ | |
from sklearn.linear_model import LinearRegression | |
from sklearn.compose import ColumnTransformer | |
from sklearn.impute import SimpleImputer | |
from sklearn.pipeline import Pipeline | |
from sklearn.model_selection import train_test_split | |
from sklearn.preprocessing import OneHotEncoder, StandardScaler | |
from sklearn import set_config | |
import seaborn as sns | |
set_config(display='diagram') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://scikit-learn.org/stable/auto_examples/model_selection/plot_multi_metric_evaluation.html#sphx-glr-auto-examples-model-selection-plot-multi-metric-evaluation-py | |
# https://machinelearningmastery.com/nested-cross-validation-for-machine-learning-with-python/ | |
from numpy import mean | |
from numpy import std | |
from sklearn.datasets import make_classification | |
from sklearn.metrics import make_scorer, accuracy_score | |
from sklearn.model_selection import cross_val_score, KFold, RandomizedSearchCV, GridSearchCV, train_test_split | |
from sklearn.ensemble import RandomForestClassifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import mean | |
from numpy import std | |
from sklearn.datasets import make_classification | |
from sklearn.model_selection import cross_val_score | |
from sklearn.model_selection import RepeatedStratifiedKFold | |
# Models | |
from sklearn.ensemble import GradientBoostingClassifier | |
from xgboost import XGBClassifier | |
from lightgbm import LGBMClassifier | |
from catboost import CatBoostClassifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.linear_model import LogisticRegression | |
from sklearn.model_selection import train_test_split, StratifiedKFold | |
from sklearn.datasets import make_classification | |
# See: https://scikit-learn.org/stable/modules/generated/sklearn.calibration.CalibratedClassifierCV.html | |
from sklearn.calibration import CalibratedClassifierCV, calibration_curve | |
# Dummy data (numpy.array) | |
X, y = make_classification(n_samples=1000, n_classes=2, weights=[1,1], random_state=1) | |
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
# write | |
with open('names.csv', 'w', newline='') as file: | |
fieldnames = ['first_name', 'last_name'] | |
writer = csv.DictWriter(file, fieldnames=fieldnames) | |
writer.writeheader() | |
writer.writerow({'first_name': 'Baked', 'last_name': 'Beans'}) | |
writer.writerow({'first_name': 'Lovely', 'last_name': 'Spam'}) | |
writer.writerow({'first_name': 'Wonderful', 'last_name': 'Spam'}) | |
# read |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.linear_model import LogisticRegression | |
from sklearn.pipeline import make_pipeline | |
from sklearn.model_selection import cross_val_score, StratifiedKFold | |
from sklearn.datasets import make_classification, load_iris | |
from sklearn.metrics import roc_auc_score, make_scorer | |
from sklearn import set_config | |
set_config(display='diagram') | |
pipeline = make_pipeline(LogisticRegression(random_state=0)) | |
pipeline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
definitions: | |
steps: | |
- step: &build-and-push | |
script: | |
- IMAGE_TAG=$(cat TAG.txt) | |
- echo ${IMAGE_TAG} | |
- IMAGE_NAME = <your-image-name> | |
- docker build -t $IMAGE_NAME . | |
- pipe: atlassian/aws-ecr-push-image:1.1.1 | |
variables: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rvest) | |
library(stringr) | |
library(leaflet) | |
library(RCurl) | |
library(rjson) | |
library(RgoogleMaps) | |
#住所を文字列で入力すると位置情報をjson形式で返却する関数 | |
GetLocationInformation <-function(address) | |
{ |