shark::CircleInSquare Class Reference

#include <shark/Data/DataDistribution.h>

+ Inheritance diagram for shark::CircleInSquare:

Public Member Functions

 CircleInSquare (unsigned int dimensions=2, double noiselevel=0.0, bool class_prob_equal=false)
void setLimits (double lower_limit, double upper_limit, double inner_radius, double outer_radius)
 allow for arbitrary box limits More...
void draw (RealVector &input, unsigned int &label) const
 Generates a single pair of input and label. More...
- Public Member Functions inherited from shark::LabeledDataDistribution< RealVector, unsigned int >
virtual ~LabeledDataDistribution ()
 Virtual destructor. More...
std::pair< RealVector, unsigned int > operator() ()
LabeledData< RealVector, unsigned int > generateDataset (std::size_t size, std::size_t maximumBatchSize) const
 Generates a dataset with samples from from the distribution. More...
LabeledData< RealVector, unsigned int > generateDataset (std::size_t size) const
 Generates a data set with samples from from the distribution. More...

Protected Attributes

unsigned int m_dimensions
double m_noiselevel
double m_lowerLimit
double m_upperLimit
double m_centerpoint
double m_inner_radius2
double m_outer_radius2
bool m_equal_class_prob
 if true, the probability to belong to either class is equal. if false, it is uniform over the cube. More...

Detailed Description

This class randomly fills a (hyper-)square with data points. Points which happen to be within a (hyper-)circle centered in the square of a certain radius get a positive class label. Noise on the labels can be added.

Definition at line 253 of file DataDistribution.h.

Constructor & Destructor Documentation

◆ CircleInSquare()

shark::CircleInSquare::CircleInSquare ( unsigned int  dimensions = 2,
double  noiselevel = 0.0,
bool  class_prob_equal = false 

Definition at line 256 of file DataDistribution.h.

Member Function Documentation

◆ draw()

void shark::CircleInSquare::draw ( RealVector &  input,
unsigned int &  label 
) const

Generates a single pair of input and label.

inputthe generated input
labelthe generated label

Implements shark::LabeledDataDistribution< RealVector, unsigned int >.

Definition at line 280 of file DataDistribution.h.

References shark::random::coinToss(), shark::random::globalRng, and shark::random::uni().

◆ setLimits()

void shark::CircleInSquare::setLimits ( double  lower_limit,
double  upper_limit,
double  inner_radius,
double  outer_radius 

allow for arbitrary box limits

Definition at line 268 of file DataDistribution.h.

References RANGE_CHECK.

Member Data Documentation

◆ m_centerpoint

double shark::CircleInSquare::m_centerpoint

Definition at line 331 of file DataDistribution.h.

◆ m_dimensions

unsigned int shark::CircleInSquare::m_dimensions

Definition at line 327 of file DataDistribution.h.

◆ m_equal_class_prob

bool shark::CircleInSquare::m_equal_class_prob

if true, the probability to belong to either class is equal. if false, it is uniform over the cube.

Definition at line 334 of file DataDistribution.h.

◆ m_inner_radius2

double shark::CircleInSquare::m_inner_radius2

Definition at line 332 of file DataDistribution.h.

◆ m_lowerLimit

double shark::CircleInSquare::m_lowerLimit

Definition at line 329 of file DataDistribution.h.

◆ m_noiselevel

double shark::CircleInSquare::m_noiselevel

Definition at line 328 of file DataDistribution.h.

◆ m_outer_radius2

double shark::CircleInSquare::m_outer_radius2

Definition at line 333 of file DataDistribution.h.

◆ m_upperLimit

double shark::CircleInSquare::m_upperLimit

Definition at line 330 of file DataDistribution.h.

The documentation for this class was generated from the following file: