Removed dangerous code to populate the database - this must be retrieved from git in order to repopulate the headlines table.

(This should not need to happen).
PricePoller and ValidationSetCreator generate the 1, 2, 3-grams.txt and validation.txt files, respectively.
MySQLHeadlineDaoImplTest reshuffles the training, validation datasets in 60-40 ratio.
This commit is contained in:
Woody Folsom
2012-04-22 21:24:01 -04:00
parent 6e3680426e
commit 5270359b10
11 changed files with 25 additions and 313 deletions

View File

@@ -6,7 +6,7 @@ import java.util.List;
import net.woodyfolsom.cs6601.p3.domain.Headline;
public interface HeadlineDao {
boolean assignRandomDatasets(int training, int test, int validation);
boolean assignRandomDatasets(int training/*, int test*/, int validation);
int getCount();
int getCount(int dataset);
int deleteById(int id);

View File

@@ -31,20 +31,20 @@ public class HeadlineDaoImpl implements HeadlineDao {
private static final String ASSIGN_RANDOM_PCT_QRY = "update headlines set dataset = (select FLOOR(RAND() * (200 - 101) + 101))";
private static final String REMAP_TRAINING_QRY = "update headlines set dataset = 1 where dataset >= 101 and dataset <= (100 + ?)";
private static final String REMAP_TEST_QRY = "update headlines set dataset = 2 where dataset >= (100 + ?) and dataset <= (100 + ?)";
private static final String REMAP_VAL_QRY = "update headlines set dataset = 3 where dataset >= (100 + ?) and dataset <= 200";
//private static final String REMAP_TEST_QRY = "update headlines set dataset = 2 where dataset >= (100 + ?) and dataset <= (100 + ?)";
private static final String REMAP_VAL_QRY = "update headlines set dataset = 3 where dataset > (100 + ?) and dataset <= 200";
private JdbcTemplate jdbcTemplate;
@Override
public boolean assignRandomDatasets(int training, int test, int validation) {
if (training + test + validation != 100) {
public boolean assignRandomDatasets(int training/*, int test*/, int validation) {
if (training /*+ test*/ + validation != 100) {
return false;
}
jdbcTemplate.update(ASSIGN_RANDOM_PCT_QRY);
jdbcTemplate.update(REMAP_TRAINING_QRY,training);
jdbcTemplate.update(REMAP_TEST_QRY,training,training+test);
jdbcTemplate.update(REMAP_VAL_QRY,training+test);
//jdbcTemplate.update(REMAP_TEST_QRY,training,training+test);
jdbcTemplate.update(REMAP_VAL_QRY,training/*+test*/);
return true;
}