本文整理汇总了Java中org.dmg.pmml.MiningFunction.REGRESSION属性的典型用法代码示例。如果您正苦于以下问题:Java MiningFunction.REGRESSION属性的具体用法?Java MiningFunction.REGRESSION怎么用?Java MiningFunction.REGRESSION使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.dmg.pmml.MiningFunction
的用法示例。
在下文中一共展示了MiningFunction.REGRESSION属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMiningFunction
static
private MiningFunction getMiningFunction(String family){
GeneralRegressionModel.Distribution distribution = parseFamily(family);
switch(distribution){
case BINOMIAL:
return MiningFunction.CLASSIFICATION;
case NORMAL:
case GAMMA:
case IGAUSS:
case POISSON:
return MiningFunction.REGRESSION;
default:
throw new IllegalArgumentException();
}
}
示例2: getMiningFunction
@Override
public MiningFunction getMiningFunction(){
GeneralizedLinearRegressionModel model = getTransformer();
String family = model.getFamily();
switch(family){
case "binomial":
return MiningFunction.CLASSIFICATION;
default:
return MiningFunction.REGRESSION;
}
}
示例3: getMiningFunction
@Override
public MiningFunction getMiningFunction(){
MiningFunction miningFunction = super.getMiningFunction();
if(miningFunction == null){
return MiningFunction.REGRESSION;
}
return miningFunction;
}
示例4: getMiningFunction
@Override
public MiningFunction getMiningFunction(){
return MiningFunction.REGRESSION;
}
示例5: createRegression
static
public SupportVectorMachineModel createRegression(Matrix<Double> sv, List<String> ids, Double rho, List<Double> coefs, Schema schema){
ContinuousLabel continuousLabel = (ContinuousLabel)schema.getLabel();
VectorDictionary vectorDictionary = LibSVMUtil.createVectorDictionary(sv, ids, schema);
List<VectorInstance> vectorInstances = vectorDictionary.getVectorInstances();
List<SupportVectorMachine> supportVectorMachines = new ArrayList<>();
supportVectorMachines.add(LibSVMUtil.createSupportVectorMachine(vectorInstances, rho, coefs));
SupportVectorMachineModel supportVectorMachineModel = new SupportVectorMachineModel(MiningFunction.REGRESSION, ModelUtil.createMiningSchema(continuousLabel), vectorDictionary, supportVectorMachines);
return supportVectorMachineModel;
}
示例6: encodeResponse
private void encodeResponse(S4Object responses, RExpEncoder encoder){
RGenericVector variables = (RGenericVector)responses.getAttributeValue("variables");
RBooleanVector is_nominal = (RBooleanVector)responses.getAttributeValue("is_nominal");
RGenericVector levels = (RGenericVector)responses.getAttributeValue("levels");
RStringVector variableNames = variables.names();
String variableName = variableNames.asScalar();
DataField dataField;
Boolean categorical = is_nominal.getValue(variableName);
if((Boolean.TRUE).equals(categorical)){
this.miningFunction = MiningFunction.CLASSIFICATION;
RExp targetVariable = variables.getValue(variableName);
RStringVector targetVariableClass = (RStringVector)targetVariable.getAttributeValue("class");
RStringVector targetCategories = (RStringVector)levels.getValue(variableName);
dataField = encoder.createDataField(FieldName.create(variableName), OpType.CATEGORICAL, RExpUtil.getDataType(targetVariableClass.asScalar()), targetCategories.getValues());
} else
if((Boolean.FALSE).equals(categorical)){
this.miningFunction = MiningFunction.REGRESSION;
dataField = encoder.createDataField(FieldName.create(variableName), OpType.CONTINUOUS, DataType.DOUBLE);
} else
{
throw new IllegalArgumentException();
}
encoder.setLabel(dataField);
}
示例7: correct
@Test
public void correct(){
FieldName name = FieldName.create("y");
DataField dataField = new DataField(name, OpType.CONTINUOUS, DataType.DOUBLE);
DataDictionary dataDictionary = new DataDictionary()
.addDataFields(dataField);
MiningField miningField = new MiningField(name)
.setUsageType(MiningField.UsageType.PREDICTED);
MiningSchema miningSchema = new MiningSchema()
.addMiningFields(miningField);
RegressionModel regressionModel = new RegressionModel(MiningFunction.REGRESSION, miningSchema, null);
PMML pmml = new PMML("4.3", new Header(), dataDictionary)
.addModels(regressionModel);
RegressionTargetCorrector corrector = new RegressionTargetCorrector();
corrector.applyTo(pmml);
Targets targets = regressionModel.getTargets();
assertNull(targets);
dataField.setDataType(DataType.INTEGER);
corrector.applyTo(pmml);
targets = regressionModel.getTargets();
assertNotNull(targets);
Target target = IndexableUtil.find(targets.getTargets(), name);
assertNotNull(target);
assertEquals(Target.CastInteger.ROUND, target.getCastInteger());
corrector = new RegressionTargetCorrector(Target.CastInteger.FLOOR);
corrector.applyTo(pmml);
assertEquals(Target.CastInteger.ROUND, target.getCastInteger());
target.setCastInteger(null);
corrector.applyTo(pmml);
assertEquals(Target.CastInteger.FLOOR, target.getCastInteger());
}