Categories
Development

Why does ADODB.connection object swallow errors?

When I create a connection to a database using the ADODB.Connection object to create a connection to a SQLServer database, I expect that when I use a throw statement I expect to have records in the conn.Errors collection. Instead, if I do any of the following two, the Errors collection will be empty: Return any […]

Categories
Development

ValueError: Tensor Tensor(“activation_11/Softmax:0”, shape=(?, 5), dtype=float32) is not an element of this graph

When I run my model in a separate file it runs fine but when I run my model with flask code it gives me an error don’t know why am I facing this problem. I have tried some solution from StackOverflow itself which says to try adding these lines after loading the model and prediction […]

Categories
Development

Plotting and labeling each bin in a histogram

I have a dataset that contains categories (labels) of different emotions. You can see which categories from the “labels” variable defined in the code below. Each of these categories has a different amount of data available in this dataset, and I’m trying to represent the distribution of the dataset through histogram bins. import matplotlib.pyplot as […]

Categories
Development

amcharts doesn’t represent data in right format

I’m retrieving value from database and pushing it to amchart (XYChart) the value of x Axes not working correctly. this is the chart code var chart5; function generateChart5(json) { chart5 = am4core.create(“chart5-data”, am4charts.XYChart); chart5.data = json; var dateAxis = chart5.xAxes.push(new am4charts.DateAxis()); dateAxis.renderer.minGridDistance = 50; function createAxisAndSeries(field, name, opposite, bullet) { var valueAxis = chart5.yAxes.push(new am4charts.ValueAxis()); […]

Categories
Development Java Javascript

What is the best way to show the ‘closest’ value based on a number in Javascript? (e.g. 1=Happy, 2=Sad, if 1.6, return Sad)

As the topic states what is the best way to show the closest value based on a number in javascript? Assume that ‘Glad’ is the same thing as ‘Happy’, and ‘Down’ is the same thing as ‘Sad’. I have the following code, but it just seems incredibly lengthy and gets bloated with more states (i.e. […]

Categories
Development

How can I get unique words from a DataFrame column of strings?

I’m looking for a way to get a list of unique words in a column of strings in a DataFrame. import pandas as pd import numpy as np df = pd.read_csv(‘FinalStemmedSentimentAnalysisDataset.csv’, sep=’;’,dtype= {‘tweetId’:int,’tweetText’:str,’tweetDate’:str,’sentimentLabel’:int}) tweets = {} tweets[0] = df[df[‘sentimentLabel’] == 0] tweets[1] = df[df[‘sentimentLabel’] == 1] the dataset I’m using is from this link: http://thinknook.com/twitter-sentiment-analysis-training-corpus-dataset-2012-09-22/ […]

Categories
Development

Error with Python For Loop within Function

So I am trying to better understand functions and using for loops to select from multiple lists. Here is the basic function that I created and it does work: def my_function(person, feeling): print(‘Hello, %s, how are you? It seems that you are feeling %s!’ %(person, feeling)) my_function(‘Matthew’, ‘rejuvinated’) But to take this further, I would […]

Categories
Development

In Postgres: What is the most concise way to use `IS DISTINCT FROM` on multiple values?

I’m trying to find all rows that have an enum column that is either NULL or otherwise distinct from a given set of enum values. I can do it with a lot of IS DINSTINCT FROM calls, but it’s really verbose and I’d rather use NOT IN() syntax, but the NULL throws that off. Here […]

Categories
Development

Face emotion analysis with WebRTC and Python server

I have a project in which I want to perform a live facial emotion recognition. A client opens a webpage, and his face image is being captured by a camera (built-in laptop camera), then this video is being painted on a canvas (HTML element), then transformed into BLOB and sent over a Python Websocket to […]

Categories
Development

How to get a length of lists in Pandas dataframe

I have a dataframe in pandas like this: List 2013-12-22 15:25:02 [good morning, good afternoon, good evening] 2009-12-14 14:29:32 [happy new year, happy birthday,] 2013-12-22 15:42:00 [happy, sad, mad, chill] how do I get something like this List Len 2013-12-22 15:25:02 [good morning, good afternoon, good evening] 3 2009-12-14 14:29:32 [happy new year, happy birthday,] […]