:mod:`multiview_generator.sub_problems` ======================================= .. py:module:: multiview_generator.sub_problems sub_problems ------------ .. py:class:: BaseSubProblem(n_classes=2, n_features=2, random_vertices=True, errors=np.array([0.5, 0.5]), random_state=np.random.RandomState(42), n_samples_per_class=np.array([100, 100]), **configuration) The base class for all the sub-problem generators. .. py:attribute:: n_classes :value: 2 .. py:attribute:: random_vertices :value: True .. py:attribute:: errors .. py:attribute:: n_features :value: 2 .. py:attribute:: rs .. py:attribute:: n_samples_per_class .. py:attribute:: bayes_error .. py:attribute:: descriptions .. py:attribute:: config .. py:attribute:: view_name :value: 'generated' .. py:method:: gen_report() General method the generate the report on the view. :return: A string containing the general report for the view .. py:class:: StumpsGenerator(n_classes=2, n_features=2, random_vertices=True, errors=np.array([0.5, 0.5]), random_state=np.random.RandomState(42), n_samples_per_class=np.array([100, 100]), **configuration) The base class for all the sub-problem generators. .. py:method:: gen_data() Generates the samples according to gaussian distributions with scales computed with the given error and class separation. This sub-problem is easily understandable by a decision tree. The features are built as : relevant_features : the math.ceil(math.log2(self.n_classes)) first ones, uniform noise features : all the remaining ones :return: data a np.ndarray of dimension n_classes, n_samples_per_class, n_features containing the samples' descriptions, sorted by class .. py:method:: gen_report() Generates the specific report for StumpsGenerator. .. py:method:: get_bayes_classifier() .. py:class:: TreesGenerator(n_classes=2, n_features=2, random_vertices=True, errors=np.array([0.5, 0.5]), random_state=np.random.RandomState(42), n_samples_per_class=np.array([100, 100]), **configuration) Work in progress : Similar generator as StumpsGenerator, but that generates several blobs per class .. py:method:: gen_data() WIP .. py:method:: gen_report() WIP .. py:method:: get_bayes_classifier() .. py:class:: RingsGenerator(n_classes=2, n_features=2, random_vertices=True, errors=np.array([0.5, 0.5]), random_state=np.random.RandomState(42), n_samples_per_class=np.array([100, 100]), **configuration) The base class for all the sub-problem generators. .. py:method:: gen_data() Generates the samples according to gaussian distributions with scales computed with the given error and class separation. The generator first computes a radius according to the gaussian distribution, then generates n_features-1 random angles to build the polar coordinates of the samples. The dataset returned is the cartesian version of this "polar" dataset. :return: data a np.ndarray of dimension n_classes, n_samples_per_class, n_features containing the samples' descriptions, sorted by class .. py:method:: gen_report() Generates the specific report for StumpsGenerator. .. py:method:: get_bayes_classifier() .. py:function:: to_cartesian(radius, angles) Transforms polar coordinates to cartesian coordinates.