Exemplo n.º 1
0
from os.path import join, dirname
import sys
from languageflow.board import Board
from languageflow.log import MultilabelLogger
from languageflow.log.tfidf import TfidfLogger
from load_data import load_dataset
from model import sentiment

data_file = join(dirname(dirname(dirname(dirname(__file__)))), "data", "fb_bank", "corpus", "test.xlsx")

X_test, y_test = load_dataset(data_file)
y_test = [tuple(item) for item in y_test]
y_pred = sentiment(X_test)

log_folder = join(dirname(__file__), "analyze")
model_folder = join(dirname(__file__), "model")

board = Board(log_folder=log_folder)

MultilabelLogger.log(X_test, y_test, y_pred, log_folder=log_folder)
TfidfLogger.log(model_folder=model_folder, log_folder=log_folder)

board.serve(port=62010)
Exemplo n.º 2
0
from os.path import join, dirname
from languageflow.board import Board
from languageflow.log import MultilabelLogger
import json


def load_data(file):
    with open(file) as f:
        content = json.load(open(file))
        X, y = content["text"], content["labels"]
        y = [tuple(item) for item in y]
        return X, y


X, y1 = load_data("results/svc_full.json")
X, y2 = load_data("results/svc.json")

log_folder = join(dirname(__file__), "compare")

board = Board(log_folder=log_folder)

MultilabelLogger.log(X, y1, y2, log_folder=log_folder)
board.serve(port=62010)
Exemplo n.º 3
0
from os.path import join, dirname
from languageflow.board import Board
from languageflow.log import MultilabelLogger

from exported.linearsvc import sentiment
from load_data import load_dataset

data = join(dirname(dirname(dirname(__file__))), "data", "vlsp2018", "corpus",
            "hotel", "dev.xlsx")
X_dev, y_dev = load_dataset(data)
y_dev = [tuple(item) for item in y_dev]
y_pred = sentiment(X_dev)

log_folder = join(dirname(__file__), "analyze")

board = Board(log_folder=log_folder)

MultilabelLogger.log(X_dev, y_dev, y_pred, log_folder=log_folder)
# board.serve(port=62010)