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.model_selection._search import ParameterGrid | |
param_grid = { | |
"metric_list" : [None, "None", "binary_logloss", "auc", ["binary_logloss"], ["auc"], | |
['binary_logloss','auc', ], ['auc', 'binary_logloss',] ], | |
"first_metric_only": [True, False], | |
"eval_train_metric": [True, False], | |
} | |
pg = ParameterGrid(param_grid) |
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 math, sys, functools, os | |
import numpy as np | |
import numpy.random as rd | |
from numpy import matrix | |
import pandas as pd | |
import scipy as sp | |
from scipy import stats as st | |
from datetime import datetime as dt | |
from collections import Counter | |
from itertools import chain |
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
trial_num = 10000 | |
x = rd.multinomial(1, [1/6]*6, trial_num) | |
result = np.sum(x, axis=0) | |
data = np.array([result, np.array([1/6]*6)*trial_num]).T | |
# Draw graph | |
df = pd.DataFrame(data, columns=["trial","theory"],index=range(1,7)) | |
ax = df.plot.bar() | |
ax.set_ylim(0,2000) |
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
# LTS (Least Trimmed Squares) testing | |
# Reference: https://cran.r-project.org/web/packages/galts/galts.pdf | |
install.packages("galts") | |
install.packages("ggplot2") | |
require(galts) | |
require(ggplot2) | |
lts_test <- function(x, y) { |
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
# Preparing | |
install.packages("Rlab") | |
install.packages("ggplot2") | |
install.packages("actuar") | |
install.packages("plyr") | |
require(plyr) | |
require(actuar) | |
require(ggplot2) | |
require(Rlab) |
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
%matplotlib inline | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import scipy.stats as st | |
from matplotlib import animation as ani | |
plt.style.use('ggplot') | |
plt.rc('text', usetex=True) |
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
%matplotlib inline | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import scipy.stats as st | |
from matplotlib import animation as ani | |
plt.style.use('ggplot') | |
plt.rc('text', usetex=True) |
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
%matplotlib inline | |
import matplotlib.pyplot as plt | |
from matplotlib import animation as ani | |
import numpy as np | |
import sys | |
plt.style.use('ggplot') |
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
%matplotlib inline | |
import matplotlib.pyplot as plt | |
import sys | |
import numpy as np | |
from matplotlib import animation as ani | |
plt.style.use('ggplot') | |
x = np.linspace(-2, 2, 500) | |
x2 = (1/2.)*x**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
%matplotlib inline | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import math | |
import mahotas as mh | |
import os.path | |
# get Lenna image | |
if os.path.isfile('./lenna.jpg'): | |
im = mh.demos.load('lena') |
NewerOlder