Exemple #1
0
from __future__ import absolute_import, division, print_function
import tensorflow as tf
import numpy as np
import os
from sys import argv
from console_logging.console import Console

console = Console()

usage = "You shouldn't be running this file."

os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
console.setVerbosity(3)  # only error, success, log

script = 'predict.py'
dataset_filename = './neuralnet/corpus/carnegie_mellon.csv'
maxgpa = 5.0
maxtest = 2400
dataset_filename = str(dataset_filename)
maxgpa = float(maxgpa)
maxtest = int(maxtest)
if dataset_filename[-4:] != ".csv":
    console.error("Filetype not recognized as CSV.")
    print(usage)
    exit(0)

# Data sets
DATA_TRAINING = dataset_filename
DATA_TEST = dataset_filename
''' We are expecting features that are floats (gpa, sat, act) and outcomes that are integers (0 for reject, 1 for accept) '''
Exemple #2
0
import pickle as pkl
from console_logging.console import Console
console = Console()
'''
Preprocessing:
remove everything except lettes spaces exclamations question marks @symbol

Features:
one hot encoded words
one hot encoded capital words (if no capitals, 0)
count of exlamation (!) and question mark (?)
Later: one hot encoded mentions (@username)
'''

# Debugging
console.setVerbosity(4)
# Training
# console.setVerbosity(3)
# Staging
# console.setVerbosity(2)
# Production
# console.mute()
# Neater logging inside VS Code
console.timeless()
console.monotone()

DATASET_FILEPATH = 'data/text_emotion.csv'
dataset_path = os.path.join(os.getcwd(), DATASET_FILEPATH)
console.log("Loading data from %s" % dataset_path)

from streaming_event_compliance.services.visualization import visualization_deviation_automata
from streaming_event_compliance.services.compliance_check import case_thread_cc
from streaming_event_compliance.objects.variable.globalvar import gVars, CCM, CTM
from streaming_event_compliance import app
import threading
from streaming_event_compliance.database import dbtools
from streaming_event_compliance.objects.exceptions.exception import ThreadException
from streaming_event_compliance.objects.logging.server_logging import ServerLogging
import traceback
import json
import os
import sys
from console_logging.console import Console

console = Console()
console.setVerbosity(5)
MAXIMUN_WINDOW_SIZE = app.config['MAXIMUN_WINDOW_SIZE']
THRESHOLD = app.config['THRESHOLD']
CLEINT_DATA_PATH = app.config['CLEINT_DATA_PATH']
AUTOMATA_FILE = app.config['AUTOMATA_FILE']
FILE_TYPE = app.config['FILE_TYPE']
threads_index = 0


def compliance_checker(client_uuid, event):
    """
    Description:
        This function will do compliance checking for each event from the streaming data provided from client_uuid.
        It will first check the global variable 'autos', to check if tt's status is true,
        if it's false, that means the automata has not built, return this information into user;
        if it's true, then it will get initialed CCM(Case memory for 'client_uuid') and CTM(Thread memory for
Exemple #4
0
from __future__ import absolute_import, division, print_function
import tensorflow as tf
import numpy as np
import os
import sys
from console_logging.console import Console
from sys import argv

usage = "\nUsage:\npython neuralnet/main.py path/to/dataset.csv path/to/crossvalidation_dataset.csv #MAX_GPA #MAX_TEST_SCORE\n\nExample:\tpython main.py harvard.csv 6.0 2400\n\nThe dataset should have one column of GPA and one column of applicable test scores, no headers."

console = Console()
console.setVerbosity(3)  # only logs success and error
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'

try:
    script, dataset_filename, test_filename, maxgpa, maxtest = argv
except:
    console.error(str(sys.exc_info()[0]))
    print(usage)
    exit(0)

dataset_filename = str(dataset_filename)
maxgpa = float(maxgpa)
maxtest = int(maxtest)

if dataset_filename[-4:] != ".csv":
    console.error("Filetype not recognized as CSV.")
    print(usage)
    exit(0)

# Data sets