Questions tagged [python]

For questions related to AI implementation in the Python language

Filter by
Sorted by
Tagged with
0
votes
0answers
8 views

Why python raises this error: “UnboundLocalError: local variable 'torch' referenced before assignment”

Why python raises this error: "UnboundLocalError: local variable 'torch' referenced before assignment" even though I do import torch at the beginning of the python script ! I have import ...
-2
votes
1answer
22 views

How to detect different sized circles, squares and rectangles in an image using python? [closed]

How can I detect different sized circles, squares and rectangles in an image using python and its relevant libraries?
1
vote
0answers
40 views

How should I simulate this Markov Decision Process?

I am working on solving a problem on nodes in a graph communicating with each other. They try to estimate a central state using Kalman consensus filter, with the connections described by the graph's ...
0
votes
0answers
27 views

Are regret values in each block of MC external sampling stored in each node of the block we are traversing down (denoted by $\{Q_1,…, Q_n\}$)?

Everything I know about Monte Carlo counterfactual regret minimization (CFR) comes from the paper Monte Carlo Sampling for Regret Minimization in Extensive Games by Marc Lanctot et al. So, I will use ...
0
votes
1answer
22 views

Sentiment analysis does not handle neturals

I'm writing some financial tools, I've found highly performant models for question and answering but when it comes to sentiment analysis I haven't found anything that good. I'm trying to use ...
0
votes
0answers
45 views

Is it possible to transform audio with neural networks to make it sound like 3d sound

so the idea is to feed neural network data like input: mono audio(extracted from existing 3d audio) output: 3d audio after training it should convert mono audio to 3d sound do you think it is possible?...
1
vote
1answer
59 views

How exactly is Monte Carlo counterfactual regret minimization with external sampling implemented?

I have read many papers, such as this or this, explaining how external sampling works, but I still don't understand how the algorithm works. I understand you divide $Q$, which is the set of all ...
0
votes
1answer
26 views

What approach to use for selecting one of the category according to short category text?

I need some tool to classify articles based on short category text which consists of two or three words separated by '-'. The RSS/XML tag content is for example: Foreign - News Football - Foreign I ...
1
vote
0answers
14 views

How to scrape product data on supplier websites?

I'm currently trying to build a semantic scraper that can extract product information from different company websites of suppliers in the packaging industry (with as little manual customization per ...
0
votes
0answers
66 views

How to make an ensemble model of two LSTM models with different window sizes i.e. different data shapes

Below is the Python code for making an ensemble model. All the inputs are the same for all three models. But what if the models have different input shapes due to different window size, such as LSTM ...
2
votes
0answers
28 views

Single-value loss/training in a CNN with a tensor output

I am playing around with an idea of using using Q-learning with a DQN (Deep Q-Network), to determine the optimal position of a number of 'units' on a grid of allowed locations, according to some ...
-1
votes
1answer
54 views

What model to use to get a robust model to predict next 3 days of sales even for products that have just sold once ever?

PROJECT: I am working on an e-commerce site where digital products can run out so there is need to reorder them 72h before they run out (reordering them sooner is not a problem but having notification ...
1
vote
2answers
77 views

How to recognize sequence of digits in an image

I am learning to program neural networks and others, and I would like to know how I can get the numbers that are in an image, for example if I pass an image that has 123 written, get with my model ...
1
vote
0answers
35 views
1
vote
1answer
30 views

Keras 1D CNN always predicts the same result even if accuracy is high on training set

The validation accuracy of my 1D CNN is stuck on 0.5 and that's because I'm always getting the same prediction out of a balanced data set. At the same time my training accuracy keeps increasing and ...
1
vote
0answers
65 views

Is object-based representation of the observation space feasible?

I just started working on a DRL project from scratch. The state of each episode can be expressed as a state set $S=(S^A, S^B, S^C, S^D)$. Each subset is a feature set of a constituent component of the ...
0
votes
0answers
6 views

What is this for loop doing in custom NER code in Spacy and what is an 'annotation' in Spacy?

I am writing a code to train custom entities in Spacy's NER engine. I am stuck in understanding small part of code from an online tutorial. Here's a link to the tutorial. The following code is line ...
2
votes
1answer
71 views

In OCR, how should I deal with the warped text on the sides of oval objects?

Consider an image that contains one can (or bottle, or any similar oval object), which has texts all over it. In the image below, I have many bottles, but you can assume that each image only contains ...
2
votes
1answer
60 views

Can TensorFlow, PyTorch, and other mainstream ML frameworks be used for research-grade work in AI?

Many authors of research papers in AI (e.g. arXiv) write their neural networks from the ground-up, using low-level languages like C++ to implement their theories. Can existing open source frameworks ...
0
votes
0answers
14 views

Drawing verticle lines on video frames in vehicle detection

I am working on an application of vehicle detection, the purpose is to check if road is congested or not. The solution that came to my mind is to detect the vehicles moving in each direction ...
0
votes
0answers
24 views

Python: Recognize actions / keywords in natural text?

This is for a personal project, and I am no very skilled programmer, language is Python, needs to work offline. That said: I have a list of 200 key actions, eg. 'Building sandcastles', 'Paintball' or '...
1
vote
0answers
24 views

Reading Data from a Twilio Stream [closed]

I work for a video tutoring organisation that uses Twilio Video API to carry out the video class. I want to run the object detection and other computer vision models on the input stream. I am stuck at ...
0
votes
1answer
42 views

How to use a conv2d layer after a flatten?

I am not familiar with Deep learning and Pytorch. And I want to know how to deal, in general with such a situation. So, I was wondering if I used a pretrained model (EfficientNet for example) if I ...
1
vote
0answers
11 views

Algorithms for training a two motor powered rc car without steering servo

Previously, I have build a donkey car where the steering of the two front wheels was done using a motor servo. This project was a success and the car was able to drive autonomously after training was ...
2
votes
1answer
33 views

Understanding LSTM through example

I want to code up one time step in a LSTM. My focus is on understanding the functioning of the forget gate layer, input gate layer, candidate values, present and future cell states. Lets assume that ...
1
vote
1answer
45 views

Autoencoder: predictions missing for nodes in the bottleneck layer

I'm using tf.Keras to build a deep-fully connected autoencoder. My input dataset is a dataframe with shape (19947,), and the purpose of the autoencoder is to predict normalized gene expression values. ...
2
votes
1answer
57 views

Mining repeated subsequences in a given sequence

Given an alphabet $I=\left\{i_1,i_2,\dots,i_n\right\}$ and a sequence $S=[e_1,e_2,\dots,e_m]$, where items $e_j \in I$, I am interested in finding every single pattern (subsequence of $S$) that ...
0
votes
0answers
10 views

How to make specific test data prediction with fitted GaussianNB Classifier in Python

I'm trying to make news classification. Here is the neural network: ...
2
votes
1answer
89 views

Keras DQN Model with Multiple Inputs and Multiple Outputs [closed]

I am trying to create a DQN agent where I have 2 inputs: the agent's position and a matrix of 0s and 1s. The output is composed of the agent's new chosen position, a matrix of 0s and 1s (different ...
0
votes
0answers
14 views

Python Create Keras Neural Network with Bag Of Words Model for News Classification

I want to train a classification neural network then predict some inputs. It's classic classification example as you know. I'm implementing this with python. I searched a lot about it and I always ...
3
votes
1answer
52 views

DQN layers when state space and action space are multi dimensional

I have built my own RL environment, where a state is composed of two elements: the agent's position and a matrix of 0s and 1s (1 if a user has requested a service from the agent, 0 otherwise); an ...
1
vote
0answers
53 views

How to design my Neural Network for Game AI

For my school project, I have to develop an agent to play my game. The base I have is a 'GameManager' which call 2 AIs, each taking a random move to do. To make my AI perform, I decided to make a ...
1
vote
0answers
40 views

How am I supposed to code equation 4.57 from the book “Machine Learning: An Algorithmic Perspective”?

Consider the equation 4.57 (p. 108) from section 4.6 of the Book Machine Learning: An Algorithmic Perspective, where the derivative of the softmax function is explained $$\delta_o(\kappa) = (y_\kappa -...
0
votes
0answers
20 views

Relative Weighting of Loss Weights for Self-Play Reinforcement Learning

I am training some self play reinforcement learning agents to play 2 player board games like Connect 4, Othello, and The Game of the Amazons. For each game, there is a single neural network with 2 ...
1
vote
0answers
16 views

How can I predict an anomaly based on FFT of multiple signals?

I have 999 signals, each with separate day timestamp, each T=10s long, sampled with fs=25kHz. This gives N=250,000 samples in total. My task was to obtain the averaged magnitude spectrum for each ...
0
votes
0answers
40 views

Distinguishing between handwritten compound fraction and subtraction

I am working in a project named "Handwritten Math Evaluation". So what basically happens in this is that there are 11 classes of (0 - 9) and (+, -) each containing 50 clean handwritten ...
2
votes
1answer
64 views

Q-learning agent stuck at taking same actions

I have created my own RL environment where I have a 2-dimensional matrix as a state space, the rows represent the users that are asking for a service, and 3 columns representing 3 types of users; so ...
0
votes
0answers
23 views

Extracting specific information from an Invoice images

Tried to extract only specific information from the images but Couldn't, We have to automate this process using this as the format of the Images keeps on changing. LinkSample data What I have Tried: <...
0
votes
0answers
23 views

Q-learning in Python (3D grid navigation): Values do not change between episodes

I am trying to implement a Q-learning algorithm in Python for a 3D gird world as part of an assignment, wherein the environment.py file defines the actions to be taken. So far I have tried several ...
3
votes
1answer
68 views

How to create a Q-Learning agent when we have a matrix as an action space?

I have a 2-dimentional matrix as an action space, the rows being a resource to be allocated, and the columns are the users that we will allocate the resources to. (I built my own RL environment) The ...
4
votes
0answers
60 views

Difficulty in agent's learning with increasing dimensions of continuous actions

I have been working on some RL project, where the policy is controlling the robot using its joint angles.Throughout the project I have noticed some phenomenon, which caught my attention. I have ...
0
votes
0answers
13 views

Cocatenate feature extractor layers with different channels

I have a network architecture for feature extraction and I wanted to concatenate layers of the same dimensions but with different feature channels. ...
1
vote
0answers
39 views

Determining if an entity in free text is 'present' or 'absent'; what is this called in NLP?

I'm processing a semi-structured scientific document and trying to extract some specific concepts. I've actually made quite good progress without machine-learning so far, but I got to a block of true ...
0
votes
0answers
30 views

How to make a CNN/RNN on a non-binary dataset?

I am using TensorFlow + Keras to make a CNN/RNN. I'm quite new to AI, I've only made a few relatively basic networks for image regression/classification. The end goal of my project is to determine the ...
0
votes
1answer
48 views

How to use validation dataset in my logistic regression model?

I am new to machine learning and recently I joined a course where I was given a logistic regression assignment in which I had to split 20% of the training dataset for the validation dataset and then ...
2
votes
0answers
18 views

How to design the step() method in a custom-built environment when the action space is a 2-dimentional matrix?

I have an action space that is a matrix. I am struggling with finding how to choose how to take the action when the number of possible actions is huge.
2
votes
1answer
42 views

How to let the agent choose how to populate a state space matrix in RL (using python)

I have an agent (drone) that has to allocate subchannels for different types of User Equipment. I have represented the subchannel allocation with a 2-dimentional binary matrix, that is initialized to ...
0
votes
1answer
56 views

How to implement or avoid masking for transformer?

When it comes to using Transformers for image captioning is there any reason to use masking? I currently have a resnet101 encoder and am trying to use the features as the input for a transformer model ...
1
vote
1answer
42 views

Pytorch Deep q network not learning and step not stepping towards target

I am trying to create a simple deep q network for rl with conv2d layers. I can’t figure out what I am doing wrong, and the only thing I can see that doesn’t seem right is when I get the model ...
1
vote
1answer
35 views

What framework for a project with a custom environment?

I'm planning an RL project and I have to decide which RL framework do I use if any at all. The project has a highly custom environment, and testing different algorithms will be required to obtain ...

1
2 3 4 5
7