Examples of Instances


Examples of co.cask.cdap.proto.Instances

        responder.sendString(HttpResponseStatus.NOT_FOUND, "Runnable not found");
        return;
      }

      int count = getProgramInstances(programId);
      responder.sendJson(HttpResponseStatus.OK, new Instances(count));
    } catch (SecurityException e) {
      responder.sendStatus(HttpResponseStatus.UNAUTHORIZED);
    } catch (Throwable throwable) {
      LOG.error("Got exception : ", throwable);
      responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
View Full Code Here

Examples of de.danielbechler.diff.access.Instances

    {
      node.setState(DiffNode.State.IGNORED);
      return node;
    }

    final Instances accessedInstances;
    if (accessor instanceof PropertyAwareAccessor)
    {
      final PropertyAwareAccessor propertyAwareAccessor = (PropertyAwareAccessor) accessor;
      try
      {
        accessedInstances = parentInstances.access(accessor);
      }
      catch (final PropertyReadException e)
      {
        node.setState(DiffNode.State.INACCESSIBLE);
        final Class<?> parentType = parentInstances.getType();
        final String propertyName = propertyAwareAccessor.getPropertyName();
        final PropertyAccessExceptionHandler exceptionHandler = propertyAccessExceptionHandlerResolver
            .resolvePropertyAccessExceptionHandler(parentType, propertyName);
        if (exceptionHandler != null)
        {
          exceptionHandler.onPropertyReadException(e, node);
        }
        return node;
      }
    }
    else
    {
      accessedInstances = parentInstances.access(accessor);
    }

    if (accessedInstances.areNull())
    {
      return new DiffNode(parentNode, accessedInstances.getSourceAccessor(), accessedInstances.getType());
    }
    else
    {
      return compareWithCircularReferenceTracking(parentNode, accessedInstances);
    }
View Full Code Here

Examples of org.apache.karaf.instance.core.internal.Instances

        org.apache.karaf.instance.core.InstanceService instanceService = EasyMock.createMock(org.apache.karaf.instance.core.InstanceService.class);
        EasyMock.expect(instanceService.createInstance("t1", instanceSettings, false)).andReturn(inst);
        EasyMock.replay(instanceService);
       
        Instances ab = new Instances(instanceService);
        assertEquals(42, ab.createInstance("t1", 123, 456, 789, "somewhere", "someopts", " webconsole,  funfeat", ""));
    }
View Full Code Here

Examples of org.integratedmodelling.riskwiz.learning.data.Instances

        public ArffReader(Reader reader, Instances template, int lines, int capacity) throws IOException {
            m_Lines = lines;
            m_Tokenizer = new StreamTokenizer(reader);
            initTokenizer();

            m_Data = new Instances(template, capacity);
            initBuffers();
        }
View Full Code Here

Examples of weka.core.Instances

   * @param inputFormat     the input format to base the output format on
   * @return                the output format
   * @throws Exception      in case the determination goes wrong
   */
  protected Instances determineOutputFormat(Instances inputFormat) throws Exception {
    Instances      result;
    Attribute      att;
    ArrayList<Attribute>  atts;
    int        i;
   
    m_AttributeIndices.setUpper(inputFormat.numAttributes() - 1);
   
    // generate new header
    atts = new ArrayList<Attribute>();
    for (i = 0; i < inputFormat.numAttributes(); i++) {
      att = inputFormat.attribute(i);
      if (m_AttributeIndices.isInRange(i)) {
  if (m_ReplaceAll)
    atts.add(att.copy(att.name().replaceAll(m_Find, m_Replace)));
  else
    atts.add(att.copy(att.name().replaceFirst(m_Find, m_Replace)));
      }
      else {
  atts.add((Attribute) att.copy());
      }
    }
    result = new Instances(inputFormat.relationName(), atts, 0);
    result.setClassIndex(inputFormat.classIndex());
   
    return result;
  }
View Full Code Here

Examples of weka.core.Instances

    int i, j;
    Random Rnd = new Random(m_seed);
    Remove delTransform = new Remove();
    delTransform.setInvertSelection(true);
    // copy the instances
    Instances trainCopy = new Instances(m_trainInstances);

    // count attributes set in the BitSet
    for (i = 0; i < m_numAttribs; i++) {
      if (subset.get(i)) {
        numAttributes++;
View Full Code Here

Examples of weka.core.Instances

    }
    if (m_removeFilter == null) {

      // establish attributes to remove from first batch

      Instances toFilter = getInputFormat();
      int[] attsToDelete = new int[toFilter.numAttributes()];
      int numToDelete = 0;
      for(int i = 0; i < toFilter.numAttributes(); i++) {
  if (i==toFilter.classIndex()) continue; // skip class
  AttributeStats stats = toFilter.attributeStats(i);
  if (stats.distinctCount < 2) {
    // remove constant attributes
    attsToDelete[numToDelete++] = i;
  } else if (toFilter.attribute(i).isNominal()) {
    // remove nominal attributes that vary too much
    double variancePercent = (double) stats.distinctCount
      / (double)(stats.totalCount - stats.missingCount) * 100.0;
    if (variancePercent > m_maxVariancePercentage) {
        attsToDelete[numToDelete++] = i;
    }
  }
      }
     
      int[] finalAttsToDelete = new int[numToDelete];
      System.arraycopy(attsToDelete, 0, finalAttsToDelete, 0, numToDelete);
     
      m_removeFilter = new Remove();
      m_removeFilter.setAttributeIndicesArray(finalAttsToDelete);
      m_removeFilter.setInvertSelection(false);
      m_removeFilter.setInputFormat(toFilter);
     
      for (int i = 0; i < toFilter.numInstances(); i++) {
  m_removeFilter.input(toFilter.instance(i));
      }
      m_removeFilter.batchFinished();

      Instance processed;
      Instances outputDataset = m_removeFilter.getOutputFormat();
   
      // restore old relation name to hide attribute filter stamp
      outputDataset.setRelationName(toFilter.relationName());
   
      setOutputFormat(outputDataset);
      while ((processed = m_removeFilter.output()) != null) {
  processed.setDataset(outputDataset);
  push(processed);
View Full Code Here

Examples of weka.core.Instances

    // can classifier handle the data?
    getCapabilities().testWithFail(instances);

    // remove instances with missing class
    Instances data = new Instances(instances);
    data.deleteWithMissingClass();

    // only class? -> build ZeroR model
    if (data.numAttributes() == 1) {
      System.err.println(
    "Cannot build model (only class attribute present in data!), "
    + "using ZeroR model instead!");
      m_ZeroR = new weka.classifiers.rules.ZeroR();
      m_ZeroR.buildClassifier(data);
View Full Code Here

Examples of weka.core.Instances

   * @param instanceInfo  the data to test
   * @throws Exception    if the test fails
   */
  protected void testInputFormat(Instances instanceInfo) throws Exception {
    for (int i = 0; i < getRanges().length; i++) {
      Instances newi = new Instances(instanceInfo, 0);
      if (instanceInfo.size() > 0){
  newi.add((Instance)instanceInfo.get(0).copy());
      }
      Range range = getRanges()[i];
      range.setUpper(instanceInfo.numAttributes() - 1);
      Instances subset = generateSubset(newi, range);
      getFilters()[i].setInputFormat(subset);
    }
  }
View Full Code Here

Examples of weka.core.Instances

   * @throws Exception  if creation fails
   */
  protected Instances generateSubset(Instances data, Range range) throws Exception {
    Remove    filter;
    StringBuilder  atts;
    Instances    result;
    int[]    indices;
    int      i;

    // determine attributes
    indices = range.getSelection();
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.