Examples of ExampleSet


Examples of com.rapidminer.example.ExampleSet

  }

  @Override
  public void doWork() throws OperatorException {
   
    ExampleSet exampleSet = exampleSetInput.getData();
    Attributes attributes = exampleSet.getAttributes();
   
    for(Attribute a : attributes)
      System.out.println(a.toString());
       
    System.out.println(exampleSet.size());
        System.out.println(attributes.size());
       
       
         IPosOnlyFeedback training_data=new PosOnlyFeedback();
         IEntityMapping user_mapping=new EntityMapping();
         IEntityMapping item_mapping=new EntityMapping();
        
         if (exampleSet.getAttributes().getSpecial("user identification") == null) {
                  throw new UserError(this,105);
              }
         
         if (exampleSet.getAttributes().getSpecial("item identification") == null) {
                  throw new UserError(this, 105);
              }
       
        
         Attributes Att = exampleSet.getAttributes();
         AttributeRole ur=Att.getRole("user identification");
         Attribute u=ur.getAttribute();
         AttributeRole ir=Att.getRole("item identification");
         Attribute i=ir.getAttribute();
       
View Full Code Here

Examples of com.rapidminer.example.ExampleSet

  }

  @Override
  public void doWork() throws OperatorException {
   
    ExampleSet exampleSet = exampleSetInput.getData();
       
         IPosOnlyFeedback training_data=new PosOnlyFeedback();
         IEntityMapping user_mapping=new EntityMapping();
         IEntityMapping item_mapping=new EntityMapping();
       
         if (exampleSet.getAttributes().getSpecial("user identification") == null) {
                  throw new UserError(this,105);
              }
         
         if (exampleSet.getAttributes().getSpecial("item identification") == null) {
                  throw new UserError(this, 105);
              }
        
         Attributes Att = exampleSet.getAttributes();
         AttributeRole ur=Att.getRole("user identification");
         Attribute u=ur.getAttribute();
         AttributeRole ir=Att.getRole("item identification");
         Attribute i=ir.getAttribute();
       
View Full Code Here

Examples of com.rapidminer.example.ExampleSet

  }

  @Override
  public void doWork() throws OperatorException {
   
        ExampleSet exampleSet = exampleSetInput.getData();
           
           
            if (exampleSet.getAttributes().getSpecial("user identification") == null) {
                      throw new UserError(this,105);
                  }
           
            boolean OU = getParameterAsBoolean("Online updates");
           
            Attributes Att = exampleSet.getAttributes();
            AttributeRole ur=Att.getRole("user identification");
            Attribute u=ur.getAttribute();
            AttributeRole ir=null;
            Attribute i=null;
           
View Full Code Here

Examples of com.rapidminer.example.ExampleSet

         }
     
      @Override
      public void doWork() throws OperatorException {
       
        ExampleSet exampleSet = exampleSetInput.getData();   
           
             IPosOnlyFeedback training_data=new PosOnlyFeedback();
             IEntityMapping user_mapping=new EntityMapping();
             IEntityMapping item_mapping=new EntityMapping();
           
             if (exampleSet.getAttributes().getSpecial("user identification") == null) {
                      throw new UserError(this,105);
                  }
             
             if (exampleSet.getAttributes().getSpecial("item identification") == null) {
                      throw new UserError(this, 105);
                  }
            
            
             Attributes Att = exampleSet.getAttributes();
             AttributeRole ur=Att.getRole("user identification");
             Attribute u=ur.getAttribute();
             AttributeRole ir=Att.getRole("item identification");
             Attribute i=ir.getAttribute();
           
            for (Example example : exampleSet) {
             
              double j=example.getValue(u);
              int uid=(int) j;

              j=example.getValue(i);
              int iid=(int) j;
             
              training_data.Add(user_mapping.ToInternalID(uid), item_mapping.ToInternalID(iid));
              checkForStop();
            }
           
           
            ExampleSet attribute_set=exampleSetInput1.getData();
           
            if (attribute_set.getAttributes().getSpecial("user identification") == null) {
                    throw new UserError(this,105);
                }
           
            if (attribute_set.getAttributes().getSpecial("attribute identification") == null) {
                    throw new UserError(this, 105);
                }
           
            Attributes aatr = attribute_set.getAttributes();
            AttributeRole ar=aatr.getRole("attribute identification");
            Attribute at=ar.getAttribute();
            ur=aatr.getRole("user identification");
            i=ur.getAttribute();
View Full Code Here

Examples of com.rapidminer.example.ExampleSet

  }

  @Override
  public void doWork() throws OperatorException {
       
    ExampleSet exampleSet = exampleSetInput.getData();
    ExampleSet exampleSet1=exampleSetInput1.getData();
    Attributes attributes1=exampleSet1.getAttributes();
       
     if (exampleSet.getAttributes().getSpecial("user identification") == null) {
              throw new UserError(this,105);
          }
    
     if (exampleSet.getAttributes().getSpecial("item identification") == null) {
              throw new UserError(this,105);
          }
     
    if (exampleSet1.getAttributes().getSpecial("item identification") == null) {
              throw new UserError(this, 105);
          }
   
    if (exampleSet1.getAttributes().getSpecial("user identification") == null) {
         throw new UserError(this, 105);
      }
       
        Attributes Att = exampleSet.getAttributes();
        AttributeRole ur=Att.getRole("user identification");
View Full Code Here

Examples of etc.aloe.data.ExampleSet

        WekaModel instance = new WekaModel(classifier);

        Boolean[] expResult = new Boolean[]{true, true, false, false};
        Double[] expConfidence = new Double[]{1.0, 1.0, 0.0, 0.0};

        ExampleSet examples = new ExampleSet(testInstances);

        Predictions predictions = instance.getPredictions(examples);

        assertEquals(expResult.length, predictions.size());
View Full Code Here

Examples of etc.aloe.data.ExampleSet

        System.out.println("== Labeling and Testing ==");

        //First extract features
        FeatureExtraction extraction = getFeatureExtractionImpl();
        ExampleSet examples = extraction.extractFeatures(segmentSet.getBasicExamples(), featureSpecification);

        this.featureValues = examples.getInstances();
       
        //Predict the labels
        Predictions predictions = this.model.getPredictions(examples);

        //Map back onto messages
View Full Code Here

Examples of etc.aloe.data.ExampleSet

        SegmentSet trainingSegments = segmentSet.onlyLabeled();
        if (getBalancingImpl() != null) {
            trainingSegments = getBalancingImpl().balance(trainingSegments);
        }

        ExampleSet basicExamples = trainingSegments.getBasicExamples();

        //Generate the features
        FeatureGeneration generation = getFeatureGenerationImpl();
        this.featureSpecification = generation.generateFeatures(basicExamples);

        //Extract features
        FeatureExtraction extraction = getFeatureExtractionImpl();
        ExampleSet examples = extraction.extractFeatures(basicExamples, this.featureSpecification);

        //Train the model
        Training training = getTrainingImpl();
        this.featureValues = examples.getInstances();
        this.model = training.train(examples);

        //Get the top features
        this.topFeatures = getFeatureWeightingImpl().getTopFeatures(examples, this.model, NUM_TOP_FEATURES);
        this.featureWeights = getFeatureWeightingImpl().getFeatureWeights(examples, this.model);
View Full Code Here

Examples of etc.aloe.data.ExampleSet

                if (getBalancingImpl() != null) {
                    trainingSegments = getBalancingImpl().balance(trainingSegments);
                }

                System.out.println("- Extracting basic features from training set");
                ExampleSet basicTrainingExamples = trainingSegments.getBasicExamples();
                trainingSegments = null;

                FeatureGeneration generation = getFeatureGenerationImpl();
                System.out.println("- Generating features");
                FeatureSpecification spec = generation.generateFeatures(basicTrainingExamples);

                FeatureExtraction extraction = getFeatureExtractionImpl();
                System.out.println("- Extracting features from training set");
                ExampleSet trainingSet = extraction.extractFeatures(basicTrainingExamples, spec);
                basicTrainingExamples = null;

                Training training = getTrainingImpl();
                Model model = training.train(trainingSet);
                trainingSet = null;
               
                System.out.println("- Splitting out test set");
                SegmentSet testingSegments = new SegmentSet();
                testingSegments.setSegments(split.getTestingForFold(segmentSet.getSegments(), foldIndex, this.folds));
                if (getBalancingImpl() != null && balanceTestSet) {
                    testingSegments = getBalancingImpl().balance(testingSegments);
                }

                System.out.println("- Extracting basic features from test set");
                ExampleSet basicTestingExamples = testingSegments.getBasicExamples();

                System.out.println("- Extracting features from test set");
                ExampleSet testingSet = extraction.extractFeatures(basicTestingExamples, spec);
                basicTestingExamples = null;

                Predictions predictions = model.getPredictions(testingSet);
                EvaluationReport report = new EvaluationReport("Fold " + (foldIndex + 1), falsePositiveCost, falseNegativeCost);
                report.addPredictions(predictions);
               
                LabelMapping mapping = getMappingImpl();
                mapping.map(predictions, testingSegments);
                report.addLabeledTestData(testingSegments);
               
                evaluationReport.addPartial(report);
                int numCorrect = report.getTrueNegativeCount() + report.getTruePositiveCount();
                System.out.println("- Fold " + (foldIndex + 1) + " completed (" + numCorrect + "/" + testingSet.size() + " correct).");
                System.out.println();
            }
        } else {
            System.out.println("== Skipping Cross Validation ==");
        }
View Full Code Here

Examples of etc.aloe.data.ExampleSet

        FeatureSpecification spec = new FeatureSpecification();
        spec.addFilter(addFilter);
        spec.addFilter(removeFilter);

        FeatureExtractionImpl instance = new FeatureExtractionImpl();
        ExampleSet examples = instance.extractFeatures(segments.getBasicExamples(), spec);
        assertNotNull(examples);
        assertNotNull(examples.getInstances());

        Instances instances = examples.getInstances();
        //3 base attrs + 4 basic features + 1 label
        assertEquals(8, instances.numAttributes());
        //Contains the added attribute in the right place
        assertEquals(attrName, instances.attribute(basicInstances.numAttributes()).name());
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.