本文整理匯總了Java中com.rapidminer.operator.learner.functions.kernel.jmysvm.kernel.KernelDot類的典型用法代碼示例。如果您正苦於以下問題:Java KernelDot類的具體用法?Java KernelDot怎麽用?Java KernelDot使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
KernelDot類屬於com.rapidminer.operator.learner.functions.kernel.jmysvm.kernel包,在下文中一共展示了KernelDot類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: learn
import com.rapidminer.operator.learner.functions.kernel.jmysvm.kernel.KernelDot; //導入依賴的package包/類
@Override
public Model learn(ExampleSet exampleSet) throws OperatorException {
Attribute label = exampleSet.getAttributes().getLabel();
if ((label.isNominal()) && (label.getMapping().size() != 2)) {
throw new UserError(this, 114, getName(), label.getName());
}
this.svmExamples = new com.rapidminer.operator.learner.functions.kernel.jmysvm.examples.SVMExamples(exampleSet,
label, getParameterAsBoolean(PARAMETER_SCALE));
// kernel
int cacheSize = getParameterAsInt(PARAMETER_KERNEL_CACHE);
Kernel kernel = new KernelDot();
kernel.init(svmExamples, cacheSize);
// SVM
SVMInterface svm = createSVM(label, kernel, svmExamples, exampleSet);
svm.init(kernel, svmExamples);
svm.train();
LinearMySVMModel model = new LinearMySVMModel(exampleSet, svmExamples, kernel, KERNEL_DOT);
this.svmExamples = null;
return model;
}
示例2: createKernel
import com.rapidminer.operator.learner.functions.kernel.jmysvm.kernel.KernelDot; //導入依賴的package包/類
/**
* Creates a new kernel of the given type. The kernel type has to be one out of KERNEL_DOT,
* KERNEL_RADIAL, KERNEL_POLYNOMIAL, KERNEL_NEURAL, KERNEL_EPANECHNIKOV,
* KERNEL_GAUSSIAN_COMBINATION, or KERNEL_MULTIQUADRIC.
*/
public static Kernel createKernel(int kernelType) {
switch (kernelType) {
case KERNEL_DOT:
return new KernelDot();
case KERNEL_RADIAL:
return new KernelRadial();
case KERNEL_POLYNOMIAL:
return new KernelPolynomial();
case KERNEL_NEURAL:
return new KernelNeural();
case KERNEL_ANOVA:
return new KernelAnova();
case KERNEL_EPANECHNIKOV:
return new KernelEpanechnikov();
case KERNEL_GAUSSIAN_COMBINATION:
return new KernelGaussianCombination();
case KERNEL_MULTIQUADRIC:
return new KernelMultiquadric();
default:
return new KernelDot();
}
}
示例3: learn
import com.rapidminer.operator.learner.functions.kernel.jmysvm.kernel.KernelDot; //導入依賴的package包/類
@Override
public Model learn(ExampleSet exampleSet) throws OperatorException {
Attribute label = exampleSet.getAttributes().getLabel();
if ((label.isNominal()) && (label.getMapping().size() != 2)) {
throw new UserError(this, 114, getName(), label.getName());
}
this.svmExamples = new com.rapidminer.operator.learner.functions.kernel.jmysvm.examples.SVMExamples(exampleSet, label, getParameterAsBoolean(PARAMETER_SCALE));
// kernel
int cacheSize = getParameterAsInt(PARAMETER_KERNEL_CACHE);
Kernel kernel = new KernelDot();
kernel.init(svmExamples, cacheSize);
// SVM
SVMInterface svm = createSVM(label, kernel, svmExamples, exampleSet);
svm.init(kernel, svmExamples);
svm.train();
LinearMySVMModel model = new LinearMySVMModel(exampleSet, svmExamples, kernel, KERNEL_DOT);
this.svmExamples = null;
return model;
}
示例4: createKernel
import com.rapidminer.operator.learner.functions.kernel.jmysvm.kernel.KernelDot; //導入依賴的package包/類
/**
* Creates a new kernel of the given type. The kernel type has to be one out
* of KERNEL_DOT, KERNEL_RADIAL, KERNEL_POLYNOMIAL, KERNEL_NEURAL,
* KERNEL_EPANECHNIKOV, KERNEL_GAUSSIAN_COMBINATION, or KERNEL_MULTIQUADRIC.
*/
public static Kernel createKernel(int kernelType) {
switch (kernelType) {
case KERNEL_DOT:
return new KernelDot();
case KERNEL_RADIAL:
return new KernelRadial();
case KERNEL_POLYNOMIAL:
return new KernelPolynomial();
case KERNEL_NEURAL:
return new KernelNeural();
case KERNEL_ANOVA:
return new KernelAnova();
case KERNEL_EPANECHNIKOV:
return new KernelEpanechnikov();
case KERNEL_GAUSSIAN_COMBINATION:
return new KernelGaussianCombination();
case KERNEL_MULTIQUADRIC:
return new KernelMultiquadric();
default:
return new KernelDot();
}
}
示例5: createKernel
import com.rapidminer.operator.learner.functions.kernel.jmysvm.kernel.KernelDot; //導入依賴的package包/類
/**
* Creates a new kernel of the given type. The kernel type has to be one out of KERNEL_DOT,
* KERNEL_RADIAL, KERNEL_POLYNOMIAL, or KERNEL_NEURAL.
*/
public static Kernel createKernel(int kernelType) {
switch (kernelType) {
case KERNEL_RADIAL:
return new KernelRadial();
case KERNEL_POLYNOMIAL:
return new KernelPolynomial();
case KERNEL_NEURAL:
return new KernelNeural();
default:
return new KernelDot();
}
}
示例6: createKernel
import com.rapidminer.operator.learner.functions.kernel.jmysvm.kernel.KernelDot; //導入依賴的package包/類
/**
* Creates a new kernel of the given type. The kernel type has to be one out of KERNEL_DOT, KERNEL_RADIAL, KERNEL_POLYNOMIAL, or KERNEL_NEURAL.
*/
public static Kernel createKernel(int kernelType) {
switch (kernelType) {
case KERNEL_RADIAL:
return new KernelRadial();
case KERNEL_POLYNOMIAL:
return new KernelPolynomial();
case KERNEL_NEURAL:
return new KernelNeural();
default:
return new KernelDot();
}
}
示例7: performPrediction
import com.rapidminer.operator.learner.functions.kernel.jmysvm.kernel.KernelDot; //導入依賴的package包/類
@Override
public ExampleSet performPrediction(ExampleSet exampleSet, Attribute predictedLabelAttribute) throws OperatorException {
if (kernel instanceof KernelDot) {
if (weights != null) {
Map<Integer, MeanVariance> meanVariances = model.getMeanVariances();
for (Example example : exampleSet) {
double prediction = getBias();
int a = 0;
for (Attribute attribute : exampleSet.getAttributes()) {
double value = example.getValue(attribute);
MeanVariance meanVariance = meanVariances.get(a);
if (meanVariance != null) {
if (meanVariance.getVariance() == 0.0d) {
value = 0.0d;
} else {
value = (value - meanVariance.getMean()) / Math.sqrt(meanVariance.getVariance());
}
}
prediction += weights[a] * value;
a++;
}
setPrediction(example, prediction);
}
return exampleSet;
}
}
// only if not simple dot hyperplane (see above)...
com.rapidminer.operator.learner.functions.kernel.jmysvm.examples.SVMExamples toPredict = new com.rapidminer.operator.learner.functions.kernel.jmysvm.examples.SVMExamples(
exampleSet, exampleSet.getAttributes().getPredictedLabel(), model.getMeanVariances());
SVMInterface svm = createSVM();
svm.init(kernel, model);
svm.predict(toPredict);
// set predictions from toPredict
Iterator<Example> reader = exampleSet.iterator();
int k = 0;
while (reader.hasNext()) {
setPrediction(reader.next(), toPredict.get_y(k++));
}
return exampleSet;
}
示例8: performPrediction
import com.rapidminer.operator.learner.functions.kernel.jmysvm.kernel.KernelDot; //導入依賴的package包/類
@Override
public ExampleSet performPrediction(ExampleSet exampleSet, Attribute predictedLabelAttribute) throws OperatorException {
if (kernel instanceof KernelDot) {
if (weights != null) {
Map<Integer, MeanVariance> meanVariances = model.getMeanVariances();
OperatorProgress progress = null;
if (getShowProgress() && getOperator() != null && getOperator().getProgress() != null) {
progress = getOperator().getProgress();
progress.setTotal(exampleSet.size());
}
int progressCounter = 0;
Attribute[] regularAttributes = exampleSet.getAttributes().createRegularAttributeArray();
for (Example example : exampleSet) {
double prediction = getBias();
int a = 0;
for (Attribute attribute : regularAttributes) {
double value = example.getValue(attribute);
MeanVariance meanVariance = meanVariances.get(a);
if (meanVariance != null) {
if (meanVariance.getVariance() == 0.0d) {
value = 0.0d;
} else {
value = (value - meanVariance.getMean()) / Math.sqrt(meanVariance.getVariance());
}
}
prediction += weights[a] * value;
a++;
}
setPrediction(example, prediction);
if (progress != null && ++progressCounter % OPERATOR_PROGRESS_STEPS == 0) {
progress.setCompleted(progressCounter);
}
}
return exampleSet;
}
}
// only if not simple dot hyperplane (see above)...
com.rapidminer.operator.learner.functions.kernel.jmysvm.examples.SVMExamples toPredict = new com.rapidminer.operator.learner.functions.kernel.jmysvm.examples.SVMExamples(
exampleSet, exampleSet.getAttributes().getPredictedLabel(), model.getMeanVariances());
SVMInterface svm = createSVM();
svm.init(kernel, model);
svm.predict(toPredict);
// set predictions from toPredict
Iterator<Example> reader = exampleSet.iterator();
int k = 0;
while (reader.hasNext()) {
setPrediction(reader.next(), toPredict.get_y(k++));
}
return exampleSet;
}
示例9: performPrediction
import com.rapidminer.operator.learner.functions.kernel.jmysvm.kernel.KernelDot; //導入依賴的package包/類
@Override
public ExampleSet performPrediction(ExampleSet exampleSet, Attribute predictedLabelAttribute) throws OperatorException {
if (kernel instanceof KernelDot) {
if (weights != null) {
Map<Integer, MeanVariance> meanVariances = model.getMeanVariances();
for (Example example : exampleSet) {
double prediction = getBias();
int a = 0;
for (Attribute attribute : exampleSet.getAttributes()) {
double value = example.getValue(attribute);
MeanVariance meanVariance = meanVariances.get(a);
if (meanVariance != null) {
if (meanVariance.getVariance() == 0.0d)
value = 0.0d;
else
value = (value - meanVariance.getMean()) / Math.sqrt(meanVariance.getVariance());
}
prediction += weights[a] * value;
a++;
}
setPrediction(example, prediction);
}
return exampleSet;
}
}
// only if not simple dot hyperplane (see above)...
com.rapidminer.operator.learner.functions.kernel.jmysvm.examples.SVMExamples toPredict = new com.rapidminer.operator.learner.functions.kernel.jmysvm.examples.SVMExamples(exampleSet, exampleSet.getAttributes().getPredictedLabel(), model.getMeanVariances());
SVMInterface svm = createSVM();
svm.init(kernel, model);
svm.predict(toPredict);
// set predictions from toPredict
Iterator<Example> reader = exampleSet.iterator();
int k = 0;
while (reader.hasNext()) {
setPrediction(reader.next(), toPredict.get_y(k++));
}
return exampleSet;
}