本文整理汇总了C#中weka.core.Instances.instancesAndWeights方法的典型用法代码示例。如果您正苦于以下问题:C# Instances.instancesAndWeights方法的具体用法?C# Instances.instancesAndWeights怎么用?C# Instances.instancesAndWeights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weka.core.Instances
的用法示例。
在下文中一共展示了Instances.instancesAndWeights方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: test
//.........这里部分代码省略.........
System.Console.Out.WriteLine("\nClass index: " + instances.classIndex());
System.Console.Out.WriteLine("\nClass is nominal: " + instances.classAttribute().Nominal);
System.Console.Out.WriteLine("\nClass is numeric: " + instances.classAttribute().Numeric);
System.Console.Out.WriteLine("\nClasses:\n");
for (i = 0; i < instances.numClasses(); i++)
{
System.Console.Out.WriteLine(instances.classAttribute().value_Renamed(i));
}
System.Console.Out.WriteLine("\nClass values and labels of instances:\n");
for (i = 0; i < instances.numInstances(); i++)
{
Instance inst = instances.instance(i);
System.Console.Out.Write(inst.classValue() + "\t");
System.Console.Out.Write(inst.toString(inst.classIndex()));
if (instances.instance(i).classIsMissing())
{
System.Console.Out.WriteLine("\tis missing");
}
else
{
System.Console.Out.WriteLine();
}
}
// Create random weights.
System.Console.Out.WriteLine("\nCreating random weights for instances.");
for (i = 0; i < instances.numInstances(); i++)
{
instances.instance(i).Weight = random.NextDouble();
}
// Print all instances and their weights (and the sum of weights).
System.Console.Out.WriteLine("\nInstances and their weights:\n");
System.Console.Out.WriteLine(instances.instancesAndWeights());
System.Console.Out.Write("\nSum of weights: ");
System.Console.Out.WriteLine(instances.sumOfWeights());
// Insert an attribute
secondInstances = new Instances(instances);
Attribute testAtt = new Attribute("Inserted");
secondInstances.insertAttributeAt(testAtt, 0);
System.Console.Out.WriteLine("\nSet with inserted attribute:\n");
//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(secondInstances);
System.Console.Out.WriteLine("\nClass name: " + secondInstances.classAttribute().name());
// Delete the attribute
secondInstances.deleteAttributeAt(0);
System.Console.Out.WriteLine("\nSet with attribute deleted:\n");
//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(secondInstances);
System.Console.Out.WriteLine("\nClass name: " + secondInstances.classAttribute().name());
// 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("? ");
}