<jupyter_start><jupyter_text>Description - Initialize with returns, alpha, and spread- Evaluate portfolios generated from the alpha- TODO(gp): This should be called `Master_strategy_evaluator` like the class  Imports<jupyter_code>%load_ext autoreload
%autoreload 2

import logging

import core.config as cconfig
import dataflow_model.model_evaluator as modeval
import dataflow_model.utils as cdmu
import helpers.hdbg as dbg
import helpers.hprint as hprint
dbg.init_logger(verbosity=logging.INFO)
# dbg.init_logger(verbosity=logging.DEBUG)

_LOG = logging.getLogger(__name__)

# _LOG.info("%s", env.get_system_signature()[0])

hprint.config_notebook()<jupyter_output><empty_output><jupyter_text>Notebook config<jupyter_code># Read from env var.
eval_config = cconfig.Config.from_env_var("AM_CONFIG_CODE")

if eval_config is None:
    experiment_dir = ""
    aws_profile = None
    selected_idxs = None

    eval_config = cconfig.get_config_from_nested_dict(
        {
            "load_experiment_kwargs": {
                "src_dir": experiment_dir,
                "file_name": "result_bundle.v2_0.pkl",
                "experiment_type": "ins_oos",
                "selected_idxs": selected_idxs,
                "aws_profile": aws_profile,
            },
            "strategy_evaluator_kwargs": {
                "returns_col": "mid_ret_0",
                "position_intent_col": "position_intent_1",
                "spread_col": "spread",
                "abort_on_error": True,
            },
            "bh_adj_threshold": 0.1,
            "resample_rule": "W",
        }
    )

print(str(eval_config))
# Build the ModelEvaluator from the eval config.
evaluator = modeval.StrategyEvaluator.from_eval_config(eval_config)
# TODO(gp): Finish this.
keys = None
evaluator.compute_stats(keys)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09753424657534246, 'fraction_numerical': 0.004383561643835616, 'mean_word_length': 3.316784869976359, 'pattern_counts': {'":': 13, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '517961', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 595, 'n_tokens_neox': 587, 'n_words': 113, 'path': 'dataflow/model/notebooks/Master_strategy_analyzer.ipynb', 'repo_name': 'alphamatic/amp', 'size': '1825'}