MCPcopy Index your code
hub / github.com/EdwardRaff/JSAT / setUp

Method setUp

JSAT/test/jsat/io/JSATDataTest.java:62–110  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60 }
61
62 @Before
63 public void setUp()
64 {
65 CategoricalData[] categories = new CategoricalData[3];
66 categories[0] = new CategoricalData(2);
67 categories[1] = new CategoricalData(3);
68 categories[2] = new CategoricalData(5);
69
70 categories[1].setCategoryName("I love " + GreekLetters.pi);//unicide to exercise non-ascii writer
71
72 simpleData = new SimpleDataSet(categories, 20);
73
74 Random rand = RandomUtil.getRandom();
75
76 for(int i = 0; i < 10; i++)
77 {
78 int[] catVals = new int[categories.length];
79 for(int j = 0; j < categories.length; j++)
80 catVals[j] = rand.nextInt(categories[j].getNumOfCategories());
81
82 double[] numeric = new double[simpleData.getNumNumericalVars()];
83 for(int j = 0; j < numeric.length/3; j++)
84 {
85 numeric[rand.nextInt(numeric.length)] = rand.nextDouble();
86 }
87
88 simpleData.add(new DataPoint(new DenseVector(numeric), catVals, categories, rand.nextDouble()));
89 }
90
91
92
93 byteIntegerData = new SimpleDataSet(categories, 20);
94
95
96 for(int i = 0; i < 10; i++)
97 {
98 int[] catVals = new int[categories.length];
99 for(int j = 0; j < categories.length; j++)
100 catVals[j] = rand.nextInt(categories[j].getNumOfCategories());
101
102 double[] numeric = new double[simpleData.getNumNumericalVars()];
103 for(int j = 0; j < numeric.length/3; j++)
104 {
105 numeric[rand.nextInt(numeric.length)] = rand.nextInt(Byte.MAX_VALUE);
106 }
107
108 byteIntegerData.add(new DataPoint(new DenseVector(numeric), catVals, categories, rand.nextInt(Byte.MAX_VALUE)));
109 }
110 }
111
112 @After
113 public void tearDown()

Callers

nothing calls this directly

Calls 6

getRandomMethod · 0.95
setCategoryNameMethod · 0.80
getNumOfCategoriesMethod · 0.80
getNumNumericalVarsMethod · 0.80
nextDoubleMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected