001 /* 002 * Created on Aug 2, 2005 003 * 004 */ 005 package aima.learning.inductive; 006 007 /** 008 * @author Ravi Mohan 009 * 010 */ 011 import java.util.ArrayList; 012 import java.util.List; 013 014 import aima.learning.framework.DataSet; 015 016 public class DLTestFactory { 017 018 public List<DLTest> createDLTestsWithAttributeCount(DataSet ds, int i) { 019 if (i != 1) { 020 throw new RuntimeException( 021 "For now DLTests with only 1 attribute can be craeted , not" 022 + i); 023 } 024 List<String> nonTargetAttributes = ds.getNonTargetAttributes(); 025 String targetAttribute = ds.getTargetAttributeName(); 026 List<String> targetValues = ds 027 .getPossibleAttributeValues(targetAttribute); 028 List<DLTest> tests = new ArrayList<DLTest>(); 029 for (String ntAttribute : nonTargetAttributes) { 030 List<String> ntaValues = ds.getPossibleAttributeValues(ntAttribute); 031 for (String ntaValue : ntaValues) { 032 033 DLTest test = new DLTest(); 034 test.add(ntAttribute, ntaValue); 035 tests.add(test); 036 037 } 038 } 039 return tests; 040 } 041 042 }