예제 #1
0
 def test_critic_pearson_nonlinear(self):
     """Test the CRITIC.Pearson method with a non-linear association."""
     z_matrix = np.array([[0.0, 0.0, 0.0], [0.0, 0.0, 1.0], [0.2, 0.5, 0.0],
                          [0.2, 0.5, 1.0], [0.4, 1.0, 0.0], [0.4, 1.0, 1.0],
                          [0.6, 1.0, 0.0], [0.6, 1.0, 1.0], [0.8, 0.5, 0.0],
                          [0.8, 0.5, 1.0], [1.0, 0.0, 0.0], [1.0, 0.0, 1.0]
                          ],
                         dtype=np.float64)
     obtained_w_vector = mcdm.weigh(z_matrix, "CRITIC", "Pearson")
     expected_w_vector = np.array([0.27329284, 0.32664742, 0.40005975],
                                  dtype=np.float64)
     np.testing.assert_allclose(obtained_w_vector, expected_w_vector)
     self.assertEqual(obtained_w_vector.dtype, expected_w_vector.dtype)
예제 #2
0
 def test_vic_dcor_nested_list(self):
     """Test the VIC.dCor method with a nested list."""
     z_matrix = [
         [0.0, 0.0, 1.0],
         [0.1, 0.2, 0.8],
         [0.2, 0.4, 0.6],
         [0.3, 0.7, 0.3],
         [0.6, 0.8, 0.2],
         [0.8, 0.9, 0.1],
         [1.0, 1.0, 0.0],
     ]
     obtained_w_vector = mcdm.weigh(z_matrix, "VIC", "dCor")
     expected_w_vector = np.array([0.33817571, 0.33091215, 0.33091215],
                                  dtype=np.float64)
     np.testing.assert_allclose(obtained_w_vector, expected_w_vector)
     self.assertEqual(obtained_w_vector.dtype, expected_w_vector.dtype)
예제 #3
0
 def test_mw_nested_list(self):
     """Test the MW method with a nested list."""
     z_matrix = [
         [0.0, 0.0, 1.0],
         [0.1, 0.2, 0.8],
         [0.2, 0.4, 0.6],
         [0.3, 0.7, 0.3],
         [0.6, 0.8, 0.2],
         [0.8, 0.9, 0.1],
         [1.0, 1.0, 0.0],
     ]
     obtained_w_vector = mcdm.weigh(z_matrix, "MW")
     expected_w_vector = np.array([0.33333333, 0.33333333, 0.33333333],
                                  dtype=np.float64)
     np.testing.assert_allclose(obtained_w_vector, expected_w_vector)
     self.assertEqual(obtained_w_vector.dtype, expected_w_vector.dtype)
예제 #4
0
 def test_vic_abspearson_nested_list(self):
     """Test the VIC.AbsPearson method with a nested list."""
     z_matrix = [
         [0.0, 0.0, 1.0],
         [0.1, 0.2, 0.8],
         [0.2, 0.4, 0.6],
         [0.3, 0.7, 0.3],
         [0.6, 0.8, 0.2],
         [0.8, 0.9, 0.1],
         [1.0, 1.0, 0.0],
     ]
     obtained_w_vector = mcdm.weigh(z_matrix, "VIC", "AbsPearson")
     expected_w_vector = np.array([0.33861310, 0.33069345, 0.33069345],
                                  dtype=np.float64)
     np.testing.assert_allclose(obtained_w_vector, expected_w_vector)
     self.assertEqual(obtained_w_vector.dtype, expected_w_vector.dtype)
예제 #5
0
 def test_critic_pearson_nested_list(self):
     """Test the CRITIC.Pearson method with a nested list."""
     z_matrix = [
         [0.0, 0.0, 1.0],
         [0.1, 0.2, 0.8],
         [0.2, 0.4, 0.6],
         [0.3, 0.7, 0.3],
         [0.6, 0.8, 0.2],
         [0.8, 0.9, 0.1],
         [1.0, 1.0, 0.0],
     ]
     obtained_w_vector = mcdm.weigh(z_matrix, "CRITIC", "Pearson")
     expected_w_vector = np.array([0.25000000, 0.25857023, 0.49142977],
                                  dtype=np.float64)
     np.testing.assert_allclose(obtained_w_vector, expected_w_vector)
     self.assertEqual(obtained_w_vector.dtype, expected_w_vector.dtype)
예제 #6
0
 def test_em_nested_list(self):
     """Test the EM method with a nested list."""
     z_matrix = [
         [0.000, 0.000, 0.333],
         [0.033, 0.050, 0.267],
         [0.067, 0.100, 0.200],
         [0.100, 0.175, 0.100],
         [0.200, 0.200, 0.067],
         [0.267, 0.225, 0.033],
         [0.333, 0.250, 0.000],
     ]
     obtained_w_vector = mcdm.weigh(z_matrix, "EM")
     expected_w_vector = np.array([0.37406776, 0.25186448, 0.37406776],
                                  dtype=np.float64)
     np.testing.assert_allclose(obtained_w_vector, expected_w_vector)
     self.assertEqual(obtained_w_vector.dtype, expected_w_vector.dtype)
예제 #7
0
 def test_em_nonlinear(self):
     """Test the EM method with a non-linear association."""
     z_matrix = np.array([[0.00000000, 0.00000000, 0.00000000],
                          [0.00000000, 0.00000000, 0.16666667],
                          [0.03333333, 0.08333333, 0.00000000],
                          [0.03333333, 0.08333333, 0.16666667],
                          [0.06666667, 0.16666667, 0.00000000],
                          [0.06666667, 0.16666667, 0.16666667],
                          [0.10000000, 0.16666667, 0.00000000],
                          [0.10000000, 0.16666667, 0.16666667],
                          [0.13333333, 0.08333333, 0.00000000],
                          [0.13333333, 0.08333333, 0.16666667],
                          [0.16666667, 0.00000000, 0.00000000],
                          [0.16666667, 0.00000000, 0.16666667]],
                         dtype=np.float64)
     obtained_w_vector = mcdm.weigh(z_matrix, "EM")
     expected_w_vector = np.array([0.20724531, 0.31710188, 0.47565280],
                                  dtype=np.float64)
     np.testing.assert_allclose(obtained_w_vector, expected_w_vector)
     self.assertEqual(obtained_w_vector.dtype, expected_w_vector.dtype)