photometric_database.microlensing_label_per_example_database

Code for representing a dataset of lightcurves for binary classification with a single label per example.

Module Contents

class MicrolensingLabelPerExampleDatabase[source]

Bases: photometric_database.lightcurve_database.LightcurveDatabase

A representation of a dataset of lightcurves for binary classification with a single label per example.

__init__(self)[source]
generate_datasets(self, positive_data_directory, negative_data_directory, positive_to_negative_data_ratio: float = None)[source]

Generates the training and validation datasets.

set_shape_function(self, lightcurve: tf.Tensor, label: tf.Tensor)[source]

Explicitly sets the shapes of the lightcurve and label tensor, otherwise TensorFlow can’t infer it.

Parameters:
  • lightcurve – The lightcurve tensor.
  • label – The label tensor.
Returns:

The lightcurve and label tensor with TensorFlow inferable shapes.

load_and_preprocess_example_file(self, file_path: tf.Tensor)[source]

Loads numpy files from the tensor alongside labels.

preprocess_and_augment_lightcurve(self, lightcurve: np.ndarray)[source]

Prepares the lightcurves for training with several preprocessing and augmenting steps.

static roll_lightcurve(lightcurve: np.ndarray)[source]

Randomly rolls the lightcurve, moving starting elements to the end.

generate_inference_dataset(self, inference_directory: str)[source]

Generates the inference dataset.