Beispiel #1
0
def graph(id):
    if id == 0:
        Graphs().cases_of_the_world(write=True)
        return render_template("./graphs/world.html")

    data = DataProcessing().all_cases_per_day_where_country_id_equal(
        country_id=id)
    df = DataProcessing().get_dateframe(data=data)
    get_graph = Graphs().get_graph(dataframe=df, country_id=id, write=True)
    return render_template("./graphs/" + get_graph[1] + ".html")
Beispiel #2
0
def graph_diff(id):
    if id == 0:
        data = DataProcessing().total_cases_per_day()
        df = DataProcessing().get_dateframe_diff(data=data)
        Graphs().get_graph(dataframe=df, country_id=0, write=True, diff=True)
        return render_template("./graphs/world-diff.html")

    data = DataProcessing().all_cases_per_day_where_country_id_equal(
        country_id=id)
    df = DataProcessing().get_dateframe_diff(data=data)
    get_graph = Graphs().get_graph(dataframe=df,
                                   country_id=id,
                                   write=True,
                                   diff=True)
    return render_template("./graphs/" + get_graph[1] + ".html")
Beispiel #3
0
def main():
    '''
    In this method we ask the user if they want to enter a show, and if they
    type 'N' the program defaults to Family Guy and American Dad. Due to an
    error in the IMDb PY data base, whenever Family Guy is searched the first
    output is "The Sorpranos". After testing we found that, this error does not
    happen on most tv shows. To fix this we coded in an index feature for
    each of the data sets. if the user wants to put in their own TV show the
    are prompted to selct theirapportare show from a list. From there we create
    the dataset and graph them 3 different ways.
    '''
    reader = GetCSV()
    if input("Do you want to input TV shows? Y or N : ") == "Y":
        string1 = input("Enter 1st TV show: ")
        string2 = input("Enter 2nd TV show: ")
        print()
        list1 = reader.get_ttcode_list(string1)
        print("Top 5 Search Results for ", string1, " :")
        # print(list1)
        for i in range(5):
            print((i + 1), ". ", list1[i])
        print()
        print('Select which show you prefer by their number.')
        # print('Index goes up by one after every line. Start from the top.')
        index1 = input("Select the index you prefer: ")
        index1 = str(int(index1) - 1)
        # index1 -= 1
        print('\n')
        list2 = reader.get_ttcode_list(string2)
        # print(list2)
        print()
        print("Top 5 Search Results for ", string2, " :")
        # print(list2)
        for i in range(5):
            print((i + 1), ". ", list2[i])
        print()
        print('Select the show that you prefer by their number.')
        # print('Index goes up by one after every line. Start from the top.')
        index2 = input("Select the index you prefer: ")
        index2 = str(int(index2) - 1)
        # index2 -= 1
    else:
        string1 = "Family Guy"
        string2 = "American Dad"
        index1 = 1
        index2 = 0
    print("Please hold while we scrape your data")
    graphs = Graphs()
    tt_string1 = reader.get_ttcode(string1, index1)
    season_length1 = reader.get_season_length(tt_string1)
    # print(tt_string1, season_length1)
    data1 = reader.get_csv(tt_string1, season_length1, string1)

    tt_string2 = reader.get_ttcode(string2, index2)
    season_length2 = reader.get_season_length(tt_string2)
    data2 = reader.get_csv(tt_string2, season_length2, string2)
    graphs.testing(data1, data2, string1, string2)
    graphs.scatterplot(data1, data2, string1, string2)
    graphs.boxplot(data1, data2, string1, string2)
    graphs.multi(data1, data2, string1, string2)
Beispiel #4
0
def main():
    try:
        # Initialization
        args = handle_args()
        init_logging(args)

        # Getting data from external resources
        balances = []
        for s in args.sources:
            src = source_classes[s]()
            balance = src.get_balance()
            balances.append((s, balance))

            logging.info(u'%s: %s', s, balance)

        # Write received data (and only if all sources returned data successfully)
        now_str = time.strftime(u'%d.%m.%Y %H:%M')
        for source, balance in balances:
            log_fname = u'logs/%s.log' % source

            with open(log_fname, u'a') as f:
                f.write(u'%s, %.2f\n' % (now_str, balance.value))

            logging.info(u'Updated file %s' % log_fname)

        # Generate html file with fancy graphs
        Graphs().generate_html()
    except Exception as e:
        # We want to notify user that error happened
        write_exception(e)
        raise
Beispiel #5
0
    def testbasics(self):
        test_graph = Graphs()
        self.assertFalse(test_graph.addEdge("A", "B"))

        test_graph.addVertex("A")
        self.assertFalse(test_graph.addEdge("A", "B"))

        test_graph.addVertex("B")

        checkgrpah = {"A": ["B"], "B": ["A"]}

        test_graph.addEdge("A", "B")

        self.assertEqual(checkgrpah, test_graph.returnGraph())

        test_graph.addVertex("C")
        test_graph.addVertex("D")

        test_graph.addEdge("A", "C")
        test_graph.addEdge("A", "D")

        test_graph.addEdge("B", "C")
        test_graph.addEdge("B", "D")
        test_graph.addEdge("C", "D")

        test_graph.addEdge("C", "C")

        test_graph.removeVertex("D")
        checkgrpah = {"A": ["B", "C"], "B": ["A", "C"], "C": ["A", "B"]}

        self.assertEqual(checkgrpah, test_graph.returnGraph())
Beispiel #6
0
def main():
    nlp = spacy.load("en_core_web_lg")
    directory = "/home/harsh/Downloads/data/ner-eval-collection-master/plainTextFiles/"
    results = []

    for i in range(0, 128):
        filename = directory + str(i) + ".txt"
        file = open(filename, "r")
        file_content = file.read()
        file_content = file_content.split("<delim>")
        article_text = file_content[0]
        doc = nlp(article_text)

        if file_content[1]:
            file_content[1].strip()
            mse_text = file_content[1].replace("[", "").replace("]", "").replace("\n", "")
            mse_text = mse_text.split(",")

        if file_content[2]:
            file_content[2].strip()
            lse_text = file_content[2].replace("[", "").replace("]", "").replace("\n", "")
            lse_text = lse_text.split(",")

        article_result = Result(i, article_text, mse_text, lse_text)
        frequency_analysis(doc, article_result)
        results.append(article_result)
        # print(article_result.toString())

    graph = Graphs(results)
    graph.graph2('frequency_analysis')
def main():

    fin = open("input.txt", "r")

    numVert = int(fin.readline())
    numEdges = int(fin.readline())

    g = Graphs(numVert)

    for i in range(numEdges):
        pair = fin.readline()
        numbers = pair.split()
        V0 = int(numbers[0])
        V1 = int(numbers[1])
        g.addEdges(V0, V1)

    testcases = int(fin.readline())

    for i in range(testcases):
        pair = fin.readline()
        testnumbers = pair.split()
        V0 = int(testnumbers[0])
        V1 = int(testnumbers[1])
        depthsearch = g.findPathDepth(V0, V1)
        # print("Depth Search is", depthsearch)
        #breadthsearch = g.findpathBreadth(V0,V1)
        print("Breadth Search is", depthsearch)
Beispiel #8
0
    def __init__(self):
        self.window = Tk()
        self.window.protocol("WM_DELETE_WINDOW", self.finishApp)
        self.window.title('Herramienta de prueba para la predicción')
        ico = PhotoImage(file=os.path.abspath('.') + '/Activos/term.png')
        self.window.call('wm', 'iconphoto', self.window._w, ico)
        self.window.config(bg=mainColor)
        self.window.attributes("-zoomed", False)
        self.window.minsize(width=300, height=300)

        #Peso 100% en self.window
        self.window.grid_rowconfigure(0, weight=1)
        self.window.grid_columnconfigure(0, weight=1)

        #Ventana principal fija sin ajuste de tamaño
        self.window.resizable(False, False)

        #Centrar ventana en función de las dimendsiones del contenedor de inicio
        self.center(450, 490)

        self.view = Window(self.window)
        self.functions = Functions()

        self.infoW = Info(self.view.dataContainer)
        self.genDataW = GenData(self.view.dataContainer)
        self.predW = Predictions(self.view.dataContainer)
        self.graphsW = Graphs(self.view.dataContainer)

        #Botones de las acciones del usuario
        self.view.buttonDisconnect.bind("<Button>", self.disconnect)
        self.view.buttonToBD.bind("<Button>", self.changeToConnect)
        self.view.buttonConnect.bind("<Button>", self.checkConnection)
        self.view.infoButton.bind(
            "<Button>", lambda event: self.switchSelector(
                self.view.predButton, self.view.graphButton, self.view.
                genDataButton, self.view.infoButton, 1))
        self.view.genDataButton.bind(
            "<Button>", lambda event: self.switchSelector(
                self.view.infoButton, self.view.predButton, self.view.
                graphButton, self.view.genDataButton, 2))
        self.view.predButton.bind(
            "<Button>", lambda event: self.switchSelector(
                self.view.infoButton, self.view.graphButton, self.view.
                genDataButton, self.view.predButton, 3))
        self.view.graphButton.bind(
            "<Button>", lambda event: self.switchSelector(
                self.view.infoButton, self.view.genDataButton, self.view.
                predButton, self.view.graphButton, 4))
        self.genDataW.buttonFilterData.bind("<Button>",
                                            lambda event: self.getNewGenData())
        self.graphsW.buttonGetGraph.bind("<Button>",
                                         lambda event: self.getGraphsData())
        self.predW.buttonForecast.bind("<Button>", self.getForecast)
        self.predW.butHistForecast.bind("<Button>", self.getHistForecast)

        #Ventana principal actualizaciones
        self.window.mainloop()
    def __init__(self):
        # pearson + linear_regression(simple) + KNN + context
        self._params = {
            'database': 'EnronInc',
            # 'database': 'mc2_vast12',
            # 'database': 'twitter_security',
            'files_path': "../../../databases/EnronInc/EnronInc_by_day",
            # 'files_path': "../../databases/mc2_vast12/basic_by_minute",
            # 'files_path': "../../databases/twitter_security/data_by_days",
            'date_format': '%d-%b-%Y.txt',  # Enron
            # 'date_format': '%d:%m:%Y_%H:%M.txt',  # vast
            # 'date_format': '%d:%m.txt',  # Twitter
            'directed': False,
            'max_connected': False,
            'logger_name': "default Anomaly logger",
            'ftr_pairs': 28,
            'identical_bar': 0.9,
            # 'single_c': False,
            'dist_mat_file_name': "dist_mat",
            'anomalies_file_name': "anomalies",
            'context_beta': 4.1,
            'KNN_k': 18,
            'context_split': 1,
            'context_bar': 0.45
        }
        self._ground_truth = [
            '13-Dec-2000', '18-Oct-2001', '22-Oct-2001', '19-Nov-2001',
            '23-Jan-2002', '30-Jan-2002', '04-Feb-2002'
        ]  # Enron
        # self._ground_truth = ['1:5', '13:5', '20:5', '24:5', '30:5', '3:6', '5:6', '6:6', '9:6', '10:6', '11:6',
        #                       '15:6', '18:6', '19:6', '20:6', '25:6', '26:6', '3:7', '18:7', '30:7', '8:8',
        #                       '9:8']  # Twitter
        # self._ground_truth = ['4:5:2012_17:51', '4:5:2012_20:25', '4:5:2012_20:26', '4:5:2012_22:16', '4:5:2012_22:21'
        #                       , '4:5:2012_22:40', '4:5:2012_22:41', '4:6:2012_17:41', '4:5:2012_18:11']  # vast

        self._logger = PrintLogger("default Anomaly logger")
        self._graphs = Graphs(self._params['database'],
                              files_path=self._params['files_path'],
                              logger=self._logger,
                              features_meta=ANOMALY_DETECTION_FEATURES,
                              directed=self._params['directed'],
                              date_format=self._params['date_format'],
                              largest_cc=self._params['max_connected'])
        self._graphs.build(force_rebuild_ftr=REBUILD_FEATURES,
                           pick_ftr=RE_PICK_FTR,
                           should_zscore=False)

        # normalize features ---------------------------------
        self._graphs.norm_features(log_norm)

        # convert to index
        self._ground_truth = [
            self._graphs.name_to_index(event) for event in self._ground_truth
        ]
        self.print_feature_meta()
Beispiel #10
0
def calc_func():
    print('func called')
    if request.form['function'] == 'heatmap':
        g = Graphs()
        return g.HeatMap(request.form['sel_val'], request.form['dis_pol'])
    if request.form['function'] == 'linechart':
        g = Graphs()
        return g.LineChart(request.form['time1_val'],
                           request.form['time2_val'])
    if request.form['function'] == 'violinchart':
        g = Graphs()
        return g.ViolinPlot(request.form['time_val'])
    if request.form['function'] == 'scatterchart':
        g = Graphs()
        return g.ScatterPlot(request.form['x_val'], request.form['y_val'])
    if request.form['function'] == 'probachart':
        g = Graphs()
        print(request.form['lat'])
        return g.ProbaPlot(request.form['hour'], request.form['district'],
                           request.form['pstation'], request.form['lat'],
                           request.form['long'])
Beispiel #11
0
    def __init__(self):
        # pearson + linear_regression(simple) + KNN + context
        self._params = {
            'database': 'EnronInc',
            'files_path': "../databases/EnronInc/EnronInc_by_day",
            'date_format': '%d-%b-%Y.txt',  # Enron
            'directed': False,
            'max_connected': True,
            'logger_name': "Yeela's logger",
            'ftr_pairs': 25,
            'identical_bar': 0.95,
            'dist_mat_file_name': "dist_mat",
            'anomalies_file_name': "anomalies",
            'context_beta': 4,
            'KNN_k': 30,
            'context_split': 1,
            'context_bar': 0.45
        }

        # the anomalies
        self._ground_truth = [
            '13-Dec-2000', '18-Oct-2001', '22-Oct-2001', '19-Nov-2001',
            '23-Jan-2002', '30-Jan-2002', '04-Feb-2002'
        ]  # Enron

        # init logger
        self._logger = PrintLogger(self._params['logger_name'])
        # init multi-graph
        self._graphs = Graphs(self._params['database'],
                              files_path=self._params['files_path'],
                              logger=self._logger,
                              features_meta=ANOMALY_DETECTION_FEATURES,
                              directed=self._params['directed'],
                              date_format=self._params['date_format'],
                              largest_cc=self._params['max_connected'])
        self._graphs.build(force_rebuild_ftr=REBUILD_FEATURES,
                           pick_ftr=RE_PICK_FTR)

        # replace features with features from old version
        old_features_path = path.join("data",
                                      "EnronInc_directed:False_lcc:True",
                                      "old_features.pkl")
        self._graphs._multi_graph._features_matrix_dict = pickle.load(
            open(old_features_path, "rb"))

        # convert anomalies name to index
        self._ground_truth = [
            self._graphs.name_to_index(event) for event in self._ground_truth
        ]
        # print features that are being used
        self.print_feature_meta()
Beispiel #12
0
def display_page(pathname):
    if pathname == '/Plots/state_county_confirmed_line_chart':
        return state_county_confirmed_line_chart.get_layout()
    elif pathname == '/Plots/daily_changes_bar_chart':
        return daily_changes_bar_chart.get_layout()
    elif pathname == '/Plots/us_cases':
        return us_cases.get_layout()
    elif pathname == '/Plots/us_deaths':
        return us_deaths.get_layout()
    elif pathname == '/Plots/state_county_death_line_chart':
        return state_county_death_line_chart.get_layout()
    elif pathname == '/graphs':
        return Graphs()
    else:
        return Homepage()
Beispiel #13
0
def display_page(pathname):
    if pathname == '/Plots/state_county_confirmed_line_chart':
        return state_county_confirmed_line_chart.get_layout()
    elif pathname == '/Plots/daily_changes_bar_chart':
        return daily_changes_bar_chart.get_layout()
    elif pathname == '/Plots/us_cases':
        return us_cases.get_layout()
    elif pathname == '/Plots/us_deaths':
        return us_deaths.get_layout()
    elif pathname == '/Plots/state_county_death_line_chart':
        return state_county_death_line_chart.get_layout()
    elif pathname == '/Plots/stocks':
        return stocks.get_layout()
    elif pathname == '/info/about':
        return about.get_layout()
    elif pathname == '/info/what_to_do':
        return what_to_do.get_layout()
    elif pathname == '/effects':
        return Effects()
    elif pathname == '/graphs':
        return Graphs()
    else:
        return Homepage()
Beispiel #14
0
logger = logging.getLogger('app')
logger.setLevel(logging.DEBUG)
chandler = logging.StreamHandler()
formatter = logging.Formatter(
    '%(asctime)s - %(name)s - %(levelname)s - %(message)s')
chandler.setFormatter(formatter)
logger.addHandler(chandler)
if config.log_file:
    fhandler = logging.FileHandler(config.log_file)
    fhandler.setFormatter(formatter)
    logger.addHandler(fhandler)

logger.debug('app starting')
backend = Backend(config)
s_metrics = structured_metrics.StructuredMetrics(config)
graphs = Graphs()
graphs.load_plugins()
graphs_all = graphs.list_graphs()


@route('<path:re:/assets/.*>')
@route('<path:re:/timeserieswidget/.*js>')
@route('<path:re:/timeserieswidget/.*css>')
@route('<path:re:/timeserieswidget/timezone-js/src/.*js>')
@route('<path:re:/timeserieswidget/tz/.*>')
@route('<path:re:/DataTables/media/js/.*js>')
@route('<path:re:/DataTablesPlugins/integration/bootstrap/.*js>')
@route('<path:re:/DataTablesPlugins/integration/bootstrap/.*css>')
def static(path):
    return static_file(path, root='.')
Beispiel #15
0
    for y in mapa[x]:
        print(x, y)
        edge.append((x, y))

print(edge)

for x, y in edge:
    if (direct):
        matriz[mapan[x]][mapan[y]] = 1
    else:
        matriz[mapan[x]][mapan[y]] = 1
        matriz[mapan[y]][mapan[x]] = 1

print(matriz)

graph = Graphs(edge, direct)  # Criando o grafo
print(graph.adj)  # Lista de adjacências

search = input("Deseja realizar uma busca? (S-> Sim / N -> Não): ")
if search is "S" or search is "s":
    vertice_root = input(
        "Defina qual o vértice raíz para realização da busca: ")
    search_type = input(
        "Deseja realizar busca de em Largura(L) ou Profundidade(P)?: ")
    visited = []
    if search_type == "L":
        bfs(graph, vertice_root, visited)
    elif search_type == "P":
        dfs(graph, vertice_root, visited)
    else:
        print("Digite uma letra correta!")
Beispiel #16
0
from graphs import Graphs
from helper import Data
import pandas as pd

pred_path = "data/"
models = ['ARIMA', 'XGBoost', 'LSTM']

import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
import dash
from dash.dependencies import Input, Output

data = Data()
graph = Graphs()

data.fetch_data()
preprocessed_df = data.preprocess_cases_data(data.df_us_cases)

app = dash.Dash(__name__, external_stylesheets=[dbc.themes.LUX])
server = app.server

navbar = dbc.Nav(
    className="nav nav-pills",
    children=[
        dbc.NavItem(
            dbc.NavLink([html.I(className="fa fa-github"), "  GitHub"],
                        href="https://github.com/sheelshah9",
                        active=True,
                        target="_blank")),
        dbc.NavItem(
Beispiel #17
0
def main():
    network_file = "network_default.txt"
    initial_weights_file = None
    args = sys.argv[1:]
    if len(args) is 3:
        network_file = args[0]
        initial_weights_file = args[1]
        dataset_file = args[2]

    else:
        print(
            "Selecione seu dataset: \n 1 - Ionosphere \n 2 - Pima \n 3 - Wdbc \n 4 - Wine \n 5 - Teste \n 6 - Galaxy "
        )
        escolha = int(input("Escolha: "))
        if escolha is 1:
            dataset_file = "./datasets/ionosphere.csv"
        elif escolha is 2:
            dataset_file = "./datasets/pima.csv"
        elif escolha is 3:
            dataset_file = "./datasets/wdbc.csv"
        elif escolha is 4:
            dataset_file = "./datasets/wine.csv"
        elif escolha is 5:
            dataset_file = "./datasets/teste2.csv"
        elif escolha is 6:
            dataset_file = "./datasets/galaxy1.csv"
        else:
            print("Escolha invalida")
            exit()
    camadas = []
    fator_regularizacao = None
    with open(network_file) as network:
        info_camadas = csv.reader(network,
                                  delimiter=",",
                                  quoting=csv.QUOTE_NONE)
        for index, row in enumerate(info_camadas):
            if index is 0:
                fator_regularizacao = float(row[0])
            else:
                camadas.append(int(row[0]))

    dataset = DataHandler(dataset_file)

    entradas = len(dataset.data[0])

    nn = NeuralNetwork(entradas, camadas, initial_weights_file,
                       fator_regularizacao)
    custo = nn.calcula_custos(dataset.data, dataset.results)

    if len(args) is 3:
        print("FATOR DE REGULARIZACAO: ", fator_regularizacao)
        print("PESOS INICIAIS:")
        nn.print_matrizes()
        for index_data, data in enumerate(dataset.data):
            print("ENTRADA: ", data)

            print("SAIDAS:")
            ativacao_matriz = nn.calcula_saidas(data)
            printMatriz(ativacao_matriz)

            deltas = nn.calcula_deltas(ativacao_matriz,
                                       dataset.results[index_data])

            gradiente_bias = deltas
            gradiente_pesos = nn.calcula_gradientes(data, ativacao_matriz,
                                                    deltas)
            print("GRADIENTES DOS BIAS PARA ENTRADA:")
            printMatriz(gradiente_bias)
            print("GRADIENTES DOS PESOS PARA ENTRADA:")
            printMatriz(gradiente_pesos)
            nn.atuliza_matriz_gradientes(gradiente_bias, gradiente_pesos)
        print(
            "\n \n =================== FIM TREINAMENTO ==================== \n"
        )
        nn.calcula_gradientes_total_regularizados(index_data + 1)
        print("GRADIENTES BIAS FINAIS DO DATASET:")
        printMatriz(nn.gradientes_bias)
        print("GRADIENTES PESOS FINAIS DO DATASET:")
        printMatriz(nn.gradientes)
        nn.atualiza_pesos(alpha)
        print("NOVOS PESSO:")
        nn.print_matrizes()
        custo = nn.calcula_custos(dataset.data, dataset.results)
        print("Custo total: ", custo)
    else:

        dataset.normalizeData()
        batches_dados, batches_resultados = dataset.generate_batches(
            num_batches)
        saida_da_rede = []
        i = 0
        custos = []
        epocas = 0
        while custo > 0.01:
            print(custo)
            for index_batch, batch_dados in enumerate(batches_dados):
                for index_entrada, entrada in enumerate(batch_dados):
                    nn.treina_rede(
                        entrada,
                        batches_resultados[index_batch][index_entrada])
                nn.calcula_gradientes_total_regularizados(index_entrada + 1)
                nn.atualiza_pesos(alpha)
                epocas += 1

                nn.gradientes = None
                nn.gradientes_bias = None

            custo = nn.calcula_custos(dataset.data, dataset.results)
            custos.append(custo)
            i = i + 1
            if i == 500:
                print(custo)
                i = 0
                saida_da_rede = []
                for index, data in enumerate(dataset.data):
                    saida_da_rede.append(nn.calcula_saidas(data)[-1])
                g = Graphs()
                g.classificacao(dataset.results,
                                saida_da_rede,
                                epocas,
                                enfase_f1_score=1,
                                custo=custo,
                                custos=custos)
        nn.print_matrizes()
        for index, data in enumerate(dataset.data):
            saida_da_rede.append(nn.calcula_saidas(data)[-1])
        g = Graphs()
        g.classificacao(dataset.results,
                        saida_da_rede,
                        epocas,
                        enfase_f1_score=1,
                        custo=custo,
                        custos=custos)
def train(agent, sim, replay_buffer):
    """Train the agent for exploration steps
        Args:
            :param replay_buffer: (ReplayBuffer) replay buffer for arm
            :param sim: (robot environment) vrep simulation
            :param agent: (Agent) agent to use, TD3 Algorithm
    """
    best_avg = -10
    start_time = time.time()

    # initialize graphs
    graphs = Graphs()

    while glo.TIMESTEP < cons.EXPLORATION:
        if glo.EPISODE == cons.MAX_EPISODE:
            print('Max Episode Reached: {}'.format(cons.MAX_EPISODE))
            break
        print('Timesteps: {}/{}.'.format(glo.TIMESTEP, cons.EXPLORATION))

        glo.EPISODE += 1  # start at episode 1, after the test so the last episode runs

        # get the current state  of the robot arms (joint angles)
        right_pos, left_pos = sim.get_current_position()
        state = right_pos + left_pos

        # video recording
        video_array = []
        if glo.EPISODE % cons.VIDEO_INTERVAL == 0:
            video_record = True
            video_array.append(sim.get_video_image())
        else:
            video_record = False

        # reset episode variables
        solved = False  # reset each episode as unsolved
        rewards = [
        ]  # used to store the episode rewards, used to average the rewards.
        collision_count = 0
        episode_length = 0
        # -------------------------------------------------------------------------------------------------
        # Start Episode
        # -------------------------------------------------------------------------------------------------
        while True:
            glo.TIMESTEP += 1
            episode_length += 1

            # check memory utilization
            '''
            GPUtil.showUtilization()
            print(torch.cuda.memory_allocated())

            count_objs = 0

            for obj in gc.get_objects():
                try:
                    if torch.is_tensor(obj) or (hasattr(obj, 'data') and torch.is_tensor(obj.data)):
                        # print(type(obj), obj.size())
                        count_objs += 1
                except:
                    pass
            print("Total objects in GPU memory: {}".format(count_objs))
            '''

            # get the initial location of the target object
            target_start = sim.get_target_position()

            new_state = []
            if set_mode.MODE == 'cooperative':
                # get a new action based on policy
                action = agent.select_action(np.array(state),
                                             noise=cons.POLICY_NOISE).tolist()
                # apply the action and get the new state
                right_state, left_state = sim.step_arms(action[:7], action[7:])
                new_state = right_state + left_state

            elif set_mode.MODE == 'independent' or set_mode.MODE == 'partial':
                right_action = agent.select_action(
                    np.array(state)[:7], 'right',
                    noise=cons.POLICY_NOISE).tolist()
                left_action = agent.select_action(
                    np.array(state)[7:], 'left',
                    noise=cons.POLICY_NOISE).tolist()

                # apply the action and get the new state
                right_state, left_state = sim.step_arms(
                    right_action, left_action)
                new_state = right_state + left_state

                # store the actions together in the replay
                action = right_action + left_action

            # add the image to the video array
            if video_record:
                video_array.append(sim.get_video_image())

            # get the new position of the target
            target_end = sim.get_target_position()
            target_x, target_y, target_z = target_end

            # calculate the reward and distance to target for the step
            reward, distance_moved, distance_to_target = rew.target_movement_reward(
                target_start, target_end, cons.XYZ_GOAL)
            # TODO: might want to use a range for each x,y,z rather than rounding.
            # round the x, y, z to compare with the goal positions
            round_target_x = round(target_x, 1)
            round_target_y = round(target_y, 1)
            round_target_z = round(target_z, 1)

            # check and see if the target is within the goal range
            if round_target_x == cons.XYZ_GOAL[0] and round_target_y == cons.XYZ_GOAL[1] and \
                    round_target_z == cons.XYZ_GOAL[2]:
                # end episode if the goal is reached
                done = True
            else:
                done = False

            # check for multiple collisions in a row (5), reset sim if so
            object_collision_table = sim.object_collision_state()
            if object_collision_table:
                # if it collides with the table 5 times in a row - end episode
                collision_count += 1
                if collision_count > 4:
                    done = True
                    collision_count = 0
            else:
                collision_count = 0

            # check distance between grippers to see if dropped
            if sim.check_suction_distance() > .32:
                done = True
                time.sleep(1)  # wait to allow the sim to catch up
                reward = -1

            # if it is dropped, reward is zero. end the episode and start a new one, it was very bad to drop it.
            if not sim.check_suction_prox():
                done = True
                time.sleep(1)  # wait to allow the sim to catch up
                reward = -1  # was zero, try a big, bad reward when you drop it

            # update the replay buffer with new tuple
            replay_buffer.add(state, action, reward, new_state, done)

            # training step
            agent.train(replay_buffer, episode_length)

            # set the state to the new state for the next step
            state = new_state

            if solved:
                print('Solved on Episode: {}'.format(glo.EPISODE))

            # add the reward to the reward list
            rewards.append(reward)

            if episode_length == 50:  # stop after 50 attempts, 30 was too low to reach goal, tried 45.
                done = True  # stop after 50 attempts, was getting stuck flipping from bad to good.

            # calculate the elapsed time
            elapsed_time = time.time() - start_time

            if cons.WRITE_TO_FILE:
                cons.report.write_report_step(glo.EPISODE, glo.TIMESTEP,
                                              reward, distance_moved,
                                              distance_to_target, solved,
                                              elapsed_time)

            if done:
                # get the average reward for the episode
                mean_reward_episode = mean(rewards)

                # if current episodes reward better, becomes new save
                if best_avg < mean_reward_episode:
                    best_avg = mean_reward_episode
                    agent.save()

                if video_record and episode_length > 10:  # only record episodes over 10
                    output_video(video_array, cons.SIZE, names.EPISODE_VIDEO)
                if solved:
                    output_video(video_array, cons.SIZE,
                                 names.EPISODE_VIDEO_SOLVED)

                system_info = psutil.virtual_memory()
                if True:
                    print("\n*** Episode " + str(glo.EPISODE) + " ***")
                    print("Avg_Reward [last episode of " +
                          str(episode_length) + " steps]: " +
                          str(mean_reward_episode))
                    print("Total Timesteps: " + str(glo.TIMESTEP))
                    print("Elapsed Time: ",
                          time.strftime("%H:%M:%S", time.gmtime(elapsed_time)))
                    print("Memory Usage: " + str(system_info.percent) + "%")

                # reset the simulation at the end of the episode
                sim.reset_sim()

                # at the end of the episode, visualize the charts.
                graphs.update_step_list_graphs()

                # end the episode
                break

        # check for system overload, if memory over-utilized, quit
        system_info = psutil.virtual_memory()
        if system_info.percent > 98:
            break

    # write any remaining values
    cons.report.write_final_values()

    # at the end do a final update of the graphs
    graphs.update_step_list_graphs()
Beispiel #19
0
from clustering import Clustering
from frequent_pattern import FrequentPattern
from sklearn.decomposition import PCA
from yellowbrick.cluster import KElbowVisualizer
from sklearn.cluster import KMeans, AgglomerativeClustering, DBSCAN
from mlxtend.preprocessing import TransactionEncoder


#cols = ["Channel","Region","Fresh","Milk","Grocery","Frozen","Detergents_Paper","Delicassen"]
df = pd.read_csv("test.csv",header=None,names=range(11))
all_labels = pd.unique(df.values.ravel('K'))
all_labels = all_labels[:-1]
#df = df.replace(np.nan, '', regex=True)
print(all_labels)
pp = PreProcessing()
gr = Graphs()
fp = FrequentPattern()
clustering  = Clustering()
#pp.categorize(df)
#gr.get_visual_data(df)

#df = df.drop(['Channel'], axis=1)
#df = df.drop(['Region'], axis=1)
start_time = time.time()
data_list = df.to_numpy()
new_data_list = []
for entry in data_list:
    new_entry = []
    for element in entry:
        if((element in all_labels) == True):
            new_entry.append(element)
Beispiel #20
0
def analysis():
    g = Graphs()
    return render_template("analysis.html", crimes=['All'] + g.getCrimes())
Beispiel #21
0
def setPstation():
    g = Graphs()
    return json.dumps(
        g.getPstation(float(request.form['lat']), float(request.form['long']),
                      request.form['district']))
Beispiel #22
0
def setDistrict():
    g = Graphs()
    return json.dumps(
        g.getDistrict(float(request.form['lat']), float(request.form['long'])))
Beispiel #23
0
def getPoliceStation():
    g = Graphs()
    pstations = g.getPstations(request.form['district'])
    return json.dumps(pstations)
Beispiel #24
0
    def __init__(self, main_gui):
        self.main_gui = main_gui

        widget_label_font = tk_font.Font(family="Tw Cen MT",
                                         size=self.main_gui.label_font_small)
        widget_title_font = tk_font.Font(family="Tw Cen MT",
                                         size=self.main_gui.label_font,
                                         weight="bold")

        graph_frame = tk.LabelFrame(self.main_gui.window,
                                    text="GRAPHS",
                                    fg="#323338",
                                    bg='#f2f3fc',
                                    font=widget_title_font,
                                    relief=tk.RIDGE)
        graph_frame.grid(row=0,
                         column=3,
                         sticky=tk.N,
                         rowspan=15,
                         padx=(self.main_gui.padx, 0))

        self.graph1 = tk.LabelFrame(graph_frame,
                                    fg="#323338",
                                    bg='#f2f3fc',
                                    font=widget_title_font,
                                    relief=tk.RIDGE)
        self.graph1.grid(row=0, column=0, sticky=tk.N, rowspan=4)

        self.graph1_plot = Graphs(self.graph1, self.main_gui.program,
                                  self.main_gui.fig_a, self.main_gui.fig_b)

        self.graph1_variable = tk.IntVar()
        self.graph1_XYY_radiobutton = tk.Radiobutton(
            self.graph1,
            text="XYY",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph1_plot_draw,
            variable=self.graph1_variable,
            value=0,
            font=widget_label_font)
        self.graph1_Smith_radiobutton = tk.Radiobutton(
            self.graph1,
            text="Smith",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph1_plot_draw,
            variable=self.graph1_variable,
            value=1,
            font=widget_label_font)

        self.graph1_XYY_radiobutton.grid(row=3,
                                         column=0,
                                         padx=(self.main_gui.fig_padx, 0),
                                         sticky=tk.N + tk.W)
        self.graph1_Smith_radiobutton.grid(row=4,
                                           column=0,
                                           padx=(self.main_gui.fig_padx, 0),
                                           sticky=tk.N + tk.W)

        self.graph1_s_variable = tk.IntVar()
        self.graph1_S11_radiobutton = tk.Radiobutton(
            self.graph1,
            text="S11",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph1_plot_draw,
            variable=self.graph1_s_variable,
            value=0,
            font=widget_label_font)
        self.graph1_S11_radiobutton.select()
        self.graph1_S12_radiobutton = tk.Radiobutton(
            self.graph1,
            text="S12",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph1_plot_draw,
            variable=self.graph1_s_variable,
            value=1,
            font=widget_label_font)
        self.graph1_S21_radiobutton = tk.Radiobutton(
            self.graph1,
            text="S21",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph1_plot_draw,
            variable=self.graph1_s_variable,
            value=2,
            font=widget_label_font)
        self.graph1_S22_radiobutton = tk.Radiobutton(
            self.graph1,
            text="S22",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph1_plot_draw,
            variable=self.graph1_s_variable,
            value=3,
            font=widget_label_font)
        self.graph1_s_variable.set(0)

        self.graph1_S11_radiobutton.grid(row=3,
                                         column=0,
                                         padx=(10, 0),
                                         sticky=tk.N + tk.W)
        self.graph1_S12_radiobutton.grid(row=3,
                                         column=0,
                                         padx=(70, 0),
                                         sticky=tk.N + tk.W)
        self.graph1_S21_radiobutton.grid(row=4,
                                         column=0,
                                         padx=(10, 0),
                                         pady=(0, 0),
                                         sticky=tk.N + tk.W)
        self.graph1_S22_radiobutton.grid(row=4,
                                         column=0,
                                         padx=(70, 0),
                                         pady=(0, 0),
                                         sticky=tk.N + tk.W)

        self.graph2 = tk.LabelFrame(graph_frame,
                                    fg="#323338",
                                    bg='#f2f3fc',
                                    font=widget_title_font,
                                    relief=tk.RIDGE)
        self.graph2.grid(row=0, column=1, sticky=tk.N, rowspan=5)

        self.graph2_plot = Graphs(self.graph2, self.main_gui.program,
                                  self.main_gui.fig_a, self.main_gui.fig_b)

        self.graph2_variable = tk.IntVar()
        self.graph2_XYY_radiobutton = tk.Radiobutton(
            self.graph2,
            text="XYY",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph2_plot_draw,
            variable=self.graph2_variable,
            value=0,
            font=widget_label_font)
        self.graph2_Smith_radiobutton = tk.Radiobutton(
            self.graph2,
            text="Smith",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph2_plot_draw,
            variable=self.graph2_variable,
            value=1,
            font=widget_label_font)

        self.graph2_XYY_radiobutton.grid(row=3,
                                         column=0,
                                         padx=(self.main_gui.fig_padx, 0),
                                         sticky=tk.N + tk.W)
        self.graph2_Smith_radiobutton.grid(row=4,
                                           column=0,
                                           padx=(self.main_gui.fig_padx, 0),
                                           sticky=tk.N + tk.W)

        self.graph2_s_variable = tk.IntVar()
        self.graph2_S11_radiobutton = tk.Radiobutton(
            self.graph2,
            text="S11",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph2_plot_draw,
            variable=self.graph2_s_variable,
            value=0,
            font=widget_label_font)
        self.graph2_S12_radiobutton = tk.Radiobutton(
            self.graph2,
            text="S12",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph2_plot_draw,
            variable=self.graph2_s_variable,
            value=1,
            font=widget_label_font)
        self.graph2_S12_radiobutton.select()
        self.graph2_S21_radiobutton = tk.Radiobutton(
            self.graph2,
            text="S21",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph2_plot_draw,
            variable=self.graph2_s_variable,
            value=2,
            font=widget_label_font)
        self.graph2_S22_radiobutton = tk.Radiobutton(
            self.graph2,
            text="S22",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph2_plot_draw,
            variable=self.graph2_s_variable,
            value=3,
            font=widget_label_font)

        self.graph2_S11_radiobutton.grid(row=3,
                                         column=0,
                                         padx=(10, 0),
                                         sticky=tk.N + tk.W)
        self.graph2_S12_radiobutton.grid(row=3,
                                         column=0,
                                         padx=(70, 0),
                                         sticky=tk.N + tk.W)
        self.graph2_S21_radiobutton.grid(row=4,
                                         column=0,
                                         padx=(10, 0),
                                         pady=(0, 0),
                                         sticky=tk.N + tk.W)
        self.graph2_S22_radiobutton.grid(row=4,
                                         column=0,
                                         padx=(70, 0),
                                         pady=(0, 0),
                                         sticky=tk.N + tk.W)

        self.graph3 = tk.LabelFrame(graph_frame,
                                    fg="#323338",
                                    bg='#f2f3fc',
                                    font=widget_title_font,
                                    relief=tk.RIDGE)
        self.graph3.grid(row=5, column=0, sticky=tk.N, rowspan=5)

        self.graph3_plot = Graphs(self.graph3, self.main_gui.program,
                                  self.main_gui.fig_a, self.main_gui.fig_b)

        self.graph3_variable = tk.IntVar()
        self.graph3_XYY_radiobutton = tk.Radiobutton(
            self.graph3,
            text="XYY",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph3_plot_draw,
            variable=self.graph3_variable,
            value=0,
            font=widget_label_font)
        self.graph3_Smith_radiobutton = tk.Radiobutton(
            self.graph3,
            text="Smith",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph3_plot_draw,
            variable=self.graph3_variable,
            value=1,
            font=widget_label_font)

        self.graph3_XYY_radiobutton.grid(row=8,
                                         column=0,
                                         padx=(self.main_gui.fig_padx, 0),
                                         sticky=tk.N + tk.W)
        self.graph3_Smith_radiobutton.grid(row=9,
                                           column=0,
                                           padx=(self.main_gui.fig_padx, 0),
                                           sticky=tk.N + tk.W)

        self.graph3_s_variable = tk.IntVar()
        self.graph3_S11_radiobutton = tk.Radiobutton(
            self.graph3,
            text="S11",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph3_plot_draw,
            variable=self.graph3_s_variable,
            value=0,
            font=widget_label_font)
        self.graph3_S12_radiobutton = tk.Radiobutton(
            self.graph3,
            text="S12",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph3_plot_draw,
            variable=self.graph3_s_variable,
            value=1,
            font=widget_label_font)
        self.graph3_S21_radiobutton = tk.Radiobutton(
            self.graph3,
            text="S21",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph3_plot_draw,
            variable=self.graph3_s_variable,
            value=2,
            font=widget_label_font)
        self.graph3_S21_radiobutton.select()
        self.graph3_S22_radiobutton = tk.Radiobutton(
            self.graph3,
            text="S22",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph3_plot_draw,
            variable=self.graph3_s_variable,
            value=3,
            font=widget_label_font)

        self.graph3_S11_radiobutton.grid(row=8,
                                         column=0,
                                         padx=(10, 0),
                                         sticky=tk.N + tk.W)
        self.graph3_S12_radiobutton.grid(row=8,
                                         column=0,
                                         padx=(70, 0),
                                         sticky=tk.N + tk.W)
        self.graph3_S21_radiobutton.grid(row=9,
                                         column=0,
                                         padx=(10, 0),
                                         pady=(0, 0),
                                         sticky=tk.N + tk.W)
        self.graph3_S22_radiobutton.grid(row=9,
                                         column=0,
                                         padx=(70, 0),
                                         pady=(0, 0),
                                         sticky=tk.N + tk.W)

        self.graph4 = tk.LabelFrame(graph_frame,
                                    fg="#323338",
                                    bg='#f2f3fc',
                                    font=widget_title_font,
                                    relief=tk.RIDGE)
        self.graph4.grid(row=6, column=1, sticky=tk.N, rowspan=5)

        self.graph4_plot = Graphs(self.graph4, self.main_gui.program,
                                  self.main_gui.fig_a, self.main_gui.fig_b)

        self.graph4_variable = tk.IntVar()
        self.graph4_XYY_radiobutton = tk.Radiobutton(
            self.graph4,
            text="XYY",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph4_plot_draw,
            variable=self.graph4_variable,
            value=0,
            font=widget_label_font)
        self.graph4_Smith_radiobutton = tk.Radiobutton(
            self.graph4,
            text="Smith",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph4_plot_draw,
            variable=self.graph4_variable,
            value=1,
            font=widget_label_font)

        self.graph4_XYY_radiobutton.grid(row=8,
                                         column=0,
                                         padx=(self.main_gui.fig_padx, 0),
                                         sticky=tk.N + tk.W)
        self.graph4_Smith_radiobutton.grid(row=9,
                                           column=0,
                                           padx=(self.main_gui.fig_padx, 0),
                                           sticky=tk.N + tk.W)

        self.graph4_s_variable = tk.IntVar()
        self.graph4_S11_radiobutton = tk.Radiobutton(
            self.graph4,
            text="S11",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph4_plot_draw,
            variable=self.graph4_s_variable,
            value=0,
            font=widget_label_font)
        self.graph4_S12_radiobutton = tk.Radiobutton(
            self.graph4,
            text="S12",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph4_plot_draw,
            variable=self.graph4_s_variable,
            value=1,
            font=widget_label_font)
        self.graph4_S21_radiobutton = tk.Radiobutton(
            self.graph4,
            text="S21",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph4_plot_draw,
            variable=self.graph4_s_variable,
            value=2,
            font=widget_label_font)
        self.graph4_S22_radiobutton = tk.Radiobutton(
            self.graph4,
            text="S22",
            bg='#f2f3fc',
            fg="#323338",
            command=self.graph4_plot_draw,
            variable=self.graph4_s_variable,
            value=3,
            font=widget_label_font)
        self.graph4_S22_radiobutton.select()

        self.graph4_S11_radiobutton.grid(row=8,
                                         column=0,
                                         padx=(10, 0),
                                         sticky=tk.N + tk.W)
        self.graph4_S12_radiobutton.grid(row=8,
                                         column=0,
                                         padx=(70, 0),
                                         sticky=tk.N + tk.W)
        self.graph4_S21_radiobutton.grid(row=9,
                                         column=0,
                                         padx=(10, 0),
                                         pady=(0, 0),
                                         sticky=tk.N + tk.W)
        self.graph4_S22_radiobutton.grid(row=9,
                                         column=0,
                                         padx=(70, 0),
                                         pady=(0, 0),
                                         sticky=tk.N + tk.W)
Beispiel #25
0
# contains all errors as key:(title,msg) items.
# will be used throughout the runtime to track all encountered errors
errors = {}

# will contain the latest data
last_update = None

config = make_config(config)

logger = make_logger('app', config)

logger.debug('app starting')
backend = Backend(config, logger)
s_metrics = structured_metrics.StructuredMetrics(config, logger)
graphs_manager = Graphs()
graphs_manager.load_plugins()
graphs_all = graphs_manager.list_graphs()

bottle.TEMPLATE_PATH.insert(0, os.path.dirname(__file__))


@route('<path:re:/assets/.*>')
@route('<path:re:/timeserieswidget/.*(js|css)>')
@route('<path:re:/timeserieswidget/timezone-js/src/.*js>')
@route('<path:re:/timeserieswidget/tz/.*>')
@route('<path:re:/DataTables/media/js/.*js>')
@route('<path:re:/DataTablesPlugins/integration/bootstrap/.*(js|css)>')
def static(path):
    return static_file(path, root=os.path.dirname(__file__))
	trans_i.append(trans_j)
	path_i.append(path_j)
	yield_i.append(yield_j)

	x_i.append(x_j)
	label_i.append(label_j)



graphPath="E:\\btrzpil\\EMPIR\\Works\\model2\\analysisResult\\singBeam11\\graph"
xData=x_i

legendTitle="Coordinates"
xAxLabel="Distance [mm]"

graphName=baseFileName

graphs=Graphs(graphName+'sen')
graphs.plotSensitivity(xData,sen_i,xAxLabel,label_i,legendTitle,graphPath)

graphs=Graphs(graphName+'ioneff')
graphs.plotIonEfficency(xData,eff_i,xAxLabel,label_i,legendTitle,graphPath)

graphs=Graphs(graphName+'yield')
graphs.plotYield(xData,yield_i,xAxLabel,label_i,legendTitle,graphPath)

graphs=Graphs(graphName+'path')
graphs.plotMeanPathLengthPrimaryParticles(xData,path_i,xAxLabel,label_i,legendTitle,graphPath)

graphs=Graphs(graphName+'transeff')
graphs.plotTransmissionEfficency(xData,trans_i,xAxLabel,label_i,legendTitle,graphPath)
Beispiel #27
0
 def setUp(self):
     self.graphs = Graphs()
     self.test_methods = TestMethods()
     self.data_processing = DataProcessing()
Beispiel #28
0
def join_two_graphs(first_id, second_id):
    get_graphs = Graphs().join_two_graphs(first_country_id=first_id,
                                          second_country_id=second_id)
    return render_template("./graphs/" + get_graphs[1] + ".html")
Beispiel #29
0
	p_i.append(p_j)
	sen_i.append(sen_j)
	eff_i.append(eff_j)
	path_i.append(path_j)
	yield_i.append(yield_j)
	x_i.append(x_j)



xData=x_i

legendTitle="Emission current [mA]"
xAxLabel='Pressure [mbar]'

graphName=baseFileName
graphs=Graphs(graphName+'sen')
graphs.plotSensitivity(xData,sen_i,xAxLabel,label_i,legendTitle,graphPath)

graphs=Graphs(graphName+'ioneff')
graphs.plotIonEfficency(xData,eff_i,xAxLabel,label_i,legendTitle,graphPath)

graphs=Graphs(graphName+'yield')
graphs.plotYield(xData,yield_i,xAxLabel,label_i,legendTitle,graphPath)

graphs=Graphs(graphName+'path')
graphs.plotMeanPathLengthPrimaryParticles(xData,path_i,xAxLabel,label_i,legendTitle,graphPath)
# //pressure


k=0
for z in range (-10, 31, 10):
Beispiel #30
0
def test():
    g = Graphs()
    return render_template("testgeomap.html",
                           districts=g.getDistricts(),
                           pstations=['Select District'])