src.superphot_plus.model.data

Module Contents

Classes

PosteriorSamplesGroup

Holds data from multiple objects' posterior objects.

TrainData

Holds train and validation datasets.

TestData

Holds information about testing data.

class PosteriorSamplesGroup[source]

Holds data from multiple objects’ posterior objects.

posterior_objects: List[superphot_plus.posterior_samples.PosteriorSamples][source]
use_redshift_info: bool | None = False[source]
ignore_param_idxs: List[int] | None[source]
random_seed: int | None[source]
__post_init__()[source]
__iter__()[source]
oversample(fits_per_majority_lc=1)[source]

Oversamples, drawing from posteriors of a certain fit. Assumes goal_per_class is the number of majority class if not set.

Returns:

Tuple containing oversampled features and labels.

Return type:

tuple of np.ndarray

oversample_smote()[source]

Uses SMOTE to oversample data from rarer classes.

split(split_frac=0.1, split_indices=None, shuffle=True)[source]
canonicalize_labels()[source]

Convert labels to canon labels.

make_binary(target_label='SN Ia')[source]

Convert labels to a binary classification problem.

make_fully_redshift_independent()[source]

Experimental! We can convert our shape parameters to be FULLY z-independent by instead using: tau_rise/gamma, tau_rise/tau_fall, beta*tau_rise

(but its log scale for tau_rise, gamma, tau_fall so add/subtract instead)

We do everything relative to tau_rise because that’s the first shape param to be measured in real time!

class TrainData[source]

Holds train and validation datasets.

train_dataset: torch.utils.data.TensorDataset[source]
val_dataset: torch.utils.data.TensorDataset[source]
__iter__()[source]
class TestData[source]

Holds information about testing data.

test_features: numpy.ndarray[source]
test_classes: numpy.ndarray[source]
test_names: numpy.ndarray[source]
__post_init__()[source]

Ensure everything is numpy arrays.

__iter__()[source]