Package trust.jfcm

Examples of trust.jfcm.WeightedConnection


    Iterator<FcmConnection> it = out.iterator();
    double val = 0;
    while(it.hasNext()){
      FcmConnection conn = it.next();
     
      WeightedConnection wconn = null;
      if(conn instanceof WeightedConnection)
        wconn = (WeightedConnection) conn;
     
      Concept cout = wconn.getTo();
      LearningConcept lout = null;
      if(cout instanceof LearningConcept)
        lout = (LearningConcept) cout;
     
      if(!lout.isErrorCalculated())
        /*
         * Error cannot be computed yet
         */
        return false;
     
      val += wconn.getWeight() * lout.getError();
     
    }
   
    /*
     * Set Error
View Full Code Here


      //insert links
      links = maps.get(map.getName()).getConnections().values();
      Iterator<FcmConnection> itc = links.iterator();
      edges = new Vector<MyEdge>();
      while(itc.hasNext()){
        WeightedConnection link = (WeightedConnection)itc.next();
        //System.out.println("Edge from" + link.getFrom().getName() + "to" + link.getTo().getName());
       
         
          String from = link.getFrom().getName();
          String to = link.getTo().getName();
          MyEdge e = new MyEdge("Edge: " + from + " -> " + to);
          e.setWeight(link.getWeight());
          edges.add(e);
        graph.addEdge(e, getVertexByName(from), getVertexByName(to), EdgeType.DIRECTED);
      }
    }
   
View Full Code Here

        elemConn.setAttribute("to", conn.getTo().getName());
      }
      if (conn instanceof WeightedConnection) {
        elemConn.setAttribute("type", "WEIGHTED");

        WeightedConnection wc = (WeightedConnection) conn;
        Element param = doc.createElement("param");
        param.setAttribute("name", "name");
        param.setAttribute("value", Double.toString(wc.getWeight()));
        elemConn.appendChild(param);

      } else {
        throw new UnsupportedOperationException(
            "FcmConnection implementation not supported: " + conn.getClass().getName());
View Full Code Here

  private double calculateDeltaOnWeights() {
    double weight_sum = 0;
    Collection<FcmConnection> connectionSet = map.getConnections().values();
    double size = connectionSet.size();
    for(FcmConnection conn : connectionSet){
      WeightedConnection wconn = (WeightedConnection) conn;
      weight_sum += wconn.getWeight();
    }
    return  weight_sum / size;
  }
View Full Code Here

   
    /* clone connections */
    Iterator<FcmConnection> iter = this.getConnectionsIterator();
    while(iter.hasNext()){
      FcmConnection old_conn = (FcmConnection) iter.next();
      WeightedConnection new_conn = (WeightedConnection) old_conn.clone();
      new_conn.setFrom(map.getConcept(old_conn.getFrom().getName()));
      new_conn.setTo(map.getConcept(old_conn.getTo().getName()));
      map.addConnection(new_conn);
      map.connect(new_conn.getFrom().getName(), new_conn.getName(), new_conn.getTo().getName());
    }
   
    map.resetConcepts();
   
    map.trainingSet = (FcmTrainingSet) trainingSet.clone();
View Full Code Here

            "to "+to.getName()+"("+to.getTrainingFunction()+") "+
            " with weight "+w.getWeight()+
            " / "+w.getWeightUncertainty()+"\n";
      }
      else{
        WeightedConnection w = (WeightedConnection) f;
        res += "   Connection from "+w.getFrom().getName()+" to "+w.getTo().getName()+ " with weight "+w.getWeight()+"\n";
      }
    }
    return res;
   
  }
View Full Code Here

TOP

Related Classes of trust.jfcm.WeightedConnection

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.