Skip to content

Instantly share code, notes, and snippets.

@puyokw
Created March 9, 2016 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save puyokw/413c5c2c2a152785d68b to your computer and use it in GitHub Desktop.
Save puyokw/413c5c2c2a152785d68b to your computer and use it in GitHub Desktop.
td_intern otto
-- トレーニングデータに乱数を入れる
INSERT OVERWRITE TABLE training_with_rnd
select *, rand(1) as rnd
from training;
-- rnd が0.3 以上のものをトレーニングデータ
INSERT OVERWRITE TABLE train_cv
select *
from training_with_rnd where rnd >= 0.3;
-- rnd が0.3 未満のものを検証用データ
INSERT OVERWRITE TABLE test_cv
select *
from training_with_rnd where rnd < 0.3;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment