当前位置: 首页>>代码示例>>Java>>正文


Java ArrayUtils.concatenate方法代码示例

本文整理汇总了Java中org.openimaj.util.array.ArrayUtils.concatenate方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtils.concatenate方法的具体用法?Java ArrayUtils.concatenate怎么用?Java ArrayUtils.concatenate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openimaj.util.array.ArrayUtils的用法示例。


在下文中一共展示了ArrayUtils.concatenate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSVMProblem

import org.openimaj.util.array.ArrayUtils; //导入方法依赖的package包/类
/**
 * 	Returns an svm_problem for the given dataset. This function will return
 * 	a new SVM problem and will also side-affect the gamma member of the
 * 	param argument.
 *
 * 	@param trainingCorpus The corpus
 * 	@param param The SVM parameters
 * 	@param featureExtractor The feature extractor to use
 * 	@param positiveClass The name of the positive class in the dataset
 * 	@param negativeClasses The names of the negative classes in the dataset
 *	@return A new SVM problem.
 */
private svm_problem getSVMProblem( final List<? extends Annotated<OBJECT, ANNOTATION>> data,
	final svm_parameter param, final FeatureExtractor<? extends FeatureVector, OBJECT> extractor  )
{
	// Get all the nodes for the features
	final svm_node[][] positiveNodes = this.computeFeature(
			data, this.classMap.get( SVMAnnotator.POSITIVE_CLASS ) );
	final svm_node[][] negativeNodes = this.computeFeature(
			data, this.classMap.get( SVMAnnotator.NEGATIVE_CLASS ) );

	// Work out how long the problem is
	final int nSamples = positiveNodes.length + negativeNodes.length;

	// The array that determines whether a sample is positive or negative.
	final double[] flagArray = new double[nSamples];
	ArrayUtils.fill( flagArray, SVMAnnotator.POSITIVE_CLASS, 0, positiveNodes.length );
	ArrayUtils.fill( flagArray, SVMAnnotator.NEGATIVE_CLASS, positiveNodes.length, negativeNodes.length );

	// Concatenate the samples to a single array
	final svm_node[][] sampleArray = ArrayUtils.concatenate(
			positiveNodes, negativeNodes );

	// Create the svm problem to solve
	final svm_problem prob = new svm_problem();

	// Setup the problem
	prob.l = nSamples;
	prob.x = sampleArray;
	prob.y = flagArray;
	param.gamma = 1.0 / SVMAnnotator.getMaxIndex( sampleArray );

	return prob;
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:45,代码来源:SVMAnnotator.java

示例2: getFeatureVectorArray

import org.openimaj.util.array.ArrayUtils; //导入方法依赖的package包/类
/**
 * @return the extracted feature (containing all statistics) from the last call to {@link #process(ConnectedComponent)}.
 */
public double[] getFeatureVectorArray() {
	return ArrayUtils.concatenate(
			colmodel.mean,
			colmodel.median,
			colmodel.mode,
			colmodel.range,
			colmodel.variance
	);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:13,代码来源:ColourDescriptor.java

示例3: Histogram

import org.openimaj.util.array.ArrayUtils; //导入方法依赖的package包/类
/**
 * Construct a histogram by concatenating the given histograms
 * 
 * @param hs
 *            histograms to concatenate
 */
public Histogram(DoubleFV... hs) {
	final double[][] hists = new double[hs.length][];
	for (int i = 0; i < hs.length; i++) {
		hists[i] = hs[i].values;
	}

	this.values = ArrayUtils.concatenate(hists);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:15,代码来源:Histogram.java

示例4: combine

import org.openimaj.util.array.ArrayUtils; //导入方法依赖的package包/类
/**
 * Create a new histogram by concatenating this one with the given ones.
 * 
 * @param hs
 *            histograms to concatenate
 * @return new histogram that is the concatenation of the argument
 *         histograms
 */
public Histogram combine(Histogram... hs) {
	final int hsLength = hs == null ? 0 : hs.length;
	final double[][] hists = new double[1 + hsLength][];
	hists[0] = this.values;

	for (int i = 0; i < hsLength; i++) {
		hists[i + 1] = hs[i].values;
	}

	return new Histogram(ArrayUtils.concatenate(hists));
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:20,代码来源:Histogram.java

示例5: toString

import org.openimaj.util.array.ArrayUtils; //导入方法依赖的package包/类
@Override
public String toString() {
	final String[][] exptinfo = formatAsTable(getExptInfoTable());
	final String[][] timeInfo = formatAsTable(getTimingTable());
	final String[][] ivInfo = formatAsTable(getIndependentVariablesTable());
	final String[][] dvInfo = formatAsTable(getDependentVariablesTable());
	final String[][] biblInfo = formatAsTable(getBibliographyTable());

	final String[][] data = ArrayUtils.concatenate(exptinfo, timeInfo, ivInfo, dvInfo, biblInfo);
	final ASCIITableHeader[] header = { new ASCIITableHeader("Experiment Context", ASCIITable.ALIGN_LEFT) };

	return ASCIITable.getInstance().getTable(header, data);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:14,代码来源:ExperimentContext.java


注:本文中的org.openimaj.util.array.ArrayUtils.concatenate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。