Open SeeenyaOhar opened 2 years ago
D:\anaconda3\python.exe D:/Documents/Code/Stock/NNS/inquiryProcessor/inquiryEstimatorTest.py The model has been loaded with C:\Users\User\mmm.weights tensor([[1.5858e-02, 5.3718e-03, 7.3716e-01, 2.3104e-03, 5.3465e-06, 8.4465e-06, 5.9548e-03, 5.9660e-06, 2.7483e-02, 2.0584e-01]], grad_fn=<CopySlices>)
import torch
import numpy as np
from NNS.inquiryProcessor.inquiryEstimator import InquiryAnalyzer
from NNS.inquiryProcessor.inquiryConverter import InquiryArrayConverter
ANAL_WEIGHTS_FILEPATH = "C:\\Users\\User\\mmm.weights"
def convert(inq):
converter = InquiryArrayConverter(inq)
return converter.convertToNumpyNumbers()
# initializing an analyzer
anal = InquiryAnalyzer(False)
anal.load(ANAL_WEIGHTS_FILEPATH)
test = ["Hi, what's your phone number?"]
testV = convert(test)
testTensor = anal.packSequence(testV)
result = anal.forward(testTensor)
print(result)
class InquiryDataset:
"""
Manages the training datasets.
"""
user_interaction_needed = np.array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0])
contact = np.array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0])
dataset_search = np.array([0, 0, 1, 0, 0, 0, 0, 0, 0, 0])
delivery = np.array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0])
order = np.array([0, 0, 0, 0, 1, 0, 0, 0, 0, 0])
welcome = np.array([0, 0, 0, 0, 0, 1, 0, 0, 0, 0])
feedback = np.array([0, 0, 0, 0, 0, 0, 1, 0, 0, 0])
checkout = np.array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0])
checkoutRequest = np.array([0, 0, 0, 0, 0, 0, 0, 0, 1, 0])
recommendation = np.array([0, 0, 0, 0, 0, 0, 0, 0, 0, 1])
Hey, the InquiryEstimator model is broken(CNNs don't work well, the word2vec doesn't work well with RNNs and stuff). Should change the model to one of these: https://towardsdatascience.com/multi-class-text-classification-model-comparison-and-selection-5eb066197568