本文整理汇总了Java中weka.filters.unsupervised.attribute.Normalize类的典型用法代码示例。如果您正苦于以下问题:Java Normalize类的具体用法?Java Normalize怎么用?Java Normalize使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Normalize类属于weka.filters.unsupervised.attribute包,在下文中一共展示了Normalize类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: loadDataFile
import weka.filters.unsupervised.attribute.Normalize; //导入依赖的package包/类
@Override
public Instances loadDataFile(String filename) {
String path = System.getProperty("user.dir") + "\\resources\\datasets\\";
path = path.concat(filename);
System.out.println("Path:\t\t" + path);
System.out.println("Dataset:\t" + filename);
ConverterUtils.DataSource source;
try {
source = new ConverterUtils.DataSource(path);
data = source.getDataSet();
System.out.println(filename + " -> Data loaded.");
// Normalizacja atrybutów, domyslne ustawienia
Normalize filterNorm = new Normalize();
filterNorm.setInputFormat(data);
data = Filter.useFilter(data, filterNorm);
System.out.println("Data Normalized");
System.out.println();
return data;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
开发者ID:kokojumbo,项目名称:master-thesis,代码行数:27,代码来源:DBScanImbalancedAlgorithm.java
示例2: loadDataFile
import weka.filters.unsupervised.attribute.Normalize; //导入依赖的package包/类
@Override
public Instances loadDataFile(String filename) {
this.filename = filename;
String path = System.getProperty("user.dir") + "\\resources\\datasets\\";
path = path.concat(filename);
System.out.println("Path:\t\t" + path);
System.out.println("Dataset:\t" + filename);
ConverterUtils.DataSource source;
try {
source = new ConverterUtils.DataSource(path);
data = source.getDataSet();
System.out.println(filename + " -> Data loaded.");
// Normalizacja atrybutów, domyslne ustawienia
Normalize filterNorm = new Normalize();
filterNorm.setInputFormat(data);
data = Filter.useFilter(data, filterNorm);
System.out.println("Data Normalized");
System.out.println();
return data;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
开发者ID:kokojumbo,项目名称:master-thesis,代码行数:27,代码来源:ClusterImbalancedAlgorithm.java
示例3: loadDataFile
import weka.filters.unsupervised.attribute.Normalize; //导入依赖的package包/类
public static Instances loadDataFile(String filename) {
Instances data;
String path = System.getProperty("user.dir") + "\\resources\\datasets\\";
path = path.concat(filename);
// System.out.println("Path:\t\t" + path);
// System.out.println("Dataset:\t" + filename);
ConverterUtils.DataSource source;
try {
source = new ConverterUtils.DataSource(path);
data = source.getDataSet();
//System.out.println(filename + " -> Data loaded.");
// Normalizacja atrybutów, domyslne ustawienia
Normalize filterNorm = new Normalize();
filterNorm.setInputFormat(data);
data = Filter.useFilter(data, filterNorm);
//System.out.println("Data Normalized");
//System.out.println();
return data;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
开发者ID:kokojumbo,项目名称:master-thesis,代码行数:26,代码来源:LoadUtils.java
示例4: loadDataFilePrint
import weka.filters.unsupervised.attribute.Normalize; //导入依赖的package包/类
public static Instances loadDataFilePrint(String filename) {
Instances data;
String path = System.getProperty("user.dir") + "\\resources\\datasets\\";
path = path.concat(filename);
System.out.println("Path:\t\t" + path);
System.out.println("Dataset:\t" + filename);
ConverterUtils.DataSource source;
try {
source = new ConverterUtils.DataSource(path);
data = source.getDataSet();
System.out.println(filename + " -> Data loaded.");
// Normalizacja atrybutów, domyslne ustawienia
Normalize filterNorm = new Normalize();
filterNorm.setInputFormat(data);
data = Filter.useFilter(data, filterNorm);
System.out.println("Data Normalized");
System.out.println();
return data;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
开发者ID:kokojumbo,项目名称:master-thesis,代码行数:26,代码来源:LoadUtils.java
示例5: createNormalizationFilter
import weka.filters.unsupervised.attribute.Normalize; //导入依赖的package包/类
/**
* Normalizes the given data
*
* @param isTrainingSet
* the Instances to be normalized
* @param fvAttributes
* List<Attribute> the list of attributes of the current dataset
* @return the normalized Instances
*/
public Normalize createNormalizationFilter(Instances isTrainingSet) {
// set the Normalize object
Normalize norm = new Normalize();
try {
// set the parameters for norm object
norm.setInputFormat(isTrainingSet);
// set and print the normalization options
String[] options = { "-S", "2.0", "-T", "-1.0" };
norm.setOptions(options);
//System.out.print("Normalization options:\t");
/*for (int i = 0; i < norm.getOptions().length; i++) {
System.out.print(norm.getOptions()[i] + "\t");
}*/
// normalized instances calculated
/*isTrainingSet_norm = Filter.useFilter(isTrainingSet, norm);
isTrainingSet_norm.setClassIndex(fvAttributes.size() - 1);*/
} catch (Exception e) {
System.out.println("Data Normalization filter cannot be created!");
e.printStackTrace();
}
// System.out.println("-----TRAINING SET-------");
// System.out.println(isTrainingSet_norm);
return norm;
}
开发者ID:socialsensor,项目名称:computational-verification,代码行数:44,代码来源:DataHandler.java
示例6: normalizeData
import weka.filters.unsupervised.attribute.Normalize; //导入依赖的package包/类
public Instances normalizeData(Instances dataset, int classIndex, Normalize normFilter){
Instances dataset_norm = null;
try {
dataset_norm = Filter.useFilter(dataset, normFilter);
dataset_norm.setClassIndex(classIndex);
} catch (Exception e) {
System.out.println("Data Normalization cannot be performed! Please check your data!");
e.printStackTrace();
}
return dataset_norm;
}
开发者ID:socialsensor,项目名称:computational-verification,代码行数:14,代码来源:DataHandler.java
示例7: buildClassifier
import weka.filters.unsupervised.attribute.Normalize; //导入依赖的package包/类
/**
* Method for building the classifier.
*
* @param data the set of training instances.
* @throws Exception if the classifier can't be built successfully.
*/
@Override
public void buildClassifier(Instances data) throws Exception {
reset();
// can classifier handle the data?
getCapabilities().testWithFail(data);
data = new Instances(data);
data.deleteWithMissingClass();
if (data.numInstances() > 0 && !m_dontReplaceMissing) {
m_replaceMissing = new ReplaceMissingValues();
m_replaceMissing.setInputFormat(data);
data = Filter.useFilter(data, m_replaceMissing);
}
// check for only numeric attributes
boolean onlyNumeric = true;
for (int i = 0; i < data.numAttributes(); i++) {
if (i != data.classIndex()) {
if (!data.attribute(i).isNumeric()) {
onlyNumeric = false;
break;
}
}
}
if (!onlyNumeric) {
if (data.numInstances() > 0) {
m_nominalToBinary = new weka.filters.supervised.attribute.NominalToBinary();
} else {
m_nominalToBinary = new weka.filters.unsupervised.attribute.NominalToBinary();
}
m_nominalToBinary.setInputFormat(data);
data = Filter.useFilter(data, m_nominalToBinary);
}
if (!m_dontNormalize && data.numInstances() > 0) {
m_normalize = new Normalize();
m_normalize.setInputFormat(data);
data = Filter.useFilter(data, m_normalize);
}
m_numInstances = data.numInstances();
m_weights = new double[data.numAttributes() + 1];
m_data = new Instances(data, 0);
if (data.numInstances() > 0) {
data.randomize(new Random(getSeed())); // randomize the data
train(data);
}
}
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:61,代码来源:SGD.java
示例8: buildClassifier
import weka.filters.unsupervised.attribute.Normalize; //导入依赖的package包/类
/**
* Method for building the classifier.
*
* @param data the set of training instances.
* @throws Exception if the classifier can't be built successfully.
*/
public void buildClassifier(Instances data) throws Exception {
reset();
// can classifier handle the data?
getCapabilities().testWithFail(data);
data = new Instances(data);
data.deleteWithMissingClass();
if (data.numInstances() > 0 && !m_dontReplaceMissing) {
m_replaceMissing = new ReplaceMissingValues();
m_replaceMissing.setInputFormat(data);
data = Filter.useFilter(data, m_replaceMissing);
}
// check for only numeric attributes
boolean onlyNumeric = true;
for (int i = 0; i < data.numAttributes(); i++) {
if (i != data.classIndex()) {
if (!data.attribute(i).isNumeric()) {
onlyNumeric = false;
break;
}
}
}
if (!onlyNumeric) {
if (data.numInstances() > 0) {
m_nominalToBinary = new weka.filters.supervised.attribute.NominalToBinary();
} else {
m_nominalToBinary = new weka.filters.unsupervised.attribute.NominalToBinary();
}
m_nominalToBinary.setInputFormat(data);
data = Filter.useFilter(data, m_nominalToBinary);
}
if (!m_dontNormalize && data.numInstances() > 0) {
m_normalize = new Normalize();
m_normalize.setInputFormat(data);
data = Filter.useFilter(data, m_normalize);
}
m_numInstances = data.numInstances();
m_weights = new double[data.numAttributes() + 1];
m_data = new Instances(data, 0);
if (data.numInstances() > 0) {
data.randomize(new Random(getSeed())); // randomize the data
train(data);
}
}
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:60,代码来源:SGD.java
示例9: buildClassifier
import weka.filters.unsupervised.attribute.Normalize; //导入依赖的package包/类
/**
* Method for building the classifier.
*
* @param data the set of training instances.
* @throws Exception if the classifier can't be built successfully.
*/
public void buildClassifier(Instances data) throws Exception {
reset();
// can classifier handle the data?
getCapabilities().testWithFail(data);
data = new Instances(data);
data.deleteWithMissingClass();
if (data.numInstances() > 0 && !m_dontReplaceMissing) {
m_replaceMissing = new ReplaceMissingValues();
m_replaceMissing.setInputFormat(data);
data = Filter.useFilter(data, m_replaceMissing);
}
// check for only numeric attributes
boolean onlyNumeric = true;
for (int i = 0; i < data.numAttributes(); i++) {
if (i != data.classIndex()) {
if (!data.attribute(i).isNumeric()) {
onlyNumeric = false;
break;
}
}
}
if (!onlyNumeric) {
m_nominalToBinary = new NominalToBinary();
m_nominalToBinary.setInputFormat(data);
data = Filter.useFilter(data, m_nominalToBinary);
}
if (!m_dontNormalize && data.numInstances() > 0) {
m_normalize = new Normalize();
m_normalize.setInputFormat(data);
data = Filter.useFilter(data, m_normalize);
}
m_weights = new double[data.numAttributes() + 1];
m_data = new Instances(data, 0);
if (data.numInstances() > 0) {
train(data);
}
}
开发者ID:williamClanton,项目名称:jbossBA,代码行数:53,代码来源:SPegasos.java
示例10: main
import weka.filters.unsupervised.attribute.Normalize; //导入依赖的package包/类
public static void main(String[] args) {
try {
CSVLoader loader = new CSVLoader();
loader.setSource(new File(OJOSECO_FILEPATH));
Instances data = loader.getDataSet();
Normalize normalize = new Normalize();
normalize.setInputFormat(data);
data = Filter.useFilter(data, normalize);
data.setClassIndex(data.numAttributes() - 1);
System.out.println(data.toSummaryString());
data.randomize(new Random(0));
int trainSize = Math.toIntExact(Math.round(data.numInstances() * RATIO_TEST));
int testSize = data.numInstances() - trainSize;
Instances train = new Instances(data, 0, trainSize);
Instances test = new Instances(data, trainSize, testSize);
MultilayerPerceptron mlp = new MultilayerPerceptron();
mlp.setOptions(Utils.splitOptions("-L 0.3 -M 0.2 -N 500 -V 0 -S 0 -E 20 -H a"));
mlp.buildClassifier(train);
System.out.println(mlp.toString());
Evaluation eval = new Evaluation(test);
eval.evaluateModel(mlp, test);
System.out.println(eval.toSummaryString());
} catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:garciparedes,项目名称:java-examples,代码行数:51,代码来源:WekaMultiLayerPerceptron.java
注:本文中的weka.filters.unsupervised.attribute.Normalize类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论