Skip to content

Instantly share code, notes, and snippets.

View myui's full-sized avatar

Makoto YUI myui

View GitHub Profile
@myui
myui / ArrayOverlapsUDF.java
Created July 17, 2015 06:23
ArrayOverlapsUDF.java
/*
* Hivemall: Hive scalable Machine Learning Library
*
* Copyright (C) 2015 Makoto YUI
* Copyright (C) 2013-2015 National Institute of Advanced Industrial Science and Technology (AIST)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@myui
myui / parallel_similarity_join.sql
Created July 16, 2015 12:05
parallel_similarity_join.sql
create table similarities
as
WITH test_rnd as (
select
rand(31) as rnd,
id,
features
from
test_hivemall
),
@myui
myui / each_top_k.sql
Created July 16, 2015 11:36
each_top_k.sql
create table similarities
as
SELECT
each_top_k(
10, t2.id, angular_similarity(t2.features, t1.features),
t2.id,
t1.id,
t1.y
) as (rank, similarity, base_id, neighbor_id, y)
FROM
@myui
myui / GreaterThanOrEqualsToUDTF.java
Created July 16, 2015 11:17
GreaterThanOrEqualsToUDTF.java
/*
* Hivemall: Hive scalable Machine Learning Library
*
* Copyright (C) 2015 Makoto YUI
* Copyright (C) 2013-2015 National Institute of Advanced Industrial Science and Technology (AIST)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@myui
myui / lof_hivemall.md
Last active August 29, 2015 14:22
Outlier Detection using Local Outlier Factor on Hivemall

This article introduce how to find outliers using Local Outlier Detection (LOF) on Hivemall.

Data Preparation

create database lof;
use lof;

create external table hundred_balls (
  rowid int, 

First of all, make sure that your Treasure Data cluster is HDP2, not CDH4. Matrix Factorization is only supported in the up-to-date HDP2 cluster. HDP2 is allocated for users who signed Treasure Data after Feb 2015. CDH4 is allcoated for the others.

NOTE: please ask our customer support to use HDP2 if you get an error.

Data preparation

Download ml-20m.zip and unzip it.

@myui
myui / mf_params
Last active August 29, 2015 14:21
Parameters of train_mf_sgd
HivemallのMatrix Factorization学習のパラメタの説明です。
http://qiita.com/myui/items/dccb4f58799f080e24ab#%E3%83%90%E3%82%A4%E3%82%A2%E3%82%B9%E3%82%92%E8%80%83%E6%85%AE%E3%81%97%E3%81%9F-matrix-factorization
factor, mu, iterations以外は通常指定不要です。指定順序は関係ありません。
etaは場合によっては指定したほうがよいケースもあります。
1) "-factor 10"
The number of latent factor [default: 10]
潜在変数の数
@myui
myui / online_offline_matrix.md
Last active August 29, 2015 14:21
Real time prediction on MySQL and batch model construction on Hivemall

Hivemall provides a batch learning scheme that builds prediction models on Apache Hadoop. The learning process itself is a batch process; however, an online/real-time prediction can be achieved by carrying a prediction on a transactional relational DBMS.

In this article, we explain how to run a real-time prediction using a relational DBMS. We assume that you have already run the a9a binary classification task.

Online/Offline Matrix of Machine Learning

The following table shows the type matrix of machine learning schemes and applications.

@myui
myui / sqoop.md
Created May 13, 2015 08:19
patch to sqoop 1
$ diff build.xml build.xml.orig
41,42c41,42
<       <echo message="Use Hadoop 2.6.0 by default" />
<       <property name="hadoopversion" value="260" />
---
>       <echo message="Use Hadoop 2.x by default" />
>       <property name="hadoopversion" value="200" />
188,201d187
< 
@myui
myui / cloudinit
Last active August 29, 2015 14:19
cloud-config
#cloud-config
hostname: dcXX
fqdn: dcXX.ec2.internal
mounts:
- [ xvdb, /mnt/disk1, "auto", "defaults,nobootwait,comment=cloudconfig", 0, 2]
- [ xvdc, /mnt/disk2, "auto", "defaults,nobootwait,comment=cloudconfig", 0, 2]
runcmd: