Package com.rapidminer.example

Examples of com.rapidminer.example.Attribute


                }
          
          
           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("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


                  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);
View Full Code Here

                  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;
View Full Code Here

           
            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;
           
          if(OU==true){
            if(Att.getRole("item identification")!=null){
              ir=Att.getRole("item identification");
              i=ir.getAttribute();
            }
          }
       
            ItemRecommender model = exampleSetInput1.getData();
             int N=getParameterAsInt("n");
            
              List<Attribute> attr=new ArrayList<Attribute>();
       
              com.rapidminer.data.CompactHashSet<Integer> s1=new com.rapidminer.data.CompactHashSet<Integer>();
             
             
              ArrayList<Integer> new_users=new ArrayList<Integer>();
              ArrayList<Integer> new_items=new ArrayList<Integer>();
             
             
              ArrayList<Integer> feed_it=null;
              ArrayList<Integer> feed_us=null;
              int use_feedUpdate=0;
              if(model.AddFeedbacks(null, null)==1){
                feed_it=new ArrayList<Integer>();
                feed_us=new ArrayList<Integer>();
                use_feedUpdate=1;
              }
             
               if(N>model.MaxItemID)
                 N=model.MaxItemID+1;
             
              com.rapidminer.data.CompactHashSet<Integer> s2=new com.rapidminer.data.CompactHashSet<Integer>();
              com.rapidminer.data.CompactHashSet<Integer> s3=new com.rapidminer.data.CompactHashSet<Integer>();
             
              for (Example example : exampleSet) {
                double j=example.getValue(u);
                int uid=model.user_mapping.ToInternalID((int) j);
                double j1=0;
                int iid=0;
 
            if(OU==true){
             
              if(uid>model.feedback.GetMaxUserID()){
                new_users.add(uid);
              }
             
              if(Att.getRole("item identification")!=null){
                  j1=example.getValue(i);
                  iid=model.item_mapping.ToInternalID((int) j1);
               
                if(iid>model.feedback.GetMaxItemID()){
                    new_items.add(iid);
                }
                model.feedback.Add(uid, iid);
                s2.add(uid);
                s3.add(iid);
               
                if(use_feedUpdate==1){
                  feed_it.add(iid);
                  feed_us.add(uid);
                }
               
              }
   
            }

                s1.add(uid);
            }
           
              ArrayList<Integer> query_users=new ArrayList<Integer>(s2);
              ArrayList<Integer> query_items=new ArrayList<Integer>(s3);
             
            if(OU==true){

              if(new_users.size()!=0)
              model.AddUsers(new_users);
              if(new_items.size()!=0)
              model.AddItems(new_items);
              if(use_feedUpdate==1){
                model.AddFeedbacks(feed_us, feed_it);
              }
              model.RetrainUsers(query_users);
              model.RetrainItems(query_items);
            }
             
              List<Integer> testU=new ArrayList<Integer>(s1);
             
              List<WeightedItem> data1=null; //dodano
             
              List<Integer> relevant_items=model.feedback.GetAllItems();
             
               Attribute a1 = AttributeFactory.createAttribute("rank", Ontology.INTEGER);
               Attribute tu = AttributeFactory.createAttribute("user_id", Ontology.INTEGER);
               Attribute ti = AttributeFactory.createAttribute("item_id", Ontology.INTEGER);
                attr.add(tu); attr.add(ti); attr.add(a1);
               
                MemoryExampleTable a=new MemoryExampleTable(attr);
                com.rapidminer.data.CompactHashSet<Integer> s=new com.rapidminer.data.CompactHashSet<Integer>();
View Full Code Here

                  }
            
            
             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();

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

         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();
       
        AttributeRole tur=attributes1.getRole("user identification");
        Attribute tu=tur.getAttribute();

        AttributeRole tir=attributes1.getRole("item identification");
        Attribute ti=tir.getAttribute();

   
        ItemRecommender model = exampleSetInput2.getData();
   
           IPosOnlyFeedback train_data=new PosOnlyFeedback();
           IPosOnlyFeedback test_data=new PosOnlyFeedback();
           IEntityMapping user_mapping=model.user_mapping;//new EntityMapping();
           IEntityMapping item_mapping=model.item_mapping;//new EntityMapping();
         

          for (Example example : exampleSet) {
            double j=example.getValue(u);
            int uid=(int) j;

            j=example.getValue(i);
            int iid=(int) j;
            train_data.Add(user_mapping.ToInternalID(uid), item_mapping.ToInternalID(iid));
        }
         
          for (Example example : exampleSet1) {
            double j=example.getValue(tu);
            int uid=(int) j;

            j=example.getValue(ti);
            int iid=(int) j;
            test_data.Add(user_mapping.ToInternalID(uid), item_mapping.ToInternalID(iid));
       
         
         
           Map<String,Double> result= ItemPredictionEval.Evaluate(model, test_data,train_data,test_data.GetAllUsers(),train_data.GetAllItems()); //train_data.GetAllUsers(),train_data.GetAllItems()

               Attribute m1 = AttributeFactory.createAttribute("AUC", Ontology.REAL);
               Attribute m2 = AttributeFactory.createAttribute("prec@5", Ontology.REAL);
               Attribute m3 = AttributeFactory.createAttribute("prec@10", Ontology.REAL);
               Attribute m4 = AttributeFactory.createAttribute("prec@15", Ontology.REAL);
               Attribute m5 = AttributeFactory.createAttribute("NDCG", Ontology.REAL);
               Attribute m6 = AttributeFactory.createAttribute("MAP", Ontology.REAL);
              
              List<Attribute> attr=new ArrayList<Attribute>();
              attr.add(m1); attr.add(m2); attr.add(m3); attr.add(m4); attr.add(m5); attr.add(m6);
              MemoryExampleTable a=new MemoryExampleTable(attr);
             
View Full Code Here

TOP

Related Classes of com.rapidminer.example.Attribute

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.