Objectives - Introduction

[1]:
%%capture
# execute the creation & training notebook first
%run "02-01-creation_and_training.ipynb"

After training we can use our causal structure to evaluate objectives. In the prediction section we actually already evaluated our first objective class, the Predictor. The .predict method from the prediction section is actually a convenience method for applying the Predictor.

Let’s import the Predictor and create some test data.

[2]:
from halerium import Predictor

test_data_a = pd.DataFrame({"(a)": np.linspace(4.5, 5.5, 100)})
[3]:
prediction = causal_structure.evaluate_objective(Predictor,
                                                 data=test_data_a)

With the evaluate_objective method the return is not a DataFrame, but a dictionary.

[4]:
type(prediction)
[4]:
dict

However, the dictionary is structured in the same way, so that it can be easily casted to a DataFrame (which is what the predict method does automatically.

[5]:
pd.DataFrame(prediction).head()
[5]:
(a) (b|a) (c|a,b)
0 4.500000 -3.962700 45.574920
1 4.510101 -4.440708 45.420133
2 4.520202 -4.913923 45.282097
3 4.530303 -5.418805 45.137820
4 4.540404 -5.893207 45.010048

For further details about the Predictor see the corresponding section in the core-documentation.

Objective classes define certain statistical questions. Every objective class has its convenience function in the CausalStructure class.

The available classes and corresponding methods are

  • Predictor (.predict) - make predictions, see the prediction section and this section,

  • InterventionPredictor (.predict_intervention) - make predictions from interventions, see intervention prediction,

  • Evaluator (.evaluate) - evaluate the performance of predictions, see evaluation,

  • OutlierDetector (.detect_outliers``)`` - find outliers, see outlier detection,

  • InfluenceEstimator (.estimate_influences) - estimate influences on a certain target, see influence estimation,

  • RankEstimator (.estimate_ranks) - estimate typicality of events, see rank estimation,

  • ProbabilityEstimator (.estimate_probabilities) - estimate the probability of events, see probability estimation.

In the next section we will learn about predicting interventions.

[ ]: