Package nets

Examples of nets.Neurone


    reseau.ini_iterateur_neurone();
    conteneur_schema.setImage(vecteur_sequences.get(sequence_courante).get(image_courante));
  }
 
  public boolean suivant() {
    Neurone ancien;
    conteneur_caracteristiques.repaint();

    if(partie == 0) {
     
      if(neurone_courant == null)
View Full Code Here


  }
 
    public void paintComponent(Graphics g) {
      super.paintComponent(g);     

      Neurone neu;
      if(gr.getVisu() == null)
        neu = gr.getCourant();
      else
        neu = gr.getVisu();
     
      g.setColor(Color.WHITE);
      g.fillRect(0, 0, getWidth(), getHeight());
     
      if(neu != null) {
        int size = neu.getDendrites().size();
        int diametre_cercle = (int) (this.getHeight()/(1.1*size+0.1));
        int espace = (int) (0.1*diametre_cercle);
       
        int border = 5;
        int fWidth = this.getWidth();
        int fHeight = this.getHeight() - border;
       
 
        for(int i=0; i<size; i++) {
          int x = (int) (fWidth*0.1);
          int y = border + espace + i*(espace+diametre_cercle);
         
          if(gr.getPartie() == 0)
            g.setColor(new Color(Couleur.degradeB((neu.getDendrites().get(i).getYi()+1)/2)));
          else if(gr.getPartie() == 1)
            g.setColor(new Color(Couleur.degradeR((neu.getDendrites().get(i).getYi()+1)/2)));
          else
            g.setColor(new Color(Couleur.degradeV((neu.getDendrites().get(i).getYi()+1)/2)));
 
          g.fillOval(x, y, diametre_cercle, diametre_cercle);
            g.setColor(Color.BLACK);
            g.drawOval(x, y, diametre_cercle, diametre_cercle);
           
            g.setColor(Color.WHITE);
            g.fillRect(x+diametre_cercle+15, y+diametre_cercle/2-7, 43, 15);
           
            g.setColor(Color.BLACK);
            g.drawRect(x+diametre_cercle+15, y+diametre_cercle/2-7, 43, 15);
            g.drawLine(x+diametre_cercle, y+diametre_cercle/2, x+diametre_cercle+15, y+diametre_cercle/2);
           
           
            if(gr.getPartie() < 2)
              g.drawString((Math.round(neu.getDendrites().get(i).getPoids()*1000)/1000. + ""), x+diametre_cercle+20, y+diametre_cercle/2+6);
            else
              g.drawString((Math.round(neu.getDendrites().get(i).getAncienPoids()*1000)/1000. + ""), x+diametre_cercle+20, y+diametre_cercle/2+6);

            if(gr.getPartie() > 0) {
              g.setColor(Color.RED);
              g.drawString((Math.round(neu.getDendrites().get(i).getPoids()*neu.getErreur()*1000)/1000. + ""), x-50, y+diametre_cercle/2+5);
             
              if(gr.getPartie() == 2) {
                g.setColor(Color.BLACK);
                g.drawLine(x+diametre_cercle, y+diametre_cercle/2, x+diametre_cercle+15, y+diametre_cercle/2);
                g.drawLine(x+diametre_cercle+15+43, y+diametre_cercle/2-7, x+diametre_cercle+15, y+diametre_cercle/2-7+15);

                g.setColor(Color.GREEN);
                g.drawString((Math.round(neu.getDendrites().get(i).getPoids()*1000)/1000. + ""), x+diametre_cercle+20, y+diametre_cercle/2+20);
              }
              g.setColor(Color.BLACK);

            }

            g.drawLine(x+diametre_cercle+58, y+diametre_cercle/2, (int) (fWidth/2.5), border + fHeight/2);
 
        }
       
        /*g.setColor(Color.RED);
        g.fillOval((int) (this.getWidth()/2.5), this.getHeight()/2-50, 100, 100);
        g.setColor(Color.BLACK);
        g.drawOval((int) (this.getWidth()/2.5), this.getHeight()/2-50, 100, 100);
          */
        try {
          Image img;
            if(gr.getPartie() == 1)
              img = ImageIO.read(new File("src/images/retour.png"));
            else
              img = ImageIO.read(new File("src/images/sigma.png"));
           
            img = img.getScaledInstance((int)(border + fHeight*0.25), (int) (border + fHeight*0.25) , Image.SCALE_AREA_AVERAGING);
        g.drawImage(img, (int) (fWidth/2.5), (int) (border+fHeight/2-(border + fHeight*0.25)/2), this);
 
      } catch (IOException e) {
        e.printStackTrace();
      }
    
       
        g.drawLine((int) ((int) (fWidth/2.5)+(border + fHeight*0.25)), border+fHeight/2, (int) (fWidth/1.5), border + fHeight/2);
        int centre = (int) (((int) (fWidth/2.5)+(border + fHeight*0.25) + (int) (fWidth/1.5))/2);
       
        g.drawLine(centre, border + fHeight/2, centre, border+fHeight/2+20);
        g.drawRect(centre-25, border + fHeight/2+25 , 50, 20);
        //g.setFont(new Font(g.getFont().getName()),g.getFont().getStyle(),16);
        g.drawString((Math.round((neu.getVal())*1000)/1000. + ""),centre-17, border + fHeight/2+40);
       
          if(gr.getPartie() == 1) {
            g.setColor(Color.RED);
          g.drawString((Math.round(neu.getErreur()*1000)/1000. + ""),centre-17, border + fHeight/2+40+20);
            g.setColor(Color.BLACK);
          }
       
       
          try {
            String fonction;
            if(neu.getFun() instanceof Identite)
              fonction = "identite.png";
            else if(neu.getFun() instanceof Sigmoide)
              fonction = "sigmoide.png";
            else
              fonction = "heaviside.png";
           
           
        Image img = ImageIO.read(new File("src/images/"+ fonction));
            img = img.getScaledInstance((int)(border + fHeight*0.25), (int) (border + fHeight*0.25) , Image.SCALE_AREA_AVERAGING);
        g.drawImage(img, (int) (fWidth/1.5), (int) (border + fHeight/2-(border + fHeight*0.25)/2), this);
        g.drawRect((int) (fWidth/1.5), (int) (border + fHeight/2-(border + fHeight*0.25)/2), (int) (border + fHeight*0.25), (int)(border + fHeight*0.25));
 
      } catch (IOException e) {
        e.printStackTrace();
      }
     
 
        g.drawLine((int) ((int) (fWidth/1.5)+(border + fHeight*0.25)), border + fHeight/2, (int) (fWidth/1.05), border + fHeight/2);
        centre = (int) (((int) (fWidth/1.5)+(border + fHeight*0.25) + (int) (fWidth/1.05))/2);
 
        g.drawLine(centre, border + fHeight/2, centre, border + fHeight/2+20);
        g.drawRect(centre-25, border + fHeight/2+25 , 50, 20);
        g.drawString((Math.round(neu.getAxone()*1000)/1000. + ""),centre-17, border + fHeight/2+40);
       
      loupe.setLocation(fWidth-(int)(fWidth*0.2)-30, 10);
 
      legende.setLocation(fWidth-200, border + fHeight-125);
      }
View Full Code Here

TOP

Related Classes of nets.Neurone

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.