paramperf <-function(restest){
  
  nbClass=max(restest[1,])
  
  if (nbClass==1){
    matr_conf=c();
    vect_prob_classif=c();
    vect_prob_erreur=c();
    print( "Attention, il n'y a qu'une seule classe")
  }else{
    matr_conf=matrix(0,nrow=nbClass,ncol=nbClass)
    for (k1 in 1:nbClass)
      for (k2 in 1:nbClass)
        matr_conf[k1,k2]<-length(which((restest[1,]==k1)&(restest[2,]==k2)))
    
   # matr_conf<- table(restest[1,],restest[2,])
    nbVecRow <- rowSums(matr_conf)
    
    matr_conf_norm = sweep(matr_conf, 1, nbVecRow, "/")
    
    vect_prob_classif <- diag(matr_conf_norm)
    matr_prob_erreur=matrix(0, nrow=2,ncol=nbClass)
    
    matr_prob_erreur[1,] <- 1-vect_prob_classif
    for ( k in 1:nbClass){
      matr_prob_erreur[2,k] <- (sum(matr_conf_norm[,k])-matr_conf_norm[k,k])/(nbClass-1)
      
    }
                          
   vect_prob_erreur <- colMeans(matr_prob_erreur)
    
  }
  
  return(list(matr_conf,vect_prob_classif,vect_prob_erreur))
}
  
  