Example #1
0
    def apply(self):
        self.clear()
        self.progressBarInit()
        self.filter_enabled(False)

        self.words = [i.name for i in self.selected_data_transformed.domain.attributes]
        self.p_values = hypergeom_p_values(self.data.X, self.selected_data_transformed.X, callback=self.progress)
        self.fdr_values = false_discovery_rate(self.p_values)
        self.filter_and_display()
        self.filter_enabled(True)
        self.progressBarFinished()
Example #2
0
    def test_false_discovery_rate(self):
        p_values = np.array(
            [0.727, 0.281, 0.791, 0.034, 0.628, 0.743, 0.958, 0.552, 0.867, 0.606,
             0.611, 0.594, 0.071, 0.517, 0.526, 0.526, 0.635, 0.932, 0.210, 0.636])
        # calculated with http://www.sdmproject.com/utilities/?show=FDR
        fdr_fixed = np.array(
            [0.92875, 0.9085714, 0.9305882, 0.68, 0.9085714, 0.92875, 0.958, 0.9085714,
             0.958, 0.9085714, 0.9085714, 0.9085714, 0.71, 0.9085714, 0.9085714, 0.9085714,
             0.9085714, 0.958, 0.9085714, 0.9085714]
        )
        corrected = false_discovery_rate(p_values)
        np.testing.assert_allclose(corrected, fdr_fixed)

        corrected = false_discovery_rate(p_values, m=len(p_values))
        np.testing.assert_allclose(corrected, fdr_fixed)

        corrected = false_discovery_rate(sorted(p_values), ordered=True)
        np.testing.assert_allclose(sorted(corrected), sorted(fdr_fixed))

        np.testing.assert_equal(false_discovery_rate([]), [])
        np.testing.assert_equal(false_discovery_rate(p_values, m=-1), [])

        dependant = [3.3414007065721947, 3.2688034599191167, 3.3480141985890031, 2.446462966857704,
                     3.2688034599191167, 3.3414007065721947, 3.4466345915436469, 3.2688034599191167,
                     3.4466345915436469, 3.2688034599191167, 3.2688034599191167, 3.2688034599191167,
                     2.554395156572014, 3.2688034599191167, 3.2688034599191167, 3.2688034599191167,
                     3.2688034599191167, 3.4466345915436469, 3.2688034599191167, 3.2688034599191167]
        np.testing.assert_equal(false_discovery_rate(p_values, dependent=True), dependant)
Example #3
0
    def test_false_discovery_rate(self):
        p_values = np.array([
            0.727, 0.281, 0.791, 0.034, 0.628, 0.743, 0.958, 0.552, 0.867,
            0.606, 0.611, 0.594, 0.071, 0.517, 0.526, 0.526, 0.635, 0.932,
            0.210, 0.636
        ])
        # calculated with http://www.sdmproject.com/utilities/?show=FDR
        fdr_fixed = np.array([
            0.92875, 0.9085714, 0.9305882, 0.68, 0.9085714, 0.92875, 0.958,
            0.9085714, 0.958, 0.9085714, 0.9085714, 0.9085714, 0.71, 0.9085714,
            0.9085714, 0.9085714, 0.9085714, 0.958, 0.9085714, 0.9085714
        ])
        corrected = false_discovery_rate(p_values)
        np.testing.assert_allclose(corrected, fdr_fixed)

        corrected = false_discovery_rate(p_values, m=len(p_values))
        np.testing.assert_allclose(corrected, fdr_fixed)

        corrected = false_discovery_rate(sorted(p_values), ordered=True)
        np.testing.assert_allclose(sorted(corrected), sorted(fdr_fixed))

        np.testing.assert_equal(false_discovery_rate([]), [])
        np.testing.assert_equal(false_discovery_rate(p_values, m=-1), [])

        dependant = [
            3.3414007065721947, 3.2688034599191167, 3.3480141985890031,
            2.446462966857704, 3.2688034599191167, 3.3414007065721947,
            3.4466345915436469, 3.2688034599191167, 3.4466345915436469,
            3.2688034599191167, 3.2688034599191167, 3.2688034599191167,
            2.554395156572014, 3.2688034599191167, 3.2688034599191167,
            3.2688034599191167, 3.2688034599191167, 3.4466345915436469,
            3.2688034599191167, 3.2688034599191167
        ]
        np.testing.assert_equal(false_discovery_rate(p_values, dependent=True),
                                dependant)
Example #4
0
    def apply(self):
        self.clear()
        self.progressBarInit()
        self.filter_enabled(False)

        self.words = [i.name for i in self.selected_data_transformed.domain.attributes]
        self.p_values = hypergeom_p_values(self.data.X,
                                           self.selected_data_transformed.X,
                                           callback=self.progress)
        self.fdr_values = false_discovery_rate(self.p_values)
        self.filter_and_display()
        self.filter_enabled(True)
        self.progressBarFinished()