Ejemplo n.º 1
0
def attrition():
    conn = sqlite3.connect("dataset.db")
    cur = conn.execute("SELECT * FROM dataset")
    data = cur.fetchall()
    att = run(data)
    newd = []
    i = 0
    for row in att:
        t = ()
        t = t + (i, )
        t = t + (row, )
        i = i + 1
        newd.append(t)
    return render_template("attrition.html", data=newd)
Ejemplo n.º 2
0
def attrition():
    conn = sqlite3.connect("dataset.db")
    cur = conn.execute("SELECT * FROM dataset")
    data = cur.fetchall()
    att, skills = run(data)
    #print(">>>>>>>>>>>>>>Attrition>>>>>>>>>>>>>>>>")
    #print(att)
    newd = []
    i = 0
    for row in range(len(att)):
        t = ()
        t = t + (i, )
        t = t + (att[row], )
        t = t + (skills[row], )
        i = i + 1
        newd.append(t)
    return render_template("attrition.html", data=newd)
Ejemplo n.º 3
0
def attrition():
    conn = sqlite3.connect("dataset.db")
    cur = conn.execute("SELECT * FROM dataset")
    data = cur.fetchall()
    print("Running  Run")
    att = run(data)
    newd = []
    i = 0
    for row in att:
        t = ()
        t = t + (i, )
        t = t + (row, )
        i = i + 1
        newd.append(t)
    cur.close()
    eval = []
    eval = list(evaluate_model())
    return render_template("attrition.html",
                           data=newd,
                           evaluations=eval,
                           display_eval=True)
Ejemplo n.º 4
0
def attr(id):
    conn = sqlite3.connect("dataset.db")
    # cur = conn.execute("SELECT * FROM dataset WHERE ID=?", (id, ))
    cur = conn.execute("SELECT * FROM dataset")
    data = cur.fetchall()
    att = run(data)
    newd = []
    i = 0
    for row in att:
        print(i)
        t = ()
        t = t + (i, )
        t = t + (row, )
        if i == id:
            newd.append(t)
            break
        i = i + 1
    cur.close()
    eval = []
    eval = list(evaluate_model())
    return render_template("attrition.html",
                           data=newd,
                           evaluations=eval,
                           display_eval=False)
Ejemplo n.º 5
0
        filename = input("  > ")
        with open("models/" + filename + ".model", "rb") as file:
            m = pickle.load(file)

    print("Enter commands (help for help, quit to exit): ")
    while (command := input("  > ")) != "quit":
        if command == "help":
            print("  help - prints the help menu")
            print("  quit - exits the program")
            print("  run - run a string through the machine")
            print("  print - print the tuple represetation of the machine")
            print("  save - save the model")
        elif command == "run":
            print("  Enter string to test: ")
            string = input("  > ")
            result = run(string, m)

            if string == "":
                string = "\xCE"

            print("    Machine( " + string + " ) = " + str(result))
        elif command == "print":
            print("    M ( " + str(m.states) + ",\n        " +
                  str(m.alphabet) + ",\n        " + str(m.trans_func) +
                  ",\n        " + str(m.start_state) + ",\n        " +
                  str(m.accept_states) + " )\n")
        elif command == "save":
            print("  Enter a filename to save to (exclude any extension): ")
            filename = input("    > ")
            with open("models/" + filename + ".model", "wb") as file:
                pickle.dump(m, file)
Ejemplo n.º 6
0
import os
import json
import sys

import machine as Machine


def getIP():
    f = open('server.json', 'r')
    json_data = json.load(f)
    f.close()
    return json_data["Server"]


if __name__ == '__main__':
    if len(sys.argv) != 2:
        print 'Help > python client.py <wlan interface>'
    else:
        dic_server = getIP()
        Machine.run(sys.argv[1], dic_server["SDN_Application"])
Ejemplo n.º 7
0
import machine
import multiprocessing

if __name__ == '__main__':
    multiprocessing.freeze_support()
    machine.run()
Ejemplo n.º 8
0
 def test_run(self):
     for expression, result in calculator_test_cases:
         self.assertAlmostEqual(run(compile2bytes(expression)), result, delta=5)