Skip to content

Instantly share code, notes, and snippets.

View y-uti's full-sized avatar

Yuji Uchiyama y-uti

View GitHub Profile
@y-uti
y-uti / genhtml.sh
Last active August 21, 2019 15:35
「k-medoids 法と DTW による時系列データのクラスタリング」の結果から HTML を出力する bash スクリプト
#!/bin/bash
#
# ブログ記事 (https://y-uti.hatenablog.jp/entry/2016/01/07/154258) の結果から描画用の HTML を出力する bash スクリプトです。
#
# [準備]
# HTMLDIR を適当に変更して mkdir で作成しておく。
# DATADIR 以下に台風の軌跡データ (T0101.csv など各行が北緯,東経の csv ファイル) を置く。
# クラスタリングの出力結果 (kmedoids_result.txt) を次のように分割する。
# $ head -n 1 kmedoids_result.txt | tr ' ' '\n' >indexes.txt
# $ tail -n 1 kmedoids_result.txt | tr ' ' '\n' >medoids.txt
@y-uti
y-uti / OverfitAndRegularization.ipynb
Created March 14, 2019 12:00
社内勉強会で過学習と正則化について説明したスライドに対応する Notebook ファイルです。
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@y-uti
y-uti / LogisticRegression.ipynb
Last active March 9, 2019 00:14
社内勉強会でロジスティック回帰について説明したスライドに対応する Notebook ファイルです。
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@y-uti
y-uti / svm-precision-recall.php
Last active February 12, 2018 02:12
A sample code calculating precision-recall curve from the result of the probability estimation by SVC
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Phpml\Classification\SVC;
use Phpml\SupportVectorMachine\Kernel;
// Load an example dataset published at the web site below
// https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary.html
//
@y-uti
y-uti / dbscan-haversine.php
Created January 17, 2018 14:54
A sample code for DBSCAN with haversine as distance
<?php
/*
* A sample program for DBSCAN with haversine as distance
*
* Requirements
* - PHP-ML (https://github.com/php-ai/php-ml)
* - php-geospatial (https://github.com/php-geospatial/geospatial)
*/
@y-uti
y-uti / iris-test.php
Created November 27, 2017 13:28
Classification of the iris dataset by LogisticRegression
<?php
require_once __DIR__ . '/../vendor/autoload.php';
use \Phpml\Classification\Linear\LogisticRegression;
use \Phpml\CrossValidation\StratifiedRandomSplit;
use \Phpml\Dataset\Demo\IrisDataset;
use \Phpml\Metric\Accuracy;
use \Phpml\Metric\ConfusionMatrix;
$dataset = new IrisDataset();
@y-uti
y-uti / PythonML-Chapter10.ipynb
Created July 8, 2017 22:49
社内勉強会で『Python 機械学習プログラミング』 の第 10 章を発表した際の Notebook ファイルです。
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@y-uti
y-uti / PythonML-Chapter03.ipynb
Last active May 12, 2017 00:22
社内勉強会で『Python 機械学習プログラミング』 の第 3 章を発表した際の Notebook ファイルです。
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?php
function test($init, $key = 'a')
{
$var = $init;
$var[$key] = 1;
echo var_export($init, true), ': ', is_array($var) ? 1 : 0, "\n";
}
test(null); // OK
--- phpenv-global- 2014-10-13 16:22:28.540097442 +0900
+++ phpenv-global 2014-10-13 18:05:08.943905016 +0900
@@ -44,6 +44,9 @@
# Link Apache apxs lib
APXS=""
+if [ "${PHPENV_VERSION}" == "system" ]; then
+ APXS="$(which apxs 2>/dev/null)"
+fi
php-config --configure-options 2>/dev/null | grep -q apxs && \