/** * Asserts that all of the dimensionalities of the input vectors in the * given set of input-output pairs are the same. * * @param data * A collection of input-output pairs. * @throws DimensionalityMismatchException * If the dimensionalities are not all equal. */ public static void assertInputDimensionalitiesAllEqual( final Iterable<? extends InputOutputPair<? extends Vectorizable, ?>> data) { assertInputDimensionalitiesAllEqual(data, getInputDimensionality(data)); }
/** * Asserts that all of the dimensionalities of the input vectors in the * given set of input-output pairs are the same. * * @param data * A collection of input-output pairs. * @throws DimensionalityMismatchException * If the dimensionalities are not all equal. */ public static void assertInputDimensionalitiesAllEqual( final Iterable<? extends InputOutputPair<? extends Vectorizable, ?>> data) { assertInputDimensionalitiesAllEqual(data, getInputDimensionality(data)); }
/** * Asserts that all of the dimensionalities of the input vectors in the * given set of input-output pairs are the same. * * @param data * A collection of input-output pairs. * @throws DimensionalityMismatchException * If the dimensionalities are not all equal. */ public static void assertInputDimensionalitiesAllEqual( final Iterable<? extends InputOutputPair<? extends Vectorizable, ?>> data) { assertInputDimensionalitiesAllEqual(data, getInputDimensionality(data)); }
final int dimensionality = DatasetUtil.getInputDimensionality(data); final Map<CategoryType, List<Vectorizable>> examplesPerCategory = DatasetUtil.splitOnOutput(data);
final int dimensionality = DatasetUtil.getInputDimensionality(data); final Map<CategoryType, List<Vectorizable>> examplesPerCategory = DatasetUtil.splitOnOutput(data);
final int dimensionality = DatasetUtil.getInputDimensionality(data); final Map<CategoryType, List<Vectorizable>> examplesPerCategory = DatasetUtil.splitOnOutput(data);
this.dimensionality = DatasetUtil.getInputDimensionality(this.data); final VectorFactory<?> vectorFactory = VectorFactory.getDenseDefault(); final Vector weights = vectorFactory.createVector(this.dimensionality);
this.dimensionality = DatasetUtil.getInputDimensionality(this.data); final VectorFactory<?> vectorFactory = VectorFactory.getDenseDefault(); final Vector weights = vectorFactory.createVector(this.dimensionality);
this.dimensionality = DatasetUtil.getInputDimensionality(this.data); final VectorFactory<?> vectorFactory = VectorFactory.getDenseDefault(); final Vector weights = vectorFactory.createVector(this.dimensionality);
this.dimensionality = DatasetUtil.getInputDimensionality(this.data); this.dataSampleSize = Math.min(dataSize, this.sampleSize);
this.dimensionality = DatasetUtil.getInputDimensionality(this.data); this.dataSampleSize = Math.min(dataSize, this.sampleSize);
this.dimensionality = DatasetUtil.getInputDimensionality(this.data); this.dataSampleSize = Math.min(dataSize, this.sampleSize);
final int dimensionality = DatasetUtil.getInputDimensionality(data);
final int dimensionality = DatasetUtil.getInputDimensionality(data); final Map<CategoryType, List<Vectorizable>> examplesPerCategory = DatasetUtil.splitOnOutput(data);
@Override protected boolean initializeAlgorithm() { if (CollectionUtil.isEmpty(this.getData())) { // No data to learn from. return false; } // Get the dimensionality of the data. final int dimensionality = DatasetUtil.getInputDimensionality( this.getData()); // Create the categorizer we will learn and create the prototypes for // each category. this.result = new LinearMultiCategorizer<CategoryType>(); final Set<CategoryType> categories = DatasetUtil.findUniqueOutputs( this.getData()); for (CategoryType category : categories) { final LinearBinaryCategorizer prototype = new LinearBinaryCategorizer( this.getVectorFactory().createVector(dimensionality), 0.0); this.result.getPrototypes().put(category, prototype); } // The algorithm is now initialized. return true; }
@Override protected boolean initializeAlgorithm() { if (CollectionUtil.isEmpty(this.getData())) { // No data to learn from. return false; } // Get the dimensionality of the data. final int dimensionality = DatasetUtil.getInputDimensionality( this.getData()); // Create the categorizer we will learn and create the prototypes for // each category. this.result = new LinearMultiCategorizer<CategoryType>(); final Set<CategoryType> categories = DatasetUtil.findUniqueOutputs( this.getData()); for (CategoryType category : categories) { final LinearBinaryCategorizer prototype = new LinearBinaryCategorizer( this.getVectorFactory().createVector(dimensionality), 0.0); this.result.getPrototypes().put(category, prototype); } // The algorithm is now initialized. return true; }
@Override protected boolean initializeAlgorithm() { if (CollectionUtil.isEmpty(this.getData())) { // No data to learn from. return false; } // Get the dimensionality of the data. final int dimensionality = DatasetUtil.getInputDimensionality( this.getData()); // Create the categorizer we will learn and create the prototypes for // each category. this.result = new LinearMultiCategorizer<CategoryType>(); final Set<CategoryType> categories = DatasetUtil.findUniqueOutputs( this.getData()); for (CategoryType category : categories) { final LinearBinaryCategorizer prototype = new LinearBinaryCategorizer( this.getVectorFactory().createVector(dimensionality), 0.0); this.result.getPrototypes().put(category, prototype); } // The algorithm is now initialized. return true; }
@Override protected boolean initializeAlgorithm() { if (this.getData() == null) { // Error: No data to learn on. return false; } // Computer the dimensionality of the data and ensure it is correct. int dimensionality = DatasetUtil.getInputDimensionality(this.getData()); if (dimensionality < 0) { // There was no data. return false; } DatasetUtil.assertInputDimensionalitiesAllEqual(this.getData()); // Initialize the result object. this.setResult(new LinearBinaryCategorizer( this.getVectorFactory().createVector(dimensionality), 0.0)); return true; }
@Override protected boolean initializeAlgorithm() { if (this.getData() == null) { // Error: No data to learn on. return false; } // Computer the dimensionality of the data and ensure it is correct. int dimensionality = DatasetUtil.getInputDimensionality(this.getData()); if (dimensionality < 0) { // There was no data. return false; } DatasetUtil.assertInputDimensionalitiesAllEqual(this.getData()); // Initialize the result object. this.setResult(new LinearBinaryCategorizer( this.getVectorFactory().createVector(dimensionality), 0.0)); return true; }
@Override protected boolean initializeAlgorithm() { if (this.getData() == null) { // Error: No data to learn on. return false; } // Computer the dimensionality of the data and ensure it is correct. int dimensionality = DatasetUtil.getInputDimensionality(this.getData()); if (dimensionality < 0) { // There was no data. return false; } DatasetUtil.assertInputDimensionalitiesAllEqual(this.getData()); // Initialize the result object. this.setResult(new LinearBinaryCategorizer( this.getVectorFactory().createVector(dimensionality), 0.0)); return true; }