The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [python]

Use for data science questions related to the programming language Python. Not intended for general coding questions (-> stackoverflow).

Filter by
Sorted by
Tagged with
0
votes
2answers
28 views

Pandas Series Sort [closed]

I want to sort digit written in object form as given below: ...
-2
votes
1answer
23 views

Python Pandas agregation

I have a data set recording daily values of several metrics say R1, R2, for example: ...
0
votes
0answers
7 views

Sequence prediction model choice

I am working on log data. I extract each user's history usage, and get his sessions into a file containing all the pages visited during all his sessions (each session in a line), sequences have ...
0
votes
0answers
14 views

Anomaly detection when doing clustering of text data

Im doing clustering of text data and Im wondering is there a way to do anomaly detection when doing clustering of text data. I have a code that works, I have vectorized the data but I do not know how ...
0
votes
0answers
7 views

Transforming target from object array to integer array to use sparse_categorical_crossentropy for class prediction

I want to do a neural network to predict to which loan class does a borower pertains. There are 6 classes [ A, B, C, D, E, F]. I tried to get rid of the NAs and ...
0
votes
1answer
25 views

Returning rows from a list of indexes in Python Pandas

Context I have a CSV containing two types of rows, an observation record and on the row below, an observation value which is related to the observation record above. The record line contains a four-...
0
votes
1answer
15 views

Pearson correlation make disapear the target column

I have a dataframe with some numerical and categorical values. I want to do some feature selection to visualise a low-dimensional split in the dataset when the target variable is the grade. Yet, when ...
-2
votes
1answer
291 views

Keras error “Failed to find data adapter that can handle input” while trying to train a model

I've been following a tutorial on training a model and I've stumbled across an error that I've been struggling to find a solution for. The code for the model training is bellow: ...
0
votes
0answers
7 views

MASK RCNN with multicalss classification

I want to create a model which solve a multiclass classification problem. The main concept is: every picture contain only one object the background is very simple all object is coming from the same ...
0
votes
1answer
22 views

Grouping similar rows to detect duplicates

I have a dataset containing all the real estate ads for sale in the process of publishing a city: ...
0
votes
4answers
62 views

Damerau-Levenshtein Edit Distance in Python

I found some python codes on Damerau Levensthein edit distance through google, but when i look at their comments, many said that the algorithms were incorrect. I'm confused. Can someone share a ...
0
votes
1answer
36 views

LSTM to multivariate sequence classification

How can I train multivariate to multiclass sequence using LSTM in keras? I have 50000 sequences, each in the length of 100 timepoints. At every time point, I have 3 features (So the width is 3). I ...
0
votes
0answers
5 views

Represent bar plots of different categories side by side in the same graph rather than in different plots

I made a loop on categorical grades which plot a certain number of graphics related to this grade. As far as these grades are categorical I was wondering if it would be more interesting to display it ...
0
votes
1answer
40 views

Model Validation accuracy stuck at 0.65671 Keras

I am using conv1d to classify EEG signals, but my val_accuracy stuck at 0.65671. No matter what changes i do, it never go beyond 0.65671. Here is the architecture ...
1
vote
0answers
12 views

Octave or python for implementing Machine Learning [closed]

When is the need to learn octave or Mat Lab for Machine Learning? Are these required if you are proficient in python?
2
votes
1answer
55 views

sklearn.accuracy_score(y_test, y_predict) vs np.mean(y_predict == y_test)

What is the difference between these two methods for finding model accuracy? I have used both methods in python3 and i normally get identical results. However in few cases i get completely different ...
0
votes
2answers
26 views

The actual results and results from pickle files are not matching in pandas for DBSCAN clustering

I've built a DBSCAN clustering model. The output result and the result after using the pickle files are not matching. Based on HD and MC column, I am clustering WT column. ...
0
votes
1answer
14 views

Identifying if the sentence if it comprise information about education

Given a sentence I am trying to classify if the sentence contain information about education. For example: ...
1
vote
1answer
40 views

Tread wear detection

I have an assignment in which I have to provide a solution to measure the tread depth of a tire using a single rgb image. I thought of two possible solutions: Using CNN to measure the image ...
0
votes
2answers
149 views

Delete/Drop only the rows which has all values as NaN in pandas [closed]

I have a Dataframe, i need to drop the rows which has all the values as NaN. ID Age Gender 601 21 M 501 NaN F NaN NaN NaN The ...
1
vote
1answer
32 views

How to extract location related terms from raw text in python

I want to extract location related keywords from raw text in python. I have already tried spacy but the results were not good and I just got names of countries while I want fine-grained location ...
0
votes
0answers
15 views

Finding features that influence net revenue

Using machine learning I would like to identify features that influence net revenue and make conclusions from data based on that. The data set is a car sharing ...
3
votes
2answers
56 views

How to represent audio data in a format that can be used for preprocessing and modelling?

I have a project that I am working on currently. The project is to classify audio data. The data is in two folders train and test...
1
vote
1answer
26 views

Does the length of the text data affects the score of clustering

I'm learning about clustering with Pythons Scikit-Learn lib. I have a list of sentences (strings) . Im wondering, does the length of the string affects the ...
1
vote
0answers
18 views

Is there a python version of Mitchell's face pose recognition code?

The original code for chapter 4 in Tom Mitchell's book for recognizing face pose from images is here: http://www.cs.cmu.edu/afs/cs.cmu.edu/user/mitchell/ftp/faces.html But it's in C, not that there ...
0
votes
0answers
8 views

How to use skimage.feature.hog to calculate hog of training data where examples are stacked vertically

I have a $n*1024$ dimensional $2D$ array where n is number of examples which contain n images($32*32$) stacked vertically. I would like to calculate the hog of these images ...
1
vote
0answers
28 views

visualize images inside the Dataframe [closed]

I use python 3.7.3 and I run this code on Jupyter Notebook . I have a column named 'image' in my Dataframe named df that contains Url of images I wanna visualize inside the df. I saw some answers ...
3
votes
1answer
50 views

How to creat a plot for the accuracy of a model

Iam pretty new to the whole topic so please dont be harsh. I know these may be simple questions but everybody has to start somewhere ^^ So I created (or more copied) my first little Model which ...
0
votes
1answer
28 views

How to use a a trained model

I just trained my first model in Python 3.7/scikitlearn (Linear Regression) (well I copied most of the code but its something ^^). Now I want to actually Use the model. Specifically its about sons ...
1
vote
2answers
50 views

anomaly detection - conceptual help on machine learning

I am working on Anomaly detection model problem for a finance data set - set of card transactions. My team member suggested an idea that " First train the model with normal instances of data and to ...
1
vote
1answer
139 views

How to interpret Logistic regression coefficients using scikit learn

I have created a model using Logistic regression with 21 features, most of which is binary. I created these features using get_dummies. Few of the other features are numeric. I get a very good ...
1
vote
0answers
17 views

Keras high loss and high accuracy in gk bot with reinforcement learning?

I'm making goal-keeper bot in haxball game. It worked well when i trained less but i worked worse when i trained more. Last reinforcement state: 5160 episode - 4171281 steps - 0.05 epsilon: Last fit ...
0
votes
0answers
7 views

Loss and accuracy remains constant in time series classification by LSTM

I have a time series data with a classification label of 1 and 0. I am using a LSTM model to classify the series by taking 100 consecutive timestamps as input with a single label. Even after training ...
1
vote
1answer
30 views

Machine learning for missing data in time series

We have two time series columns - column A is the reference column ( source of truth) and column B is a ''cousin'' of column A, in the sense that it exhibits ( or should exhibit) the same patterns, ...
0
votes
1answer
12 views

Python metaheuristic packages

I need to use a metaheuristic algorithm to solve an optimization problem on a Python codebase. Metaheuristics usually need to be written in C++ or Java as they involve a lot of iterations, while ...
0
votes
1answer
36 views

Python can't take input while using functions

While building my model, I figured that it makes sense to reuse some of the code that I've been using for the train dataset, on the test set as well so I took the code performing mutual operations ...
0
votes
0answers
9 views

Set the number of iterations gpt-2

I'm fine tunning a gpt-2 model following this tutorial: https://medium.com/@ngwaifoong92/beginners-guide-to-retrain-gpt-2-117m-to-generate-custom-text-content-8bb5363d8b7f With is associated GitHub ...
1
vote
1answer
52 views

Efficient environment for machine or deep learning in Python

I am getting very frustrated working with either Google Colab or Azure notebooks (they are very slow and glitchy). Usually, I work with Jupyter notebooks to perform Machine Learning or Deep Learning ...
0
votes
1answer
22 views

Data quality improvement as a part of preprocessing: Imputation

I have a python pandas dataframe representing a superset. The data contains a lot of nulls which I want to overwrite with real values. the superset has: both numerical and categorical data some ...
0
votes
1answer
40 views

How to choose the model parameters (RandomizedSearchCV, .GridSearchCV) or manually

Faced with the task of selecting parameters for the lightgbm model, the question accordingly arises, what is the best way to select them? I used the RandomizedSearchCV method, within 10 hours the ...
1
vote
1answer
38 views

Evaluating pairwise distances between the output of a tf.keras.model

I am trying to create a custom loss function in tensorflow. I am using tensorflow v2.0.rc0 for running the code. Following is the code and the function min_dist_loss...
0
votes
0answers
8 views

Error while installing grpcio while installing tensorflow in Linux

I am trying to install tensorflow in my linux VM through VNC. I am getting an environment error for some reason. ...
0
votes
1answer
53 views

My CNN model Accuracy doesn't increase (high loss and low acc)

Well, I need to do a CNN to classify if a Image is from one or another class. But my model return high losses (6.~8.) and low accuracies (0.50 on max). I tried to include more layers, change my ...
3
votes
2answers
128 views

Is There a Way to Re-Calibrate Predicted Probabilities After Using Class Weights?

I have classification data with far more negative instances than positive instances. I have used class weights in my models and have achieved the discrimination I want but the predicted probabilities ...
1
vote
1answer
22 views

Starting search from rightmost column and moving left pandas

I'm very new to pandas and I'm trying to implement the code to search for something on an excel spreadsheet. Basically, the most recent price can be found on the furthest right column named ...
1
vote
1answer
21 views

What is the branch of data science that deals with generating data? Looking for tutorials

So far all the tutorials (Python/Tensorflow) I have been following dealt with processing the data, they are classification problems. Things that give Yes or No answers. Now I want to find tutorials on ...
0
votes
1answer
30 views

ValueError: Error when checking input: expected conv2d_1_input to have 4 dimensions, but got array with shape (142, 1)

I'm trying to pass all my images (71 for each class) from folder 'train' to model.fit. The method ReadImages get these images and resize them (because are too big 4288x2848).... But when i run my ...
0
votes
0answers
14 views

How to compare two samples taken from the same dataset?

I have data from almost 10 different sensors and was trying to downsample the data. I tried the reservoir algorithm and the uniform sampling and the random sampling techniques. I was wondering how I ...
-2
votes
1answer
42 views

To build a machine learning model of large data sets of 20,000 rows using python [closed]

What are the essential steps to build a Machine Learning model to predict the following 4 classes: whether the user was a male, a female, a brand (non-individual) or unknown. The dataset contains 20,...
0
votes
0answers
5 views

To train in Keras two identical RNN but with different outputs

I am training to solve a problem where I am using a RNN to track an object, learn about it, and then generate trajectories. Therefore the input of the RNN is stuff like x,y,speed,... and the output is ...