data_representation¶
Base model for defining data representations.
- class graphnet.models.data_representation.data_representation.DataRepresentation(*args, **kwargs)[source]¶
Bases:
ModelAn Abstract class to create data representations from.
Construct´DataRepresentation´. The ´detector´ holds.
´Detector´-specific code. E.g. scaling/standardization and geometry tables.
- Parameters:
detector (
Detector) – The corresponding ´Detector´ representing the data.input_feature_names (
Optional[List[str]], default:None) – Names of each column in expected input data that will be built into a the data. If not provided, it is automatically assumed that all features in Detector is used.dtype (
Optional[dtype], default:torch.float32) – data type used for features. e.g. ´torch.float´perturbation_dict (
Optional[Dict[str,float]], default:None) – Dictionary mapping a feature name to a standard deviation according to which the values for this feature should be randomly perturbed. Defaults to None.seed (
Union[int,Generator,None], default:None) – seed or Generator used to randomly sample perturbations. Defaults to None.add_inactive_sensors (
bool, default:False) – If True, inactive sensors will be appended to the data with padded pulse information. Defaults to False.sensor_mask (
Optional[List[int]], default:None) –A list of sensor id’s to be masked from the data. Any sensor listed here will be removed from the data.
Defaults to None.
string_mask (
Optional[List[int]], default:None) – A list of string id’s to be masked from the data. Defaults to None.repeat_labels (
bool, default:False) – If True, labels will be repeated to match the the number of rows in the output of the GraphDefinition. Defaults to False.args (Any)
kwargs (Any)
- Return type:
object
- property nb_outputs: int¶
Return the number of output features.
- property output_feature_names: List[str]¶
Initialize / return the names of output features.
- forward(input_features, input_feature_names, truth_dicts, custom_label_functions, loss_weight_column, loss_weight, loss_weight_default_value, data_path)[source]¶
Construct data as ´Data´ object.
- Parameters:
input_features (
ndarray) – Input features for data construction. Shape ´[num_rows, d]´input_feature_names (
List[str]) – name of each column. Shape ´[,d]´.truth_dicts (
Optional[List[Dict[str,Any]]], default:None) – Dictionary containing truth labels.custom_label_functions (
Optional[Dict[str,Callable[...,Any]]], default:None) – Custom label functions.loss_weight_column (
Optional[str], default:None) – Name of column that holds loss weight. Defaults to None.loss_weight (
Optional[float], default:None) – Loss weight associated with event. Defaults to None.loss_weight_default_value (
Optional[float], default:None) – default value for loss weight. Used in instances where some events have no pre-defined loss weight. Defaults to None.data_path (
Optional[str], default:None) – Path to dataset data files. Defaults to None.
- Return type:
Data- Returns:
data