本文整理汇总了C#中weka.core.Instances.renameAttributeValue方法的典型用法代码示例。如果您正苦于以下问题:C# Instances.renameAttributeValue方法的具体用法?C# Instances.renameAttributeValue怎么用?C# Instances.renameAttributeValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weka.core.Instances
的用法示例。
在下文中一共展示了Instances.renameAttributeValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: test
//.........这里部分代码省略.........
// Test if headers are equal
System.Console.Out.WriteLine("\nHeaders equal: " + instances.equalHeaders(secondInstances) + "\n");
// Print data in internal format.
System.Console.Out.WriteLine("\nData (internal values):\n");
for (i = 0; i < instances.numInstances(); i++)
{
for (j = 0; j < instances.numAttributes(); j++)
{
if (instances.instance(i).isMissing(j))
{
System.Console.Out.Write("? ");
}
else
{
System.Console.Out.Write(instances.instance(i).value_Renamed(j) + " ");
}
}
System.Console.Out.WriteLine();
}
// Just print header
System.Console.Out.WriteLine("\nEmpty dataset:\n");
empty = new Instances(instances, 0);
//UPGRADE_TODO: Method 'java.io.PrintStream.println' was converted to 'System.Console.Out.WriteLine' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioPrintStreamprintln_javalangObject'"
System.Console.Out.WriteLine(empty);
System.Console.Out.WriteLine("\nClass name: " + empty.classAttribute().name());
// Create copy and rename an attribute and a value (if possible)
if (empty.classAttribute().Nominal)
{
Instances copy = new Instances(empty, 0);
copy.renameAttribute(copy.classAttribute(), "new_name");
copy.renameAttributeValue(copy.classAttribute(), copy.classAttribute().value_Renamed(0), "new_val_name");
System.Console.Out.WriteLine("\nDataset with names changed:\n" + copy);
System.Console.Out.WriteLine("\nOriginal dataset:\n" + empty);
}
// Create and prints subset of instances.
start = instances.numInstances() / 4;
num = instances.numInstances() / 2;
System.Console.Out.Write("\nSubset of dataset: ");
System.Console.Out.WriteLine(num + " instances from " + (start + 1) + ". instance");
secondInstances = new Instances(instances, start, num);
System.Console.Out.WriteLine("\nClass name: " + secondInstances.classAttribute().name());
// Print all instances and their weights (and the sum of weights).
System.Console.Out.WriteLine("\nInstances and their weights:\n");
System.Console.Out.WriteLine(secondInstances.instancesAndWeights());
System.Console.Out.Write("\nSum of weights: ");
System.Console.Out.WriteLine(secondInstances.sumOfWeights());
// Create and print training and test sets for 3-fold
// cross-validation.
System.Console.Out.WriteLine("\nTrain and test folds for 3-fold CV:");
if (instances.classAttribute().Nominal)
{
instances.stratify(3);
}
for (j = 0; j < 3; j++)
{
//UPGRADE_TODO: The differences in the expected value of parameters for constructor 'java.util.Random.Random' may cause compilation errors. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1092'"
train = instances.trainCV(3, j, new System.Random((System.Int32) 1));
test = instances.testCV(3, j);
// Print all instances and their weights (and the sum of weights).