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


Java Tools.onlyNumericalAttributes方法代码示例

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


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

示例1: doWork

import com.rapidminer.example.Tools; //导入方法依赖的package包/类
@Override
public void doWork() throws OperatorException {
	ExampleSet es = exampleSetInput.getData(ExampleSet.class);
	int dimensions = getParameterAsInt(PARAMETER_DIMENSIONS);

	Tools.onlyNumericalAttributes(es, "dimensionality reduction");
	Tools.isNonEmpty(es);
	Tools.checkAndCreateIds(es);

	double[][] p = dimensionalityReduction(es, dimensions);

	DimensionalityReducerModel model = new DimensionalityReducerModel(es, p, dimensions);

	if (exampleSetOutput.isConnected()) {
		exampleSetOutput.deliver(model.apply((ExampleSet) es.clone()));
	}
	originalOutput.deliver(es);
	modelOutput.deliver(model);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:20,代码来源:DimensionalityReducer.java

示例2: init

import com.rapidminer.example.Tools; //导入方法依赖的package包/类
@Override
public void init(ExampleSet exampleSet) throws OperatorException {
	super.init(exampleSet);
	Tools.onlyNumericalAttributes(exampleSet, "value based similarities");
	Attributes attributes = exampleSet.getAttributes();
	if (attributes.size() != 1) {
		throw new OperatorException(
				"The bregman divergence you've choosen is not applicable for the dataset! Proceeding with the 'Squared Euclidean distance' bregman divergence.");
	}
	for (Example example : exampleSet) {
		for (Attribute attribute : attributes) {
			if (example.getValue(attribute) <= 0) {
				throw new OperatorException(
						"The bregman divergence you've choosen is not applicable for the dataset! Proceeding with the 'Squared Euclidean distance' bregman divergence.");
			}
			;
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:20,代码来源:ItakuraSaitoDistance.java

示例3: init

import com.rapidminer.example.Tools; //导入方法依赖的package包/类
@Override
public void init(ExampleSet exampleSet) throws OperatorException {
	super.init(exampleSet);
	Tools.onlyNumericalAttributes(exampleSet, "value based similarities");
	Attributes attributes = exampleSet.getAttributes();
	if (attributes.size() != 1) {
		throw new OperatorException(
				"The bregman divergence you've choosen is not applicable for the dataset! Proceeding with the 'Squared Euclidean distance' bregman divergence.");
	}
	for (Example example : exampleSet) {
		for (Attribute attribute : attributes) {
			double value = example.getValue(attribute);
			if (value <= 0 || value >= 1) {
				throw new OperatorException(
						"The bregman divergence you've choosen is not applicable for the dataset! Proceeding with the 'Squared Euclidean distance' bregman divergence.");
			}
			;
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:21,代码来源:LogisticLoss.java

示例4: init

import com.rapidminer.example.Tools; //导入方法依赖的package包/类
@Override
public void init(ExampleSet exampleSet) throws OperatorException {
	super.init(exampleSet);
	Tools.onlyNumericalAttributes(exampleSet, "value based similarities");
	Attributes attributes = exampleSet.getAttributes();
	if (attributes.size() != 1) {
		throw new OperatorException(
				"The bregman divergence you've choosen is not applicable for the dataset! Proceeding with the 'Squared Euclidean distance' bregman divergence.");
	}
	for (Attribute attribute : attributes) {
		for (Example example : exampleSet) {
			if (example.getValue(attribute) <= 0) {
				throw new OperatorException(
						"The bregman divergence you've choosen is not applicable for the dataset! Proceeding with the 'Squared Euclidean distance' bregman divergence.");
			}
		}
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:19,代码来源:LogarithmicLoss.java

示例5: init

import com.rapidminer.example.Tools; //导入方法依赖的package包/类
@Override
public void init(ExampleSet exampleSet) throws OperatorException {
	super.init(exampleSet);
	Tools.onlyNumericalAttributes(exampleSet, "value based similarities");
	Attributes attributes = exampleSet.getAttributes();
	if (attributes.size() != 1) {
		throw new OperatorException(
				"The bregman divergence you've choosen is not applicable for the dataset! Proceeding with the 'Squared Euclidean distance' bregman divergence.");
	}
	for (Attribute attribute : attributes) {
		for (Example example : exampleSet) {
			double value = example.getValue(attribute);
			if (value <= 0 || value >= 1) {
				throw new OperatorException(
						"The bregman divergence you've choosen is not applicable for the dataset! Proceeding with the 'Squared Euclidean distance' bregman divergence.");
			}
		}
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:20,代码来源:LogisticLoss.java

示例6: doWork

import com.rapidminer.example.Tools; //导入方法依赖的package包/类
@Override
public void doWork() throws OperatorException {
    ExampleSet es = exampleSetInput.getData(ExampleSet.class);
    int dimensions = getParameterAsInt(PARAMETER_DIMENSIONS);

    Tools.onlyNumericalAttributes(es, "dimensionality reduction");
    Tools.isNonEmpty(es);
    Tools.checkAndCreateIds(es);

    double[][] p = dimensionalityReduction(es, dimensions);

    DimensionalityReducerModel model = new DimensionalityReducerModel(es, p, dimensions);

    if (exampleSetOutput.isConnected())
        exampleSetOutput.deliver(model.apply((ExampleSet)es.clone()));
    originalOutput.deliver(es);
    modelOutput.deliver(model);
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:19,代码来源:DimensionalityReducer.java

示例7: init

import com.rapidminer.example.Tools; //导入方法依赖的package包/类
@Override
public void init(ExampleSet exampleSet) throws OperatorException {
	super.init(exampleSet);
	Tools.onlyNumericalAttributes(exampleSet, "value based similarities");
	Attributes attributes = exampleSet.getAttributes();
	for (Example example : exampleSet) {
		for (Attribute attribute : attributes) {
			if (example.getValue(attribute) <= 0) {
				throw new OperatorException(
						"The bregman divergence you've choosen is not applicable for the dataset! Proceeding with the 'Squared Euclidean distance' bregman divergence.");
			}
			;
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:16,代码来源:GeneralizedIDivergence.java

示例8: init

import com.rapidminer.example.Tools; //导入方法依赖的package包/类
@Override
public void init(ExampleSet exampleSet) throws OperatorException {
	super.init(exampleSet);
	Tools.onlyNumericalAttributes(exampleSet, "value based similarities");
	Attributes attributes = exampleSet.getAttributes();
	if (attributes.size() != 1) {
		throw new OperatorException(
				"The bregman divergence you've choosen is not applicable for the dataset! Try 'Squared Euclidean distance' bregman divergence.");
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:11,代码来源:SquaredLoss.java

示例9: init

import com.rapidminer.example.Tools; //导入方法依赖的package包/类
@Override
public void init(ExampleSet exampleSet) throws OperatorException {
	super.init(exampleSet);
	Tools.onlyNumericalAttributes(exampleSet, "value based similarities");
	Attributes attributes = exampleSet.getAttributes();
	for (Attribute attribute : attributes) {
		for (Example example : exampleSet) {
			if (example.getValue(attribute) <= 0) {
				throw new OperatorException(
						"The bregman divergence you've choosen is not applicable for the dataset! Proceeding with the 'Squared Euclidean distance' bregman divergence.");
			}
		}
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:15,代码来源:GeneralizedIDivergence.java

示例10: init

import com.rapidminer.example.Tools; //导入方法依赖的package包/类
@Override
public void init(ExampleSet exampleSet) throws OperatorException {
	super.init(exampleSet);
    Tools.onlyNumericalAttributes(exampleSet, "value based similarities");
	Attributes attributes = exampleSet.getAttributes();
	for (Example example: exampleSet) {
		for (Attribute attribute: attributes) {
			if (example.getValue(attribute) <= 0) 
				throw new OperatorException("The bregman divergence you've choosen is not applicable for the dataset! Proceeding with the 'Squared Euclidean distance' bregman divergence.");;
		}
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:13,代码来源:GeneralizedIDivergence.java

示例11: init

import com.rapidminer.example.Tools; //导入方法依赖的package包/类
@Override
public void init(ExampleSet exampleSet) throws OperatorException {
    super.init(exampleSet);
    Tools.onlyNumericalAttributes(exampleSet, "value based similarities");
	Attributes attributes = exampleSet.getAttributes();
	if (attributes.size() != 1)
		throw new OperatorException("The bregman divergence you've choosen is not applicable for the dataset! Proceeding with the 'Squared Euclidean distance' bregman divergence.");
	for (Example example: exampleSet) {
		for (Attribute attribute: attributes) {
			if (example.getValue(attribute) <= 0) 
				throw new OperatorException("The bregman divergence you've choosen is not applicable for the dataset! Proceeding with the 'Squared Euclidean distance' bregman divergence.");;
		}
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:15,代码来源:LogarithmicLoss.java

示例12: init

import com.rapidminer.example.Tools; //导入方法依赖的package包/类
@Override
public void init(ExampleSet exampleSet) throws OperatorException {
       super.init(exampleSet);	      
    Tools.onlyNumericalAttributes(exampleSet, "value based similarities");
	Attributes attributes = exampleSet.getAttributes();
	if (attributes.size() != 1)
		throw new OperatorException("The bregman divergence you've choosen is not applicable for the dataset! Try 'Squared Euclidean distance' bregman divergence.");
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:9,代码来源:SquaredLoss.java

示例13: doWork

import com.rapidminer.example.Tools; //导入方法依赖的package包/类
@Override
public void doWork() throws OperatorException {
	ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class);

	// only use numeric attributes
	Tools.onlyNumericalAttributes(exampleSet, "KernelPCA");
	Tools.onlyNonMissingValues(exampleSet, getOperatorClassName(), this);

	Attributes attributes = exampleSet.getAttributes();
	int numberOfExamples = exampleSet.size();

	// calculating means for later zero centering
	exampleSet.recalculateAllAttributeStatistics();
	double[] means = new double[exampleSet.getAttributes().size()];
	int i = 0;
	for (Attribute attribute : exampleSet.getAttributes()) {
		means[i] = exampleSet.getStatistics(attribute, Statistics.AVERAGE);
		i++;
	}

	// kernel
	Kernel kernel = Kernel.createKernel(this);

	// copying zero centered exampleValues
	ArrayList<double[]> exampleValues = new ArrayList<double[]>(numberOfExamples);
	i = 0;
	for (Example columnExample : exampleSet) {
		double[] columnValues = getAttributeValues(columnExample, attributes, means);
		exampleValues.add(columnValues);
		i++;
	}

	// filling kernel matrix
	Matrix kernelMatrix = new Matrix(numberOfExamples, numberOfExamples);
	for (i = 0; i < numberOfExamples; i++) {
		for (int j = 0; j < numberOfExamples; j++) {
			kernelMatrix.set(i, j, kernel.calculateDistance(exampleValues.get(i), exampleValues.get(j)));
		}
	}

	// calculating eigenVectors
	EigenvalueDecomposition eig = kernelMatrix.eig();
	Model model = new KernelPCAModel(exampleSet, means, eig.getV(), exampleValues, kernel);

	if (exampleSetOutput.isConnected()) {
		exampleSetOutput.deliver(model.apply(exampleSet));
	}
	originalOutput.deliver(exampleSet);
	modelOutput.deliver(model);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:51,代码来源:KernelPCA.java

示例14: doWork

import com.rapidminer.example.Tools; //导入方法依赖的package包/类
@Override
public void doWork() throws OperatorException {
	// check whether all attributes are numerical
	ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class);

	Tools.onlyNonMissingValues(exampleSet, getOperatorClassName(), this, new String[0]);
	Tools.onlyNumericalAttributes(exampleSet, "PCA");

	Iterator<Attribute> iterate = exampleSet.getAttributes().allAttributes();
	while (iterate.hasNext()) {
		Attribute curattribute = iterate.next();
		if (curattribute.getName().startsWith("pc_")) {
			throw new UserError(this, "pca_attribute_names", curattribute.getName());
		}
	}

	// create covariance matrix
	log("Creating the covariance matrix...");
	Matrix covarianceMatrix = CovarianceMatrix.getCovarianceMatrix(exampleSet, this);

	// EigenVector and EigenValues of the covariance matrix
	log("Performing the eigenvalue decomposition...");
	EigenvalueDecomposition eigenvalueDecomposition = covarianceMatrix.eig();

	checkForStop();

	// create and deliver results
	double[] eigenvalues = eigenvalueDecomposition.getRealEigenvalues();
	Matrix eigenvectorMatrix = eigenvalueDecomposition.getV();
	double[][] eigenvectors = eigenvectorMatrix.getArray();

	PCAModel model = new PCAModel(exampleSet, eigenvalues, eigenvectors);

	int reductionType = getParameterAsInt(PARAMETER_REDUCTION_TYPE);
	switch (reductionType) {
		case REDUCTION_NONE:
			model.setNumberOfComponents(exampleSet.getAttributes().size());
			break;
		case REDUCTION_VARIANCE:
			model.setVarianceThreshold(getParameterAsDouble(PARAMETER_VARIANCE_THRESHOLD));
			break;
		case REDUCTION_FIXED:
			model.setNumberOfComponents(Math.min(exampleSet.getAttributes().size(),
					getParameterAsInt(PARAMETER_NUMBER_OF_COMPONENTS)));
			break;
	}

	modelOutput.deliver(model);
	originalOutput.deliver(exampleSet);
	if (exampleSetOutput.isConnected()) {
		exampleSetOutput.deliver(model.apply(exampleSet));
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:54,代码来源:PCA.java

示例15: doWork

import com.rapidminer.example.Tools; //导入方法依赖的package包/类
@Override
public void doWork() throws OperatorException {
	// check whether all attributes are numerical
	ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class);

	Tools.onlyNonMissingValues(exampleSet, getOperatorClassName(), this);
	Tools.onlyNumericalAttributes(exampleSet, "SVD");

	// create data matrix
	Matrix dataMatrix = MatrixTools.getDataAsMatrix(exampleSet);

	// Singular Value Decomposition
	SingularValueDecomposition singularValueDecomposition = dataMatrix.svd();

	// create and deliver results
	double[] singularvalues = singularValueDecomposition.getSingularValues();
	Matrix vMatrix = singularValueDecomposition.getV();

	SVDModel model = new SVDModel(exampleSet, singularvalues, vMatrix);
	if (getCompatibilityLevel().isAtMost(OPERATOR_VERSION_CHANGED_ATTRIBUTE_NAME)) {
		model.enableLegacyMode();
	}

	int reductionType = getParameterAsInt(PARAMETER_REDUCTION_TYPE);
	switch (reductionType) {
		case REDUCTION_NONE:
			model.setNumberOfComponents(exampleSet.getAttributes().size());
			break;
		case REDUCTION_PERCENTAGE:
			model.setVarianceThreshold(getParameterAsDouble(PARAMETER_PERCENTAGE_THRESHOLD));
			break;
		case REDUCTION_FIXED:
			model.setNumberOfComponents(getParameterAsInt(PARAMETER_NUMBER_OF_COMPONENTS));
			break;
	}

	modelOutput.deliver(model);
	originalOutput.deliver(exampleSet);
	if (exampleSetOutput.isConnected()) {
		exampleSetOutput.deliver(model.apply(exampleSet));
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:43,代码来源:SVDReduction.java


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