IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C++ Discussion :

Probleme erreurs deprecated conversion et extra qualification


Sujet :

C++

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    15
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 15
    Par défaut Probleme erreurs deprecated conversion et extra qualification
    Bonjour
    débutante en C++ je dois utiliser un programme qui m'a été fourni sur un site (université du texas)
    Je l'ai installé sur Eclipse (Helios sur Linux mandriva)
    et j'ai plusieurs erreurs
    la première : attention : deprecated conversion from string constant to ‘char*’
    L'erreur se trouve entre autre à la ligne 121 mais aussi partout où il y a Mycc (33 erreurs)
    le code concerné est
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    /*
      Cocluster.cc
        the main file for co-clustering programs 
        
        Copyright (c) 2005, 2006
                  by Hyuk Cho
        Copyright (c) 2003, 2004
        	      by Hyuk Cho, Yuqiang Guan, and Suvrit Sra
                    {hyukcho, yguan, suvrit}@cs.utexas.edu
    */
     
     
    #include <fstream>
    #include <cmath>
    #include <iomanip>
    #include <time.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <assert.h>
     
    #include "MatrixVector.h"
    #include "TimerUtility.h"
    #include "Tools.h"
    #include "Itcc.h"
    #include "MssrIcc.h"
    #include "MssrIIcc.h"
     
    using namespace std;
     
    long memoryUsed = 0l;
     
     
    int main(int argc, char **argv)
    {
      commandLineArgument myCLA;  
    //------------------------------------------------------------------------------
      setCommandLine(myCLA);		// set default command line arguments  
      getCommandLine(argc, argv, myCLA);	// get command line arguments
    //------------------------------------------------------------------------------
      if (!myCLA.havingArgument)
        printHelp();
      if (myCLA.numInvalidCLA != 0)
        exit(EXIT_FAILURE);
      if (myCLA.algorithmType == INFORMATION_THEORETIC_CC && myCLA.takingReverse){
        cout << "  Taking reverse is invalid for ITCC..." << endl << endl;
        exit(EXIT_FAILURE);
      }
      if (myCLA.takingReverse && myCLA.coclusterOffsetType == START_FROM_0){
        cout << "  Taking reverse and output labels starting from 0 are not valid..." << endl << endl;
        exit(EXIT_FAILURE);
      }
    //  strcat(myCLA.dumpFilename, DUMP_FILENAME_SUFFIX);
    //  strcat(myCLA.objectiveFilename, OBJECTIVE_FILENAME_SUFFIX);
    //  strcat(myCLA.coclusterFilename, COCLUSTER_FILENAME_SUFFIX);
    //  makeFilename(myCLA.objectiveFilename, OBJECTIVE_FILENAME_SUFFIX, myCLA);
    //  makeFilename(myCLA.coclusterFilename, COCLUSTER_FILENAME_SUFFIX, myCLA);
     
    //------------------------------------------------------------------------------
      sparseStruct sparseCCS;
      sparseStruct sparseCRS;
      denseStruct denseMat;
      TimerUtil runTime;
     
      switch (myCLA.inputMatrixType){
        case DENSE_MATRIX:
        case DENSE_MATRIX_TRANS:	// not used...
          myCLA.emptyColId = readMatrix(myCLA.inputFilename, &denseMat, myCLA.numEmptyCol, myCLA.inputFormatType, myCLA.inputMatrixType);
          assert(((myCLA.numRowCluster <= denseMat.numRow) && (myCLA.numColCluster <= denseMat.numCol)) && (myCLA.numRowCluster != denseMat.numRow || myCLA.numColCluster != denseMat.numCol));
          assert((myCLA.rowLocalSearchLength < denseMat.numRow) && (myCLA.colLocalSearchLength < denseMat.numCol));
          memoryUsed += denseMat.numRow * denseMat.numCol * sizeof(double);
          break;
        case SPARSE_MATRIX:
          myCLA.emptyColId = readMatrix(myCLA.inputFilename, &sparseCCS, myCLA.numEmptyCol, myCLA.inputFormatType, myCLA.scalingType);
          assert(((myCLA.numRowCluster <= sparseCCS.numRow) && (myCLA.numColCluster <= sparseCCS.numCol)) && (myCLA.numRowCluster != sparseCCS.numRow || myCLA.numColCluster != sparseCCS.numCol));
          assert((myCLA.rowLocalSearchLength < sparseCCS.numRow) && (myCLA.colLocalSearchLength < sparseCCS.numCol));
          sparseCRS.colPtr = new int[sparseCCS.numRow+1];
          sparseCRS.rowIdx = new int[sparseCCS.numVal];
          sparseCRS.value = new double[sparseCCS.numVal];
          sparseCRS.numCol = sparseCCS.numRow;
          sparseCRS.numRow = sparseCCS.numCol;
          sparseCRS.numVal = sparseCCS.numVal;
          convertSparse2Sparse(sparseCCS.numCol, sparseCCS.numRow, sparseCCS.numVal, sparseCCS.colPtr, sparseCCS.rowIdx, sparseCCS.value, sparseCRS.colPtr, sparseCRS.rowIdx, sparseCRS.value); 
     //     checkConvertSparse2Sparse(sparseCCS.numCol, sparseCCS.numRow, sparseCCS.numVal, sparseCCS.colPtr, sparseCCS.rowIdx, sparseCCS.value, sparseCRS.colPtr, sparseCRS.rowIdx, sparseCRS.value); 
          memoryUsed += (sparseCCS.numCol + sparseCCS.numRow + 2 * sparseCCS.numVal) * sizeof(int) + 2 * sparseCCS.numVal * sizeof(double);
          break;
        default:
          break;
      }
    //------------------------------------------------------------------------------
     
    //------------------------------------------------------------------------------
      Matrix *myCCS = NULL;
      Matrix *myCRS = NULL;
      Coclustering *myCC = NULL;
     
      switch (myCLA.inputMatrixType){
        case DENSE_MATRIX:
          myCCS = new DenseMatrix(denseMat.numRow, denseMat.numCol, denseMat.value); 
          myCRS = myCCS;
          if (myCLA.algorithmType == INFORMATION_THEORETIC_CC)
            myCCS->preprocess();
          break;
        case SPARSE_MATRIX:
          myCCS = new SparseMatrix(sparseCCS.numRow, sparseCCS.numCol, sparseCCS.numVal, sparseCCS.value, sparseCCS.rowIdx, sparseCCS.colPtr);
          if (myCLA.algorithmType == INFORMATION_THEORETIC_CC)
            myCCS->preprocess();
          myCRS = new SparseMatrix(sparseCRS.numRow, sparseCRS.numCol, sparseCRS.numVal, sparseCRS.value, sparseCRS.rowIdx, sparseCRS.colPtr); 
          if (myCLA.algorithmType == INFORMATION_THEORETIC_CC)
            myCRS->preprocess();
          break;
        default:
          break;
      }  
    //------------------------------------------------------------------------------  
     
    //------------------------------------------------------------------------------  
      switch (myCLA.algorithmType){
        case INFORMATION_THEORETIC_CC:
          myCC = new Itcc(myCCS, myCRS, myCLA);
          myCC->classPrefix = ITCC_CLASS;
          break;
        case MINIMUM_SUM_SQUARE_RESIDUE_I_CC:
          myCC = new MssrIcc(myCCS, myCRS, myCLA);
          myCC->classPrefix = MSSRICC_CLASS;
          break;
        case MINIMUM_SUM_SQUARE_RESIDUE_II_CC:
          myCC = new MssrIIcc(myCCS, myCRS, myCLA);
          myCC->classPrefix = MSSRIICC_CLASS;
          break;
        default:
          myCC = new Itcc(myCCS, myCRS, myCLA);
          myCC->classPrefix = ITCC_CLASS;
          break;
      }
    //------------------------------------------------------------------------------  
     
    //------------------------------------------------------------------------------  
      if (myCLA.externalValidityType == ROW_EXTERNAL_VALIDITY){
        myCLA.rowClassLabel = new int[myCCS->getNumRow()];
        myCLA.numRowClass = readLabel(myCLA.rowClassFilename, myCCS->getNumRow(), myCLA.rowClassLabel, myCLA.classOffsetType);
      }
      if (myCLA.externalValidityType == COL_EXTERNAL_VALIDITY){ 
        myCLA.colClassLabel = new int[myCCS->getNumCol()];
        myCLA.numColClass = readLabel(myCLA.colClassFilename, myCCS->getNumCol(), myCLA.colClassLabel, myCLA.classOffsetType);
      }
      if (myCLA.externalValidityType == BOTH_EXTERNAL_VALIDITY){
        myCLA.rowClassLabel = new int[myCCS->getNumRow()];
        myCLA.colClassLabel = new int[myCCS->getNumRow()];
        readLabel(myCLA.bothClassFilename, myCCS->getNumRow(), myCCS->getNumCol(), myCLA.rowClassLabel, myCLA.colClassLabel, myCLA.numRowClass, myCLA.numColClass, myCLA.classOffsetType);   
      }
    //------------------------------------------------------------------------------
     
    //------------------------------------------------------------------------------    
      outputConstructor(myCLA, myCC->classPrefix, myCC->dumpFile, myCC->statisticsFile);
      if (myCLA.numRun >= 1){
        int *numPingPong = new int[myCLA.numRun];
        int *numReversedRow = NULL;
        double *initialObjectVal4RC = NULL, *initialObjectVal4CC = NULL;
        double *finalObjectVal4RC = NULL, *finalObjectVal4CC = NULL;
        double *numEmptyRC = new double[myCLA.numRun];
        double *numEmptyCC = new double[myCLA.numRun];
        double *numSingletonRC = new double[myCLA.numRun];
        double *numSingletonCC = new double[myCLA.numRun];
        double *initialObjectVal = new double[myCLA.numRun];
        double *finalObjectVal = new double[myCLA.numRun];
        double *initialRowPrecision = NULL, *initialColPrecision = NULL;		// micro-averaged precision
        double *finalRowPrecision = NULL, *finalColPrecision = NULL;		// micro-averaged precision
        double *initialRowAccuracy = NULL, *initialColAccuracy = NULL;
        double *finalRowAccuracy = NULL, *finalColAccuracy = NULL;
        if (myCLA.externalValidityType == ROW_EXTERNAL_VALIDITY || myCLA.externalValidityType == BOTH_EXTERNAL_VALIDITY){
          initialRowPrecision = new double[myCLA.numRun];
          finalRowPrecision = new double[myCLA.numRun];
          initialRowAccuracy = new double[myCLA.numRun];
          finalRowAccuracy = new double[myCLA.numRun];
        }
        if (myCLA.externalValidityType == COL_EXTERNAL_VALIDITY || myCLA.externalValidityType == BOTH_EXTERNAL_VALIDITY){
          initialColPrecision = new double[myCLA.numRun];
          finalColPrecision = new double[myCLA.numRun];
          initialColAccuracy = new double[myCLA.numRun];
          finalColAccuracy = new double[myCLA.numRun];
        }
        if (myCLA.takingReverse)
          numReversedRow = new int[myCLA.numRun];
        if (myCLA.computingOneWayObjective){
          initialObjectVal4RC = new double[myCLA.numRun];
          initialObjectVal4CC = new double[myCLA.numRun];
          finalObjectVal4RC = new double[myCLA.numRun];
          finalObjectVal4CC = new double[myCLA.numRun];
        }
        for (int i = 0; i < myCLA.numRun; i++){
          cout << endl << myCC->classPrefix << "beginRandomRun(): numRun(" << i+1 << ")" << endl << endl;;
          if (myCLA.dumpLevel == MAXIMUM_DUMP_LEVEL)
            myCC->dumpFile << endl << myCC->classPrefix << "beginRandomRun(): numRun(" << i+1 << ")" << endl << endl;
          if (myCLA.statisticsAccessMode != NO_OPEN_MODE)
            myCC->statisticsFile << endl << myCC->classPrefix << "beginRandomRun(): numRun(" << i+1 << ")" << endl << endl;
          myCC->setRowSmoothingFactor(myCLA.rowSmoothingFactor);
          myCC->setColSmoothingFactor(myCLA.colSmoothingFactor);
          myCC->doInitialization();
          initialObjectVal[i] = myCC->getObjValue();
          if (myCLA.computingOneWayObjective){
            initialObjectVal4RC[i] = myCC->getObjValue4RowCluster();
    	initialObjectVal4CC[i] = myCC->getObjValue4ColCluster();
          }
          if (myCLA.externalValidityType == ROW_EXTERNAL_VALIDITY || myCLA.externalValidityType == BOTH_EXTERNAL_VALIDITY){ 
            myCC->validateRowCluster(myCLA.numRowClass, myCLA.rowClassLabel);
            initialRowPrecision[i] = myCC->getRowPrecision();
            initialRowAccuracy[i] = myCC->getRowAccuracy();
          }
          if (myCLA.externalValidityType == COL_EXTERNAL_VALIDITY || myCLA.externalValidityType == BOTH_EXTERNAL_VALIDITY){
            myCC->validateColCluster(myCLA.numColClass, myCLA.colClassLabel);
            initialColPrecision[i] = myCC->getColPrecision();
            initialColAccuracy[i] = myCC->getColAccuracy();
          }
          myCC->doPingPong();
          numEmptyRC[i] = myCC->getEmptyRC();
          numEmptyCC[i] = myCC->getEmptyCC();
          numSingletonRC[i] = myCC->getSingletonRC();
          numSingletonCC[i] = myCC->getSingletonCC();
          finalObjectVal[i] = myCC->getObjValue();
          if (myCLA.computingOneWayObjective){
            finalObjectVal4RC[i] = myCC->getObjValue4RowCluster();
    	finalObjectVal4CC[i] = myCC->getObjValue4ColCluster();
          }
          numPingPong[i] = myCC->getNumIteration();
          if (myCLA.externalValidityType == ROW_EXTERNAL_VALIDITY || myCLA.externalValidityType == BOTH_EXTERNAL_VALIDITY){ 
            myCC->validateRowCluster(myCLA.numRowClass, myCLA.rowClassLabel);
            finalRowPrecision[i] = myCC->getRowPrecision();
            finalRowAccuracy[i] = myCC->getRowAccuracy();
          }
          if (myCLA.externalValidityType == COL_EXTERNAL_VALIDITY || myCLA.externalValidityType == BOTH_EXTERNAL_VALIDITY){
            myCC->validateColCluster(myCLA.numColClass, myCLA.colClassLabel);
            finalColPrecision[i] = myCC->getColPrecision();
            finalColAccuracy[i] = myCC->getColAccuracy();
          }
          if (myCLA.takingReverse)
            numReversedRow[i] = myCC->getNumReversedRow();
          cout << myCC->classPrefix << "endRandomRun(): numRun(" << i+1 << ")" << endl << endl;
          if (myCLA.dumpLevel == MAXIMUM_DUMP_LEVEL)
            myCC->dumpFile << myCC->classPrefix << "endRandomRun(): numRun(" << i+1 << ")" << endl << endl;
          if (myCLA.statisticsAccessMode != NO_OPEN_MODE)
            myCC->statisticsFile << myCC->classPrefix << "endRandomRun(): numRun(" << i+1 << ")" << endl  << endl;
        }
    //    cout << endl << "  ### " << myCLA.numRun << " random run(s) done ###" << endl << endl;
    //    if (myCLA.dumpLevel == MAXIMUM_DUMP_LEVEL)
    //      myCC->dumpFile << endl << "  ### " << myCLA.numRun << " random run(s) done ###" << endl << endl;
    //    if (myCLA.statisticsAccessMode != NO_OPEN_MODE)
    //      myCC->statisticsFile << endl << "  ### " << myCLA.numRun << " random run(s) done ###" << endl << endl;
     
        outputStatistics(myCLA, myCC->classPrefix, numPingPong, "Average # of PingPong Iteration     = ", myCC->dumpFile, myCC->statisticsFile);
        outputStatistics(myCLA, myCC->classPrefix, numEmptyRC,  "Average # of Empty Row Clusters     = ", myCC->dumpFile, myCC->statisticsFile);
        outputStatistics(myCLA, myCC->classPrefix, numEmptyCC,  "Average # of Empty Col Clusters     = ", myCC->dumpFile, myCC->statisticsFile);
        outputStatistics(myCLA, myCC->classPrefix, numSingletonRC, "Average # of Singleton Row Clusters = ", myCC->dumpFile, myCC->statisticsFile);
        outputStatistics(myCLA, myCC->classPrefix, numSingletonCC, "Average # of Singleton Col Clusters = ", myCC->dumpFile, myCC->statisticsFile);
        if (myCLA.takingReverse){
          outputStatistics(myCLA, myCC->classPrefix, numReversedRow,"Average # of Reversed Row(s)        = ", myCC->dumpFile, myCC->statisticsFile);
          delete [] numReversedRow;
        } 
        outputStatistics(myCLA, myCC->classPrefix, initialObjectVal, "Average Initial Objective Value     = ", myCC->dumpFile, myCC->statisticsFile);
        outputStatistics(myCLA, myCC->classPrefix, finalObjectVal,   "Average Final Objective Value       = ", myCC->dumpFile, myCC->statisticsFile);
        if (myCLA.computingOneWayObjective){
          outputStatistics(myCLA, myCC->classPrefix, initialObjectVal4RC, "Average Initial Obj. of Row Cluster = ", myCC->dumpFile, myCC->statisticsFile);
          outputStatistics(myCLA, myCC->classPrefix, finalObjectVal4RC,   "Average Final Obj. of Row Cluster   = ", myCC->dumpFile, myCC->statisticsFile);
          outputStatistics(myCLA, myCC->classPrefix, initialObjectVal4CC, "Average Initial Obj. of Col Cluster = ", myCC->dumpFile, myCC->statisticsFile);
          outputStatistics(myCLA, myCC->classPrefix, finalObjectVal4CC,   "Average Final Obj. of Col Cluster   = ", myCC->dumpFile, myCC->statisticsFile);
          delete [] initialObjectVal4RC;
          delete [] initialObjectVal4CC;
          delete [] finalObjectVal4RC;
          delete [] finalObjectVal4CC;
        }      
        delete [] numPingPong;
        delete [] numEmptyRC;
        delete [] numEmptyCC;
        delete [] numSingletonRC;
        delete [] numSingletonCC;
        delete [] initialObjectVal;
        delete [] finalObjectVal;
        if (myCLA.externalValidityType == ROW_EXTERNAL_VALIDITY || myCLA.externalValidityType == BOTH_EXTERNAL_VALIDITY){
          outputStatistics(myCLA, myCC->classPrefix, initialRowPrecision, "Average Initial Row Precision Value = ", myCC->dumpFile, myCC->statisticsFile);
          delete [] initialRowPrecision;
        }
        if (myCLA.externalValidityType == ROW_EXTERNAL_VALIDITY || myCLA.externalValidityType == BOTH_EXTERNAL_VALIDITY){
          outputStatistics(myCLA, myCC->classPrefix, finalRowPrecision, "Average Final Row Precision Value   = ", myCC->dumpFile, myCC->statisticsFile);
          delete [] finalRowPrecision;
        }
        if (myCLA.externalValidityType == COL_EXTERNAL_VALIDITY || myCLA.externalValidityType == BOTH_EXTERNAL_VALIDITY){
          outputStatistics(myCLA, myCC->classPrefix, initialColPrecision, "Average Initial Col Precision Value = ", myCC->dumpFile, myCC->statisticsFile);
          delete [] initialColPrecision;
        }
        if (myCLA.externalValidityType == COL_EXTERNAL_VALIDITY || myCLA.externalValidityType == BOTH_EXTERNAL_VALIDITY){
          outputStatistics(myCLA, myCC->classPrefix, finalColPrecision, "Average Final Col Precision Value   = ", myCC->dumpFile, myCC->statisticsFile);
          delete [] finalColPrecision;
        }
        if (myCLA.externalValidityType == ROW_EXTERNAL_VALIDITY || myCLA.externalValidityType == BOTH_EXTERNAL_VALIDITY){
          outputStatistics(myCLA, myCC->classPrefix, initialRowAccuracy,  "Average Initial Row Accuracy Value  = ", myCC->dumpFile, myCC->statisticsFile);
          delete [] initialRowAccuracy;
        }
        if (myCLA.externalValidityType == ROW_EXTERNAL_VALIDITY || myCLA.externalValidityType == BOTH_EXTERNAL_VALIDITY){
          outputStatistics(myCLA, myCC->classPrefix, finalRowAccuracy,  "Average Final Row Accuracy Value    = ", myCC->dumpFile, myCC->statisticsFile);
          delete [] finalRowAccuracy;
        }
        if (myCLA.externalValidityType == COL_EXTERNAL_VALIDITY || myCLA.externalValidityType == BOTH_EXTERNAL_VALIDITY){
          outputStatistics(myCLA, myCC->classPrefix, initialColAccuracy,  "Average Initial Col Accuracy Value  = ", myCC->dumpFile, myCC->statisticsFile);
          delete [] initialColAccuracy;
        }
        if (myCLA.externalValidityType == COL_EXTERNAL_VALIDITY || myCLA.externalValidityType == BOTH_EXTERNAL_VALIDITY){
          outputStatistics(myCLA, myCC->classPrefix, finalColAccuracy,  "Average Final Col Accuracy Value    = ", myCC->dumpFile, myCC->statisticsFile);
          delete [] finalColAccuracy;
        }
    //------------------------------------------------------------------------------
        if (myCLA.coclusterAccessMode != NO_OPEN_MODE)
          if (myCLA.numRun == 1 || (myCLA.numRun > 1 && myCLA.coclusterAccessMode == APPEND_MODE))
            myCC->writeCocluster();
    //------------------------------------------------------------------------------    
      }
      outputRunTime(runTime, myCLA, myCC->classPrefix, myCC->dumpFile, myCC->statisticsFile);
      outputDeconstructor(myCLA, myCC->classPrefix, myCC->dumpFile, myCC->statisticsFile);
      outputCommandLineArgument(argc, argv, cout);
      outputCommandLineArgument(argc, argv, myCC->dumpFile);
      outputCommandLineArgument(argc, argv, myCC->statisticsFile);
    }
    la deuxième erreur est dans une autre classe de la même application:
    erreur: extra qualification ‘MssrIIcc::’ on member ‘doBatchUpdate4VariationI’ MssrIIcc.h. Elle se situe chaque fois qu'il y a doBatchUpdate4Variation dans le code que voici

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
     
    /*
      MssrIIcc.h
        Header file for MssrIIcc class
     
        Copyright (c) 2005, 2006
                  by Hyuk Cho
        Copyright (c) 2003, 2004
        	      by Hyuk Cho, Yuqiang Guan, and Suvrit Sra
                    {hyukcho, yguan, suvrit}@cs.utexas.edu
    */
     
     
    #if !defined(_MSSRIICC_H_)
    #define _MSSRIICC_H_
     
     
    #include <cmath>
     
    #include "Coclustering.h"
     
    class MssrIIcc : public Coclustering
    {
      protected:
     
        bool isNormalizedCompressed;
        bool isNormalizedRowCentroid;
        bool isNormalizedColCentroid;
     
        double *rowQuality4Compressed, *colQuality4Compressed;
        double *rowQuality4Centroid, *colQuality4Centroid;
        double **rowCentroid, **colCentroid;	// used also for computing one-way objective
        double **rowAR, **colAC;
        double *rowAP, *colAP;
        double squaredFNormA;
     
        void normalizeCompressedMatrix();
        void computeRowQuality4Compressed2WayUnnormalized();
        void computeRowQuality4Compressed2WayNormalized();
        double computeRowQuality4Compressed2WayUnnormalized(int rc);
        double computeRowQuality4Compressed2WayNormalized(int rc);
        double computeRowQuality4Compressed2WayUnnormalized(double *row2Way, int rowClusterSize);
        double computeRowQuality4Compressed2WayNormalized(double *row2Way, int rowClusterSize);
        void computeColQuality4Compressed2WayUnnormalized();
        void computeColQuality4Compressed2WayNormalized();
        double computeColQuality4Compressed2WayUnnormalized(int cc);
        double computeColQuality4Compressed2WayNormalized(int cc);
        double computeColQuality4Compressed2WayUnnormalized(double *col2Way, int colClusterSize);
        double computeColQuality4Compressed2WayNormalized(double *col2Way, int colClusterSize);
        double computeQuality4CompressedUnnormalized();
        double computeQuality4CompressedNormalized();
        void computeObjectiveFunction4Unnormalized();
        void computeObjectiveFunction4Normalized();
    void computeObjectiveFunction4Normalized(double **Acompressed);
    void computeObjectiveFunction4Normalized(double **Acompressed, bool *isInversed);
    void computeObjectiveFunction4RowCluster();
    void computeObjectiveFunction4ColCluster();
     
        double computeQuality4RowCentroidUnnormalized();
        double computeQuality4RowCentroidNormalized();
        double computeQuality4ColCentroidUnnormalized();
        double computeQuality4ColCentroidNormalized();
        void computeRowQuality4CentroidUnnormalized();
        void computeRowQuality4CentroidNormalized();
        double computeRowQuality4CentroidUnnormalized(int rc);
        double computeRowQuality4CentroidNormalized(int rc);
        double computeRowQuality4CentroidUnnormalized(double *row1Way, int rowClusterSize);
        double computeRowQuality4CentroidNormalized(double *row1Way, int rowClusterSize);
        void computeColQuality4CentroidUnnormalized();
        void computeColQuality4CentroidNormalized();
        double computeColQuality4CentroidUnnormalized(int cc);
        double computeColQuality4CentroidNormalized(int cc);
        double computeColQuality4CentroidUnnormalized(double *col1Way, int colClusterSize);
        double computeColQuality4CentroidNormalized(double *col1Way, int colClusterSize);
     
        double rowDistance(int r, int rc);
        double rowDistance(int r, int rc, bool *isInversed);
        double colDistance(int c, int cc);
        double colDistance(int c, int cc, bool *isInversed);
        void reassignRC();
        void reassignRC(bool *isInversed);
        void reassignCC();
    void reassignCC4Variation();
        void reassignCC(bool *isInversed);    
    void reassignCC4Variation(bool *isInversed);    
        void recoverRowCL(int begin, int end, oneStep trace []);
        void recoverRowCL(int begin, int end, oneStep trace [], bool *isInversed);
        void recoverColCL(int begin, int end, oneStep trace []);
        void recoverColCL(int begin, int end, oneStep trace [], bool *isInversed);
     
        virtual void doBatchUpdate();
    void MssrIIcc::doBatchUpdate4VariationI();
    void MssrIIcc::doBatchUpdate4VariationII();
    void MssrIIcc::doBatchUpdate4VariationIII();
    void MssrIIcc::doBatchUpdate4VariationIV();
    //void MssrIIcc::doBatchUpdate4VariationV();
        virtual void doBatchUpdate(bool *isInversed);
    void MssrIIcc::doBatchUpdate4VariationI(bool *isInversed);
    void MssrIIcc::doBatchUpdate4VariationII(bool *isInversed);
    void MssrIIcc::doBatchUpdate4VariationIII(bool *isInversed);
    void MssrIIcc::doBatchUpdate4VariationIV(bool *isInversed);
    //void MssrIIcc::doBatchUpdate4VariationV(bool *isInversed);
        void doRowLocalSearch(oneStep trace [], int step);
        void doRowLocalSearch(oneStep trace [], int step, bool *isInversed);
        void doColLocalSearch(oneStep trace [], int step);
        void doColLocalSearch(oneStep trace [], int step, bool *isInversed);
        bool doRowLocalSearchChain();
        bool doColLocalSearchChain();
     
        void computeRowCentroid();
        void computeRowCentroid(bool *isInversed);
        void computeColCentroid();
        void computeColCentroid(bool *isInversed);
        void normalizeRowCentroid();
        void normalizeColCentroid();
        void computeRowAR();
        void computeColAC();
        void computeQuality4RowAR();
        void computeQuality4ColAC();
        void computeRowAP(int rowId);
        void computeRowAP(int rowId, bool *isInversed);
        void computeColAP(int colId);
        void computeColAP(int colId, bool *isInversed);
        virtual void doRowFarthestInitialization();
        virtual void doColFarthestInitialization();
        virtual void doRowRandomPerturbInitialization();
        virtual void doColRandomPerturbInitialization();
     
      public:
        MssrIIcc(Matrix *inputMatrix_CCS, Matrix *inputMatrix_CRS, commandLineArgument myCLA);
        ~MssrIIcc();
        virtual void doInitialization();
        virtual void doPingPong();
    };
    #endif //!defined(_MSSRIICC_H_)
    Voila déjà pour le début

    Ensuite si une âme charitable pouvait m'aider un peu à comprendre comment ca fonctionne, je lui enverais le code mail si c'est ok parce que je suis un peu dépassée. Et dans mon environnement personne ne connait c++ et en plus j'ai pas internet au boulot, donc travail chez moi obligatoire hors HB.

    Merci de votre aide

  2. #2
    Rédacteur/Modérateur
    Avatar de JolyLoic
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Août 2004
    Messages
    5 463
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 50
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2004
    Messages : 5 463
    Par défaut
    Quand tu as une constante de chaîne de caractères dans ton code, comme "Hello" (ou dans ton cas ITCC_CLASS qui doit probablement être un #define vers une telle constante), son type est char const * (voir FAQ).

    Et je pense que ton code essaye d'assigner cette constante à un char * (sans le const). Avec un autre type, ce serait interdit. Par contre, avec char*, vu que c'est une erreur qui a été permise aux temps anciens, quand la notion de const n'existait pas encore, c'est autorisé, mais "deprecated", ce qui signifie que c'est mal, et que rien ne garanti que ça restera autorisé éternellement.

    D'où ton warning (Attention) qui n'empêche pas de compiler, mais signale un problème potentiel.




    Deuxième problème, ligne 92 et suivantes, il y a un MssrIIcc:: en trop. L'enlever corrigera probablement ça.

    Pour le troisième sujet, désolé, c'est une question bien trop vaste et chronophage. Je doute que tu aies une réponse sur le sujet. Tu dis que tu débutes, mais reprendre du code existant, surtout s'il n'est pas hyper carré, n'est pas vraiment une activité pour débutant. Ne connais tu personne dans ton entourage au boulot qui pourrait t'aider ? Est-ce que tu dois travailler sous des contraintes de temps strictes, ou bien as tu la possibilité de plus te former ? Ta boîte a-t-elle un budget pour prendre un prestataire qui pourra te mettre le pied à l'étrier ?
    Ma session aux Microsoft TechDays 2013 : Développer en natif avec C++11.
    Celle des Microsoft TechDays 2014 : Bonnes pratiques pour apprivoiser le C++11 avec Visual C++
    Et celle des Microsoft TechDays 2015 : Visual C++ 2015 : voyage à la découverte d'un nouveau monde
    Je donne des formations au C++ en entreprise, n'hésitez pas à me contacter.

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    15
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 15
    Par défaut Nouvelle ereeur
    Bonsoir
    désolée de n'être venue plus tôt, je suis en préparation de soutenance...

    Merci pour la réponse, je vais regarder comme ca.

    Pour le reste, si déja j'arrive à le faire fonctionner, ca sera pas mal.

    Hélas non autour de moi que des spécialistes Java, pas de C++

    Après avoir relancer sur ma machine perso (Mac os X + eclipse)

    j'ai fait un Build all et là j'ai le retour suivant

    make all
    Building file: ../src/Cocluster.cc
    Invoking: GCC C++ Compiler
    g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/Cocluster.d" -MT"src/Cocluster.d" -o "src/Cocluster.o" "../src/Cocluster.cc"
    Finished building: ../src/Cocluster.cc

    Building file: ../src/Coclustering.cc
    Invoking: GCC C++ Compiler
    g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/Coclustering.d" -MT"src/Coclustering.d" -o "src/Coclustering.o" "../src/Coclustering.cc"
    Finished building: ../src/Coclustering.cc

    Building file: ../src/DenseMatrix.cc
    Invoking: GCC C++ Compiler
    g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/DenseMatrix.d" -MT"src/DenseMatrix.d" -o "src/DenseMatrix.o" "../src/DenseMatrix.cc"
    Finished building: ../src/DenseMatrix.cc

    Building file: ../src/ExternalValidity.cc
    Invoking: GCC C++ Compiler
    g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/ExternalValidity.d" -MT"src/ExternalValidity.d" -o "src/ExternalValidity.o" "../src/ExternalValidity.cc"
    ../src/ExternalValidity.cc: In member function 'void ExternalValidity::F_measure(std::ostream&, std::ostream&, std::ostream&)':
    ../src/ExternalValidity.cc:179: error: array bound forbidden after parenthesized type-id
    ../src/ExternalValidity.cc:179: note: try removing the parentheses around the type-id
    make: *** [src/ExternalValidity.o] Error 1

    **** Build Finished ****
    J'ai essayé de modifier les parenthèses et les crochets mais ça va pas mieux.
    le code concerné est le suivant
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    /*
      ExternalVality.cc
        Implementation of the ExternalValidity class
    
        Copyright (c) 2005, 2006
                  by Hyuk Cho
        Copyright (c) 2003, 2004
        	      by Hyuk Cho, Yuqiang Guan, and Suvrit Sra
                    {hyukcho, yguan, suvrit}@cs.utexas.edu
    */
    
    
    #include <iostream>
    #include <fstream>
    #include <algorithm>
    #include <vector>
    #include <cmath>
    #include <stdio.h>
    #include <assert.h>
    
    #include "ExternalValidity.h"
    
    using namespace std;
    
    ExternalValidity::ExternalValidity(int nClass, int nCluster, int nPoint, int *classLbl, int *clusterLbl)
    {
      numClass = nClass;
      numCluster = nCluster;
      numPoint = nPoint;
      classLabel = classLbl;
      clusterLabel = clusterLbl;
      clusterSize = new int [numCluster];
      classSize = new int [numClass];
      confusionMatrix = new int * [numCluster];
      for (int i = 0; i < numCluster; i++)
        confusionMatrix[i] = new int [numClass];
      for (int i = 0; i < numCluster; i++)
        clusterSize[i] = 0;
      for (int i = 0; i < numClass; i++)
        classSize[i] = 0;
      for (int i = 0; i < numPoint; i++){
        clusterSize[clusterLabel[i]]++;
        classSize[classLabel[i]]++;
      }
      for(int i = 0; i < numCluster; i++)
        for (int j = 0; j < numClass; j++)
          confusionMatrix[i][j] = 0;
      for (int i = 0; i < numPoint; i++)
        confusionMatrix[clusterLabel[i]][classLabel[i]]++;
      isSilent = false;		// not used...
      memoryUsed += (numCluster*numClass + numCluster + numClass) * sizeof(int);
    }
    
    
    ExternalValidity::~ExternalValidity()
    {
      for (int j=0; j< numClass; j++)
        delete [] confusionMatrix[j];
      delete [] confusionMatrix;
      delete [] classSize;
      delete [] clusterSize;
    }
    
    
    void ExternalValidity::setSilent(bool s)	// not used...
    {
      isSilent = s;
    }
    
    
    void ExternalValidity::printCM(ostream &os)
    {
      if ((!os) == 0){
        os << "  Confusion Matrix" << endl;
        for (int i = 0; i < numCluster; i++){
    //      os << endl << "\t";
          for (int j = 0; j < numClass; j++)
            os << "\t" << confusionMatrix[i][j];
          os << endl;
        }
        os << endl;
      }
    }
    
    
    void ExternalValidity::purity_Entropy_MutInfo(bool isShowingEachCluster, ostream &os1, ostream &os2, ostream &os3)
    {
      int *sum_row, *sum_col;
      double sum, max, mut_info = 0.0, average_purity = 0.0, average_entropy = 0.0;
      sum_row = new int [numCluster];
      sum_col = new int [numClass];
      for(int i = 0;i < numCluster; i++){
        sum = 0.0;
        max = -1;
        for(int j = 0; j < numClass; j++){
          if (max < confusionMatrix[i][j])
            max = confusionMatrix[i][j];
          if (clusterSize[i] != 0 && confusionMatrix[i][j] != 0)
            sum += (double)confusionMatrix[i][j] / clusterSize[i] * log((double)clusterSize[i] / confusionMatrix[i][j]) / log((double)numClass);
        }
        if(clusterSize[i] != 0){  
          if (isShowingEachCluster){
            if ((!os1) == 0){
              os1 << "  Purity of cluster  " << i << "        = " << (double)max/clusterSize[i] << endl;
              os1 << "  Entropy of cluster " << i << "        = " << sum*log(2.0) << endl;
            }
            if ((!os2) == 0){
              os2 << "  Purity of cluster  " << i << "        = " << (double)max/clusterSize[i] << endl;
              os2 << "  Entropy of cluster " << i << "        = " << sum*log(2.0) << endl;
            }
            if ((!os3) == 0){
              os3 << "  Purity of cluster  " << i << "        = " << (double)max/clusterSize[i] << endl;
              os3 << "  Entropy of cluster " << i << "        = " << sum*log(2.0) << endl;
            }
          }
          average_purity += (double)max / clusterSize[i];
        } 
        average_entropy += sum;
      }
      if ((!os1) == 0){
        os1 << "  Average Purity of clusters  = " << average_purity / numCluster << endl;
        os1 << "  Average Entropy of clusters = " << average_entropy * log(2.0) / numCluster << endl;
      }
      if ((!os2) == 0){
        os2 << "  Average Purity of clusters  = " << average_purity / numCluster << endl;
        os2 << "  Average Entropy of clusters = " << average_entropy * log(2.0) / numCluster << endl;
      }
      if ((!os3) == 0){
        os3 << "  Average Purity of clusters  = " << average_purity / numCluster << endl;
        os3 << "  Average Entropy of clusters = " << average_entropy * log(2.0) / numCluster << endl;
      }
      for(int i = 0; i < numCluster; i++){
        sum_row[i] = 0;
        for(int k = 0; k < numClass; k++)
          sum_row[i] += confusionMatrix[i][k];
      }
      for(int k = 0; k < numClass; k++){
        sum_col[k] = 0;
        for(int i = 0; i < numCluster; i++)
          sum_col[k] += confusionMatrix[i][k];
      }
      for(int i = 0; i < numCluster; i++)
        for(int k = 0; k < numClass; k++)
          if (confusionMatrix[i][k] > 0)
            mut_info += confusionMatrix[i][k] * log(confusionMatrix[i][k] * numPoint * 1.0 / (sum_row[i] * sum_col[k]));
      mut_info /= numPoint;
      double hx = 0, hy = 0, min;
      for (int i = 0; i < numCluster; i++)
        if (sum_row[i] > 0)
          hx += sum_row[i] * log(sum_row[i] * 1.0);    
      hx = log(numPoint * 1.0) - hx / numPoint;
      for (int i = 0; i < numClass; i++)
        if (sum_col[i] > 0)
          hy += sum_col[i] * log(sum_col[i] * 1.0);
      hy = log(numPoint * 1.0) - hy / numPoint;
      //min = hx<hy?hx:hy;
      min = (hx + hy) / 2;
      if ((!os1) == 0)
        os1 << "  (Normalized) MI of clusters = " << mut_info / min << endl;
      if ((!os2) == 0)
        os2 << "  (Normalized) MI of clusters = " << mut_info / min << endl;
      if ((!os3) == 0)
        os3 << "  (Normalized) MI of clusters = " << mut_info / min << endl;
      delete [] sum_row;
      delete [] sum_col;
    }
    
    
    void ExternalValidity::F_measure(ostream &os1, ostream &os2, ostream &os3)
    {
      double **Recall, **Precision, **F;
      double F_value; 
      Recall = new double *[numCluster];
      for (int i = 0; i < numCluster; i++)
        Recall[i] = new double[numClass];
      Precision = new double *[numCluster];
      for (int i = 0; i < numCluster; i++)
        Precision[i] = new double[numClass];
      F = new (double *)[numCluster];<----------- Erreur 
      for (int i = 0; i < numCluster; i++)
        F[i] = new double[numClass];
      for (int i = 0; i < numCluster; i++)
        for (int j = 0; j < numClass; j++)
          Recall[i][j] = confusionMatrix[i][j] * 1.0 / classSize[j];
      for (int i = 0; i < numCluster; i++)
        for (int j = 0; j < numClass; j++)
          Precision[i][j] = confusionMatrix[i][j] * 1.0 / clusterSize[i];
      for (int i = 0; i < numCluster; i++)
        for (int j = 0; j < numClass; j++)
          F[i][j] = 2.0 * Recall[i][j] * Precision[i][j] / (Recall[i][j] + Precision[i][j]);
      F_value = 0.0;
      for (int j = 0; j < numClass; j++){
        double temp_max = 0.0;
        for (int i = 0; i < numCluster; i++)
          if (temp_max < F[i][j])
    	temp_max = F[i][j];
        F_value += temp_max * classSize[j];
      }
      F_value /= numPoint;
      if ((!os1) == 0)
        os1 << "  F-measure value of clusters = " << F_value << endl;
      if ((!os2) == 0)
        os2 << "  F-measure value of clusters = " << F_value << endl;
      if ((!os3) == 0)
        os3 << "  F-measure value of clusters = " << F_value << endl;
      for(int i = 0; i < numCluster; i++){
        delete [] Recall[i];
        delete [] Precision[i];
        delete [] F[i];
      }
      delete [] F;
      delete [] Precision;
      delete [] Recall;
    }
    
    
    void ExternalValidity::micro_avg_precision_recall(double &p_t, double &r_t, ostream &os1, ostream &os2, ostream &os3)
      /* for the definition of micro-average precision/recall see paper "Unsupervised document classification
         using sequential information maximization" by N. Slonim, N. Friedman and N. Tishby */
    {
      int *uni_label, *alpha, *beta, *gamma;
      uni_label = new int[numCluster];
      for (int i = 0; i < numCluster; i++){
        uni_label[i] = 0;
        double temp = confusionMatrix[i][0];
        for (int j = 1; j < numClass; j++)
          if (temp < confusionMatrix[i][j]){
            temp = confusionMatrix[i][j];
    	uni_label[i] = j;
          }
      }
      alpha = new int[numClass];
      beta = new int[numClass];
      gamma = new int[numClass];
      for (int j = 0; j < numClass; j++){
        alpha[j] = 0;
        beta[j] = 0;
        gamma[j] = 0;
      }
      for (int i = 0; i < numPoint; i++)
        if (uni_label[clusterLabel[i]] == classLabel[i])
          alpha[classLabel[i]]++;
        else {
          beta[uni_label[clusterLabel[i]]]++;
          gamma[classLabel[i]]++;
        }
      double temp = 0, temp1 = 0;
      for (int j = 0; j < numClass; j++){
        temp += alpha[j];
        temp1 += beta[j];
      }
      temp1 += temp;
      p_t = temp * 1.0 / temp1;
      temp1 = 0;
      for (int j = 0; j < numClass; j++)
        temp1 += gamma[j];
      temp1 += temp;
      r_t = temp * 1.0 / temp1;
      if ((!os1) == 0){
        os1 << "  Micro-average Precision     = " << p_t << endl;
        os1 << "  Micro-average Recall        = " << r_t << endl << endl;
      }
      if ((!os2) == 0){
        os2 << "  Micro-average Precision     = " << p_t << endl;
        os2 << "  Micro-average Recall        = " << r_t << endl << endl;
      }
      if ((!os3) == 0){
        os3 << "  Micro-average Precision     = " << p_t << endl;
        os3 << "  Micro-average Recall        = " << r_t << endl << endl;
      }
      delete [] uni_label;
      delete [] alpha;
      delete [] beta;
      delete [] gamma;
    }    
    
    
    void ExternalValidity::getAccuracy(double &accuracy, ostream &os1, ostream &os2, ostream &os3)
      /* This computes the general precision, sometimes called accuracy, which can be defined as:
         Accuracy = 1/T (sum_{i=1}^l (t_i)) * 100, 
         where T denotes the total number of points, 
               l denotes the number of clusters,
    	   and t_i denotes the number of the points correctly clustered into a corresponding class i.
         Notice that each t_i is a diagonal element of the corresponding confusion matrix whose cluster labels 
         are permuted so that sum of diagonal elements is maximized.
      */ 
    {
      assert(numClass == numCluster);
      vector<int> v;
      // create the data...
      for (int i = 0; i < numClass; i++)
        v.push_back(i);
      // permutate the data...
      int maxTrace = 0;
      do {
        int tempTrace = 0;
        for (int i = 0; i < numClass; i++)
          tempTrace += confusionMatrix[v[i]][i];
        if (tempTrace > maxTrace)
          maxTrace = tempTrace;
      } while (next_permutation(v.begin(), v.end()));
      int tempSum = 0;
      for (int i = 0; i < numClass; i++)
        for (int j = 0; j < numClass; j++)
          tempSum += confusionMatrix[i][j];
      accuracy = (double)maxTrace / (double)tempSum;
      if ((!os1) == 0)
        os1 << "  Accuracy (= Precision)      = " << accuracy << endl << endl;
      if ((!os2) == 0)
        os2 << "  Accuracy (= Precision)      = " << accuracy << endl << endl;
      if ((!os3) == 0)
        os3 << "  Accuracy (= Precision)      = " << accuracy << endl << endl;
    }
    Merci pour l'aide

  4. #4
    Membre éprouvé
    Profil pro
    Inscrit en
    Novembre 2004
    Messages
    2 766
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2004
    Messages : 2 766
    Par défaut
    Et si tu enlèves les parenthèses ?

  5. #5
    Rédacteur
    Avatar de 3DArchi
    Profil pro
    Inscrit en
    Juin 2008
    Messages
    7 634
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2008
    Messages : 7 634
    Par défaut
    Effectivement :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    double ** F = new double *[numCluster];
    Mais,bon vu la tête du code, bon courage

  6. #6
    Membre averti
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    15
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 15
    Par défaut
    Citation Envoyé par 3DArchi Voir le message
    Effectivement :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    double ** F = new double *[numCluster];
    Mais,bon vu la tête du code, bon courage
    merci
    et encore je n'ai pas tout mis, il y a un quinzaine de classes, donc certains qui font plus de 20 pages imprimées

    et le fichier d'aide est pas vraiment très "clair". C'est juste une page type man .

  7. #7
    Membre averti
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    15
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 15
    Par défaut
    Bonsoir

    j'ai un peu avancé depuis.
    effectivement j'ai trouvé les parenthèses boiteuses .
    J'ai aussi trouvé dans un autre module une bonne série de include qui manquait. (merci Netbeans qui et beaucoup plus facile à mettre en oeuvre sur linux qu'éclipse)

    Aujourd'hui j'arrive à compiler. J'ai trouvé comment passer la ligne de commande, mais il faut que je lise tout le programme pour comprendre ce qu'il faut lui donner à manger . Pas simple.

    Bon je n'ai plus que 4 jours pour trouver. Après j'aurais fini mon étude sans ce truc...

    Si une bonne âme avait un peu de temps pour se pencher avec moi dessus ce truc... Mais je n'y crois aps trop.
    J'ai passé un Help au créateur de l'appli, mais sans succès (il est à l’université du texas).

    En tout cas merci pour la suggestion.

Discussions similaires

  1. Erreur de conversion
    Par franculo_caoulene dans le forum MS SQL Server
    Réponses: 7
    Dernier message: 01/08/2005, 16h23
  2. Erreur de conversion et requête dynamique dans une procédure
    Par franculo_caoulene dans le forum MS SQL Server
    Réponses: 3
    Dernier message: 01/08/2005, 15h12
  3. Erreur de conversion de type Null en String
    Par navis84 dans le forum Bases de données
    Réponses: 3
    Dernier message: 26/07/2005, 15h25
  4. Erreur de conversion int to socklen_t
    Par def_jam_vendetta dans le forum C++
    Réponses: 6
    Dernier message: 04/03/2005, 10h53
  5. Probleme erreur 241.
    Par FilipeVV dans le forum MS SQL Server
    Réponses: 15
    Dernier message: 18/02/2005, 11h50

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo