Instantly share code, notes, and snippets.

# kenmatsu4matsuken92

• Sort options
Last active May 11, 2019
Demonstration of hidden class ParameterGrid on sklearn.
View ParameterGrid_test.py
 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)
Last active Aug 3, 2016
frequently used libraries etc
View default_import.py
 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
Created May 5, 2016
View test.py
 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)
Last active Nov 28, 2015
View Least_trimmed_squares.r
 # 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) {
Last active Dec 5, 2015
View 00_distributions.r
 # Preparing install.packages("Rlab") install.packages("ggplot2") install.packages("actuar") install.packages("plyr") require(plyr) require(actuar) require(ggplot2) require(Rlab)
Last active Aug 29, 2015
GLMM : draw graphs of mixture distributions.
View 01_preparation.py
 %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)
Last active Aug 29, 2015
View 01_preparation.py
 %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)
Last active Apr 3, 2017
Graph for explanation of Standard Deviation.
View 01_prep.py
 %matplotlib inline import matplotlib.pyplot as plt from matplotlib import animation as ani import numpy as np import sys plt.style.use('ggplot')
Created Jul 28, 2015
Drawing a evaluate function for Quantile Regression.
View 01_quantile_reg_evaluate_func.py
 %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
Last active Aug 29, 2015
Draw a image of famous Lenna and filtered image.
View 01_draw_lenna_and_filter.py
 %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')
You can’t perform that action at this time.