2018-01-01から1年間の記事一覧
python-remrin.hatenadiary.jp
alphanumeric の RegexValidator で追加。 alphanumeric = RegexValidator(r'^[0-9a-zA-Z]*$', 'Only alphanumeric characters are allowed.') name = models.CharField(max_length=50, blank=True, null=True, validators=[alphanumeric]) email = models.E…
いつの日にか実装するかもしれないので、メモ github.com qiita.com
以下のコマンドで、取り出す。 mysql -uroot -N information_schema -e "select table_name from tables where table_schema = 'tablename' and table_name like 'prefix_%'" > table.txt
正解率が90%と低めに出た。。原因は今度調べよう import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) mnist.train.images.shape => (55000, 784) n_feat…
yomon.hatenablog.com JVM Settings | Apache Solr Reference Guide 6.6 SolrPerformanceFactors - Solr Wiki ShawnHeisey - Solr Wiki SolrPerformanceProblems - Solr Wiki JVM 自体のチューニング yoskhdia.hatenablog.com fomsan.sakura.ne.jp
結構すごい。。表記ゆれとかも吸収できそう。 from gensim.models import word2vec ls = [] for row in df_id['review_comment'].values[:100000]: ls.append(_split_to_rawwords(row)) model = word2vec.Word2Vec(ls, size=500, window=5, min_count=5, wor…
レビューの分析方法をまとめる。 import os import glob import sys from datetime import (datetime, date, timedelta) import logging import re import shutil import tempfile import pandas as pd import numpy as np from scipy.sparse.csc import csc…
sparseな行列についての実装 import numpy as np from scipy.sparse import coo_matrix ) a = np.arange(30).reshape(10,3) print(a) [[ 0 1 2] [ 3 4 5] [ 6 7 8] [ 9 10 11] [12 13 14] [15 16 17] [18 19 20] [21 22 23] [24 25 26] [27 28 29]] b, c, d …
Building a Recommendation System in TensorFlow: Overview | Solutions | Google Cloud
applyとかassignとかpipeとかapplymapとか。numpyで対応していたところもあって知らなかった。 qiita.com stackoverflow.com stackoverflow.com
まとまっている pdf を貼る 実対称行列についてのまとめも記載 http://www.cs.shinshu-u.ac.jp/~maruyama/lin/pdf/lin09.pdf dora.bk.tsukuba.ac.jp おまけ(線形代数のわかりやすいサイト) oguemon.com
GC とか Full GC とか、いろいろ単語が出ていたので、調べた。 Java が 動作するための仮想環境 JVM のチューニングが必要らしい。 Javaパフォーマンスチューニングのルール (1/2):Javaパフォーマンスチューニング(1) - @IT www.infoq.com
Access-Control-Allow-Origin エラーはドメインの異なるリソースを表示しようとする際に起こるブラウザ側のエラー developer.mozilla.org
tab で 4 space 入れる方法。 #!/usr/bin/env python # -*- encoding:utf-8 -*- # vim:tabstop=4:shiftwidth=4:expandtab print('aaa') /* vim:set ts=4 sw=4 et ws is nowrap ft=java fenc=utf-8 ff=dos: */ class JSample13_1{ public static void main(St…
utf-8 => unicode にファイルをエンコードする。 $ cat JSample3_1.java class JSample3_1{ public static void main(String args[]){ System.out.println("こんにちは"); System.out.println("お元気ですか"); } } $ native2ascii -encoding UTF-8 JSample3…
www.javadrive.jp www.javacodegeeks.com www.javacodegeeks.com
レコメンドエンジンで使えそうな論文。 FM https://www.csie.ntu.edu.tw/~b97053/paper/Rendle2010FM.pdf FFM https://www.andrew.cmu.edu/user/yongzhua/conferences/ffm.pdf 参考までに。FM の実装 github.com "SLIM: Sparse Linear Methods for Top-N Rec…
レビューとかでユーザが明示的に評価したら、Explicit。 PVとかCVとかのlogで評価を判断するのがImplicit。らしい。 There are two ways to gather the data. The first method is to ask for explicit ratings from a user, typically on a concrete rating…
MySQLも同様だけど、yumではなく、tarballからもインストールできるので勉強として。 実行 ## cassandraがyum installされている場合 sudo yum remove cassandra ls /var/lib/cassandra/* rm -rf /var/lib/cassandra/* ## tarをインストール mkdir /usr/loca…
dsnotes.com ebaytech.berlin netflix https://beta.vu.nl/nl/Images/werkstuk-fernandez_tcm235-874624.pdf 協調フィルタリング http://yifanhu.net/PUB/cf.pdf
クラスタリングアルゴリズムの中で、クラスタが球状という前提を持たずに、 クラスタラベルを割り当てる。 from sklearn.datasets import make_moons X, y = make_moons( n_samples=200, noise=0.05, random_state=0 ) plt.scatter(X[:, 0 ], X[:, 1]) plt.t…
データ作成 shape: (5, 3) のランダム行列を作成 import pandas as pd import numpy as np np.random.seed(123) variables = ['X', 'Y', 'Z'] labels = ['ID_0', 'ID_1', 'ID_2', 'ID_3', 'ID_4'] X = np.random.random_sample([5, 3])*10 ## pandas のデー…
MySQL で maxを取得しようとしたさい、あれどんな挙動するんやろと迷った 気にすることなかった。 mysql> select (NULL < 1); +------------+ | (NULL < 1) | +------------+ | NULL | +------------+ 1 row in set (0.00 sec) mysql> select (NULL > 0); +-…
## クラスタリングのサンプルを作成 from sklearn.datasets import make_blobs X, y = make_blobs( n_samples=150, n_features=2, centers=3, cluster_std=0.5, shuffle=True, random_state=True ) ## クラスタリングを描画 plt.scatter(X[:, 0], X[:, 1], c…
ここのコードを再利用することで、実装も簡単かも。 github.com Python Data Science Handbook | Python Data Science Handbook sebastianraschka.com https://sebastianraschka.com/pdf/books/dlb/appendix_d_calculus.pdf
一般的に、アンサンブル分類器の方が、個別の分類器より性能が高い from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.preprocessing import ( StandardScaler, LabelEncoder, ) iris = datasets.load_iris(…
以下の投稿で load したX_train, y_train,... を利用。 kidnohr.hatenadiary.com 適合率と再現率と F1 スコア 適合率(PRE)と再現率(REC)について、F1 スコアという性能指標が存在する。 PRE = TP / ( TP + FP ) REC = TP / ( TP + FN ) f1 = 2 * ( PRE *…
サポートベクトルマシンのパイプラインのトレーニング from sklearn.preprocessing import LabelEncoder from sklearn.preprocessing import StandardScaler from sklearn.pipeline import make_pipeline from sklearn.model_selection import GridSearchCV …
以下をまずは見て。 kidnohr.hatenadiary.com train_size を指定することで、学習曲線を描画 import matplotlib.pyplot as plt from sklearn.model_selection import learning_curve pipe_lr = make_pipeline(StandardScaler(), LogisticRegression(penalty=…