Exemplo n.º 1
0
def plot_factors(spread_factors,
                 save_name,
                 x_lim,
                 y_lim,
                 show=False,
                 train_size=1000,
                 font_size=18):
    setting_spread = copy.deepcopy(setting)
    setting_spread.update({
        "network_name": "SpreadNet",
        "line_title2": "$Spread_{PH}$",
        "plot_colors": ["r", "g", "b"],
        "plot_marker": [" "],
        "train_size": train_size,
    })

    setting_dense_spread = copy.deepcopy(setting)
    setting_dense_spread.update({
        "network_name": "DenseSpreadNet",
        "line_title2": "$MLP_{RT}$",
        "plot_colors": ["r", "g", "b"],
        "plot_marker": ["-"],
        "train_size": train_size,
    })
    settings_spread = []
    settings_dense_spread = []
    colors = ["r", "g", "b", "y", "g", "b"]
    for spread_factor, color in zip(spread_factors, colors):
        print(spread_factor)
        s_spread = copy.deepcopy(setting_spread)
        s_dense_spread = copy.deepcopy(setting_dense_spread)
        s_spread.update({
            "spread_factor":
            spread_factor,
            "plot_colors": [color],
            "plot_markers": [" "],
            "line_title2":
            s_spread['line_title2'] + " sf " + str(spread_factor)
        })
        s_dense_spread.update({
            "spread_factor":
            spread_factor,
            "plot_colors": [color],
            "plot_markers": ["h"],
            "line_title2":
            s_dense_spread['line_title2'] + " sf " + str(spread_factor)
        })
        settings_spread.append(s_spread)
        settings_dense_spread.append(s_dense_spread)
    network_settings = {
        "SpreadNet": settings_spread,
        # "DenseSpreadNet": settings_dense_spread
    }
    plot.create_plot(network_settings,
                     save_name,
                     x_lim,
                     y_lim,
                     font_size=font_size)
    if show:
        plt.show()
Exemplo n.º 2
0
def plot_train_size(train_size, save_name, x_lim, y_lim, show=False):
    setting_spread = copy.deepcopy(setting)
    setting_spread.update({
        "network_name": "SpreadNet",
        "line_title2": "$Spread_{PH}$",
        "plot_colors": ["g"],
        "train_size": train_size
    })

    setting_dense = copy.deepcopy(setting)
    setting_dense.update({
        "network_name": "DenseNet",
        "line_title2": "$MLP_{best}$",
        "plot_colors": ["r"],
        "spread_factor": 1,
        "train_size": train_size
    })

    setting_dense_spread = copy.deepcopy(setting)
    setting_dense_spread.update({
        "network_name": "DenseSpreadNet",
        "line_title2": "$MLP_{RT}$",
        "plot_colors": ["b"],
        "train_size": train_size
    })
    network_settings = {
        "SpreadNet": [setting_spread],
        "DenseNet": [setting_dense],
        "DenseSpreadNet": [setting_dense_spread]
    }
    plot.create_plot(network_settings, save_name, x_lim, y_lim)
    if show:
        plt.plot()
Exemplo n.º 3
0
def plot_batch(batch_sizes,
               save_name,
               x_lim,
               y_lim,
               show=False,
               train_size=1000):
    setting_spread = copy.deepcopy(setting)
    setting_spread.update({
        "network_name": "SpreadNet",
        "line_title2": "$Spread_{PH}$",
        "plot_colors": ["r", "g", "b"],
        "plot_marker": [" "],
        "train_size": train_size,
    })

    setting_dense_spread = copy.deepcopy(setting)
    setting_dense_spread.update({
        "network_name": "DenseSpreadNet",
        "line_title2": "$MLP_{RT}$",
        "plot_colors": ["r", "g", "b"],
        "plot_marker": ["-"],
        "train_size": train_size,
    })
    settings_spread = []
    settings_dense_spread = []
    colors = ["r", "g", "b", "y", "g", "b"]
    for batch_size, color in zip(batch_sizes, colors):
        print(batch_size)
        s_spread = copy.deepcopy(setting_spread)
        s_dense_spread = copy.deepcopy(setting_dense_spread)
        s_spread.update({
            "batch_size":
            batch_size,
            "plot_colors": [color],
            "plot_markers": [" "],
            "line_title2":
            s_spread['line_title2'] + " batch size  " + str(batch_size)
        })
        s_dense_spread.update({
            "batch_size":
            batch_size,
            "plot_colors": [color],
            "plot_markers": ["h"],
            "line_title2":
            s_dense_spread['line_title2'] + " batch size " + str(batch_size)
        })
        settings_spread.append(s_spread)
        settings_dense_spread.append(s_dense_spread)
    network_settings = {
        "SpreadNet": settings_spread,
        "DenseSpreadNet": settings_dense_spread
    }
    plot.create_plot(network_settings, save_name, x_lim, y_lim)
    if show:
        plt.show()
Exemplo n.º 4
0
def plot_factors(spread_factors,
                 save_name,
                 x_lim,
                 y_lim,
                 show=False,
                 train_size=1000,
                 font_size=18):
    setting_spread = copy.deepcopy(setting)
    setting_spread.update({
        "network_name": "SpreadNet",
        "line_title2": "$Spread_{PH}$",
        "plot_colors": ["r", "g", "b", "g"],
        "plot_marker": [" "],
        "train_size": train_size,
    })

    setting_spread_norm = copy.deepcopy(setting)
    setting_spread_norm.update({
        "network_name": "DenseNorm",
        "line_title2": "$Spread_{V2}$",
        "plot_colors": ["r", "g", "b", "g"],
        "plot_marker": [" "],
        "train_size": train_size,
    })

    setting_dense_batch = copy.deepcopy(setting)
    setting_dense_batch.update({
        "network_name": "DenseBatch",
        "line_title2": "$DenseBatch_{RT}$",
        "plot_colors": ["r", "g", "b", "g"],
        "plot_marker": ["-"],
        "train_size": train_size,
    })

    setting_mlp_best = copy.deepcopy(setting)
    setting_mlp_best.update({
        "network_name": "DenseNet",
        "line_title2": "$MLP_{BEST}$",
        "plot_colors": ["r", "g", "b", "g"],
        "plot_marker": ["<"],
        "train_size": train_size,
    })
    setting_spreadv3 = copy.deepcopy(setting)
    setting_spreadv3.update({
        "network_name": "SpreadV3",
        "line_title2": "$Spread_{V3}$",
        "plot_colors": ["r", "g", "b"],
        "plot_marker": [" "],
        "train_size": train_size
    })
    settings_spread_norm = []
    settings_spread = []
    settings_dense_batch = []
    settings_spread_v3 = []
    colors = ["r", "g", "b", "y", "g", "b", "g", "r"]
    for spread_factor, color in zip(spread_factors, colors):
        print(spread_factor)
        s_spread_norm = copy.deepcopy(setting_spread_norm)
        s_spread_norm.update({
            "spread_factor":
            spread_factor,
            "plot_colors": [color],
            "plot_markers": [" "],
            "line_title2":
            s_spread_norm['line_title2'] + " sf " + str(spread_factor)
        })
        settings_spread_norm.append(s_spread_norm)

        s_spread_v3 = copy.deepcopy(setting_spreadv3)
        s_spread_v3.update({
            "experiment":
            "",
            "spread_factor":
            spread_factor,
            "plot_colors": [color],
            "plot_markers": [">"],
            "line_title2":
            s_spread_v3['line_title2'] + " sf " + str(spread_factor)
        })
        settings_spread_v3.append(s_spread_v3)

        s_spread = copy.deepcopy(setting_spread)
        s_spread.update({
            "experiment":
            '3',
            "spread_factor":
            spread_factor,
            "plot_colors": [color],
            "plot_markers": [">"],
            "line_title2":
            s_spread['line_title2'] + " sf " + str(spread_factor)
        })
        settings_spread.append(s_spread)

        s_dense_spread = copy.deepcopy(setting_dense_batch)
        s_dense_spread.update({
            "spread_factor":
            spread_factor,
            "plot_colors": [color],
            "plot_markers": ["h"],
            "line_title2":
            s_dense_spread['line_title2'] + " sf " + str(spread_factor)
        })
        settings_dense_batch.append(s_dense_spread)

    settings_mlp_best = []
    s_mlp_best = copy.deepcopy(setting_mlp_best)
    s_mlp_best.update({
        "experiment": '3',
        "spread_factor": 1,
        "plot_colors": ['silver'],
        "plot_markers": ["<"],
        "line_title2": s_mlp_best['line_title2']
    })
    settings_mlp_best.append(s_mlp_best)

    network_settings = {
        # "DenseNorm": settings_spread_norm,
        # "DenseBatch": settings_dense_batch,
        "SpreadV3": settings_spread_v3,
        # "SpreadNet": settings_spread,
        # "DenseNet": settings_mlp_best
    }
    plot.create_plot(network_settings,
                     save_name,
                     x_lim,
                     y_lim,
                     font_size=font_size,
                     show_acc=False,
                     show_loss=False)
    if show:
        plt.show()
Exemplo n.º 5
0
def plot_train_size(train_size,
                    save_name,
                    x_lim,
                    y_lim,
                    show=False,
                    font_size=18):
    setting_spread = copy.deepcopy(setting)
    setting_spread.update({
        "network_name": "SpreadNet",
        "line_title2": "$Spread_{PH}$",
        "plot_colors": ["g"],
        "train_size": train_size
    })

    setting_dense = copy.deepcopy(setting)
    setting_dense.update({
        "network_name": "DenseNet",
        "line_title2": "$MLP_{best}$",
        "plot_colors": ["r"],
        "spread_factor": 1,
        "train_size": train_size
    })

    setting_dense_spread = copy.deepcopy(setting)
    setting_dense_spread.update({
        "network_name": "DenseSpreadNet",
        "line_title2": "$MLP_{RT}$",
        "plot_colors": ["b"],
        "train_size": train_size
    })

    setting_spread_v3 = copy.deepcopy(setting)
    setting_spread_v3.update({
        "network_name": "SpreadV3",
        "line_title2": "$Spread_{V3}$",
        "plot_colors": ["y"],
        "experiment": '',
        "train_size": train_size
    })

    setting_dense_bn = copy.deepcopy(setting)
    setting_dense_bn.update({
        "network_name": "DenseNorm",
        "line_title2": "$Dense_{BN}$",
        "plot_colors": ["brown"],
        "experiment": '',
        "train_size": train_size
    })

    network_settings = {
        "SpreadNet": [setting_spread],
        "DenseNet": [setting_dense],
        "DenseSpreadNet": [setting_dense_spread],
        "SpreadV3": [setting_spread_v3],
        "DenseNorm": [setting_dense_bn],
    }
    plot.create_plot(network_settings,
                     save_name,
                     x_lim,
                     y_lim,
                     font_size=font_size)
    if show:
        plt.plot()