SKLearnReconstructor

class ctapipe.reco.sklearn.SKLearnReconstructor(**kwargs: Any)[source]

Bases: ctapipe.reco.reconstructor.Reconstructor

Base Class for a Machine Learning Based Reconstructor.

Keeps a dictionary of sklearn models, the current tools are designed to train one model per telescope type.

Attributes Summary

features

Features to use for this model

instrument_table

load_path

If given, load serialized model from this path

model_cls

An enum whose value must be in a given sequence.

model_config

kwargs for the sklearn model

prefix

Prefix for the output of this model.

property

property predicted, overridden in baseclass

stereo_combiner_cls

Which stereo combination method to use.

target

Name of the target column in training table

Methods Summary

__call__(event)

Event-wise prediction for the EventSource-Loop.

fit(key, table)

Create and fit a new model for key using the data in table.

predict_table(key, table)

Predict on a table of events

write(path[, overwrite])

Attributes Documentation

features

Features to use for this model

instrument_table
load_path

If given, load serialized model from this path

model_cls

An enum whose value must be in a given sequence.

model_config

kwargs for the sklearn model

prefix

Prefix for the output of this model. If None, model_cls is used.

property = None

property predicted, overridden in baseclass

stereo_combiner_cls

Which stereo combination method to use. Possible values: []

target: str = ''

Name of the target column in training table

Methods Documentation

abstract __call__(event: ctapipe.containers.ArrayEventContainer)None[source]

Event-wise prediction for the EventSource-Loop.

Fills the event.dl2.<your-feature>[name] container.

Parameters
event: ArrayEventContainer
fit(key, table)[source]

Create and fit a new model for key using the data in table.

abstract predict_table(key, table: astropy.table.table.Table)astropy.table.table.Table[source]

Predict on a table of events

Parameters
keyHashable

Key of the model. Currently always a TelescopeDescription as we train models per telescope type.

tableTable

Table of features

Returns
tableTable

Table(s) with predictions, matches the corresponding container definition(s)

write(path, overwrite=False)[source]