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


Java RegressionModel.NormalizationMethod方法代码示例

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


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

示例1: normalizeRegressionResult

import org.dmg.pmml.regression.RegressionModel; //导入方法依赖的package包/类
static
public <V extends Number> Value<V> normalizeRegressionResult(Value<V> value, RegressionModel.NormalizationMethod normalizationMethod){

	switch(normalizationMethod){
		case NONE:
			return value;
		case SOFTMAX:
		case LOGIT:
			return value.inverseLogit();
		case EXP:
			return value.exp();
		case PROBIT:
			return value.inverseProbit();
		case CLOGLOG:
			return value.inverseCloglog();
		case LOGLOG:
			return value.inverseLoglog();
		case CAUCHIT:
			return value.inverseCauchit();
		default:
			throw new IllegalArgumentException();
	}
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:24,代码来源:RegressionModelUtil.java

示例2: normalizeBinaryLogisticClassificationResult

import org.dmg.pmml.regression.RegressionModel; //导入方法依赖的package包/类
static
public <V extends Number> Value<V> normalizeBinaryLogisticClassificationResult(Value<V> value, RegressionModel.NormalizationMethod normalizationMethod){

	switch(normalizationMethod){
		case NONE:
			return value.restrict(0d, 1d);
		case LOGIT:
			return value.inverseLogit();
		case PROBIT:
			return value.inverseProbit();
		case CLOGLOG:
			return value.inverseCloglog();
		case LOGLOG:
			return value.inverseLoglog();
		case CAUCHIT:
			return value.inverseCauchit();
		default:
			throw new IllegalArgumentException();
	}
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:21,代码来源:RegressionModelUtil.java

示例3: createRegression

import org.dmg.pmml.regression.RegressionModel; //导入方法依赖的package包/类
static
public MiningModel createRegression(Model model, RegressionModel.NormalizationMethod normalizationMethod, Schema schema){
	Feature feature = MiningModelUtil.MODEL_PREDICTION.apply(model);

	RegressionModel regressionModel = RegressionModelUtil.createRegression(model.getMathContext(), Collections.singletonList(feature), Collections.singletonList(1d), null, normalizationMethod, schema);

	return createModelChain(Arrays.asList(model, regressionModel), schema);
}
 
开发者ID:jpmml,项目名称:jpmml-converter,代码行数:9,代码来源:MiningModelUtil.java

示例4: createBinaryLogisticClassification

import org.dmg.pmml.regression.RegressionModel; //导入方法依赖的package包/类
static
public MiningModel createBinaryLogisticClassification(Model model, double coefficient, double intercept, RegressionModel.NormalizationMethod normalizationMethod, boolean hasProbabilityDistribution, Schema schema){
	Feature feature = MiningModelUtil.MODEL_PREDICTION.apply(model);

	RegressionModel regressionModel = RegressionModelUtil.createBinaryLogisticClassification(model.getMathContext(), Collections.singletonList(feature), Collections.singletonList(coefficient), intercept, normalizationMethod, hasProbabilityDistribution, schema);

	return createModelChain(Arrays.asList(model, regressionModel), schema);
}
 
开发者ID:jpmml,项目名称:jpmml-converter,代码行数:9,代码来源:MiningModelUtil.java

示例5: createRegression

import org.dmg.pmml.regression.RegressionModel; //导入方法依赖的package包/类
static
public RegressionModel createRegression(MathContext mathContext, List<? extends Feature> features, List<Double> coefficients, Double intercept, RegressionModel.NormalizationMethod normalizationMethod, Schema schema){
	ContinuousLabel continuousLabel = (ContinuousLabel)schema.getLabel();

	if(normalizationMethod != null){

		switch(normalizationMethod){
			case NONE:
			case SOFTMAX:
			case LOGIT:
			case PROBIT:
			case CLOGLOG:
			case EXP:
			case LOGLOG:
			case CAUCHIT:
				break;
			default:
				throw new IllegalArgumentException();
		}
	}

	RegressionModel regressionModel = new RegressionModel(MiningFunction.REGRESSION, ModelUtil.createMiningSchema(continuousLabel), null)
		.setNormalizationMethod(normalizationMethod)
		.setMathContext(ModelUtil.simplifyMathContext(mathContext))
		.addRegressionTables(createRegressionTable(features, coefficients, intercept));

	return regressionModel;
}
 
开发者ID:jpmml,项目名称:jpmml-converter,代码行数:29,代码来源:RegressionModelUtil.java

示例6: createBinaryLogisticClassification

import org.dmg.pmml.regression.RegressionModel; //导入方法依赖的package包/类
static
public RegressionModel createBinaryLogisticClassification(MathContext mathContext, List<? extends Feature> features, List<Double> coefficients, Double intercept, RegressionModel.NormalizationMethod normalizationMethod, boolean hasProbabilityDistribution, Schema schema){
	CategoricalLabel categoricalLabel = (CategoricalLabel)schema.getLabel();

	if(categoricalLabel.size() != 2){
		throw new IllegalArgumentException();
	} // End if

	if(normalizationMethod != null){

		switch(normalizationMethod){
			case NONE:
			case LOGIT:
			case PROBIT:
			case CLOGLOG:
			case LOGLOG:
			case CAUCHIT:
				break;
			default:
				throw new IllegalArgumentException();
		}
	}

	RegressionTable activeRegressionTable = RegressionModelUtil.createRegressionTable(features, coefficients, intercept)
		.setTargetCategory(categoricalLabel.getValue(1));

	RegressionTable passiveRegressionTable = RegressionModelUtil.createRegressionTable(Collections.<Feature>emptyList(), Collections.<Double>emptyList(), null)
		.setTargetCategory(categoricalLabel.getValue(0));

	RegressionModel regressionModel = new RegressionModel(MiningFunction.CLASSIFICATION, ModelUtil.createMiningSchema(categoricalLabel), null)
		.setNormalizationMethod(normalizationMethod)
		.setMathContext(ModelUtil.simplifyMathContext(mathContext))
		.addRegressionTables(activeRegressionTable, passiveRegressionTable)
		.setOutput(hasProbabilityDistribution ? ModelUtil.createProbabilityOutput(mathContext, categoricalLabel) : null);

	return regressionModel;
}
 
开发者ID:jpmml,项目名称:jpmml-converter,代码行数:38,代码来源:RegressionModelUtil.java

示例7: getNormalizationMethod

import org.dmg.pmml.regression.RegressionModel; //导入方法依赖的package包/类
@Override
public RegressionModel.NormalizationMethod getNormalizationMethod(){
	return RegressionModel.NormalizationMethod.LOGIT;
}
 
开发者ID:jpmml,项目名称:jpmml-xgboost,代码行数:5,代码来源:LogisticRegression.java

示例8: getNormalizationMethod

import org.dmg.pmml.regression.RegressionModel; //导入方法依赖的package包/类
abstract
public RegressionModel.NormalizationMethod getNormalizationMethod();
 
开发者ID:jpmml,项目名称:jpmml-xgboost,代码行数:3,代码来源:GeneralizedLinearRegression.java

示例9: getNormalizationMethod

import org.dmg.pmml.regression.RegressionModel; //导入方法依赖的package包/类
@Override
public RegressionModel.NormalizationMethod getNormalizationMethod(){
	return RegressionModel.NormalizationMethod.EXP;
}
 
开发者ID:jpmml,项目名称:jpmml-xgboost,代码行数:5,代码来源:PoissonRegression.java

示例10: createClassification

import org.dmg.pmml.regression.RegressionModel; //导入方法依赖的package包/类
static
public MiningModel createClassification(List<? extends Model> models, RegressionModel.NormalizationMethod normalizationMethod, boolean hasProbabilityDistribution, Schema schema){
	CategoricalLabel categoricalLabel = (CategoricalLabel)schema.getLabel();

	if(categoricalLabel.size() < 3 || categoricalLabel.size() != models.size()){
		throw new IllegalArgumentException();
	} // End if

	if(normalizationMethod != null){

		switch(normalizationMethod){
			case NONE:
			case SIMPLEMAX:
			case SOFTMAX:
				break;
			default:
				throw new IllegalArgumentException();
		}
	}

	MathContext mathContext = null;

	List<RegressionTable> regressionTables = new ArrayList<>();

	for(int i = 0; i < categoricalLabel.size(); i++){
		Model model = models.get(i);

		MathContext modelMathContext = model.getMathContext();
		if(modelMathContext == null){
			modelMathContext = MathContext.DOUBLE;
		} // End if

		if(mathContext == null){
			mathContext = modelMathContext;
		} else

		{
			if(!Objects.equals(mathContext, modelMathContext)){
				throw new IllegalArgumentException();
			}
		}

		Feature feature = MiningModelUtil.MODEL_PREDICTION.apply(model);

		RegressionTable regressionTable = RegressionModelUtil.createRegressionTable(Collections.singletonList(feature), Collections.singletonList(1d), null)
			.setTargetCategory(categoricalLabel.getValue(i));

		regressionTables.add(regressionTable);
	}

	RegressionModel regressionModel = new RegressionModel(MiningFunction.CLASSIFICATION, ModelUtil.createMiningSchema(categoricalLabel), regressionTables)
		.setNormalizationMethod(normalizationMethod)
		.setMathContext(ModelUtil.simplifyMathContext(mathContext))
		.setOutput(hasProbabilityDistribution ? ModelUtil.createProbabilityOutput(mathContext, categoricalLabel) : null);

	List<Model> segmentationModels = new ArrayList<>(models);
	segmentationModels.add(regressionModel);

	return createModelChain(segmentationModels, schema);
}
 
开发者ID:jpmml,项目名称:jpmml-converter,代码行数:61,代码来源:MiningModelUtil.java

示例11: createClassification

import org.dmg.pmml.regression.RegressionModel; //导入方法依赖的package包/类
static
public MiningModel createClassification(List<? extends Model> models, RegressionModel.NormalizationMethod normalizationMethod, boolean hasProbabilityDistribution, Schema schema){
    CategoricalLabel categoricalLabel = (CategoricalLabel)schema.getLabel();

    // modified here
    if(categoricalLabel.size() != models.size()){
        throw new IllegalArgumentException();
    } // End if

    if(normalizationMethod != null){

        switch(normalizationMethod){
            case NONE:
            case SIMPLEMAX:
            case SOFTMAX:
                break;
            default:
                throw new IllegalArgumentException();
        }
    }

    MathContext mathContext = null;

    List<RegressionTable> regressionTables = new ArrayList<>();

    for(int i = 0; i < categoricalLabel.size(); i++){
        Model model = models.get(i);

        MathContext modelMathContext = model.getMathContext();
        if(modelMathContext == null){
            modelMathContext = MathContext.DOUBLE;
        } // End if

        if(mathContext == null){
            mathContext = modelMathContext;
        } else

        {
            if(!Objects.equals(mathContext, modelMathContext)){
                throw new IllegalArgumentException();
            }
        }

        Feature feature = MODEL_PREDICTION.apply(model);

        RegressionTable regressionTable = RegressionModelUtil.createRegressionTable(Collections.singletonList(feature), Collections.singletonList(1d), null)
                .setTargetCategory(categoricalLabel.getValue(i));

        regressionTables.add(regressionTable);
    }

    RegressionModel regressionModel = new RegressionModel(MiningFunction.CLASSIFICATION, ModelUtil.createMiningSchema(categoricalLabel), regressionTables)
            .setNormalizationMethod(normalizationMethod)
            .setMathContext(ModelUtil.simplifyMathContext(mathContext))
            .setOutput(hasProbabilityDistribution ? ModelUtil.createProbabilityOutput(mathContext, categoricalLabel) : null);

    List<Model> segmentationModels = new ArrayList<>(models);
    segmentationModels.add(regressionModel);

    return createModelChain(segmentationModels, schema);
}
 
开发者ID:cheng-li,项目名称:pyramid,代码行数:62,代码来源:MiningModelUtil.java

示例12: evaluateRegression

import org.dmg.pmml.regression.RegressionModel; //导入方法依赖的package包/类
private <V extends Number> Map<FieldName, ?> evaluateRegression(ValueFactory<V> valueFactory, EvaluationContext context){
	RegressionModel regressionModel = getModel();

	TargetField targetField = getTargetField();

	FieldName targetFieldName = regressionModel.getTargetFieldName();
	if(targetFieldName != null && !Objects.equals(targetField.getName(), targetFieldName)){
		throw new InvalidAttributeException(regressionModel, PMMLAttributes.REGRESSIONMODEL_TARGETFIELDNAME, targetFieldName);
	}

	List<RegressionTable> regressionTables = regressionModel.getRegressionTables();
	if(regressionTables.size() != 1){
		throw new InvalidElementListException(regressionTables);
	}

	RegressionTable regressionTable = regressionTables.get(0);

	Value<V> result = evaluateRegressionTable(valueFactory, regressionTable, context);
	if(result == null){
		return TargetUtil.evaluateRegressionDefault(valueFactory, targetField);
	}

	RegressionModel.NormalizationMethod normalizationMethod = regressionModel.getNormalizationMethod();
	switch(normalizationMethod){
		case NONE:
		case SOFTMAX:
		case LOGIT:
		case EXP:
		case PROBIT:
		case CLOGLOG:
		case LOGLOG:
		case CAUCHIT:
			RegressionModelUtil.normalizeRegressionResult(result, normalizationMethod);
			break;
		case SIMPLEMAX:
			throw new InvalidAttributeException(regressionModel, normalizationMethod);
		default:
			throw new UnsupportedAttributeException(regressionModel, normalizationMethod);
	}

	return TargetUtil.evaluateRegression(targetField, result);
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:43,代码来源:RegressionModelEvaluator.java

示例13: computeBinomialProbabilities

import org.dmg.pmml.regression.RegressionModel; //导入方法依赖的package包/类
static
public <K, V extends Number> ValueMap<K, V> computeBinomialProbabilities(ValueMap<K, V> values, RegressionModel.NormalizationMethod normalizationMethod){

	if(values.size() != 2){
		throw new IllegalArgumentException();
	}

	Iterator<Value<V>> valueIt = values.iterator();

	Value<V> firstValue = valueIt.next();

	// The probability of the first category is calculated
	normalizeBinaryLogisticClassificationResult(firstValue, normalizationMethod);

	Value<V> secondValue = valueIt.next();

	// The probability of the second category is obtained by subtracting the probability of the first category from 1.0
	secondValue.residual(firstValue);

	return values;
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:22,代码来源:RegressionModelUtil.java

示例14: computeOrdinalProbabilities

import org.dmg.pmml.regression.RegressionModel; //导入方法依赖的package包/类
static
public <K, V extends Number> ValueMap<K, V> computeOrdinalProbabilities(ValueMap<K, V> values, RegressionModel.NormalizationMethod normalizationMethod){

	if(values.size() < 2){
		throw new IllegalArgumentException();
	}

	switch(normalizationMethod){
		case NONE:
		case LOGIT:
		case PROBIT:
		case CLOGLOG:
		case LOGLOG:
		case CAUCHIT:
			{
				Value<V> sum = null;

				Iterator<Value<V>> valueIt = values.iterator();
				for(int i = 0, max = values.size() - 1; i < max; i++){
					Value<V> value = valueIt.next();

					normalizeBinaryLogisticClassificationResult(value, normalizationMethod);

					if(sum == null){
						sum = value.copy();
					} else

					{
						value.subtract(sum);

						sum.add(value);
					}
				}

				Value<V> lastValue = valueIt.next();

				lastValue.residual(sum);
			}
			break;
		default:
			throw new IllegalArgumentException();
	}

	return values;
}
 
开发者ID:jpmml,项目名称:jpmml-evaluator,代码行数:46,代码来源:RegressionModelUtil.java


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