SKLearnReconstructor#

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

Bases: 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

Which scikit-learn model to use.

model_config

kwargs for the sklearn model.

prefix

Prefix for the output of this model.

property

Property predicted, overridden in subclass.

stereo_combiner_cls

Which stereo combination method to use.

target

Name of the target table column for training.

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#

Which scikit-learn model to use.

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 subclass.

stereo_combiner_cls#

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

target: str = ''#

Name of the target table column for training.

Methods Documentation

abstract __call__(event: 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: 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]#