private Matrix trainAndTransform(Matrix matrix) {
        pTransform.train(matrix);

        Matrix nMatrix = new Matrix(matrix, true);
        for (List<Double> row : matrix.getData()){
            nMatrix.addRow(pTransform.transform(row));
        }

        return nMatrix;
    }