multiview_generator.sub_problems

sub_problems

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.

n_classes = 2
random_vertices = True
errors
n_features = 2
rs
n_samples_per_class
bayes_error
descriptions
config
view_name = 'generated'
gen_report()

General method the generate the report on the view.

Returns:

A string containing the general report for the view

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.

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

Returns:

data a np.ndarray of dimension n_classes, n_samples_per_class, n_features containing the samples’ descriptions, sorted by class

gen_report()

Generates the specific report for StumpsGenerator.

get_bayes_classifier()
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

gen_data()

WIP

gen_report()

WIP

get_bayes_classifier()
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.

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.

Returns:

data a np.ndarray of dimension n_classes, n_samples_per_class, n_features containing the samples’ descriptions, sorted by class

gen_report()

Generates the specific report for StumpsGenerator.

get_bayes_classifier()
to_cartesian(radius, angles)

Transforms polar coordinates to cartesian coordinates.