2019-07-01から1ヶ月間の記事一覧
はじめに image 描写 gray color convert RGB or GBR or HSV ... import cv2 import matplotlib.pyplot as plt def cv2_imshow(title, image): plt.imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB)) plt.title(title) # as opencv loads in BGR format by de…
p-value は、説明変数の 係数が0である帰無仮説が棄却されるかどうか検定するもの。 なので、 - p-value が 0.05 (alpha) 以下の場合は、重要な特徴 - R2 score は、回帰モデル自体がデータをどれくらい性格に予測できているかを示す指標 blog.minitab.com
pandas の dtype 判定ように apiがある。 from pandas.api.types import is_string_dtype from pandas.api.types import is_numeric_dtype is_string_dtype(df['A']) >>>> True is_numeric_dtype(df['B']) >>>> True stackoverflow.com
tmp = '''Variable Description Id A unique identifier associated with an application. Product_Info_1-7 A set of normalized variables relating to the product applied for Ins_Age Normalized age of applicant Ht Normalized height of applicant W…
以下のサイトが分かりやすい。他クラスのスコアのとり方で使用できる。 順序ごとに target label が貼られている場合、target をより ground truth より遠く推論したものにペナルティが加わる。 from sklearn.metrics import cohen_kappa_score from sklearn…
HSV は、「色相(Hue)」「彩度(Saturation)」「明度(Value・Brightness)」の3要素 で、色相は虹みたいな感じ。 www.peko-step.com import PIL from PIL import Image from matplotlib import pyplot as plt import cv2 path = './data/horses.jpg' im = Image…
Yolo v3 での物体検出を Pytorch で実装している。Kaggle 等で使えそう。 github.com pjreddie.com
pytorch のcallback が実装されている。 pytorch.org 2年前の更新で止まっているが、便利。 github.com
めちゃくちゃまとまっている。分かりやすい github.com
www.kaggle.com 細かい内容に心折れそう...。結構、詳しく書いてあったので参考に。 参考にした kernel www.kaggle.com www.kaggle.com www.kaggle.com
Hungarian algorithm が有名所。scipy はこのアルゴリズムで実装されている。 >>> cost = np.array([[4, 1, 3], [2, 0, 5], [3, 2, 2]]) >>> from scipy.optimize import linear_sum_assignment >>> row_ind, col_ind = linear_sum_assignment(cost) >>> col…
phash で画像ファイルを 64bit で表現する。ハミング距離から、画像の類似性を判定できる。 from imagehash import phash from PIL import Image as pil_image img = pil_image.open(path) h = phash(img) h """ array([[ True, False, True, True, True, Tr…
EarlyStopping: min_delta 以下の improvement しか、見られない時に patience 回しか耐えない。monitor より確認 ReduceLROnPlateau: min_delta 以下の改善しか見られない時に、学習率 (lr) に factor を掛ける。 ModelCheckpoint: model_name で保存する。…
わかりやすい。scipy の matrix は output --> input としているので、T @ vec のアフィン変換をする場合は、matrix=mat_inv(T)と逆行列を指定する必要がある。 from scipy.ndimage import affine_transform from numpy.linalg import inv as mat_inv def ce…
以下のコマンドでフォントがあれば、入れてみる。 print([f.name for f in matplotlib.font_manager.fontManager.ttflist]) 例えば from matplotlib import rcParams rcParams['font.family'] = 'IPAPGothic'
docker で django のアプリを作ろうとして詰まった。 uwsgi-docs.readthedocs.io qiita.com
基本的には、upsampling か downsampling か。大体の母分布がわかっている場合は、平均分散を用いて、augmentation するのもあり。 www.kaggle.com A systematic study of the class imbalance problem in convolutional neural networks from Yuya Soneoka …
# 移動平均。重み付けなし df.rolling(window=3).mean() # 未来永劫平均取る的な。 df.expanding(min_periods=3).mean() # 移動平均。重み付けあり。 df.ewm(com=0.5).mean() com : float, optional Specify decay in terms of center of mass, 𝛼=1/(1+𝑐𝑜𝑚),…
str を 数値に変換 Nan を無視できる。 df.num.convert_objects(convert_numeric=True) #=> 0 0 #=> 1 1 #=> 2 NaN #=> 3 3 blog.mwsoft.jp
リーマン距離って、正定値行列同士の距離を正確に測る手段なのか... 不明すぎる。 math.stackexchange.com https://hal.archives-ouvertes.fr/hal-01570120/document
以下のサイトでいい感じにまとめていた。 http://chem.ru.dendai.ac.jp/Ruike/ru_i.ke/3_junior3/bunshi/lec_support/lecture_9.pdf