本文整理汇总了Java中weka.filters.supervised.attribute.Discretize.setUseBetterEncoding方法的典型用法代码示例。如果您正苦于以下问题:Java Discretize.setUseBetterEncoding方法的具体用法?Java Discretize.setUseBetterEncoding怎么用?Java Discretize.setUseBetterEncoding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weka.filters.supervised.attribute.Discretize
的用法示例。
在下文中一共展示了Discretize.setUseBetterEncoding方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildEvaluator
import weka.filters.supervised.attribute.Discretize; //导入方法依赖的package包/类
/**
* Initializes a symmetrical uncertainty attribute evaluator. Discretizes all
* attributes that are numeric.
*
* @param data set of instances serving as training data
* @throws Exception if the evaluator has not been generated successfully
*/
@Override
public void buildEvaluator(Instances data) throws Exception {
// can evaluator handle data?
getCapabilities().testWithFail(data);
m_trainInstances = data;
m_classIndex = m_trainInstances.classIndex();
m_numInstances = m_trainInstances.numInstances();
Discretize disTransform = new Discretize();
disTransform.setUseBetterEncoding(true);
disTransform.setInputFormat(m_trainInstances);
m_trainInstances = Filter.useFilter(m_trainInstances, disTransform);
m_numClasses = m_trainInstances.attribute(m_classIndex).numValues();
}
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:23,代码来源:SymmetricalUncertAttributeEval.java
示例2: buildEvaluator
import weka.filters.supervised.attribute.Discretize; //导入方法依赖的package包/类
/**
* Initializes a gain ratio attribute evaluator. Discretizes all attributes
* that are numeric.
*
* @param data set of instances serving as training data
* @throws Exception if the evaluator has not been generated successfully
*/
@Override
public void buildEvaluator(Instances data) throws Exception {
// can evaluator handle data?
getCapabilities().testWithFail(data);
m_trainInstances = data;
m_classIndex = m_trainInstances.classIndex();
m_numInstances = m_trainInstances.numInstances();
Discretize disTransform = new Discretize();
disTransform.setUseBetterEncoding(true);
disTransform.setInputFormat(m_trainInstances);
m_trainInstances = Filter.useFilter(m_trainInstances, disTransform);
m_numClasses = m_trainInstances.attribute(m_classIndex).numValues();
}
示例3: buildEvaluator
import weka.filters.supervised.attribute.Discretize; //导入方法依赖的package包/类
/**
* Initializes a symmetrical uncertainty attribute evaluator.
* Discretizes all attributes that are numeric.
*
* @param data set of instances serving as training data
* @throws Exception if the evaluator has not been
* generated successfully
*/
public void buildEvaluator (Instances data)
throws Exception {
// can evaluator handle data?
getCapabilities().testWithFail(data);
m_trainInstances = data;
m_classIndex = m_trainInstances.classIndex();
m_numAttribs = m_trainInstances.numAttributes();
m_numInstances = m_trainInstances.numInstances();
Discretize disTransform = new Discretize();
disTransform.setUseBetterEncoding(true);
disTransform.setInputFormat(m_trainInstances);
m_trainInstances = Filter.useFilter(m_trainInstances, disTransform);
m_numClasses = m_trainInstances.attribute(m_classIndex).numValues();
}
示例4: buildEvaluator
import weka.filters.supervised.attribute.Discretize; //导入方法依赖的package包/类
/**
* Initializes a gain ratio attribute evaluator.
* Discretizes all attributes that are numeric.
*
* @param data set of instances serving as training data
* @throws Exception if the evaluator has not been
* generated successfully
*/
public void buildEvaluator (Instances data)
throws Exception {
// can evaluator handle data?
getCapabilities().testWithFail(data);
m_trainInstances = data;
m_classIndex = m_trainInstances.classIndex();
m_numAttribs = m_trainInstances.numAttributes();
m_numInstances = m_trainInstances.numInstances();
Discretize disTransform = new Discretize();
disTransform.setUseBetterEncoding(true);
disTransform.setInputFormat(m_trainInstances);
m_trainInstances = Filter.useFilter(m_trainInstances, disTransform);
m_numClasses = m_trainInstances.attribute(m_classIndex).numValues();
}
示例5: buildEvaluator
import weka.filters.supervised.attribute.Discretize; //导入方法依赖的package包/类
/**
* Generates a attribute evaluator. Has to initialize all fields of the
* evaluator that are not being set via options.
*
* @param data set of instances serving as training data
* @throws Exception if the evaluator has not been
* generated successfully
*/
public void buildEvaluator (Instances data) throws Exception {
// can evaluator handle data?
getCapabilities().testWithFail(data);
m_trainInstances = new Instances(data);
m_trainInstances.deleteWithMissingClass();
m_classIndex = m_trainInstances.classIndex();
m_numAttribs = m_trainInstances.numAttributes();
m_numInstances = m_trainInstances.numInstances();
m_disTransform = new Discretize();
m_disTransform.setUseBetterEncoding(true);
m_disTransform.setInputFormat(m_trainInstances);
m_trainInstances = Filter.useFilter(m_trainInstances, m_disTransform);
}
示例6: buildEvaluator
import weka.filters.supervised.attribute.Discretize; //导入方法依赖的package包/类
/**
* Generates a attribute evaluator. Has to initialize all fields of the
* evaluator that are not being set via options.
*
* CFS also discretises attributes (if necessary) and initializes
* the correlation matrix.
*
* @param data set of instances serving as training data
* @throws Exception if the evaluator has not been
* generated successfully
*/
public void buildEvaluator (Instances data)
throws Exception {
// can evaluator handle data?
getCapabilities().testWithFail(data);
m_trainInstances = new Instances(data);
m_trainInstances.deleteWithMissingClass();
m_classIndex = m_trainInstances.classIndex();
m_numAttribs = m_trainInstances.numAttributes();
m_numInstances = m_trainInstances.numInstances();
m_isNumeric = m_trainInstances.attribute(m_classIndex).isNumeric();
if (!m_isNumeric) {
m_disTransform = new Discretize();
m_disTransform.setUseBetterEncoding(true);
m_disTransform.setInputFormat(m_trainInstances);
m_trainInstances = Filter.useFilter(m_trainInstances, m_disTransform);
}
m_std_devs = new double[m_numAttribs];
m_corr_matrix = new float [m_numAttribs][];
for (int i = 0; i < m_numAttribs; i++) {
m_corr_matrix[i] = new float [i+1];
}
for (int i = 0; i < m_corr_matrix.length; i++) {
m_corr_matrix[i][i] = 1.0f;
m_std_devs[i] = 1.0;
}
for (int i = 0; i < m_numAttribs; i++) {
for (int j = 0; j < m_corr_matrix[i].length - 1; j++) {
m_corr_matrix[i][j] = -999;
}
}
}