MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / replaceNumericFeatures

Method replaceNumericFeatures

JSAT/src/jsat/DataSet.java:226–244  ·  view source on GitHub ↗

This method will replace every numeric feature in this dataset with a Vec object from the given list. All vecs in the given list must be of the same size. @param newNumericFeatures the list of new numeric features to use

(List<Vec> newNumericFeatures)

Source from the content-addressed store, hash-verified

224 * @param newNumericFeatures the list of new numeric features to use
225 */
226 public void replaceNumericFeatures(List<Vec> newNumericFeatures)
227 {
228 if(this.getSampleSize() != newNumericFeatures.size())
229 throw new RuntimeException("Input list does not have the same not of dataums as the dataset");
230
231 for(int i = 0; i < newNumericFeatures.size(); i++)
232 {
233 DataPoint dp_i = getDataPoint(i);
234 setDataPoint(i, new DataPoint(newNumericFeatures.get(i), dp_i.getCategoricalValues(), dp_i.getCategoricalData(), dp_i.getWeight()));
235 }
236
237 this.numNumerVals = getDataPoint(0).numNumericalValues();
238 if (this.numericalVariableNames != null)
239 {
240 this.numericalVariableNames.clear();
241 for (int i = 0; i < getNumNumericalVars(); i++)
242 numericalVariableNames.add("TN" + (i + 1));
243 }
244 }
245
246 /**
247 * Returns the <tt>i</tt>'th data point in this set. The order will never

Callers 2

transformMethod · 0.80
transformMethod · 0.80

Calls 12

getSampleSizeMethod · 0.95
getDataPointMethod · 0.95
setDataPointMethod · 0.95
getCategoricalValuesMethod · 0.95
getCategoricalDataMethod · 0.95
getWeightMethod · 0.95
getNumNumericalVarsMethod · 0.95
numNumericalValuesMethod · 0.80
sizeMethod · 0.65
getMethod · 0.45
clearMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected