def func():
    # Used to re-compute specific failed jobs, `None` otherwise.
    indices = [7, 8]

    index = int(os.environ["PBS_ARRAY_INDEX"])

    if indices is not None:
        index = indices[index]

    print("Index:", index)

    X_train, X_test, y_train, y_test = data_split_cache.load()
    results, rf = cross_val_cache.load()

    job_samples = 50

    tree_path_dependent_shap_interact_cache = SimpleCache(
        f"tree_path_dependent_shap_interact_{index}_{job_samples}",
        cache_dir=os.path.join(CACHE_DIR, "shap_interaction"),
    )

    @tree_path_dependent_shap_interact_cache
    def get_interact_shap_values(model, X):
        return get_shap_values(model, X, interaction=True)

    get_interact_shap_values(
        rf, X_train[index * job_samples : (index + 1) * job_samples]
    )
Exemplo n.º 2
0
def func():
    def save_pdp_plot_2d(model, X_train, features, n_jobs):
        model.n_jobs = n_jobs
        with parallel_backend("threading", n_jobs=n_jobs):
            pdp_interact_out = pdp.pdp_interact(
                model=model,
                dataset=X_train,
                model_features=X_train.columns,
                features=features,
                num_grid_points=[20, 20],
            )

        fig, axes = pdp.pdp_interact_plot(
            pdp_interact_out, features, x_quantile=True, figsize=(7, 8)
        )
        axes["pdp_inter_ax"].xaxis.set_tick_params(rotation=45)
        figure_saver.save_figure(fig, "__".join(features), sub_directory="pdp_2d")

    X_train, X_test, y_train, y_test = data_split_cache.load()
    results, rf = cross_val_cache.load()
    columns_list = list(combinations(X_train.columns, 2))

    index = int(os.environ["PBS_ARRAY_INDEX"])
    print("Index:", index)
    print("Columns:", columns_list[index])

    ncpus = get_ncpus()
    print("NCPUS:", ncpus)

    # Use the array index to select the desired columns.
    save_pdp_plot_2d(rf, X_train, columns_list[index], ncpus)
Exemplo n.º 3
0
def func():
    # Used to re-compute specific failed jobs, `None` otherwise.
    indices = [
        5,
        76,
        82,
        89,
        258,
        259,
        263,
        317,
        318,
        329,
        349,
        352,
        425,
        434,
        451,
        452,
        453,
        457,
        461,
        462,
        472,
        473,
        589,
        590,
        600,
        626,
    ]

    index = int(os.environ["PBS_ARRAY_INDEX"])

    if indices is not None:
        index = indices[index]

    print("Index:", index)

    X_train, X_test, y_train, y_test = data_split_cache.load()
    rf = get_model()

    job_samples = 2000

    tree_path_dependent_shap_cache = SimpleCache(
        f"tree_path_dependent_shap_{index}_{job_samples}",
        cache_dir=os.path.join(CACHE_DIR, "shap"),
    )

    @tree_path_dependent_shap_cache
    def cached_get_shap_values(model, X):
        return get_shap_values(model, X, interaction=False)

    cached_get_shap_values(rf, X_train[index * job_samples : (index + 1) * job_samples])
Exemplo n.º 4
0
def func():
    # Used to re-compute specific failed jobs, `None` otherwise.
    indices = [
        1017,
        1088,
        1089,
        1136,
        1174,
        1202,
        1277,
        1303,
        1364,
        1480,
        1529,
        1589,
        1687,
        1805,
        1845,
        1889,
        1896,
        1931,
        1932,
        1941,
        1966,
        1967,
        1970,
        1984,
        2014,
        2035,
        2043,
        2047,
        2051,
        2061,
        2062,
        2067,
        2069,
        2075,
        2081,
        2094,
        2095,
        2103,
        2122,
        2123,
        2126,
        2127,
        2128,
        2130,
        2131,
        2137,
        2138,
        2152,
        2154,
        2155,
        2156,
        2157,
        2159,
        2160,
        2161,
        2173,
        2174,
        2175,
        2176,
        2179,
        2180,
        2188,
        2189,
        2191,
        2193,
        2194,
        2195,
        2196,
        2198,
        2199,
        2202,
        2203,
        2205,
        2206,
        2207,
        2210,
        2224,
        2225,
        2227,
        2232,
        2233,
        2236,
        2238,
        2248,
        2249,
        2250,
        2251,
        2252,
        2253,
        2254,
        2258,
        2259,
        2261,
        2262,
        2263,
        2264,
        2272,
        2273,
        2274,
        2276,
        2279,
        2280,
        2281,
        2282,
        2283,
        2285,
        2287,
        2288,
        2289,
        2291,
        2292,
        2294,
        2302,
        2308,
        2310,
        2314,
        2315,
        2316,
        2320,
        2321,
        2323,
        2327,
        2328,
        2332,
        2340,
        2341,
        2355,
        2356,
        2361,
        2366,
        2367,
        2368,
        2369,
        2371,
        2372,
        2373,
        2377,
        2381,
        2394,
        2395,
        2397,
        2402,
        2403,
        2407,
        2412,
        2418,
        2425,
        2438,
        2441,
        2442,
        2444,
        2456,
        2473,
        2475,
        2476,
        2477,
        2478,
        2494,
        2507,
        2515,
        2516,
        2517,
        2531,
        2534,
        2565,
        2567,
        2571,
        2572,
        2573,
        2574,
        2575,
        2582,
        2587,
        2588,
        2594,
        2595,
        2611,
        2624,
        2625,
        2626,
        2627,
        2628,
        2629,
        2630,
        2632,
        2633,
        2634,
        2637,
        2638,
        2639,
        2640,
        2641,
        2642,
        2650,
        2651,
        2654,
        2655,
        2671,
        2672,
        2673,
        2674,
        2675,
        2676,
        2677,
        2679,
        2680,
        2682,
        2683,
        2686,
        2687,
        2688,
        2689,
        2690,
        2692,
        2697,
        2707,
        2708,
        2710,
        2711,
        2712,
        2714,
        2715,
        2716,
        2717,
        2718,
        2719,
        2721,
        2722,
        2723,
        2724,
        2725,
        2727,
        2730,
        2736,
        2737,
        2757,
        2758,
        2759,
        2762,
        2763,
        2764,
        2765,
        2766,
        2767,
        2768,
        2769,
        2771,
        2772,
        2773,
        2775,
        2776,
        2777,
        2779,
        2780,
        2781,
        2782,
        2783,
        2784,
        2800,
        2801,
        2802,
        2803,
        2804,
        2805,
        2806,
        2807,
        2808,
        2809,
        2810,
        2811,
        2812,
        2813,
        2815,
        2816,
        2817,
        2818,
        2819,
        2820,
        2821,
        2823,
        2824,
        2825,
        2826,
        2831,
        2832,
        2833,
        2834,
        2835,
        2852,
        2854,
        2855,
        2856,
        2857,
        2858,
        2859,
        2861,
        2862,
        2863,
        2864,
        2865,
        2866,
        2867,
        2868,
        2870,
        2871,
        2872,
        2873,
        2874,
        2876,
        2879,
        2880,
        2881,
        2885,
        2900,
        2910,
        2911,
        2912,
        2913,
        2914,
        2915,
        2918,
        2919,
        2920,
        2921,
        2924,
        2925,
        2930,
        2931,
        2932,
        2933,
        2935,
        2936,
        2937,
        2938,
        2943,
        2945,
        2957,
        2961,
        2962,
        2964,
        2965,
        2966,
        2970,
        2971,
        2972,
        2975,
        2976,
        2978,
        2979,
        2980,
        2981,
        2982,
        2985,
        2986,
        2997,
        3005,
        3014,
        3017,
        3023,
        3024,
        3027,
        3028,
        3043,
        3054,
        3061,
        3062,
        3103,
        3141,
        3873,
        3881,
        3884,
        3886,
        3887,
        3890,
        3891,
        3894,
        3895,
        3896,
        3897,
        3898,
        3899,
        3900,
        3903,
        3909,
        3910,
        3911,
        3912,
        3916,
        3925,
        3926,
        3927,
        3928,
        3929,
        3932,
        3933,
        3934,
        3935,
        3936,
        3938,
        3941,
        3942,
        3943,
        3944,
        3947,
        3948,
        3951,
        3952,
        3953,
        3954,
        3955,
        3956,
        3957,
        3958,
        3959,
        3960,
        3961,
        3962,
        3963,
        3964,
        3965,
        3966,
        3967,
        3968,
        3969,
        3970,
        3971,
        3973,
        3974,
        3975,
        3976,
        3978,
        3979,
        3980,
        3981,
        3982,
        3983,
        3984,
        3985,
        3986,
        3987,
        3988,
        3989,
        3990,
        3991,
        3992,
        3993,
        3994,
        3995,
        3996,
        3997,
        3998,
        3999,
        4000,
        4001,
        4002,
        4003,
        4004,
        4005,
        4006,
        4007,
        4015,
        4016,
        4250,
        4284,
        4285,
        4373,
        4374,
        4418,
        4419,
        4420,
        4421,
        4445,
        4446,
        4493,
        4494,
        4495,
        4496,
        4514,
        4515,
        4537,
        4544,
        4545,
        4546,
        4547,
        4570,
        4571,
        4594,
        4600,
        4601,
        4602,
        4603,
        4613,
        4614,
        4625,
        4626,
        4627,
        4631,
        4632,
        4656,
        4657,
        4675,
        4676,
        4693,
        4694,
        4708,
        4709,
        4726,
        4727,
        4743,
        4744,
        4749,
        4750,
        4771,
        4772,
        4788,
        4789,
        4791,
        4792,
        4793,
        4802,
        4803,
        4804,
        4805,
        4815,
        4816,
        4828,
        4829,
        4830,
        4831,
        4832,
        4862,
        4863,
        4873,
        4874,
        4876,
        4877,
        4878,
        4887,
        4888,
        4889,
        4890,
        4897,
        4904,
        4905,
        4925,
        4927,
        4928,
        4929,
        4935,
        4936,
        4937,
        4941,
        4949,
        4950,
        4961,
        4977,
        4985,
        4986,
        4999,
        5007,
        5008,
        5009,
        5025,
        5026,
        5028,
        5029,
        5048,
        5049,
        5057,
        5058,
        5066,
        5067,
        5078,
        5082,
        5083,
        5084,
        5085,
        5104,
        5105,
        5112,
        5113,
        5128,
        5129,
        5133,
        5134,
        5135,
        5136,
        5137,
        5145,
        5146,
        5153,
        5154,
        5168,
        5172,
        5173,
        5174,
        5175,
        5176,
        5178,
        5187,
        5199,
        5200,
        5214,
        5217,
        5221,
        5222,
        5223,
        5224,
        5225,
        5226,
        5227,
        5228,
        5233,
        5242,
        5243,
        5261,
        5266,
        5268,
        5269,
        5270,
        5271,
        5273,
        5279,
        5286,
        5287,
        5293,
        5294,
        5295,
        5296,
        5297,
        5298,
        5299,
        5300,
        5301,
        5302,
        5311,
        5312,
        5320,
        5321,
        5328,
        5329,
        5331,
        5332,
        5333,
        5334,
        5335,
        5336,
        5337,
        5338,
        5343,
        5344,
        5351,
        5352,
        5363,
        5364,
        5368,
        5369,
        5370,
        5371,
        5372,
        5373,
        5374,
        5375,
        5383,
        5384,
        5393,
        5394,
        5402,
        5405,
        5406,
        5407,
        5408,
        5409,
        5410,
        5411,
        5412,
        5413,
        5419,
        5420,
        5430,
        5431,
        5442,
        5446,
        5447,
        5448,
        5449,
        5450,
        5451,
        5452,
        5453,
        5454,
        5456,
        5457,
        5464,
        5465,
        5476,
        5485,
        5486,
        5487,
        5488,
        5489,
        5490,
        5491,
        5492,
        5493,
        5494,
        5499,
        5507,
        5508,
        5524,
        5525,
        5526,
        5527,
        5528,
        5529,
        5530,
        5531,
        5532,
        5542,
        5543,
        5550,
        5551,
        5565,
        5566,
        5572,
        5573,
        5574,
        5575,
        5576,
        5577,
        5578,
        5579,
        5580,
        5581,
        5591,
        5594,
        5595,
        5608,
        5609,
        5612,
        5613,
        5614,
        5620,
        5621,
        5622,
        5623,
        5626,
        5627,
        5628,
        5629,
        5630,
        5640,
        5641,
        5644,
        5645,
        5656,
        5657,
        5658,
        5659,
        5660,
        5662,
        5663,
        5667,
        5668,
        5669,
        5670,
        5671,
        5672,
        5673,
        5674,
        5675,
        5676,
        5681,
        5685,
        5686,
        5713,
        5714,
        5715,
        5716,
        5719,
        5720,
        5729,
        5730,
        5731,
        5732,
        5733,
        5734,
        5735,
        5736,
        5737,
        5738,
        5749,
        5750,
        5756,
        5757,
        5785,
        5786,
        5787,
        5788,
        5791,
        5792,
        5796,
        5799,
        5800,
        5801,
        5802,
        5803,
        5804,
        5805,
        5806,
        5807,
        5823,
        5824,
        5831,
        5832,
        5864,
        5868,
        5869,
        5883,
        5884,
        5901,
        5902,
        5903,
        5904,
        5907,
        5908,
        5911,
        5912,
        5913,
        5914,
        5915,
        5916,
        5917,
        5918,
        5919,
        5920,
        5923,
        5924,
        5932,
        5933,
        5942,
        5943,
        5944,
        5945,
        5946,
        5948,
        5949,
        5950,
        5977,
        5978,
        5979,
        5980,
        5981,
        5983,
        5984,
        5991,
        5995,
        5996,
        5997,
        5999,
    ]

    index = int(os.environ["PBS_ARRAY_INDEX"])

    if indices is not None:
        index = indices[index]

    print("Index:", index)

    X_train, X_test, y_train, y_test = data_split_cache.load()
    rf = get_model()

    job_samples = 50

    tree_path_dependent_shap_interact_cache = SimpleCache(
        f"tree_path_dependent_shap_interact_{index}_{job_samples}",
        cache_dir=os.path.join(CACHE_DIR, "shap_interaction"),
    )

    @tree_path_dependent_shap_interact_cache
    def cached_get_interact_shap_values(model, X):
        return get_shap_values(model, X, interaction=True)

    cached_get_interact_shap_values(
        rf, X_train[index * job_samples:(index + 1) * job_samples])
def func():
    # Used to re-compute specific failed jobs, `None` otherwise.
    indices = [
        54,
        55,
        56,
        57,
        58,
        65,
        66,
        72,
        73,
        82,
        83,
        84,
        85,
        92,
        93,
        94,
        112,
        113,
        114,
        115,
        116,
        118,
        119,
        128,
        131,
        132,
        133,
        134,
        135,
        136,
        137,
        138,
        139,
        143,
        144,
        147,
        148,
        164,
        165,
        166,
        167,
        172,
        173,
        174,
        196,
        197,
        198,
        199,
        201,
        203,
        204,
        212,
        215,
        216,
        217,
        218,
        220,
        221,
        222,
        223,
        224,
        230,
        231,
        236,
        237,
        247,
        248,
        249,
        250,
        251,
        254,
        255,
        256,
        259,
        293,
        294,
        295,
        296,
        298,
        299,
        300,
        305,
        307,
        308,
        309,
        310,
        311,
        312,
        313,
        314,
        315,
        325,
        326,
        328,
        329,
        352,
        353,
        354,
        355,
        356,
        360,
        361,
        362,
        370,
        419,
        420,
        421,
        422,
        425,
        426,
        427,
        428,
        431,
        432,
        433,
        434,
        435,
        436,
        437,
        438,
        439,
        446,
        447,
        455,
        456,
        489,
        490,
        491,
        492,
        493,
        495,
        496,
        497,
        504,
        532,
        533,
        534,
        535,
        538,
        539,
        540,
        546,
        550,
        551,
        552,
        556,
        557,
        558,
        559,
        560,
        561,
        577,
        578,
        587,
        588,
    ]

    index = int(os.environ["PBS_ARRAY_INDEX"])

    if indices is not None:
        index = indices[index]

    print("Index:", index)

    X_train, X_test, y_train, y_test = data_split_cache.load()
    rf = get_model()

    job_samples = 2000

    tree_path_dependent_shap_cache = SimpleCache(
        f"tree_path_dependent_shap_{index}_{job_samples}",
        cache_dir=os.path.join(CACHE_DIR, "shap"),
    )

    @tree_path_dependent_shap_cache
    def cached_get_shap_values(model, X):
        return get_shap_values(model, X, interaction=False)

    cached_get_shap_values(
        rf, X_train[index * job_samples:(index + 1) * job_samples])
Exemplo n.º 6
0
def func():
    # Used to re-compute specific failed jobs, `None` otherwise.
    indices = [
        115,
        989,
        1102,
        1163,
        1236,
        1275,
        1276,
        1277,
        1377,
        1378,
        1514,
        1515,
        1516,
        1716,
        1771,
        1772,
        1773,
        1774,
        1867,
        1940,
        1955,
        2095,
        2174,
        2301,
        2827,
        2908,
        2947,
        2958,
        2960,
        3138,
        3168,
        3169,
        3782,
        3783,
        3784,
        3785,
        3786,
        3787,
        4108,
        4128,
        4129,
        4130,
        4131,
        4132,
        4224,
        4281,
        4302,
        4357,
        4435,
        4436,
        4579,
        4673,
        4865,
        4904,
    ]

    index = int(os.environ["PBS_ARRAY_INDEX"])

    if indices is not None:
        index = indices[index]

    print("Index:", index)

    X_train, X_test, y_train, y_test = data_split_cache.load()
    results, rf = cross_val_cache.load()

    job_samples = 50

    tree_path_dependent_shap_interact_cache = SimpleCache(
        f"tree_path_dependent_shap_interact_{index}_{job_samples}",
        cache_dir=os.path.join(CACHE_DIR, "shap_interaction"),
    )

    @tree_path_dependent_shap_interact_cache
    def get_interact_shap_values(model, X):
        return get_shap_values(model, X, interaction=True)

    get_interact_shap_values(
        rf, X_train[index * job_samples:(index + 1) * job_samples])
def func():
    # Used to re-compute specific failed jobs, `None` otherwise.
    indices = [
        5,
        6,
        7,
        8,
        9,
        10,
        11,
        12,
        13,
        17,
        22,
        23,
        24,
        26,
        27,
        28,
        32,
        35,
        36,
        42,
        46,
        48,
        58,
        59,
        60,
        61,
        62,
        64,
        75,
        76,
        77,
        78,
        79,
        80,
        81,
        82,
        83,
        89,
        90,
        91,
        92,
        93,
        94,
        95,
        96,
        97,
        98,
        99,
        100,
        101,
        102,
        110,
        113,
        114,
        115,
        116,
        117,
        118,
        119,
        120,
        121,
        137,
        138,
        139,
        140,
        141,
        142,
        145,
        146,
        147,
        148,
        149,
        150,
        151,
        152,
        153,
        154,
        155,
        156,
        182,
        183,
        213,
        214,
        215,
        216,
        217,
        218,
        219,
        220,
        221,
        222,
        223,
        224,
        225,
        226,
        227,
        241,
        242,
        243,
        244,
        245,
        246,
        247,
        248,
        249,
        250,
        251,
        252,
        253,
        254,
        255,
        256,
        257,
        258,
        259,
        260,
        261,
        262,
        263,
        264,
        265,
        332,
        338,
        339,
        340,
        344,
        345,
        346,
        348,
        351,
        352,
        353,
        354,
        355,
        356,
        357,
        358,
        359,
        360,
        361,
        362,
        363,
        364,
        365,
        366,
        367,
        368,
        369,
        375,
        390,
        391,
        392,
        393,
        394,
        395,
        396,
        399,
        400,
        401,
        402,
        403,
        404,
        406,
        407,
        408,
        409,
        410,
        411,
        412,
        413,
        414,
        415,
        416,
        417,
        418,
        419,
        420,
        421,
        426,
        444,
        445,
        446,
        447,
        448,
        449,
        450,
        451,
        452,
        453,
        454,
        455,
        456,
        484,
        487,
        488,
        527,
        529,
        530,
        531,
        533,
        534,
        535,
        536,
        537,
        538,
        539,
        540,
        572,
        574,
        575,
        577,
        578,
        579,
        580,
        581,
        584,
        585,
        586,
        587,
        588,
        603,
        617,
        618,
        619,
        620,
        621,
        622,
        623,
        624,
        628,
        629,
        630,
        631,
        632,
        633,
        634,
        635,
        636,
        637,
        638,
        639,
        640,
        641,
        643,
        644,
        647,
        648,
        649,
        650,
        651,
        652,
        666,
        679,
        685,
        686,
        695,
        696,
        697,
        698,
        699,
        700,
        701,
        702,
        704,
        705,
        706,
        707,
        708,
        709,
        710,
        711,
        712,
        713,
        714,
        715,
        717,
        718,
        719,
        720,
        721,
        722,
        724,
        725,
        727,
        728,
        729,
        730,
        731,
        732,
        733,
        734,
        745,
        746,
        769,
        770,
        771,
        782,
        784,
        785,
        786,
        787,
        788,
        789,
        790,
        791,
        792,
        793,
        794,
        795,
        796,
        797,
        798,
        799,
        800,
        801,
        802,
        803,
        804,
        805,
        806,
        807,
        808,
        809,
        818,
        834,
        843,
        845,
        846,
        847,
        849,
        850,
        851,
        852,
        856,
        857,
        868,
        869,
        892,
        893,
        894,
        895,
        941,
        942,
        963,
        965,
        972,
        973,
        974,
        988,
        989,
    ]

    index = int(os.environ["PBS_ARRAY_INDEX"])

    if indices is not None:
        index = indices[index]

    print("Index:", index)

    X_train, X_test, y_train, y_test = data_split_cache.load()
    results, rf = cross_val_cache.load()

    job_samples = 2000

    tree_path_dependent_shap_cache = SimpleCache(
        f"tree_path_dependent_shap_{index}_{job_samples}",
        cache_dir=os.path.join(CACHE_DIR, "shap"),
    )

    @tree_path_dependent_shap_cache
    def get_interact_shap_values(model, X):
        return get_shap_values(model, X, interaction=False)

    get_interact_shap_values(
        rf, X_train[index * job_samples:(index + 1) * job_samples])
Exemplo n.º 8
0
def func():
    # Used to re-compute specific failed jobs, `None` otherwise.
    indices = [
        8,
        50,
        51,
        58,
        60,
        61,
        62,
        63,
        64,
        68,
        94,
        219,
        265,
        266,
        268,
        314,
        315,
        317,
        319,
        320,
        321,
        322,
        347,
        348,
        379,
        383,
        384,
        392,
        419,
        420,
        421,
        422,
        453,
        456,
        458,
        472,
        473,
        474,
        475,
        476,
        489,
        537,
        538,
        540,
        542,
        571,
        572,
        573,
        574,
        654,
        655,
        664,
        665,
        666,
    ]

    index = int(os.environ["PBS_ARRAY_INDEX"])

    if indices is not None:
        index = indices[index]

    print("Index:", index)

    X_train, X_test, y_train, y_test = data_split_cache.load()
    rf = get_model()

    job_samples = 2000

    tree_path_dependent_shap_cache = SimpleCache(
        f"tree_path_dependent_shap_{index}_{job_samples}",
        cache_dir=os.path.join(CACHE_DIR, "shap"),
    )

    @tree_path_dependent_shap_cache
    def cached_get_shap_values(model, X):
        return get_shap_values(model, X, interaction=False)

    cached_get_shap_values(
        rf, X_train[index * job_samples:(index + 1) * job_samples])
def func():
    # Used to re-compute specific failed jobs, `None` otherwise.
    indices = [
        3,
        4,
        6,
        7,
        41,
        42,
        43,
        44,
        45,
        46,
        47,
        48,
        58,
        59,
        60,
        61,
        62,
        63,
        65,
        66,
        69,
        71,
        72,
        73,
        74,
        75,
        76,
        77,
        78,
        87,
        88,
        112,
        113,
        114,
        115,
        116,
        117,
        121,
        122,
        123,
        124,
        125,
        127,
        128,
        129,
        130,
        131,
        133,
        134,
        136,
        137,
        142,
        143,
        144,
        147,
        150,
        151,
        153,
        154,
        179,
        180,
        182,
        183,
        185,
        186,
        187,
        188,
        196,
        197,
        198,
        199,
        200,
        201,
        205,
        209,
        210,
        211,
        222,
        223,
        241,
        242,
        243,
        244,
        245,
        246,
        247,
        248,
        249,
        250,
        251,
        252,
        253,
        256,
        257,
        258,
        259,
        260,
        261,
        262,
        263,
        264,
        270,
        272,
        273,
        274,
        278,
        279,
        280,
        283,
        284,
        303,
        304,
        305,
        306,
        307,
        308,
        309,
        310,
        313,
        314,
        316,
        325,
        326,
        327,
        328,
        329,
        330,
        334,
        337,
        338,
        339,
        351,
        352,
        361,
        362,
        363,
        364,
        365,
        366,
        367,
        368,
        369,
        370,
        371,
        372,
        374,
        375,
        376,
        377,
        378,
        379,
        380,
        382,
        383,
        389,
        390,
        391,
        394,
        398,
        400,
        401,
        402,
        403,
        422,
        423,
        425,
        426,
        429,
        431,
        432,
        433,
        442,
        443,
        444,
        445,
        446,
        447,
        450,
        454,
        455,
        456,
        464,
        465,
        479,
        480,
        481,
        482,
        483,
        484,
        485,
        486,
        487,
        488,
        489,
        490,
        493,
        494,
        495,
        496,
        497,
        498,
        499,
        501,
        502,
        515,
        521,
        522,
        523,
        529,
        530,
        531,
        534,
        535,
        539,
        540,
        552,
        553,
        554,
        555,
        557,
        558,
        559,
        560,
        564,
        565,
        566,
        568,
        569,
        570,
        573,
        575,
        576,
        577,
        578,
        591,
        593,
        594,
        595,
        596,
        597,
        598,
        599,
        600,
        601,
        602,
        603,
        605,
        606,
        607,
        608,
        609,
    ]

    index = int(os.environ["PBS_ARRAY_INDEX"])

    if indices is not None:
        index = indices[index]

    print("Index:", index)

    X_train, X_test, y_train, y_test = data_split_cache.load()
    rf = get_model()

    job_samples = 2000

    tree_path_dependent_shap_cache = SimpleCache(
        f"tree_path_dependent_shap_{index}_{job_samples}",
        cache_dir=os.path.join(CACHE_DIR, "shap"),
    )

    @tree_path_dependent_shap_cache
    def cached_get_shap_values(model, X):
        return get_shap_values(model, X, interaction=False)

    cached_get_shap_values(
        rf, X_train[index * job_samples:(index + 1) * job_samples])
Exemplo n.º 10
0
def func():
    # Used to re-compute specific failed jobs, `None` otherwise.
    indices = [
        14,
        43,
        45,
        59,
        62,
        73,
        79,
        94,
        104,
        110,
        122,
        140,
        142,
        150,
        157,
        161,
        187,
        196,
        232,
        236,
        247,
        264,
        298,
        306,
        311,
        312,
        398,
        402,
        408,
        410,
        446,
        454,
        456,
        459,
        460,
        461,
        462,
        464,
        467,
        469,
        470,
        471,
        482,
        483,
        484,
        492,
        493,
        494,
        495,
        496,
        497,
        516,
        517,
        518,
        523,
        535,
        537,
        543,
        554,
        557,
        565,
        572,
        573,
        644,
        645,
        646,
        647,
        648,
        671,
        673,
        674,
        676,
        677,
        678,
        679,
        700,
        701,
        715,
        750,
        751,
        752,
        753,
        803,
        804,
        805,
        814,
        816,
        817,
        820,
        822,
        827,
        829,
        830,
        831,
        952,
        953,
        954,
        989,
    ]

    index = int(os.environ["PBS_ARRAY_INDEX"])

    if indices is not None:
        index = indices[index]

    print("Index:", index)

    X_train, X_test, y_train, y_test = data_split_cache.load()
    results, rf = cross_val_cache.load()

    job_samples = 2000

    tree_path_dependent_shap_cache = SimpleCache(
        f"tree_path_dependent_shap_{index}_{job_samples}",
        cache_dir=os.path.join(CACHE_DIR, "shap"),
    )

    @tree_path_dependent_shap_cache
    def get_interact_shap_values(model, X):
        return get_shap_values(model, X, interaction=False)

    get_interact_shap_values(
        rf, X_train[index * job_samples:(index + 1) * job_samples])
def func():
    # Used to re-compute specific failed jobs, `None` otherwise.
    indices = [
        4,
        5,
        6,
        7,
        10,
        11,
        12,
        13,
        14,
        15,
        16,
        18,
        19,
        21,
        31,
        32,
        39,
        49,
        52,
        66,
        67,
        72,
        73,
        75,
        76,
        81,
        82,
        86,
        87,
        89,
        99,
        101,
        112,
        126,
        127,
        142,
        147,
        148,
        161,
        162,
        163,
        164,
        174,
        175,
        182,
        185,
        186,
        188,
        189,
        190,
        192,
        196,
        197,
        198,
        199,
        204,
        205,
        206,
        209,
        216,
        226,
        227,
        228,
        236,
        240,
        241,
        253,
        254,
        258,
        259,
        260,
        262,
        263,
        264,
        300,
        303,
        304,
        316,
        317,
        318,
        329,
        330,
        348,
        349,
        351,
        352,
        365,
        425,
        434,
        451,
        452,
        453,
        457,
        459,
        461,
        462,
        472,
        473,
        475,
        480,
        481,
        486,
        488,
        491,
        493,
        495,
        496,
        499,
        502,
        509,
        521,
        523,
        546,
        547,
        549,
        550,
        551,
        561,
        562,
        570,
        575,
        586,
        587,
        589,
        590,
        598,
        599,
        600,
        601,
        602,
        603,
        604,
        605,
        608,
        609,
        611,
        612,
        613,
        614,
        616,
        617,
        626,
        629,
        630,
        634,
        635,
        642,
        648,
        656,
        657,
        658,
        659,
        660,
        661,
        662,
        663,
        664,
        665,
        666,
        667,
        668,
        669,
        670,
        671,
        672,
        673,
        674,
        675,
        676,
        677,
        678,
        679,
        680,
        681,
        682,
        683,
        684,
        685,
        686,
        687,
        688,
        689,
        690,
        691,
        692,
        693,
        694,
        695,
        696,
        697,
        698,
        699,
        700,
        701,
        702,
        703,
        704,
        705,
        706,
        707,
        708,
        709,
        710,
        711,
        712,
        713,
        714,
        715,
        716,
        717,
        718,
        719,
        720,
        721,
        722,
        723,
        724,
        725,
        726,
        727,
        728,
        729,
        730,
        731,
        732,
        733,
        734,
        735,
        736,
        737,
        738,
        739,
        740,
        741,
        742,
        743,
        744,
        745,
        746,
        747,
        748,
        749,
        750,
        751,
        752,
        753,
        754,
        755,
        756,
        757,
        758,
        759,
        760,
        761,
        762,
        763,
        764,
        765,
        766,
        767,
        768,
        769,
        770,
        771,
        772,
        773,
        774,
        775,
        776,
        777,
        778,
        779,
        780,
        781,
        782,
        783,
        784,
        785,
        786,
        787,
        788,
        789,
        790,
        791,
        792,
        793,
        794,
        795,
        796,
        797,
        798,
        799,
        800,
        801,
        802,
        803,
        804,
        805,
        806,
        807,
        808,
        809,
        810,
        811,
        812,
        813,
        814,
        815,
        816,
        817,
        818,
        819,
        820,
        821,
        822,
        823,
        824,
        825,
        826,
        827,
        828,
        829,
        830,
        831,
        832,
        833,
        834,
        835,
        836,
        837,
        838,
        839,
        840,
        841,
        842,
        843,
        844,
        845,
        846,
        847,
        848,
        849,
        850,
        851,
        852,
        853,
        854,
        855,
        856,
        857,
        858,
        859,
        860,
        861,
        862,
        863,
        864,
        865,
        866,
        867,
        868,
        869,
        870,
        871,
        872,
        873,
        874,
        875,
        876,
        877,
        878,
        879,
        880,
        881,
        882,
        883,
        884,
        885,
        886,
        887,
        888,
        889,
        890,
        891,
        892,
        893,
        894,
        895,
        896,
        897,
        898,
        899,
        900,
        901,
        902,
        903,
        904,
        905,
        906,
        907,
        908,
        909,
        910,
        911,
        912,
        913,
        914,
        915,
        916,
        917,
        918,
        919,
        920,
        921,
        922,
        923,
        924,
        925,
        926,
        927,
        928,
        929,
        930,
        931,
        932,
        933,
        934,
        935,
        936,
        937,
        938,
        939,
        940,
        941,
        942,
        943,
        944,
        945,
        946,
        947,
        948,
        949,
        950,
        951,
        952,
        953,
        954,
        955,
        956,
        957,
        958,
        959,
        960,
        961,
        962,
        963,
        964,
        965,
        966,
        967,
        968,
        969,
        970,
        971,
        972,
        973,
        974,
        975,
        976,
        977,
        978,
        979,
        980,
        981,
        982,
        983,
        984,
        985,
        986,
        987,
        988,
        989,
        990,
        991,
        992,
        993,
        994,
        995,
    ]

    index = int(os.environ["PBS_ARRAY_INDEX"])

    if indices is not None:
        index = indices[index]

    print("Index:", index)

    X_train, X_test, y_train, y_test = data_split_cache.load()
    rf = get_model()

    job_samples = 2000

    tree_path_dependent_shap_cache = SimpleCache(
        f"tree_path_dependent_shap_{index}_{job_samples}",
        cache_dir=os.path.join(CACHE_DIR, "shap"),
    )

    @tree_path_dependent_shap_cache
    def cached_get_shap_values(model, X):
        return get_shap_values(model, X, interaction=False)

    cached_get_shap_values(
        rf, X_train[index * job_samples:(index + 1) * job_samples])
def func():
    # Used to re-compute specific failed jobs, `None` otherwise.
    indices = [
        2,
        3,
        6,
        7,
        14,
        15,
        16,
        17,
        19,
        21,
        22,
        28,
        29,
        35,
        36,
        52,
        53,
        54,
        55,
        59,
        60,
        61,
        62,
        68,
        69,
        70,
        71,
        72,
        73,
        76,
        81,
        82,
        83,
        84,
        94,
        98,
        99,
        100,
        101,
        102,
        103,
        104,
        105,
        106,
        107,
        108,
        109,
        111,
        112,
        113,
        114,
        115,
        116,
        117,
        118,
        119,
        123,
        124,
        125,
        129,
        130,
        132,
        133,
        134,
        135,
        141,
        142,
        155,
        156,
        170,
        171,
        172,
        173,
        175,
        176,
        177,
        178,
        183,
        184,
        185,
        186,
        188,
        189,
        196,
        201,
        202,
        203,
        204,
        220,
        221,
        222,
        223,
        224,
        225,
        226,
        227,
        228,
        229,
        230,
        231,
        232,
        235,
        236,
        237,
        238,
        239,
        240,
        241,
        245,
        246,
        252,
        254,
        255,
        257,
        258,
        261,
        262,
        263,
        264,
        266,
        267,
        276,
        277,
        311,
        312,
        313,
        314,
        316,
        319,
        320,
        321,
        327,
        328,
        329,
        330,
        331,
        332,
        338,
        341,
        342,
        343,
        344,
        369,
        372,
        373,
        374,
        375,
        376,
        377,
        378,
        379,
        380,
        381,
        382,
        383,
        384,
        385,
        386,
        387,
        388,
        393,
        395,
        396,
        401,
        402,
        409,
        410,
        411,
        412,
        413,
        414,
        422,
        423,
        437,
        438,
        439,
        440,
        441,
        444,
        445,
        447,
        453,
        454,
        455,
        456,
        457,
        459,
        462,
        470,
        471,
        472,
        473,
        508,
        509,
        510,
        511,
        512,
        513,
        514,
        515,
        516,
        519,
        520,
        521,
        522,
        523,
        524,
        525,
        526,
        527,
        528,
        535,
        536,
        537,
        539,
        540,
        543,
        544,
        545,
        546,
        548,
        549,
    ]

    index = int(os.environ["PBS_ARRAY_INDEX"])

    if indices is not None:
        index = indices[index]

    print("Index:", index)

    X_train, X_test, y_train, y_test = data_split_cache.load()
    rf = get_model()

    job_samples = 50

    tree_path_dependent_shap_interact_cache = SimpleCache(
        f"tree_path_dependent_shap_interact_{index}_{job_samples}",
        cache_dir=os.path.join(CACHE_DIR, "shap_interaction"),
    )

    @tree_path_dependent_shap_interact_cache
    def cached_get_interact_shap_values(model, X):
        return get_shap_values(model, X, interaction=True)

    cached_get_interact_shap_values(
        rf, X_train[index * job_samples:(index + 1) * job_samples])
Exemplo n.º 13
0
def func():
    # Used to re-compute specific failed jobs, `None` otherwise.
    indices = [
        0,
        1,
        2,
        3,
        4,
        7,
        8,
        9,
        15,
        61,
        62,
        63,
        64,
        65,
        66,
        68,
        69,
        73,
        75,
        76,
        77,
        78,
        79,
        80,
        81,
        82,
        83,
        92,
        93,
        102,
        103,
        119,
        120,
        121,
        122,
        123,
        128,
        129,
        130,
        132,
        169,
        170,
        171,
        172,
        174,
        175,
        176,
        177,
        178,
        179,
        180,
        181,
        182,
        183,
        184,
        185,
        188,
        189,
        200,
        201,
        208,
        209,
        229,
        230,
        231,
        232,
        233,
        235,
        236,
        237,
        242,
        260,
        261,
        275,
        276,
        277,
        278,
        280,
        281,
        283,
        284,
        285,
        286,
        287,
        288,
        289,
        290,
        291,
        292,
        302,
        303,
        333,
        334,
        335,
        336,
        337,
        345,
        346,
        347,
        349,
        366,
        367,
        382,
        383,
        384,
        385,
        390,
        391,
        397,
        401,
        402,
        403,
        404,
        405,
        406,
        407,
        408,
        409,
        419,
        420,
        446,
        447,
        448,
        449,
        450,
        456,
        457,
        458,
        465,
        479,
        480,
        488,
        489,
        490,
        491,
        492,
        493,
        499,
        500,
        501,
        502,
        503,
        505,
        506,
        507,
        508,
        509,
        520,
        521,
        532,
        533,
        548,
        549,
        550,
        551,
        552,
        553,
        554,
        555,
        556,
        561,
        562,
        563,
        564,
        579,
        580,
        595,
        596,
        601,
        602,
        603,
        604,
        606,
        608,
        620,
        621,
        646,
        647,
        648,
        649,
        651,
        652,
        653,
        654,
        655,
        664,
        665,
        666,
        667,
        680,
        681,
        698,
        699,
        704,
        705,
        706,
        707,
        708,
        709,
        717,
        718,
        735,
        736,
        737,
        738,
        739,
        740,
        741,
        742,
        743,
        751,
        752,
        753,
        754,
        768,
        769,
        801,
        802,
        808,
        809,
        810,
        811,
        814,
        815,
        823,
        824,
        856,
        857,
        858,
        859,
        860,
        861,
        862,
        863,
        864,
        868,
        869,
        870,
        871,
        892,
        893,
        936,
        937,
        946,
        947,
        948,
        949,
        950,
        951,
        966,
        967,
        977,
        978,
        1001,
        1002,
        1003,
        1004,
        1005,
        1006,
        1008,
        1009,
        1010,
        1013,
        1014,
        1015,
        1016,
        1049,
        1050,
        1054,
        1055,
        1056,
        1057,
        1058,
        1059,
        1064,
        1065,
        1073,
        1074,
        1086,
        1087,
        1088,
        1089,
        1090,
        1091,
        1094,
        1095,
        1096,
        1100,
        1101,
        1102,
        1104,
        1126,
        1128,
        1129,
        1130,
        1131,
        1132,
        1133,
        1139,
        1140,
        1147,
        1148,
        1163,
        1164,
        1165,
        1166,
        1167,
        1168,
        1170,
        1171,
        1172,
        1173,
        1174,
        1201,
        1202,
        1203,
        1204,
        1205,
        1206,
        1207,
        1217,
        1218,
        1230,
        1231,
        1241,
        1242,
        1243,
        1244,
        1245,
        1246,
        1247,
        1248,
        1249,
        1250,
        1251,
        1252,
        1267,
        1268,
        1275,
        1276,
        1277,
        1281,
        1282,
        1283,
        1284,
        1286,
        1287,
        1294,
        1295,
        1306,
        1307,
        1308,
        1309,
        1310,
        1311,
        1312,
        1313,
        1314,
        1324,
        1325,
        1332,
        1333,
        1334,
        1335,
        1336,
        1337,
        1338,
        1339,
        1340,
        1345,
        1346,
        1360,
        1361,
        1362,
        1363,
        1366,
        1367,
        1368,
        1369,
        1370,
        1380,
        1381,
        1393,
        1394,
        1395,
        1398,
        1403,
        1404,
        1405,
        1406,
        1407,
        1408,
        1411,
        1412,
        1426,
        1427,
        1428,
        1429,
        1430,
        1438,
        1439,
        1449,
        1450,
        1451,
        1452,
        1454,
        1455,
        1456,
        1457,
        1458,
        1459,
        1462,
        1463,
        1471,
        1472,
        1473,
        1474,
        1475,
        1485,
        1486,
        1494,
        1496,
        1497,
        1498,
        1503,
        1504,
        1505,
        1506,
        1507,
        1508,
        1514,
        1515,
        1521,
        1522,
        1529,
        1530,
        1531,
        1536,
        1537,
        1538,
        1540,
        1541,
        1562,
        1564,
        1565,
        1566,
        1572,
        1574,
        1575,
        1576,
        1577,
        1578,
        1579,
        1584,
        1585,
        1591,
        1592,
        1604,
        1605,
        1606,
        1616,
        1617,
        1618,
        1619,
        1620,
        1643,
        1644,
        1645,
        1646,
        1658,
        1659,
        1660,
        1661,
        1662,
        1663,
        1664,
        1672,
        1673,
        1677,
        1678,
        1689,
        1690,
        1691,
        1706,
        1707,
        1708,
        1709,
        1710,
        1737,
        1740,
        1741,
        1742,
        1750,
        1751,
        1752,
        1753,
        1754,
        1755,
        1756,
        1764,
        1765,
        1769,
        1770,
        1776,
        1781,
        1782,
        1791,
        1792,
        1793,
        1794,
        1795,
        1826,
        1827,
        1828,
        1829,
        1836,
        1837,
        1838,
        1839,
        1840,
        1843,
        1844,
        1851,
        1852,
        1855,
        1856,
        1862,
        1863,
        1864,
        1876,
        1877,
        1878,
        1879,
        1880,
        1901,
        1903,
        1904,
        1905,
        1914,
        1915,
        1916,
        1917,
        1918,
        1919,
        1920,
        1927,
        1928,
        1939,
        1940,
        1957,
        1958,
        1959,
        1962,
        1964,
        1965,
        1966,
        1971,
        1972,
        1973,
        1974,
        1975,
        1976,
        1977,
        1981,
        1982,
        2004,
        2005,
        2027,
        2028,
        2051,
        2053,
        2054,
        2056,
        2059,
        2060,
        2061,
        2073,
        2074,
        2075,
        2076,
        2077,
        2078,
        2079,
        2095,
        2096,
        2102,
        2103,
        2131,
        2132,
        2133,
        2134,
        2185,
        2187,
        2188,
        2189,
        2192,
        2193,
        2194,
        2201,
        2202,
        2203,
        2204,
        2205,
        2206,
        2207,
        2222,
        2225,
        2226,
        2235,
        2236,
        2255,
        2256,
        2257,
        2258,
        2313,
        2316,
        2317,
        2320,
        2323,
        2324,
        2326,
        2336,
        2337,
        2338,
        2339,
        2340,
        2341,
        2342,
        2345,
        2350,
        2351,
        2364,
        2365,
        2387,
        2388,
        2389,
        2390,
        2433,
        2435,
        2436,
        2437,
        2439,
        2440,
        2443,
        2449,
        2450,
        2451,
        2452,
        2453,
        2454,
        2455,
        2461,
        2465,
        2466,
        2470,
        2471,
        2487,
        2488,
        2489,
        2490,
        2533,
        2536,
        2537,
        2538,
        2540,
        2541,
        2542,
        2546,
        2547,
        2548,
        2549,
        2550,
        2551,
        2552,
        2563,
        2566,
        2567,
        2572,
        2573,
        2588,
        2589,
        2590,
        2591,
        2640,
        2641,
        2642,
        2643,
        2644,
        2646,
        2647,
        2648,
        2657,
        2658,
        2659,
        2660,
        2661,
        2662,
        2663,
        2671,
        2674,
        2675,
        2681,
        2682,
        2704,
        2705,
        2706,
        2707,
        2750,
        2752,
        2753,
        2754,
        2755,
        2756,
        2757,
        2758,
        2762,
        2763,
        2764,
        2765,
        2766,
        2767,
        2768,
        2773,
        2778,
        2779,
        2791,
        2792,
        2817,
        2818,
        2819,
        2820,
        2842,
        2845,
        2846,
        2847,
        2848,
        2849,
        2850,
        2851,
        2854,
        2855,
        2856,
        2858,
        2859,
        2860,
        2863,
        2869,
        2870,
        2882,
        2883,
        2895,
        2896,
        2897,
        2898,
        2899,
        2903,
        2920,
        2924,
        2925,
        2926,
        2927,
        2928,
        2929,
        2930,
        2933,
        2934,
        2935,
        2936,
        2937,
        2940,
        2944,
        2945,
        2948,
        2949,
        2959,
        2960,
        2973,
        2974,
        2975,
        2976,
        2977,
        2980,
        3013,
        3016,
        3017,
        3018,
        3019,
        3020,
        3021,
        3022,
        3024,
        3027,
        3028,
        3029,
        3032,
        3034,
        3038,
        3046,
        3047,
        3052,
        3053,
        3057,
        3058,
        3074,
        3075,
        3076,
        3077,
        3078,
        3089,
        3123,
        3125,
        3126,
        3127,
        3128,
        3129,
        3130,
        3131,
        3132,
        3138,
        3139,
        3140,
        3141,
        3142,
        3144,
        3145,
        3146,
        3150,
        3151,
        3159,
        3160,
        3179,
        3180,
        3181,
        3182,
        3183,
        3190,
        3230,
        3232,
        3233,
        3234,
        3235,
        3236,
        3237,
        3238,
        3239,
        3240,
        3245,
        3246,
        3247,
        3248,
        3249,
        3250,
        3254,
        3255,
        3258,
        3259,
        3266,
        3267,
        3300,
        3301,
        3302,
        3303,
        3304,
        3305,
        3309,
        3331,
        3332,
        3333,
        3334,
        3335,
        3337,
        3338,
        3340,
        3341,
        3343,
        3345,
        3346,
        3347,
        3348,
        3349,
        3350,
        3357,
        3358,
        3361,
        3362,
        3370,
        3371,
        3400,
        3401,
        3402,
        3403,
        3404,
        3405,
        3415,
        3456,
        3458,
        3459,
        3460,
        3461,
        3463,
        3464,
        3466,
        3467,
        3468,
        3472,
        3473,
        3474,
        3475,
        3476,
        3477,
        3479,
        3480,
        3482,
        3483,
        3488,
        3489,
        3506,
        3508,
        3509,
        3510,
        3511,
        3512,
        3513,
        3524,
        3556,
        3557,
        3558,
        3559,
        3560,
        3563,
        3564,
        3565,
        3566,
        3567,
        3571,
        3572,
        3573,
        3575,
        3576,
        3578,
        3588,
        3589,
        3592,
        3593,
        3599,
        3600,
        3622,
        3624,
        3625,
        3626,
        3627,
        3628,
        3629,
        3646,
        3676,
        3677,
        3678,
        3679,
        3680,
        3681,
        3682,
        3683,
        3685,
        3686,
        3687,
        3692,
        3693,
        3694,
        3695,
        3696,
        3698,
        3701,
        3708,
        3709,
        3714,
        3715,
        3718,
        3719,
        3740,
        3741,
        3743,
        3745,
        3746,
        3747,
        3748,
        3749,
        3759,
        3791,
        3792,
        3793,
        3794,
        3795,
        3796,
        3798,
        3799,
        3800,
        3801,
        3802,
        3811,
        3812,
        3813,
        3814,
        3815,
        3816,
        3818,
        3826,
        3827,
        3829,
        3830,
        3839,
        3840,
        3856,
        3857,
        3858,
        3859,
        3860,
        3861,
        3872,
        3904,
        3905,
        3907,
        3908,
        3909,
        3910,
        3911,
        3912,
        3913,
        3914,
        3915,
        3916,
        3922,
        3923,
        3924,
        3925,
        3926,
        3927,
        3929,
        3933,
        3934,
        3935,
        3940,
        3941,
        3946,
        3947,
        3969,
        3970,
        3971,
        3972,
        3973,
        3974,
        3975,
        3985,
        4017,
        4020,
        4021,
        4022,
        4023,
        4024,
        4025,
        4026,
        4027,
        4028,
        4029,
        4034,
        4035,
        4036,
        4037,
        4038,
        4039,
        4042,
        4050,
        4051,
        4052,
        4053,
        4054,
        4058,
        4059,
        4069,
        4071,
        4072,
        4073,
        4074,
        4075,
        4076,
        4082,
        4100,
        4102,
        4103,
        4104,
        4105,
        4106,
        4108,
        4109,
        4112,
        4113,
        4114,
        4115,
        4116,
        4117,
        4118,
        4119,
        4120,
        4121,
        4122,
        4127,
        4128,
        4129,
        4130,
        4131,
        4144,
        4145,
        4158,
        4160,
        4161,
        4162,
        4163,
        4164,
        4165,
        4166,
        4172,
        4175,
        4177,
        4178,
        4201,
        4202,
        4203,
        4204,
        4205,
        4206,
        4207,
        4208,
        4210,
        4211,
        4212,
        4213,
        4214,
        4223,
        4224,
        4225,
        4226,
        4227,
        4228,
        4229,
        4234,
        4235,
        4236,
        4237,
        4238,
        4248,
        4261,
        4263,
        4264,
        4265,
        4266,
        4267,
        4268,
        4269,
        4270,
        4285,
        4288,
        4292,
        4298,
        4299,
        4318,
        4322,
        4323,
        4324,
        4325,
        4326,
        4329,
        4330,
        4333,
        4334,
        4336,
        4338,
        4339,
        4340,
        4341,
        4342,
        4345,
        4350,
        4351,
        4352,
        4353,
        4354,
        4366,
        4367,
        4380,
        4382,
        4387,
        4388,
        4389,
        4390,
        4391,
        4392,
        4393,
        4399,
        4403,
        4411,
        4415,
        4416,
        4426,
        4427,
        4444,
        4445,
        4446,
        4447,
        4448,
        4449,
        4450,
        4451,
        4452,
        4453,
        4457,
        4458,
        4459,
        4460,
        4462,
        4464,
        4466,
        4467,
        4475,
        4476,
        4477,
        4478,
        4479,
        4498,
        4499,
        4507,
        4509,
        4510,
        4511,
        4512,
        4513,
        4514,
        4515,
        4524,
        4525,
        4526,
        4533,
        4539,
        4540,
        4549,
        4550,
        4563,
        4566,
        4568,
        4569,
        4570,
        4571,
        4573,
        4574,
        4575,
        4576,
        4578,
        4582,
        4583,
        4584,
        4585,
        4586,
        4587,
        4588,
        4596,
        4597,
        4598,
        4599,
        4600,
        4601,
        4609,
        4610,
        4624,
        4626,
        4627,
        4628,
        4629,
        4630,
        4631,
        4632,
        4638,
        4646,
        4652,
        4653,
        4659,
        4660,
        4669,
        4672,
        4673,
        4674,
        4675,
        4677,
        4678,
        4681,
        4682,
        4683,
        4687,
        4688,
        4689,
        4690,
        4691,
        4692,
        4693,
        4702,
        4703,
        4704,
        4705,
        4706,
        4707,
        4708,
        4723,
        4724,
        4737,
        4739,
        4740,
        4741,
        4742,
        4743,
        4744,
        4745,
        4746,
        4759,
        4768,
        4772,
        4773,
        4779,
        4795,
        4801,
        4802,
        4803,
        4804,
        4806,
        4807,
        4809,
        4810,
        4812,
        4820,
        4821,
        4822,
        4823,
        4825,
        4826,
        4828,
        4829,
        4838,
        4839,
        4840,
        4841,
        4842,
        4843,
        4844,
        4845,
        4858,
        4859,
        4890,
        4891,
        4892,
        4894,
        4895,
        4896,
        4897,
        4898,
        4899,
        4900,
        4911,
        4912,
        4913,
        4915,
        4921,
        4924,
        4925,
        4935,
        4936,
        4957,
        4959,
        4960,
        4961,
        4962,
        4964,
        4965,
        4966,
        4967,
        4969,
        4970,
        4973,
        4977,
        4978,
        4979,
        4980,
        4981,
        4982,
        4990,
        4991,
        4992,
        4993,
        4994,
        4996,
        4997,
        4998,
        5025,
        5028,
        5031,
        5032,
        5033,
        5034,
        5035,
        5036,
        5037,
        5045,
        5046,
        5047,
        5049,
        5054,
        5055,
        5059,
        5060,
        5071,
        5072,
        5105,
        5107,
        5108,
        5109,
        5110,
        5116,
        5118,
        5119,
        5120,
        5122,
        5123,
        5124,
        5126,
        5127,
        5128,
        5137,
        5138,
        5139,
        5140,
        5141,
        5142,
        5143,
        5144,
        5174,
        5176,
        5178,
        5179,
        5180,
        5181,
        5182,
        5183,
        5184,
        5188,
        5189,
        5195,
        5200,
        5201,
        5202,
        5205,
        5206,
        5207,
        5208,
        5213,
        5214,
        5232,
        5233,
        5234,
        5235,
        5236,
        5237,
        5238,
        5239,
        5240,
        5241,
        5242,
        5245,
        5248,
        5249,
        5250,
        5253,
        5254,
        5256,
        5260,
        5261,
        5262,
        5263,
        5264,
        5266,
        5267,
        5268,
        5289,
        5290,
        5292,
        5293,
        5294,
        5295,
        5296,
        5297,
        5298,
        5299,
        5300,
        5306,
        5308,
        5309,
        5310,
        5319,
        5320,
        5327,
        5328,
        5339,
        5340,
        5352,
        5353,
        5354,
        5355,
        5356,
        5357,
        5358,
        5359,
        5361,
        5366,
        5367,
        5368,
        5369,
        5370,
        5371,
        5376,
        5380,
        5381,
        5382,
        5383,
        5384,
        5385,
        5386,
        5387,
        5418,
        5419,
        5421,
        5422,
        5423,
        5424,
        5425,
        5426,
        5427,
        5430,
        5431,
        5438,
        5439,
        5440,
        5441,
        5448,
        5449,
        5454,
        5455,
        5460,
        5461,
        5482,
        5483,
        5484,
        5485,
        5486,
        5488,
        5489,
        5490,
        5491,
        5499,
        5500,
        5501,
        5502,
        5503,
        5504,
        5511,
        5515,
        5516,
        5517,
        5518,
        5519,
        5520,
        5521,
        5522,
        5538,
        5556,
        5557,
        5559,
        5560,
        5561,
        5562,
        5563,
        5564,
        5565,
        5570,
        5571,
        5577,
        5579,
        5580,
        5582,
        5587,
        5588,
        5592,
        5593,
        5601,
        5627,
        5628,
        5629,
        5630,
        5631,
        5633,
        5634,
        5635,
        5636,
        5639,
        5640,
        5641,
        5643,
        5644,
        5645,
        5652,
        5653,
        5654,
        5655,
        5656,
        5657,
        5658,
        5659,
        5660,
        5672,
        5696,
        5697,
        5698,
        5700,
        5701,
        5702,
        5703,
        5704,
        5705,
        5706,
        5710,
        5711,
        5715,
        5716,
        5717,
        5719,
        5723,
        5724,
        5727,
        5728,
        5738,
        5764,
        5765,
        5766,
        5767,
        5769,
        5770,
        5771,
        5772,
        5782,
        5783,
        5784,
        5786,
        5787,
        5788,
        5794,
        5798,
        5799,
        5800,
        5801,
        5802,
        5803,
        5804,
        5805,
        5815,
        5816,
        5837,
        5838,
        5839,
        5840,
        5842,
        5843,
        5844,
        5845,
        5846,
        5847,
        5848,
        5850,
        5851,
        5855,
        5857,
        5858,
        5860,
        5871,
        5872,
        5874,
        5875,
        5899,
        5900,
        5901,
        5902,
        5905,
        5906,
        5907,
        5908,
        5913,
        5914,
        5915,
        5916,
        5917,
        5918,
        5920,
        5926,
        5927,
        5928,
        5929,
        5930,
        5931,
        5932,
        5933,
        5940,
        5941,
        5963,
        5964,
        5965,
        5966,
        5967,
        5968,
        5969,
        5970,
        5972,
        5973,
        5974,
        5975,
        5976,
        5978,
        5979,
        5982,
        5983,
        5990,
        5994,
        5995,
        5997,
    ]

    index = int(os.environ["PBS_ARRAY_INDEX"])

    if indices is not None:
        index = indices[index]

    print("Index:", index)

    X_train, X_test, y_train, y_test = data_split_cache.load()
    rf = get_model()

    job_samples = 50

    tree_path_dependent_shap_interact_cache = SimpleCache(
        f"tree_path_dependent_shap_interact_{index}_{job_samples}",
        cache_dir=os.path.join(CACHE_DIR, "shap_interaction"),
    )

    @tree_path_dependent_shap_interact_cache
    def cached_get_interact_shap_values(model, X):
        return get_shap_values(model, X, interaction=True)

    cached_get_interact_shap_values(
        rf, X_train[index * job_samples : (index + 1) * job_samples]
    )
def func():
    # Used to re-compute specific failed jobs, `None` otherwise.
    indices = [
        2,
        3,
        49,
        87,
        88,
        99,
        108,
        148,
        152,
        153,
        170,
        238,
        239,
        275,
        276,
        296,
        297,
        302,
        303,
        348,
        349,
        350,
        373,
        440,
        441,
        442,
        454,
        515,
        532,
        551,
        552,
        579,
        581,
        603,
        607,
        608,
        618,
        620,
        625,
        646,
        647,
        648,
        669,
        686,
        701,
        743,
        750,
        752,
        850,
        852,
        867,
        894,
        896,
        944,
        945,
        980,
        983,
        984,
        985,
        987,
        989,
        990,
        991,
        1006,
        1009,
        1010,
        1020,
        1021,
        1072,
        1099,
        1182,
        1205,
        1211,
        1215,
        1237,
        1262,
        1263,
        1264,
        1271,
        1295,
        1296,
        1297,
        1310,
        1311,
        1314,
        1315,
        1316,
        1324,
        1339,
        1345,
        1390,
        1405,
        1521,
        1545,
        1546,
        1555,
        1582,
        1671,
        1835,
        1875,
        1876,
        2182,
        2399,
        2551,
        2605,
        2663,
        2726,
        2807,
        2826,
        2918,
        2971,
        2972,
        3006,
        3054,
        3055,
        3061,
        3068,
        3088,
        3092,
        3093,
        3094,
        3105,
        3108,
        3126,
        3175,
        3211,
        3215,
        3226,
        3227,
        3233,
        3235,
        3247,
        3251,
        3284,
        3290,
        3291,
        3292,
        3297,
        3308,
        3352,
        3375,
        3376,
        3392,
        3396,
        3397,
        3400,
        3444,
        3477,
        3478,
        3502,
        3515,
        3530,
        3650,
        3651,
        3675,
        3731,
        3757,
        3758,
        3768,
        3812,
        3813,
        3841,
        3852,
        3886,
        3919,
        3922,
        3925,
        3961,
        3963,
        4020,
        4021,
        4090,
        4125,
        4148,
        4177,
        4203,
        4212,
        4246,
        4247,
        4276,
        4310,
        4312,
        4339,
        4340,
        4365,
        4366,
        4371,
        4396,
        4406,
        4407,
        4408,
        4409,
        4428,
        4430,
        4431,
        4462,
        4483,
        4484,
        4486,
        4508,
        4546,
        4559,
        4595,
        4605,
        4656,
        4684,
        4698,
        4713,
        4746,
        4806,
        4826,
        4874,
        4887,
        4909,
        4993,
        4994,
        4995,
        4996,
        4997,
        5001,
        5002,
        5006,
        5008,
        5021,
        5055,
        5068,
        5084,
        5086,
        5137,
        5148,
        5187,
        5271,
        5272,
        5273,
        5274,
        5290,
        5291,
        5303,
        5304,
        5412,
        5413,
        5416,
        5432,
        5485,
        5507,
        5509,
        5511,
        5512,
        5513,
        5514,
        5515,
        5516,
        5517,
        5518,
        5519,
        5520,
        5584,
        5586,
        5607,
        5654,
        5655,
        5656,
        5658,
        5714,
        5715,
        5719,
        5720,
        5721,
        5722,
        5727,
        5728,
        5729,
        5735,
        5736,
        5739,
        5741,
        5827,
        5828,
        5887,
        5888,
        5889,
        5890,
        5891,
        5892,
        5893,
        5934,
        5935,
        5936,
        5937,
        5938,
        5939,
        5940,
        5965,
        5966,
        5967,
        5968,
    ]

    index = int(os.environ["PBS_ARRAY_INDEX"])

    if indices is not None:
        index = indices[index]

    print("Index:", index)

    X_train, X_test, y_train, y_test = data_split_cache.load()
    rf = get_model()

    job_samples = 50

    tree_path_dependent_shap_interact_cache = SimpleCache(
        f"tree_path_dependent_shap_interact_{index}_{job_samples}",
        cache_dir=os.path.join(CACHE_DIR, "shap_interaction"),
    )

    @tree_path_dependent_shap_interact_cache
    def cached_get_interact_shap_values(model, X):
        return get_shap_values(model, X, interaction=True)

    cached_get_interact_shap_values(
        rf, X_train[index * job_samples:(index + 1) * job_samples])
def func():
    # Used to re-compute specific failed jobs, `None` otherwise.
    indices = [
        2,
        11,
        12,
        13,
        121,
        122,
        123,
        124,
        125,
        126,
        127,
        128,
        129,
        130,
        131,
        132,
        133,
        134,
        135,
        202,
        203,
        205,
        206,
        209,
        210,
        211,
        212,
        220,
        221,
        222,
        223,
        224,
        225,
        226,
        227,
        228,
        229,
        230,
        231,
        232,
        235,
        236,
        237,
        238,
        242,
        243,
        250,
        251,
        254,
        256,
        265,
        277,
        307,
        387,
        388,
        414,
        415,
        427,
        428,
        429,
        432,
        433,
        447,
        488,
        489,
        494,
        550,
        557,
        573,
        574,
        585,
        633,
    ]

    index = int(os.environ["PBS_ARRAY_INDEX"])

    if indices is not None:
        index = indices[index]

    print("Index:", index)

    X_train, X_test, y_train, y_test = data_split_cache.load()
    rf = get_model()

    job_samples = 2000

    tree_path_dependent_shap_cache = SimpleCache(
        f"tree_path_dependent_shap_{index}_{job_samples}",
        cache_dir=os.path.join(CACHE_DIR, "shap"),
    )

    @tree_path_dependent_shap_cache
    def cached_get_shap_values(model, X):
        return get_shap_values(model, X, interaction=False)

    cached_get_shap_values(
        rf, X_train[index * job_samples:(index + 1) * job_samples])
def func():
    # Used to re-compute specific failed jobs, `None` otherwise.
    indices = [
        3,
        4,
        154,
        155,
        211,
        240,
        251,
        289,
        293,
        294,
        330,
        331,
        334,
        345,
        380,
        381,
        392,
        410,
        421,
        422,
        423,
        439,
        460,
        461,
        467,
        468,
        483,
        503,
        516,
        522,
        523,
        528,
        536,
        539,
        540,
        541,
        542,
        543,
        558,
        560,
        564,
        567,
        568,
        580,
        585,
        586,
        590,
        591,
        617,
        618,
        619,
        620,
        625,
        626,
        633,
        658,
        659,
        660,
        661,
        662,
        663,
        668,
        687,
        688,
        689,
        691,
        692,
        693,
        694,
        695,
        696,
        697,
        698,
        700,
        702,
        703,
        721,
        746,
        754,
        755,
        762,
        763,
        790,
        791,
        792,
        793,
        794,
        798,
        806,
        814,
        818,
        827,
        828,
        829,
        832,
        844,
        845,
        861,
        862,
        863,
        864,
        866,
        884,
        888,
        889,
        890,
        891,
        892,
        897,
        900,
        902,
        903,
        904,
        905,
        906,
        910,
        911,
        912,
        913,
        927,
        928,
        929,
        930,
        937,
        938,
        948,
        949,
        950,
        952,
        953,
        956,
        960,
        962,
        974,
        975,
        976,
        977,
        978,
        980,
        982,
        983,
    ]

    index = int(os.environ["PBS_ARRAY_INDEX"])

    if indices is not None:
        index = indices[index]

    print("Index:", index)

    X_train, X_test, y_train, y_test = data_split_cache.load()
    results, rf = cross_val_cache.load()

    job_samples = 2000

    tree_path_dependent_shap_cache = SimpleCache(
        f"tree_path_dependent_shap_{index}_{job_samples}",
        cache_dir=os.path.join(CACHE_DIR, "shap"),
    )

    @tree_path_dependent_shap_cache
    def get_interact_shap_values(model, X):
        return get_shap_values(model, X, interaction=False)

    get_interact_shap_values(
        rf, X_train[index * job_samples:(index + 1) * job_samples])
def func():
    # Used to re-compute specific failed jobs, `None` otherwise.
    indices = [
        108,
        148,
        153,
        454,
        515,
        532,
        551,
        581,
        603,
        607,
        608,
        618,
        646,
        647,
        648,
        669,
        850,
        852,
        867,
        944,
        945,
        983,
        984,
        985,
        987,
        989,
        991,
        1006,
        1009,
        1010,
        1020,
        1072,
        1182,
        1205,
        1211,
        1215,
        1237,
        1262,
        1263,
        1271,
        1295,
        1296,
        1310,
        1314,
        1315,
        1324,
        1339,
        1345,
        1390,
        1405,
        1521,
        1546,
        1555,
        1582,
        1671,
        1835,
        2182,
        2399,
        2826,
        2918,
        2971,
        2972,
        3006,
        3061,
        3092,
        3093,
        3211,
        3227,
        3233,
        3297,
        3308,
        3396,
        3397,
        4125,
        4148,
        4177,
        4203,
        4312,
        4339,
        4340,
        4365,
        4366,
        4371,
        4406,
        4407,
        4408,
        4430,
        4431,
        4483,
        4484,
        4486,
        4546,
        4559,
        4713,
        4994,
        4996,
        5940,
        5965,
    ]

    index = int(os.environ["PBS_ARRAY_INDEX"])

    if indices is not None:
        index = indices[index]

    print("Index:", index)

    X_train, X_test, y_train, y_test = data_split_cache.load()
    rf = get_model()

    job_samples = 50

    tree_path_dependent_shap_interact_cache = SimpleCache(
        f"tree_path_dependent_shap_interact_{index}_{job_samples}",
        cache_dir=os.path.join(CACHE_DIR, "shap_interaction"),
    )

    @tree_path_dependent_shap_interact_cache
    def cached_get_interact_shap_values(model, X):
        return get_shap_values(model, X, interaction=True)

    cached_get_interact_shap_values(
        rf, X_train[index * job_samples:(index + 1) * job_samples])
Exemplo n.º 18
0
def func():
    # Used to re-compute specific failed jobs, `None` otherwise.
    indices = [
        32,
        71,
        277,
        278,
        279,
        280,
        281,
        282,
        283,
        284,
        339,
        340,
        341,
        342,
        343,
        344,
        379,
        481,
        483,
        498,
        500,
        515,
        516,
        517,
        518,
        519,
        520,
        521,
        522,
        523,
        524,
        564,
        565,
        566,
        589,
        903,
        904,
        905,
        906,
        907,
        908,
        914,
        915,
        994,
        995,
        1016,
        1023,
        1024,
        1025,
        1026,
        1085,
        1103,
        1107,
        1123,
        1126,
        1127,
        1128,
        1243,
        1271,
        1272,
        1324,
        1378,
        1385,
        1386,
        1387,
        1388,
        1389,
        1390,
        1391,
        1403,
        1404,
        1416,
        1418,
        1438,
        1440,
        1455,
        1456,
        1457,
        1589,
        1592,
        1626,
        1627,
        1629,
        1675,
        1676,
        2008,
        2009,
        2010,
        2153,
        2160,
        2164,
        2167,
        2169,
        2205,
        2208,
        2248,
        2249,
        2250,
        2277,
        2297,
        2298,
        2299,
        2328,
        2337,
        2342,
        2343,
        2379,
        2381,
        2382,
        2383,
        2604,
        2919,
        2920,
        3036,
        3048,
        3049,
        3050,
        3051,
        3052,
        3059,
        3065,
        3066,
        3067,
        3068,
        3075,
        3076,
        3077,
        3078,
        3079,
        3080,
        3081,
        3082,
        3083,
        3085,
        3091,
        3092,
        3093,
        3094,
        3095,
        3102,
        3103,
        3104,
        3105,
        3106,
        3107,
        3108,
        3109,
        3110,
        3111,
        3112,
        3113,
        3114,
        3115,
        3124,
        3126,
        3170,
        3171,
        3299,
        3301,
        3307,
        3343,
        3716,
        3733,
        3734,
        3735,
        3736,
        3751,
        3753,
        3757,
        3817,
        3818,
        3828,
        4046,
        4047,
        4048,
        4049,
        4050,
        4051,
        4052,
        4053,
        4054,
        4055,
        4056,
        4057,
        4058,
        4059,
        4060,
        4061,
        4062,
        4063,
        4064,
        4065,
        4066,
        4067,
        4074,
        4075,
        4080,
        4081,
        4082,
        4083,
        4084,
        4085,
        4086,
        4087,
        4088,
        4089,
        4090,
        4091,
        4092,
        4093,
        4094,
        4095,
        4096,
        4097,
        4098,
        4099,
        4100,
        4101,
        4102,
        4336,
        4346,
        4347,
        4384,
        4385,
        4386,
        4387,
        4388,
        4389,
        4404,
        4420,
        4422,
        4475,
        4483,
        4508,
        4512,
        4527,
        4528,
        4607,
        4608,
        4609,
        4610,
        4611,
        4612,
        4613,
        4614,
        4615,
        4616,
        4694,
        4695,
        4696,
        4697,
        4729,
        4730,
        4740,
        4761,
        4837,
        4838,
        4880,
        4881,
        4882,
        4991,
        4992,
        5032,
        5061,
        5087,
        5096,
        5186,
        5187,
        5188,
        5189,
        5190,
        5191,
        5192,
        5193,
        5199,
        5407,
        5408,
        5451,
        5452,
        5511,
        5598,
        5599,
        5600,
        5601,
        5602,
        5603,
        5604,
        5605,
        5606,
        5607,
        5608,
        5620,
        5662,
        5667,
        5699,
        5700,
        5757,
        5763,
        5852,
        5853,
        5854,
        5855,
        5856,
        5857,
        5941,
        5991,
    ]

    index = int(os.environ["PBS_ARRAY_INDEX"])

    if indices is not None:
        index = indices[index]

    print("Index:", index)

    X_train, X_test, y_train, y_test = data_split_cache.load()
    results, rf = cross_val_cache.load()

    job_samples = 50

    tree_path_dependent_shap_interact_cache = SimpleCache(
        f"tree_path_dependent_shap_interact_{index}_{job_samples}",
        cache_dir=os.path.join(CACHE_DIR, "shap_interaction"),
    )

    @tree_path_dependent_shap_interact_cache
    def get_interact_shap_values(model, X):
        return get_shap_values(model, X, interaction=True)

    get_interact_shap_values(
        rf, X_train[index * job_samples:(index + 1) * job_samples])