Package com.rapidminer.example

Examples of com.rapidminer.example.Attributes


      
       if (exampleSet.getAttributes().getLabel() == 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();
       Attribute ui=Att.getLabel();
       
        for (Example example : exampleSet) {
         
          double j=example.getValue(u);
          int uid=user_mapping.ToInternalID((int) j);
View Full Code Here


      
       if (exampleSet.getAttributes().getLabel() == 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();
       Attribute ui=Att.getLabel();

        for (Example example : exampleSet) {
         
          double j=example.getValue(u);
          int uid=user_mapping.ToInternalID((int) j);
View Full Code Here

        
         if (exampleSet.getAttributes().getLabel() == 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();
         Attribute ui=Att.getLabel();
         
          for (Example example : exampleSet) {
           
            double j=example.getValue(u);
            int uid=user_mapping.ToInternalID((int) j);
View Full Code Here

  @Override
  public void doWork() throws OperatorException {
   
        ExampleSet exampleSet = exampleSetInput.getData();
        Attributes attributes = exampleSet.getAttributes()
        boolean OU = getParameterAsBoolean("Online updates");
       

             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()
             Attribute label=null;
            
              if(OU==true){
                if(Att.getLabel()!=null)
                  label=Att.getLabel();
              }
       
            RatingPredictor model = exampleSetInput1.getData();
   
            ExampleSet out=exampleSet;
           
            ArrayList<Integer> new_users=new ArrayList<Integer>();
            ArrayList<Integer> new_items=new ArrayList<Integer>();
            com.rapidminer.data.CompactHashSet<Integer> s2=new com.rapidminer.data.CompactHashSet<Integer>();
            com.rapidminer.data.CompactHashSet<Integer> s3=new com.rapidminer.data.CompactHashSet<Integer>();
           
            ArrayList<Integer> r_users=null;
            ArrayList<Integer> r_items=null;
            ArrayList<Double> ratings=null;
           
             Attribute pred = AttributeFactory.createAttribute("prediction",
                Ontology.REAL);
         
             if(!attributes.contains(pred)){
            attributes.addRegular(pred);
            ExampleTable a=exampleSet.getExampleTable();
            a.addAttribute(pred);
             }
             else pred=attributes.get("prediction");
         
            int useRatingUpdate=0;
           
            if(OU==true && Att.getLabel()!=null){
              r_users=new ArrayList<Integer>();
              r_items=new ArrayList<Integer>();
              ratings=new ArrayList<Double>();
             
              for (Example example : out) {
                int us=model.user_mapping.ToInternalID((int)example.getValue(u));
                int it=model.item_mapping.ToInternalID((int)example.getValue(i));
                if(us>model.MaxUserID){
                  new_users.add(us);
                  model.MaxUserID=us;
                }
                if(it>model.MaxItemID){
                  new_items.add(it);
                  model.MaxItemID=it;
                }
                s2.add(us);
                s3.add(it);
                double r=example.getValue(label);

                if(model.AddRatings(null, null, null)==1){
                r_users.add(us);
                r_items.add(it);
                ratings.add(r);
                useRatingUpdate=1;
                }
              }
            }
           
            ArrayList<Integer> query_users=new ArrayList<Integer>(s2);
            ArrayList<Integer> query_items=new ArrayList<Integer>(s3);
           
           
            if(OU==true && Att.getLabel()!=null){
              if(new_items.size()!=0)
              model.AddItems(new_items);
              if(new_users.size()!=0)
              model.AddUsers(new_users);
             
View Full Code Here

            
             if (exampleSet.getAttributes().getLabel() == 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();
             Attribute ui=Att.getLabel();

            for (Example example : exampleSet) {
             
              double j=example.getValue(u);
              int uid=user_mapping.ToInternalID((int) j);
             
              j=example.getValue(i);
              int iid=item_mapping.ToInternalID((int) j);
             
              double r=example.getValue(ui);
              training_data.Add(uid, iid, r);
             
            }
           
           
            ExampleSet attribute_set=exampleSetInput1.getData();
            Attributes aatr = attribute_set.getAttributes();
            AttributeRole ar=aatr.getRole("attribute identification");
            Attribute at=ar.getAttribute();

            ur=aatr.getRole("user identification");
            i=ur.getAttribute();

            SparseBooleanMatrix mat=new SparseBooleanMatrix();
         
           
View Full Code Here

  @Override
  public void doWork() throws OperatorException {
       
        ExampleSet exampleSet = exampleSetInput1.getData();
        Attributes attributes = exampleSet.getAttributes();
       
        for(Attribute a : attributes)
          System.out.println(a.toString());
           
        System.out.println(exampleSet.size());
            System.out.println(attributes.size());
           
           
            ExampleSet  predicted= exampleSetInput1.getData();
           
           
View Full Code Here

      
       if (exampleSet.getAttributes().getLabel() == 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();
       Attribute ui=Att.getLabel();
       
        for (Example example : exampleSet) {
         
          double j=example.getValue(u);
          int uid=user_mapping.ToInternalID((int) j);
View Full Code Here

      
       if (exampleSet.getAttributes().getLabel() == 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();
       Attribute ui=Att.getLabel();
       
        for (Example example : exampleSet) {
         
          double j=example.getValue(u);
          int uid=user_mapping.ToInternalID((int) j);
View Full Code Here

      
       if (exampleSet.getAttributes().getLabel() == 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();
       Attribute ui=Att.getLabel();
       
        for (Example example : exampleSet) {
         
          double j=example.getValue(u);
          int uid=user_mapping.ToInternalID((int) j);
View Full Code Here

          
           if (exampleSet.getAttributes().getLabel() == 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();
           Attribute ui=Att.getLabel();
         

          for (Example example : exampleSet) {
           
            double j=example.getValue(u);
            int uid=user_mapping.ToInternalID((int) j);
           
            j=example.getValue(i);
            int iid=item_mapping.ToInternalID((int) j);

            double r=example.getValue(ui);
            training_data.Add(uid, iid, r);
           
          }
         
         
          ExampleSet attribute_set=exampleSetInput1.getData();
         
          if (attribute_set.getAttributes().getSpecial("item 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();
          ir=aatr.getRole("item identification");
          i=ir.getAttribute();
         
          SparseBooleanMatrix mat=new SparseBooleanMatrix();
       
         
View Full Code Here

TOP

Related Classes of com.rapidminer.example.Attributes

Copyright © 2018 www.massapicom. 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.