MARK CHANG'S BLOG

若發生公式跑掉或無法正常顯示的情形,請在公式上按右鍵設定:math setting-> math render->SVG
  • About Me
  • Archive
  • feeds

Posts match “ Sample ” tag:

over 8 years ago

R -- Data Splitting

在做機器學習演算法時,常常需要把資料分成 training set 和 validation set 這兩個資料組。
但是,要如何切割,才可以讓具有不同 label 的資料,在這兩個資料組中,平均分佈?

用統計語言 R 處理 iris 資料組為例。iris 的資料如下:

index Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
... ... ... ... ... ......
51 7.0 3.2 4.7 1.4 versicolor
52 6.4 3.2 4.5 1.5 versicolor
... ... ... ... ... ......
101 6.3 3.3 6.0 2.5 virginica
102 5.8 2.7 5.1 1.9 virginica
... ... ... ... ... ......
Read on →
  • data_splitting
  • Sample
  • createDataPartition
  • r
  • August 23, 2014 14:46
  • Permalink
  • Comments
 

Copyright © 2013 cpmarkchang . Powered by Logdown.
Based on work at subtlepatterns.com.