def createConfMatrix(self, iterations = 100):
        if iterations > len(self.df):
            raise Exception('More iterations than data')

        dim = self.answer.max()
        cm = ConfusionMatrix(dim)

        for i in range(iterations):

            # copy original data
            df = self.df
            ans = self.answer

            # select data
            item = df.loc[i]
            real = ans.loc[i]
            
            # remove data
            self.df = self.df.drop(i, axis = 0)
            self.answer = self.answer.drop(i)
            
            # get knn
            predict = self.getKNN(item)
            
            # check validation
            cm.validate(predict, real)

            # restore data
            self.df = df
            self.answer = ans
            print('loading: {}/{}'.format(i+1, iterations))
        
        print('')

        cm.showMatrix()
        print("Erro: ",cm.totalError(iterations))