Package weka.core

Examples of weka.core.Instance.numValues()


      Assert.assertEquals("REL statechum compatibility score",testClassifier.attributesOfAnInstance[1].name());
    }
   
    {// pairB - another correct pair
      Instance instance = instEnum.nextElement();
      Assert.assertFalse(instance.classIsMissing());Assert.assertEquals(5,instance.numValues());
      Assert.assertFalse(instance.hasMissingValue());
      Assert.assertTrue(instance.classAttribute().isNominal());
      Assert.assertEquals(2,instance.classAttribute().numValues());// true/false
      Assert.assertEquals("true",instance.classAttribute().value((int) instance.value(instance.classAttribute())));
 
View Full Code Here


      Assert.assertEquals("REL statechum compatibility score",testClassifier.attributesOfAnInstance[1].name());
    }
   
    {// pairC - incorrect pair
      Instance instance = instEnum.nextElement();
      Assert.assertFalse(instance.classIsMissing());Assert.assertEquals(5,instance.numValues());
      Assert.assertFalse(instance.hasMissingValue());
      Assert.assertTrue(instance.classAttribute().isNominal());
      Assert.assertEquals(2,instance.classAttribute().numValues());// true/false
      Assert.assertEquals("false",instance.classAttribute().value((int) instance.value(instance.classAttribute())));
 
View Full Code Here

  public void testConstructEmptyInstance1()
  {
    WekaDataCollector classifier = new WekaDataCollector();
    classifier.initialise("TestCreateInstances2", 10, new ArrayList<PairRank>(),0);
    Instance instance = classifier.constructInstance(new int []{},false);
    Assert.assertFalse(instance.classIsMissing());Assert.assertEquals(1,instance.numValues());
    Assert.assertFalse(instance.hasMissingValue());
    Assert.assertTrue(instance.classAttribute().isNominal());
    Assert.assertEquals(2,instance.classAttribute().numValues());// true/false
    Assert.assertEquals("false",instance.classAttribute().value((int) instance.value(instance.classAttribute())));
    Assert.assertEquals("false",instance.stringValue(instance.classAttribute()));
View Full Code Here

      }
    });
    classifier.initialise("TestCreateInstances2", 0, assessors,0);
   
    Instance instance = classifier.constructInstance(new int []{1,0},true);
    Assert.assertFalse(instance.classIsMissing());Assert.assertEquals(3,instance.numValues());
    Assert.assertFalse(instance.hasMissingValue());
    Assert.assertTrue(instance.classAttribute().isNominal());
    Assert.assertEquals(2,instance.classAttribute().numValues());// true/false
    Assert.assertEquals("true",instance.classAttribute().value((int) instance.value(instance.classAttribute())));
    Assert.assertEquals(WekaDataCollector.ONE,instance.stringValue(classifier.attributesOfAnInstance[0]));
View Full Code Here

      }
    });
    classifier.initialise("TestCreateInstances2", 10, assessors,0);

    Instance instance = classifier.constructInstance(new int []{1,-1},true);
    Assert.assertFalse(instance.classIsMissing());Assert.assertEquals(3,instance.numValues());
    Assert.assertFalse(instance.hasMissingValue());
    Assert.assertTrue(instance.classAttribute().isNominal());
    Assert.assertEquals(2,instance.classAttribute().numValues());// true/false
    Assert.assertEquals("true",instance.classAttribute().value((int) instance.value(instance.classAttribute())));
View Full Code Here

      }
    });
    classifier.initialise("TestCreateInstances2", 10, assessors,0);
   
    Instance instance = classifier.constructInstance(new int []{1,0,0,-1}, true);
    Assert.assertFalse(instance.classIsMissing());Assert.assertEquals(5,instance.numValues());
    Assert.assertFalse(instance.hasMissingValue());
    Assert.assertTrue(instance.classAttribute().isNominal());
    Assert.assertEquals(2,instance.classAttribute().numValues());// true/false
    Assert.assertEquals("true",instance.classAttribute().value((int) instance.value(instance.classAttribute())));
View Full Code Here

    @SuppressWarnings("unchecked")
    Enumeration<Instance> instEnum = testClassifier.trainingData.enumerateInstances();

    {// pairA - the correct pair
      Instance instance = instEnum.nextElement();
      Assert.assertFalse(instance.classIsMissing());Assert.assertEquals(5,instance.numValues());
      Assert.assertFalse(instance.hasMissingValue());
      Assert.assertTrue(instance.classAttribute().isNominal());
      Assert.assertEquals(2,instance.classAttribute().numValues());// true/false
      Assert.assertEquals("true",instance.classAttribute().value((int) instance.value(instance.classAttribute())));
 
View Full Code Here

  public void testConstructEmptyInstance1()
  {
    WekaDataCollector classifier = new WekaDataCollector();
    classifier.initialise("TestCreateInstances2", 10, new ArrayList<PairRank>(),0);
    Instance instance = classifier.constructInstance(new int []{},false);
    Assert.assertFalse(instance.classIsMissing());Assert.assertEquals(1,instance.numValues());
    Assert.assertFalse(instance.hasMissingValue());
    Assert.assertTrue(instance.classAttribute().isNominal());
    Assert.assertEquals(2,instance.classAttribute().numValues());// true/false
    Assert.assertEquals("false",instance.classAttribute().value((int) instance.value(instance.classAttribute())));
    Assert.assertEquals("false",instance.stringValue(instance.classAttribute()));
View Full Code Here

      }
    });
    classifier.initialise("TestCreateInstances2", 0, assessors,0);
   
    Instance instance = classifier.constructInstance(new int []{1,0},true);
    Assert.assertFalse(instance.classIsMissing());Assert.assertEquals(3,instance.numValues());
    Assert.assertFalse(instance.hasMissingValue());
    Assert.assertTrue(instance.classAttribute().isNominal());
    Assert.assertEquals(2,instance.classAttribute().numValues());// true/false
    Assert.assertEquals("true",instance.classAttribute().value((int) instance.value(instance.classAttribute())));
    Assert.assertEquals(WekaDataCollector.ONE,instance.stringValue(classifier.attributesOfAnInstance[0]));
View Full Code Here

      }
    });
    classifier.initialise("TestCreateInstances2", 10, assessors,0);

    Instance instance = classifier.constructInstance(new int []{1,-1},true);
    Assert.assertFalse(instance.classIsMissing());Assert.assertEquals(3,instance.numValues());
    Assert.assertFalse(instance.hasMissingValue());
    Assert.assertTrue(instance.classAttribute().isNominal());
    Assert.assertEquals(2,instance.classAttribute().numValues());// true/false
    Assert.assertEquals("true",instance.classAttribute().value((int) instance.value(instance.classAttribute())));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.